Add mkimage secp521r1 ECDSA curve support

Adds support for the secp521r1 ECDSA algorithm to mkimage.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Joakim Tjernlund 2024-09-20 18:14:35 +02:00 committed by Tom Rini
parent a280368b48
commit 7bc5f66f55
3 changed files with 9 additions and 1 deletions

View file

@ -65,5 +65,6 @@ int ecdsa_verify(struct image_sign_info *info,
/** @} */ /** @} */
#define ECDSA256_BYTES (256 / 8) #define ECDSA256_BYTES (256 / 8)
#define ECDSA521_BYTES ((521 + 7) / 8)
#endif #endif

View file

@ -108,7 +108,7 @@ static size_t ecdsa_key_size_bytes(const EC_KEY *key)
const EC_GROUP *group; const EC_GROUP *group;
group = EC_KEY_get0_group(key); 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) static int default_password(char *buf, int size, int rwflag, void *u)

View file

@ -76,6 +76,13 @@ struct crypto_algo crypto_algos[] = {
.add_verify_data = ecdsa_add_verify_data, .add_verify_data = ecdsa_add_verify_data,
.verify = ecdsa_verify, .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[] = { struct padding_algo padding_algos[] = {