u-boot/lib/rsa
Loic Poulain 1b99c15d73 lib: rsa: Set conventional salt length RSA-PSS parameter
RFC 3447 says that Typical salt length are either 0 or the length
of the output of the digest algorithm, RFC 4055 also recommends
hash value length as the salt length. Moreover, By convention,
most of the signing infrastructures/libraries use the length of
the digest algorithm (such as google cloud kms:
                      https://cloud.google.com/kms/docs/algorithms).

If the salt-length parameter is not set, openssl default to the
maximum allowed value, which is a openssl 'specificity', so this
works well for local signing, but restricts compatibility with
other engines (e.g pkcs11/libkmsp11):

```
returning 0x71 from C_SignInit due to status INVALID_ARGUMENT:
    at rsassa_pss.cc:53: expected salt length for key XX is 32,
    but 478 was supplied in the parameters
Could not obtain signature: error:41000070:PKCS#11 module::Mechanism invalid
```

To improve compatibility, we set the default RSA-PSS salt-length
value to the conventional one. A further improvement could consist
in making it configurable as signature FIT node attribute.

rfc3447: https://datatracker.ietf.org/doc/html/rfc3447
rfc4055: https://datatracker.ietf.org/doc/html/rfc4055

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2024-11-14 18:14:05 -06:00
..
Kconfig spl: Ensure all SPL symbols in Kconfig have some SPL dependency 2022-07-07 09:29:08 -04:00
Makefile global: Rename SPL_TPL_ to PHASE_ 2024-10-11 11:44:48 -06:00
rsa-keyprop.c lib: Remove <common.h> inclusion from these files 2023-12-21 08:54:37 -05:00
rsa-mod-exp.c lib: Remove <common.h> inclusion from these files 2023-12-21 08:54:37 -05:00
rsa-sign.c lib: rsa: Set conventional salt length RSA-PSS parameter 2024-11-14 18:14:05 -06:00
rsa-verify.c lib: add missing line breaks in debug messages 2024-04-10 09:34:53 -06:00