mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
AES-CTR with the counter incremented as one 128-bit big-endian number, SP 800-38A's standard incrementing function (OpenSSL's CRYPTO_ctr128, mbedtls's aes_crypt_ctr). aes_ctr_crypt carries only the low 32 bits, as GCM needs; formats whose initial counter is a random 128-bit value (the PS3's SELF files, for the RPCS3 core) need the carry into the rest. It runs aes_ctr_crypt's AES-NI and ARMv8 multi-block paths in runs that stop where the low 32 bits wrap, and carries into octets 0..11 by hand, so the fast paths are untouched. test_crypto checks it against the SP 800-38A F.5.1 vector, then against a block-at-a-time reference from counters about to wrap their low word, their low 96 bits and the whole block, in one call and in pieces.