Re: [PATCH v7 05/15] lib: rsa: internalize PKCS#1 DigestInfo prefixes

Simon Glass <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <CAFLszTjSa7bsQ2LNEgb1-za1LdOPs=TQ5R4jfyjJzX49auVCvw@mail.gmail.com>
On 2026-08-13T19:58:53, James Hilliard <[email protected]> wrote:
> lib: rsa: internalize PKCS#1 DigestInfo prefixes
>
> The checksum algorithm table is shared by RSA and ECDSA, but its DER
> prefix fields are used only by RSA PKCS#1 v1.5 padding verification.
> Keeping those prefixes in the software hash implementations also ties
> signature metadata to a particular hash backend and duplicates it between
> the legacy and MbedTLS shims.
>
> Keep the SHA-1, SHA-256, SHA-384 and SHA-512 DigestInfo prefixes in the RSA
> verifier instead. Select the prefix by checksum name when checking PKCS#1
> v1.5 padding, include every algorithm in host tools and only configured
> algorithms in target builds, and reject padding which is too short for the
> required eight-byte padding string.
>
> Remove the DER fields from the generic checksum descriptor and remove the
> now-unneeded constants from the hash implementations. ECDSA-only and
> hardware-hash-only builds then carry no RSA-specific DigestInfo data.
>
> Signed-off-by: James Hilliard <[email protected]>
>
> boot/image-sig.c        |  8 ------
>  include/image.h         |  2 --
>  include/u-boot/sha1.h   |  3 ---
>  include/u-boot/sha256.h |  3 ---
>  include/u-boot/sha512.h |  6 -----
>  lib/mbedtls/sha1.c      |  5 ----
>  lib/mbedtls/sha256.c    |  6 -----
>  lib/mbedtls/sha512.c    | 12 ---------
>  lib/rsa/rsa-verify.c    | 67 ++++++++++++++++++++++++++++++++++++++++++++++---
>  lib/sha1.c              |  5 ----
>  lib/sha256.c            |  6 -----
>  lib/sha512.c            | 12 ---------
>  tools/image-sig-host.c  |  8 ------
>  13 files changed, 63 insertions(+), 80 deletions(-)

Reviewed-by: Simon Glass <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.