* [PATCH v2] crypto: Redundant type conversion for AES_KEY pointer
@ 2020-05-05 8:59 Chen Qun
2020-05-05 9:15 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Chen Qun @ 2020-05-05 8:59 UTC (permalink / raw)
To: qemu-devel, qemu-trivial
Cc: Chen Qun, Euler Robot, berrange, laurent, zhang.zhanghailiang
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 <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
v1->v2:
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Modify the AES_KEY parameter with 'const' in
qcrypto_cipher_aes_ecb_(en|de)crypt() methods.
(Base on Daniel P. Berrangé's suggestion)
https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg00515.html
---
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.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] crypto: Redundant type conversion for AES_KEY pointer
2020-05-05 8:59 [PATCH v2] crypto: Redundant type conversion for AES_KEY pointer Chen Qun
@ 2020-05-05 9:15 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2020-05-05 9:15 UTC (permalink / raw)
To: Chen Qun
Cc: qemu-trivial, zhang.zhanghailiang, Euler Robot, qemu-devel,
laurent
On Tue, May 05, 2020 at 04:59:40PM +0800, Chen Qun wrote:
> 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 <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> v1->v2:
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
>
> Modify the AES_KEY parameter with 'const' in
> qcrypto_cipher_aes_ecb_(en|de)crypt() methods.
> (Base on Daniel P. Berrangé's suggestion)
>
> https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg00515.html
>
> ---
> crypto/cipher-builtin.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
and queued - will send a PR with this and some other crypto fixes later
today most likely.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-05 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05 8:59 [PATCH v2] crypto: Redundant type conversion for AES_KEY pointer Chen Qun
2020-05-05 9:15 ` Daniel P. Berrangé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).