[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH 6/7] crypto: remove useless casts
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH 6/7] crypto: remove useless casts |
Date: |
Wed, 14 Sep 2016 10:40:56 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 |
15.06.2016 19:14, Laurent Vivier пишет:
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Daniel P. Berrange <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
crypto/cipher-builtin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
index 88963f6..d791c80 100644
--- a/crypto/cipher-builtin.c
+++ b/crypto/cipher-builtin.c
@@ -132,7 +132,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
{
const QCryptoCipherBuiltinAESContext *aesctx = ctx;
- qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
+ qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
src, dst, length);
}
@@ -144,7 +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,
+ qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
src, dst, length);
}
This patch causes the following build failure:
CC crypto/block.o
In file included from
/build/qemu/git/crypto/cipher.c:156:0:crypto/cipher-builtin.c: In
function ‘qcrypto_cipher_aes_xts_encrypt’:
crypto/cipher-builtin.c:135:36: error: passing argument 1 of
‘qcrypto_cipher_aes_ecb_encrypt’ discards ‘const’ qualifier from pointer
target type [-Werror]
qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
^
crypto/cipher-builtin.c:76:13: note: expected ‘struct AES_KEY *’ but
argument is of type ‘const struct AES_KEY *’
static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
^
crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_decrypt’:
crypto/cipher-builtin.c:147:36: error: passing argument 1 of
‘qcrypto_cipher_aes_ecb_decrypt’ discards ‘const’ qualifier from pointer
target type [-Werror]
qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
^
crypto/cipher-builtin.c:102:13: note: expected ‘struct AES_KEY *’ but
argument is of type ‘const struct AES_KEY *’
static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
^
cc1: all warnings being treated as errors
It's interesting that the qemu functions accepts const argument,
while apparently this is wrong, as qcrypto functions modifies their
args. Looks like a bug either in qemu or qcrypto... :)
I'll reverted this change for now.
Thanks,
/mjt
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [Qemu-trivial] [PATCH 6/7] crypto: remove useless casts,
Michael Tokarev <=