Move sha224_initial_hash_value[] under !SHA2_SMALL, else it is unused if sha2.c is built with SHA2_SMALL, as pointed out by clang.
This applies to the sha2.c copies in libc and libsa. The one in sys/crypto doesn't have SHA224. ok? Index: lib/libc/hash/sha2.c =================================================================== RCS file: /cvs/src/lib/libc/hash/sha2.c,v retrieving revision 1.25 diff -u -p -r1.25 sha2.c --- lib/libc/hash/sha2.c 3 Sep 2016 16:25:03 -0000 1.25 +++ lib/libc/hash/sha2.c 27 May 2017 14:11:27 -0000 @@ -195,18 +195,6 @@ static const u_int32_t K256[64] = { 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; -/* Initial hash value H for SHA-224: */ -static const u_int32_t sha224_initial_hash_value[8] = { - 0xc1059ed8UL, - 0x367cd507UL, - 0x3070dd17UL, - 0xf70e5939UL, - 0xffc00b31UL, - 0x68581511UL, - 0x64f98fa7UL, - 0xbefa4fa4UL -}; - /* Initial hash value H for SHA-256: */ static const u_int32_t sha256_initial_hash_value[8] = { 0x6a09e667UL, @@ -276,6 +264,18 @@ static const u_int64_t sha512_initial_ha }; #if !defined(SHA2_SMALL) +/* Initial hash value H for SHA-224: */ +static const u_int32_t sha224_initial_hash_value[8] = { + 0xc1059ed8UL, + 0x367cd507UL, + 0x3070dd17UL, + 0xf70e5939UL, + 0xffc00b31UL, + 0x68581511UL, + 0x64f98fa7UL, + 0xbefa4fa4UL +}; + /* Initial hash value H for SHA-384 */ static const u_int64_t sha384_initial_hash_value[8] = { 0xcbbb9d5dc1059ed8ULL, Index: sys/lib/libsa/sha2.c =================================================================== RCS file: /cvs/src/sys/lib/libsa/sha2.c,v retrieving revision 1.1 diff -u -p -r1.1 sha2.c --- sys/lib/libsa/sha2.c 10 Sep 2016 18:22:34 -0000 1.1 +++ sys/lib/libsa/sha2.c 27 May 2017 14:12:35 -0000 @@ -196,18 +196,6 @@ static const u_int32_t K256[64] = { 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; -/* Initial hash value H for SHA-224: */ -static const u_int32_t sha224_initial_hash_value[8] = { - 0xc1059ed8UL, - 0x367cd507UL, - 0x3070dd17UL, - 0xf70e5939UL, - 0xffc00b31UL, - 0x68581511UL, - 0x64f98fa7UL, - 0xbefa4fa4UL -}; - /* Initial hash value H for SHA-256: */ static const u_int32_t sha256_initial_hash_value[8] = { 0x6a09e667UL, @@ -277,6 +265,18 @@ static const u_int64_t sha512_initial_ha }; #if !defined(SHA2_SMALL) +/* Initial hash value H for SHA-224: */ +static const u_int32_t sha224_initial_hash_value[8] = { + 0xc1059ed8UL, + 0x367cd507UL, + 0x3070dd17UL, + 0xf70e5939UL, + 0xffc00b31UL, + 0x68581511UL, + 0x64f98fa7UL, + 0xbefa4fa4UL +}; + /* Initial hash value H for SHA-384 */ static const u_int64_t sha384_initial_hash_value[8] = { 0xcbbb9d5dc1059ed8ULL, -- Christian "naddy" Weisgerber na...@mips.inka.de