From 4f1f7b3a4d1ce93665c617cafb92e3ff52fa20dd Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 14 May 2024 01:01:47 -0500 Subject: [PATCH] linuxkm/lkcapi_glue.c: update names of wc_AesXts{En,De}cryptInit(). wolfcrypt/src/aes.c: activate _AesXtsHelper() in AesXts{En,De}cryptUpdate_sw(). --- linuxkm/lkcapi_glue.c | 8 ++++---- wolfcrypt/src/aes.c | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/linuxkm/lkcapi_glue.c b/linuxkm/lkcapi_glue.c index b9711560d..467aa4856 100644 --- a/linuxkm/lkcapi_glue.c +++ b/linuxkm/lkcapi_glue.c @@ -930,10 +930,10 @@ static int km_AesXtsEncrypt(struct skcipher_request *req) tail = 0; } - err = wc_AesXtsEncryptStart(ctx->aesXts, walk.iv, walk.ivsize); + err = wc_AesXtsEncryptInit(ctx->aesXts, walk.iv, walk.ivsize); if (unlikely(err)) { - pr_err("%s: wc_AesXtsEncryptStart failed: %d\n", + pr_err("%s: wc_AesXtsEncryptInit failed: %d\n", crypto_tfm_alg_driver_name(crypto_skcipher_tfm(tfm)), err); return -EINVAL; } @@ -1053,10 +1053,10 @@ static int km_AesXtsDecrypt(struct skcipher_request *req) tail = 0; } - err = wc_AesXtsDecryptStart(ctx->aesXts, walk.iv, walk.ivsize); + err = wc_AesXtsDecryptInit(ctx->aesXts, walk.iv, walk.ivsize); if (unlikely(err)) { - pr_err("%s: wc_AesXtsDecryptStart failed: %d\n", + pr_err("%s: wc_AesXtsDecryptInit failed: %d\n", crypto_tfm_alg_driver_name(crypto_skcipher_tfm(tfm)), err); return -EINVAL; } diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 796683234..f9b448112 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -12751,13 +12751,12 @@ static int AesXtsEncryptUpdate_sw(XtsAes* xaes, byte* out, const byte* in, word32 blocks = (sz / AES_BLOCK_SIZE); Aes *aes = &xaes->aes; -#if 0 && defined(HAVE_AES_ECB) +#ifdef HAVE_AES_ECB /* encrypt all of buffer at once when possible */ - if ((in != out) && ((sz & (AES_BLOCK_SIZE - 1)) == 0)) { /* can not handle inline */ + if (in != out) { /* can not handle inline */ XMEMCPY(out, i, AES_BLOCK_SIZE); if ((ret = _AesXtsHelper(aes, out, in, sz, AES_ENCRYPTION)) != 0) return ret; - XMEMCPY(i, out + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE); } #endif @@ -12765,8 +12764,8 @@ static int AesXtsEncryptUpdate_sw(XtsAes* xaes, byte* out, const byte* in, word32 j; byte carry = 0; -#if 0 && defined(HAVE_AES_ECB) - if ((in == out) || ((sz & (AES_BLOCK_SIZE - 1)) != 0)) +#ifdef HAVE_AES_ECB + if (in == out) #endif { /* check for if inline */ byte buf[AES_BLOCK_SIZE]; @@ -13199,19 +13198,18 @@ static int AesXtsDecryptUpdate_sw(XtsAes* xaes, byte* out, const byte* in, blocks--; } -#if 0 && defined(HAVE_AES_ECB) +#ifdef HAVE_AES_ECB /* decrypt all of buffer at once when possible */ - if ((in != out) && ((sz & (AES_BLOCK_SIZE - 1)) == 0)) { /* can not handle inline */ + if (in != out) { /* can not handle inline */ XMEMCPY(out, i, AES_BLOCK_SIZE); if ((ret = _AesXtsHelper(aes, out, in, sz, AES_DECRYPTION)) != 0) return ret; - XMEMCPY(i, out + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE); } #endif while (blocks > 0) { -#if 0 && defined(HAVE_AES_ECB) - if ((in == out) || ((sz & (AES_BLOCK_SIZE - 1)) != 0)) +#ifdef HAVE_AES_ECB + if (in == out) #endif { /* check for if inline */ byte buf[AES_BLOCK_SIZE];