Skip to content

Commit 4b05765

Browse files
xnoxherbertx
authored andcommitted
crypto: FIPS 202 SHA-3 register in hash info for IMA
Register FIPS 202 SHA-3 hashes in hash info for IMA and other users. Sizes 256 and up, as 224 is too weak for any practical purposes. Signed-off-by: Dimitri John Ledkov <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 2ee7c1b commit 4b05765

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

crypto/hash_info.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const char *const hash_algo_name[HASH_ALGO__LAST] = {
2929
[HASH_ALGO_SM3_256] = "sm3",
3030
[HASH_ALGO_STREEBOG_256] = "streebog256",
3131
[HASH_ALGO_STREEBOG_512] = "streebog512",
32+
[HASH_ALGO_SHA3_256] = "sha3-256",
33+
[HASH_ALGO_SHA3_384] = "sha3-384",
34+
[HASH_ALGO_SHA3_512] = "sha3-512",
3235
};
3336
EXPORT_SYMBOL_GPL(hash_algo_name);
3437

@@ -53,5 +56,8 @@ const int hash_digest_size[HASH_ALGO__LAST] = {
5356
[HASH_ALGO_SM3_256] = SM3256_DIGEST_SIZE,
5457
[HASH_ALGO_STREEBOG_256] = STREEBOG256_DIGEST_SIZE,
5558
[HASH_ALGO_STREEBOG_512] = STREEBOG512_DIGEST_SIZE,
59+
[HASH_ALGO_SHA3_256] = SHA3_256_DIGEST_SIZE,
60+
[HASH_ALGO_SHA3_384] = SHA3_384_DIGEST_SIZE,
61+
[HASH_ALGO_SHA3_512] = SHA3_512_DIGEST_SIZE,
5662
};
5763
EXPORT_SYMBOL_GPL(hash_digest_size);

include/crypto/hash_info.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <crypto/sha1.h>
1212
#include <crypto/sha2.h>
13+
#include <crypto/sha3.h>
1314
#include <crypto/md5.h>
1415
#include <crypto/streebog.h>
1516

include/uapi/linux/hash_info.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ enum hash_algo {
3535
HASH_ALGO_SM3_256,
3636
HASH_ALGO_STREEBOG_256,
3737
HASH_ALGO_STREEBOG_512,
38+
HASH_ALGO_SHA3_256,
39+
HASH_ALGO_SHA3_384,
40+
HASH_ALGO_SHA3_512,
3841
HASH_ALGO__LAST
3942
};
4043

0 commit comments

Comments
 (0)