CVSROOT:        /cvs
Module name:    src
Changes by:     js...@cvs.openbsd.org   2025/06/27 11:10:45

Modified files:
        lib/libcrypto/aes: aes.c aes_amd64.c aes_i386.c 
        lib/libcrypto/arch/amd64: crypto_arch.h 
        lib/libcrypto/arch/i386: crypto_arch.h 
        lib/libcrypto/evp: e_aes.c 

Log message:
Move AES-NI from EVP to AES for CTR mode.

The mode implementation for CTR has two variants - one takes the block
function, while the other takes a "ctr32" function. The latter is expected
to handle the lower 32 bits of the IV/counter, but is not expected to
handle overflow. The AES-NI implementation for CTR currently uses the
second variant.

Provide aes_ctr32_encrypt_internal() as a function that can be replaced on
a machine dependent basis, along with an aes_ctr32_encrypt_generic()
function that provides the default implementation and can be used as a
fallback. Wire up the AES-NI version for amd64 and i386, change
AES_ctr128_encrypt() to use CRYPTO_ctr128_encrypt_ctr32() (which calls
aes_ctr32_encrypt_internal()) and remove the various AES-NI specific
EVP_CIPHER methods for CTR.

Callers of AES_ctr128_encrypt() will now use AES-NI, if available.

ok tb@

Reply via email to