[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/5] crypto: Redundant type conversion for AES_KEY pointer
From: |
Daniel P . Berrangé |
Subject: |
[PULL 3/5] crypto: Redundant type conversion for AES_KEY pointer |
Date: |
Thu, 7 May 2020 12:58:01 +0100 |
From: Chen Qun <address@hidden>
We can delete the redundant type conversion if
we set the the AES_KEY parameter with 'const' in
qcrypto_cipher_aes_ecb_(en|de)crypt() function.
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Chen Qun <address@hidden>
Signed-off-by: Daniel P. Berrangé <address@hidden>
---
crypto/cipher-builtin.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
index bf8413e71a..35cf7820d9 100644
--- a/crypto/cipher-builtin.c
+++ b/crypto/cipher-builtin.c
@@ -74,7 +74,7 @@ static void qcrypto_cipher_free_aes(QCryptoCipher *cipher)
}
-static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
+static void qcrypto_cipher_aes_ecb_encrypt(const AES_KEY *key,
const void *in,
void *out,
size_t len)
@@ -100,7 +100,7 @@ static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
}
-static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
+static void qcrypto_cipher_aes_ecb_decrypt(const AES_KEY *key,
const void *in,
void *out,
size_t len)
@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
{
const QCryptoCipherBuiltinAESContext *aesctx = ctx;
- qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
- src, dst, length);
+ qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
}
@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
{
const QCryptoCipherBuiltinAESContext *aesctx = ctx;
- qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
- src, dst, length);
+ qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
}
--
2.26.2
- [PULL 0/5] Misc crypto subsystem fixes, Daniel P . Berrangé, 2020/05/07
- [PULL 1/5] crypto: fix getter of a QCryptoSecret's property, Daniel P . Berrangé, 2020/05/07
- [PULL 3/5] crypto: Redundant type conversion for AES_KEY pointer,
Daniel P . Berrangé <=
- [PULL 2/5] crypto/secret: fix inconsequential errors., Daniel P . Berrangé, 2020/05/07
- [PULL 5/5] crypto: extend hash benchmark to cover more algorithms, Daniel P . Berrangé, 2020/05/07
- [PULL 4/5] block: luks: better error message when creating too large files, Daniel P . Berrangé, 2020/05/07
- Re: [PULL 0/5] Misc crypto subsystem fixes, Peter Maydell, 2020/05/07