]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: x86/aes-xts - change len parameter to int
authorEric Biggers <ebiggers@google.com>
Thu, 12 Dec 2024 21:28:43 +0000 (13:28 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 21 Dec 2024 14:46:24 +0000 (22:46 +0800)
The AES-XTS assembly code currently treats the length as signed, since
this saves a few instructions in the loop compared to treating it as
unsigned.  Therefore update the type to make this clear.  (It is not
actually passed any values larger than PAGE_SIZE.)

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aes-xts-avx-x86_64.S
arch/x86/crypto/aesni-intel_glue.c

index 903b894e5f48f6d387c389b451621fd37f23c6f3..c4e8ba6ed61df4b53b8b8ba16da1a890441cb629 100644 (file)
@@ -767,7 +767,7 @@ SYM_FUNC_END(aes_xts_encrypt_iv)
 // instantiated from the above macro.  They all have the following prototype:
 //
 // void (*xts_crypt_func)(const struct crypto_aes_ctx *key,
-//                       const u8 *src, u8 *dst, unsigned int len,
+//                       const u8 *src, u8 *dst, int len,
 //                       u8 tweak[AES_BLOCK_SIZE]);
 //
 // |key| is the data key.  |tweak| contains the next tweak; the encryption of
index fbf43482e1f5ecd697f8363bb8feb282a901561b..11e95fc62636e85df382f9acc8f969920085fed5 100644 (file)
@@ -505,7 +505,7 @@ static int xts_setkey_aesni(struct crypto_skcipher *tfm, const u8 *key,
 typedef void (*xts_encrypt_iv_func)(const struct crypto_aes_ctx *tweak_key,
                                    u8 iv[AES_BLOCK_SIZE]);
 typedef void (*xts_crypt_func)(const struct crypto_aes_ctx *key,
-                              const u8 *src, u8 *dst, unsigned int len,
+                              const u8 *src, u8 *dst, int len,
                               u8 tweak[AES_BLOCK_SIZE]);
 
 /* This handles cases where the source and/or destination span pages. */
@@ -624,14 +624,14 @@ static void aesni_xts_encrypt_iv(const struct crypto_aes_ctx *tweak_key,
 }
 
 static void aesni_xts_encrypt(const struct crypto_aes_ctx *key,
-                             const u8 *src, u8 *dst, unsigned int len,
+                             const u8 *src, u8 *dst, int len,
                              u8 tweak[AES_BLOCK_SIZE])
 {
        aesni_xts_enc(key, dst, src, len, tweak);
 }
 
 static void aesni_xts_decrypt(const struct crypto_aes_ctx *key,
-                             const u8 *src, u8 *dst, unsigned int len,
+                             const u8 *src, u8 *dst, int len,
                              u8 tweak[AES_BLOCK_SIZE])
 {
        aesni_xts_dec(key, dst, src, len, tweak);
@@ -790,10 +790,10 @@ asmlinkage void aes_xts_encrypt_iv(const struct crypto_aes_ctx *tweak_key,
                                                                               \
 asmlinkage void                                                                       \
 aes_xts_encrypt_##suffix(const struct crypto_aes_ctx *key, const u8 *src,      \
-                        u8 *dst, unsigned int len, u8 tweak[AES_BLOCK_SIZE]); \
+                        u8 *dst, int len, u8 tweak[AES_BLOCK_SIZE]);          \
 asmlinkage void                                                                       \
 aes_xts_decrypt_##suffix(const struct crypto_aes_ctx *key, const u8 *src,      \
-                        u8 *dst, unsigned int len, u8 tweak[AES_BLOCK_SIZE]); \
+                        u8 *dst, int len, u8 tweak[AES_BLOCK_SIZE]);          \
                                                                               \
 static int xts_encrypt_##suffix(struct skcipher_request *req)                 \
 {                                                                             \