AES ECB/CTR/XTS: enable AES-NI usage
Perform multiple blocks of encryption/decryption in assembly call with ECB. This improves performance of ECB, CTR and XTS on Intel x64.
This commit is contained in:
parent
d336e22b85
commit
b359dd27e4
@ -10915,6 +10915,14 @@ static WARN_UNUSED_RESULT int _AesEcbEncrypt(
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
if (aes->keylen == 16)
|
||||
return DCPAesEcbEncrypt(aes, out, in, sz);
|
||||
#endif
|
||||
#ifdef WOLFSSL_AESNI
|
||||
if (haveAESNI && aes->use_aesni) {
|
||||
SAVE_VECTOR_REGISTERS(return _svr_ret;);
|
||||
AES_ECB_encrypt(in, out, sz, (byte*)aes->key, aes->rounds);
|
||||
RESTORE_VECTOR_REGISTERS();
|
||||
blocks = 0;
|
||||
}
|
||||
#endif
|
||||
while (blocks > 0) {
|
||||
int ret = wc_AesEncryptDirect(aes, out, in);
|
||||
@ -10943,6 +10951,14 @@ static WARN_UNUSED_RESULT int _AesEcbDecrypt(
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
if (aes->keylen == 16)
|
||||
return DCPAesEcbDecrypt(aes, out, in, sz);
|
||||
#endif
|
||||
#ifdef WOLFSSL_AESNI
|
||||
if (haveAESNI && aes->use_aesni) {
|
||||
SAVE_VECTOR_REGISTERS(return _svr_ret;);
|
||||
AES_ECB_decrypt(in, out, sz, (byte*)aes->key, aes->rounds);
|
||||
RESTORE_VECTOR_REGISTERS();
|
||||
blocks = 0;
|
||||
}
|
||||
#endif
|
||||
while (blocks > 0) {
|
||||
int ret = wc_AesDecryptDirect(aes, out, in);
|
||||
|
Loading…
x
Reference in New Issue
Block a user