Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 03/04/2020 à 10:47, Laurent Vivier a écrit : > Le 25/03/2020 à 10:21, Chen Qun a écrit : >> Fix: eaec903c5b8 >> >> Reported-by: Euler Robot >> Signed-off-by: Chen Qun >> --- >> Cc: "Daniel P. Berrangé" >> --- >> crypto/cipher-builtin.c | 6 ++ >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c >> index bf8413e71a..99d6280a16 100644 >> --- a/crypto/cipher-builtin.c >> +++ b/crypto/cipher-builtin.c >> @@ -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); >> } >> >> >> > > Applied to my trivial-patches-for-5.1 branch. Removed from the queue because of build errors: https://travis-ci.com/github/vivier/qemu/jobs/327261040 In file included from /home/travis/build/vivier/qemu/crypto/cipher.c:157:0: 1251/home/travis/build/vivier/qemu/crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_encrypt’: 1252/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:136:36: error: passing argument 1 of ‘qcrypto_cipher_aes_ecb_encrypt’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 1253 qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length); 1254^ 1255/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:77:13: note: expected ‘AES_KEY * {aka struct aes_key_st *}’ but argument is of type ‘const AES_KEY * {aka const struct aes_key_st *}’ 1256 static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key, 1257 ^~ 1258/home/travis/build/vivier/qemu/crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_decrypt’: 1259/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:147:36: error: passing argument 1 of ‘qcrypto_cipher_aes_ecb_decrypt’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 1260 qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length); 1261^ 1262/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:103:13: note: expected ‘AES_KEY * {aka struct aes_key_st *}’ but argument is of type ‘const AES_KEY * {aka const struct aes_key_st *}’ 1263 static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key, 1264 ^~ 1265cc1: all warnings being treated as errors 1266/home/travis/build/vivier/qemu/rules.mak:69: recipe for target 'crypto/cipher.o' failed 1267make: *** [crypto/cipher.o] Error 1 1268make: *** Waiting for unfinished jobs
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 25/03/2020 à 10:21, Chen Qun a écrit : > Fix: eaec903c5b8 > > Reported-by: Euler Robot > Signed-off-by: Chen Qun > --- > Cc: "Daniel P. Berrangé" > --- > crypto/cipher-builtin.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c > index bf8413e71a..99d6280a16 100644 > --- a/crypto/cipher-builtin.c > +++ b/crypto/cipher-builtin.c > @@ -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); > } > > > Applied to my trivial-patches-for-5.1 branch. Thanks, Laurent
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 25/03/2020 à 11:06, Chenqun (kuhn) a écrit : >> -Original Message- >> From: Laurent Vivier [mailto:laur...@vivier.eu] >> Sent: Wednesday, March 25, 2020 5:45 PM >> To: Chenqun (kuhn) ; qemu-devel@nongnu.org; >> qemu-triv...@nongnu.org >> Cc: Zhanghailiang ; Euler Robot >> ; Daniel P. Berrangé >> Subject: Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY >> pointer >> >> Le 25/03/2020 à 10:21, Chen Qun a écrit : >>> Fix: eaec903c5b8 >>> >> >> Did you run the coccinelle script scripts/coccinelle/typecast.cocci ? >> > Yes, I run it and plan to integrate it into EulerRobot so that similar issues > can be discovered sooner. > > Thanks. >> >>> Reported-by: Euler Robot >>> Signed-off-by: Chen Qun >>> --- >>> Cc: "Daniel P. Berrangé" >>> --- >>> crypto/cipher-builtin.c | 6 ++ >>> 1 file changed, 2 insertions(+), 4 deletions(-) >>> >>> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c index >>> bf8413e71a..99d6280a16 100644 >>> --- a/crypto/cipher-builtin.c >>> +++ b/crypto/cipher-builtin.c >>> @@ -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); >>> } >>> >>> >>> > Reviewed-by: Laurent Vivier
RE: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
>-Original Message- >From: Laurent Vivier [mailto:laur...@vivier.eu] >Sent: Wednesday, March 25, 2020 5:45 PM >To: Chenqun (kuhn) ; qemu-devel@nongnu.org; >qemu-triv...@nongnu.org >Cc: Zhanghailiang ; Euler Robot >; Daniel P. Berrangé >Subject: Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer > >Le 25/03/2020 à 10:21, Chen Qun a écrit : >> Fix: eaec903c5b8 >> > >Did you run the coccinelle script scripts/coccinelle/typecast.cocci ? > Yes, I run it and plan to integrate it into EulerRobot so that similar issues can be discovered sooner. Thanks. > >> Reported-by: Euler Robot >> Signed-off-by: Chen Qun >> --- >> Cc: "Daniel P. Berrangé" >> --- >> crypto/cipher-builtin.c | 6 ++ >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c index >> bf8413e71a..99d6280a16 100644 >> --- a/crypto/cipher-builtin.c >> +++ b/crypto/cipher-builtin.c >> @@ -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); >> } >> >> >>
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
On Wed, Mar 25, 2020 at 05:21:37PM +0800, Chen Qun wrote: > Fix: eaec903c5b8 > > Reported-by: Euler Robot > Signed-off-by: Chen Qun > --- > Cc: "Daniel P. Berrangé" > --- > crypto/cipher-builtin.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) Acked-by: Daniel P. Berrangé > > diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c > index bf8413e71a..99d6280a16 100644 > --- a/crypto/cipher-builtin.c > +++ b/crypto/cipher-builtin.c > @@ -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 > > 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 :|
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 25/03/2020 à 10:21, Chen Qun a écrit : > Fix: eaec903c5b8 > Did you run the coccinelle script scripts/coccinelle/typecast.cocci ? Thanks, Laurent > Reported-by: Euler Robot > Signed-off-by: Chen Qun > --- > Cc: "Daniel P. Berrangé" > --- > crypto/cipher-builtin.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c > index bf8413e71a..99d6280a16 100644 > --- a/crypto/cipher-builtin.c > +++ b/crypto/cipher-builtin.c > @@ -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); > } > > >