From: Jerry Shih Date: Mon, 25 Sep 2023 00:42:23 +0000 (+0800) Subject: Fix the aes-xts key-length checking condition and hw declaration. X-Git-Tag: openssl-3.3.0-alpha1~734 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5871e951d3f3c3f0c498a0420c5ce1f53c425a5;p=thirdparty%2Fopenssl.git Fix the aes-xts key-length checking condition and hw declaration. The argument `key-length` includes 2 sets of keys. All declarations should under `PROV_CIPHER_HW_declare_xts()` macro. Signed-off-by: Jerry Shih Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21923) --- diff --git a/providers/implementations/ciphers/cipher_aes_xts_hw.c b/providers/implementations/ciphers/cipher_aes_xts_hw.c index e5ee6741ea0..24b8fb17dfd 100644 --- a/providers/implementations/ciphers/cipher_aes_xts_hw.c +++ b/providers/implementations/ciphers/cipher_aes_xts_hw.c @@ -184,7 +184,7 @@ static int cipher_hw_aes_xts_rv64i_zvkned_initkey(PROV_CIPHER_CTX *ctx, OSSL_xts_stream_fn stream_dec = NULL; /* Zvkned only supports 128 and 256 bit keys. */ - if (keylen * 8 == 128 || keylen * 8 == 256) { + if (keylen * 8 == 128 * 2 || keylen * 8 == 256 * 2) { XTS_SET_KEY_FN(rv64i_zvkned_set_encrypt_key, rv64i_zvkned_set_decrypt_key, rv64i_zvkned_encrypt, rv64i_zvkned_decrypt, @@ -202,7 +202,7 @@ static const PROV_CIPHER_HW aes_xts_rv64i_zknd_zkne = { \ cipher_hw_aes_xts_rv64i_zknd_zkne_initkey, \ NULL, \ cipher_hw_aes_xts_copyctx \ -}; +}; \ static const PROV_CIPHER_HW aes_xts_rv64i_zvkned = { \ cipher_hw_aes_xts_rv64i_zvkned_initkey, \ NULL, \