crypto: sha512_ssse3: fix byte count to bit count conversion
Subsystems (2)
PATCH 1/1 crypto: sha512_ssse3: fix byte count to bit count conversion
Byte-to-bit-count computation is only partly converted to big-endian and is mixing in CPU-endian values. Problem was noticed by sparce with warning:
CHECK arch/x86/crypto/sha512_ssse3_glue.carch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted __be64 degrades to integer arch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)arch/x86/crypto/sha512_ssse3_glue.c:144:17: expected restricted __be64 <noident>arch/x86/crypto/sha512_ssse3_glue.c:144:17: got unsigned long long
--- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)/* save number of bits */ bits[1 ] =cpu_to_be64 (sctx->count[0 ] <<3 ); - bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 ) | sctx->count[0 ] >>61 ; + bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 | sctx->count[0 ] >>61 );/* Pad out to 112 mod 128 and append length */ index = sctx->count[0 ] &0x7f ;
Thanks for catching this.
Should propagate this patch to stable kernels 3.14, 3.12 and 3.10 too.
Quoted 29 lines · Jussi Kivilinna
Byte-to-bit-count computation is only partly converted to big-endian and is mixing in CPU-endian values. Problem was noticed by sparce with warning:
CHECK
arch/x86/crypto/sha512_ssse3_glue.carch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted__be64degrades to integerarch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)arch/x86/crypto/sha512_ssse3_glue.c:144:17: expected restricted__be64<noident>arch/x86/crypto/sha512_ssse3_glue.c:144:17: got unsigned long longCc Tim Chen <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>--- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/crypto/sha512_ssse3_glue.c +1
-1@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)/* save number of bits */ bits[1 ] =cpu_to_be64 (sctx->count[0 ] <<3 ); - bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 ) | sctx->count[0 ] >>61 ; + bits[0 ] =cpu_to_be64 (sctx->count[1 ] <<3 | sctx->count[0 ] >>61 );/* Pad out to 112 mod 128 and append length */ index = sctx->count[0 ] &0x7f ;
Herbert Xu
maintainerQuoted 11 lines · Jussi Kivilinna
Byte-to-bit-count computation is only partly converted to big-endian and is mixing in CPU-endian values. Problem was noticed by sparce with warning:
CHECK
arch/x86/crypto/sha512_ssse3_glue.carch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted__be64degrades to integerarch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)arch/x86/crypto/sha512_ssse3_glue.c:144:17: expected restricted__be64<noident>arch/x86/crypto/sha512_ssse3_glue.c:144:17: got unsigned long longCc Tim Chen <[email protected]>Signed-off-by Jussi Kivilinna <[email protected]>
Patch applied to crypto.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt