Skip to content

Commit cfe82d4

Browse files
jkivilinherbertx
authored andcommitted
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.c arch/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 Cc: <[email protected]> Signed-off-by: Jussi Kivilinna <[email protected]> Acked-by: Tim Chen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 7171511 commit cfe82d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/crypto/sha512_ssse3_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)
141141

142142
/* save number of bits */
143143
bits[1] = cpu_to_be64(sctx->count[0] << 3);
144-
bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61;
144+
bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
145145

146146
/* Pad out to 112 mod 128 and append length */
147147
index = sctx->count[0] & 0x7f;

0 commit comments

Comments
 (0)