Message ID | 20240920161521.917955-1-joakim.tjernlund@infinera.com |
---|---|
State | Accepted |
Commit | 7bc5f66f55fd1a3106e8e6beb91949e0c34fc7b1 |
Delegated to: | Tom Rini |
Headers | show |
Series | Add mkimage secp521r1 ECDSA curve support | expand |
Hi Joakim, On Fri, 20 Sept 2024 at 18:15, Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote: > > Adds support for secp521r1 ECDSA in mkimage > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> > --- > include/u-boot/ecdsa.h | 1 + > lib/ecdsa/ecdsa-libcrypto.c | 2 +- > tools/image-sig-host.c | 7 +++++++ > 3 files changed, 9 insertions(+), 1 deletion(-) Just sending this again as it wasn't picked up: Reviewed-by: Simon Glass <sjg@chromium.org> > > diff --git a/include/u-boot/ecdsa.h b/include/u-boot/ecdsa.h > index 53490c6b287..8f9f5e7d6e7 100644 > --- a/include/u-boot/ecdsa.h > +++ b/include/u-boot/ecdsa.h > @@ -65,5 +65,6 @@ int ecdsa_verify(struct image_sign_info *info, > /** @} */ > > #define ECDSA256_BYTES (256 / 8) > +#define ECDSA521_BYTES ((521 + 7) / 8) > > #endif > diff --git a/lib/ecdsa/ecdsa-libcrypto.c b/lib/ecdsa/ecdsa-libcrypto.c > index 5fa9be10b4b..403dfe0b97c 100644 > --- a/lib/ecdsa/ecdsa-libcrypto.c > +++ b/lib/ecdsa/ecdsa-libcrypto.c > @@ -108,7 +108,7 @@ static size_t ecdsa_key_size_bytes(const EC_KEY *key) > const EC_GROUP *group; > > group = EC_KEY_get0_group(key); > - return EC_GROUP_order_bits(group) / 8; > + return (EC_GROUP_order_bits(group) + 7) / 8; > } > > static int default_password(char *buf, int size, int rwflag, void *u) > diff --git a/tools/image-sig-host.c b/tools/image-sig-host.c > index d0133aec4c8..21b4fa5d39d 100644 > --- a/tools/image-sig-host.c > +++ b/tools/image-sig-host.c > @@ -76,6 +76,13 @@ struct crypto_algo crypto_algos[] = { > .add_verify_data = ecdsa_add_verify_data, > .verify = ecdsa_verify, > }, > + { > + .name = "secp521r1", > + .key_len = ECDSA521_BYTES, > + .sign = ecdsa_sign, > + .add_verify_data = ecdsa_add_verify_data, > + .verify = ecdsa_verify, > + }, > }; > > struct padding_algo padding_algos[] = { > -- > 2.44.2 > Regards, Simon
On Fri, 20 Sep 2024 18:14:35 +0200, Joakim Tjernlund wrote: > Adds support for secp521r1 ECDSA in mkimage > > Applied to u-boot/next, thanks!
diff --git a/include/u-boot/ecdsa.h b/include/u-boot/ecdsa.h index 53490c6b287..8f9f5e7d6e7 100644 --- a/include/u-boot/ecdsa.h +++ b/include/u-boot/ecdsa.h @@ -65,5 +65,6 @@ int ecdsa_verify(struct image_sign_info *info, /** @} */ #define ECDSA256_BYTES (256 / 8) +#define ECDSA521_BYTES ((521 + 7) / 8) #endif diff --git a/lib/ecdsa/ecdsa-libcrypto.c b/lib/ecdsa/ecdsa-libcrypto.c index 5fa9be10b4b..403dfe0b97c 100644 --- a/lib/ecdsa/ecdsa-libcrypto.c +++ b/lib/ecdsa/ecdsa-libcrypto.c @@ -108,7 +108,7 @@ static size_t ecdsa_key_size_bytes(const EC_KEY *key) const EC_GROUP *group; group = EC_KEY_get0_group(key); - return EC_GROUP_order_bits(group) / 8; + return (EC_GROUP_order_bits(group) + 7) / 8; } static int default_password(char *buf, int size, int rwflag, void *u) diff --git a/tools/image-sig-host.c b/tools/image-sig-host.c index d0133aec4c8..21b4fa5d39d 100644 --- a/tools/image-sig-host.c +++ b/tools/image-sig-host.c @@ -76,6 +76,13 @@ struct crypto_algo crypto_algos[] = { .add_verify_data = ecdsa_add_verify_data, .verify = ecdsa_verify, }, + { + .name = "secp521r1", + .key_len = ECDSA521_BYTES, + .sign = ecdsa_sign, + .add_verify_data = ecdsa_add_verify_data, + .verify = ecdsa_verify, + }, }; struct padding_algo padding_algos[] = {
Adds support for secp521r1 ECDSA in mkimage Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> --- include/u-boot/ecdsa.h | 1 + lib/ecdsa/ecdsa-libcrypto.c | 2 +- tools/image-sig-host.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-)