From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
To: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] kmod: Add FIPS 202 SHA-3 support
Date: Sun, 22 Oct 2023 19:09:28 +0100 [thread overview]
Message-ID: <20231022180928.180437-1-dimitri.ledkov@canonical.com> (raw)
Add support for parsing FIPS 202 SHA-3 signature hashes. Separately,
it is not clear why explicit hashes are re-encoded here, instead of
trying to generically show any digest openssl supports.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
libkmod/libkmod-signature.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index b749a818f9..a39059cd7c 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -57,6 +57,9 @@ enum pkey_hash_algo {
PKEY_HASH_SHA512,
PKEY_HASH_SHA224,
PKEY_HASH_SM3,
+ PKEY_HASH_SHA3_256,
+ PKEY_HASH_SHA3_384,
+ PKEY_HASH_SHA3_512,
PKEY_HASH__LAST
};
@@ -70,6 +73,9 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = {
[PKEY_HASH_SHA512] = "sha512",
[PKEY_HASH_SHA224] = "sha224",
[PKEY_HASH_SM3] = "sm3",
+ [PKEY_HASH_SHA3_256] = "sha3-256",
+ [PKEY_HASH_SHA3_384] = "sha3-384",
+ [PKEY_HASH_SHA3_512] = "sha3-512",
};
enum pkey_id_type {
@@ -167,6 +173,12 @@ static int obj_to_hash_algo(const ASN1_OBJECT *o)
case NID_sm3:
return PKEY_HASH_SM3;
# endif
+ case NID_sha3_256:
+ return PKEY_HASH_SHA3_256;
+ case NID_sha3_384:
+ return PKEY_HASH_SHA3_384;
+ case NID_sha3_512:
+ return PKEY_HASH_SHA3_512;
default:
return -1;
}
--
2.34.1
next reply other threads:[~2023-10-22 18:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-22 18:09 Dimitri John Ledkov [this message]
2023-12-06 15:22 ` [PATCH] kmod: Add FIPS 202 SHA-3 support Lucas De Marchi
2023-12-12 20:11 ` Dimitri John Ledkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231022180928.180437-1-dimitri.ledkov@canonical.com \
--to=dimitri.ledkov@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).