Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: eip93 - Make read-only arrays static const

Don't populate the read-only arrays sha256_init, sha224_init, sha1_init
and md5_init on the stack at run time, instead make them static.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Colin Ian King and committed by
Herbert Xu
83366bcc bda5cd6e

+14 -6
+14 -6
drivers/crypto/inside-secure/eip93/eip93-hash.c
··· 97 97 98 98 static void eip93_hash_init_sa_state_digest(u32 hash, u8 *digest) 99 99 { 100 - u32 sha256_init[] = { SHA256_H0, SHA256_H1, SHA256_H2, SHA256_H3, 101 - SHA256_H4, SHA256_H5, SHA256_H6, SHA256_H7 }; 102 - u32 sha224_init[] = { SHA224_H0, SHA224_H1, SHA224_H2, SHA224_H3, 103 - SHA224_H4, SHA224_H5, SHA224_H6, SHA224_H7 }; 104 - u32 sha1_init[] = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 }; 105 - u32 md5_init[] = { MD5_H0, MD5_H1, MD5_H2, MD5_H3 }; 100 + static const u32 sha256_init[] = { 101 + SHA256_H0, SHA256_H1, SHA256_H2, SHA256_H3, 102 + SHA256_H4, SHA256_H5, SHA256_H6, SHA256_H7 103 + }; 104 + static const u32 sha224_init[] = { 105 + SHA224_H0, SHA224_H1, SHA224_H2, SHA224_H3, 106 + SHA224_H4, SHA224_H5, SHA224_H6, SHA224_H7 107 + }; 108 + static const u32 sha1_init[] = { 109 + SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 110 + }; 111 + static const u32 md5_init[] = { 112 + MD5_H0, MD5_H1, MD5_H2, MD5_H3 113 + }; 106 114 107 115 /* Init HASH constant */ 108 116 switch (hash) {