diff options
| author | Tom Rini <[email protected]> | 2025-11-11 14:53:33 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-11-11 14:53:33 -0600 |
| commit | 62e89de7698a637c673b08ec129941d8079a5405 (patch) | |
| tree | e82d077ea6fcf4c96719bb0cad4247cb2cf2da70 /lib/rsa | |
| parent | 4b46f98244273df9fc7472a99a5678511fd5870e (diff) | |
| parent | c50f6b11b3242adba0c8a3a6a50082a2eca01772 (diff) | |
Merge patch series "rsa: fix dependency, rename and relocate RSASSA PSS symbols"
Quentin Schulz <[email protected]> says:
While historically signature verification is mostly done for FIT such
FIT_SIGNATURE dependency for signature algorithm makes sense, it isn't
the only kind of file we can verify signatures of. It can also be done
manually with rsa_verify_hash() with an embedded public key.
Considering the impacted code is guarded by RSA_VERIFY, let's make the
symbol depend on that otherwise selecting it without RSA_VERIFY won't do
anything. The FIT_SIGNATURE dependency wasn't also enough before as it
only implied RSA_VERIFY.
Then, simply relocate the RSA SSA PSS padding with the other RSA symbols
in lib/rsa instead of in boot/ and rename it to remove the mention to
FIT.
Finally, add the PSS padding wherever PKCS1.5 padding is specified as
one or the other can be used.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'lib/rsa')
| -rw-r--r-- | lib/rsa/Kconfig | 14 | ||||
| -rw-r--r-- | lib/rsa/rsa-sign.c | 2 | ||||
| -rw-r--r-- | lib/rsa/rsa-verify.c | 8 |
3 files changed, 19 insertions, 5 deletions
diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig index 3eda4bc61b9..1a763149c05 100644 --- a/lib/rsa/Kconfig +++ b/lib/rsa/Kconfig @@ -67,6 +67,20 @@ config SPL_RSA_VERIFY_WITH_PKEY key properties will be calculated on the fly in verification code in the SPL. +config RSASSA_PSS + bool "Support rsassa-pss signature scheme" + depends on RSA_VERIFY + help + Enable this to support the pss padding algorithm as described + in the rfc8017 (https://tools.ietf.org/html/rfc8017). + +config SPL_RSASSA_PSS + bool "Support rsassa-pss signature scheme within SPL" + depends on SPL_RSA_VERIFY + help + Enable this to support the pss padding algorithm as described + in the rfc8017 (https://tools.ietf.org/html/rfc8017) within SPL. + config RSA_SOFTWARE_EXP bool "Enable driver for RSA Modular Exponentiation in software" depends on DM diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 92b9d7876e5..0e38c9e802f 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -421,7 +421,7 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo, goto err_sign; } - if (CONFIG_IS_ENABLED(FIT_RSASSA_PSS) && padding_algo && + if (CONFIG_IS_ENABLED(RSASSA_PSS) && padding_algo && !strcmp(padding_algo->name, "pss")) { if (EVP_PKEY_CTX_set_rsa_padding(ckey, RSA_PKCS1_PSS_PADDING) <= 0) { diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index b65fbe44007..e7e612a4688 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -89,7 +89,7 @@ U_BOOT_PADDING_ALGO(pkcs_15) = { }; #endif -#if CONFIG_IS_ENABLED(FIT_RSASSA_PSS) +#if CONFIG_IS_ENABLED(RSASSA_PSS) static void u32_i2osp(uint32_t val, uint8_t *buf) { buf[0] = (uint8_t)((val >> 24) & 0xff); @@ -310,7 +310,7 @@ U_BOOT_PADDING_ALGO(pss) = { /** * rsa_verify_key() - Verify a signature against some data using RSA Key * - * Verify a RSA PKCS1.5 signature against an expected hash using + * Verify a RSA PKCS1.5/PSS signature against an expected hash using * the RSA Key properties in prop structure. * * @info: Specifies key and FIT information @@ -388,7 +388,7 @@ static int rsa_verify_key(struct image_sign_info *info, * @sig_len: Number of bytes in signature * * Parse a RSA public key blob in DER format pointed to in @info and fill - * a key_prop structure with properties of the key. Then verify a RSA PKCS1.5 + * a key_prop structure with properties of the key. Then verify a RSA PKCS1.5/PSS * signature against an expected hash using the calculated properties. * * Return 0 if verified, -ve on error @@ -423,7 +423,7 @@ int rsa_verify_with_pkey(struct image_sign_info *info, * information in node with prperties of RSA Key like modulus, exponent etc. * * Parse sign-node and fill a key_prop structure with properties of the - * key. Verify a RSA PKCS1.5 signature against an expected hash using + * key. Verify a RSA PKCS1.5/PSS signature against an expected hash using * the properties parsed * * @info: Specifies key and FIT information |
