Skip to content

Commit

Permalink
crypto: FIPS 202 SHA-3 register in hash info for IMA
Browse files Browse the repository at this point in the history
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 <dimitri.ledkov@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
xnox authored and herbertx committed Oct 27, 2023
1 parent 2ee7c1b commit 4b05765
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crypto/hash_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const char *const hash_algo_name[HASH_ALGO__LAST] = {
[HASH_ALGO_SM3_256] = "sm3",
[HASH_ALGO_STREEBOG_256] = "streebog256",
[HASH_ALGO_STREEBOG_512] = "streebog512",
[HASH_ALGO_SHA3_256] = "sha3-256",
[HASH_ALGO_SHA3_384] = "sha3-384",
[HASH_ALGO_SHA3_512] = "sha3-512",
};
EXPORT_SYMBOL_GPL(hash_algo_name);

Expand All @@ -53,5 +56,8 @@ const int hash_digest_size[HASH_ALGO__LAST] = {
[HASH_ALGO_SM3_256] = SM3256_DIGEST_SIZE,
[HASH_ALGO_STREEBOG_256] = STREEBOG256_DIGEST_SIZE,
[HASH_ALGO_STREEBOG_512] = STREEBOG512_DIGEST_SIZE,
[HASH_ALGO_SHA3_256] = SHA3_256_DIGEST_SIZE,
[HASH_ALGO_SHA3_384] = SHA3_384_DIGEST_SIZE,
[HASH_ALGO_SHA3_512] = SHA3_512_DIGEST_SIZE,
};
EXPORT_SYMBOL_GPL(hash_digest_size);
1 change: 1 addition & 0 deletions include/crypto/hash_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <crypto/sha1.h>
#include <crypto/sha2.h>
#include <crypto/sha3.h>
#include <crypto/md5.h>
#include <crypto/streebog.h>

Expand Down
3 changes: 3 additions & 0 deletions include/uapi/linux/hash_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ enum hash_algo {
HASH_ALGO_SM3_256,
HASH_ALGO_STREEBOG_256,
HASH_ALGO_STREEBOG_512,
HASH_ALGO_SHA3_256,
HASH_ALGO_SHA3_384,
HASH_ALGO_SHA3_512,
HASH_ALGO__LAST
};

Expand Down

0 comments on commit 4b05765

Please sign in to comment.