1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-27 00:24:09 +01:00

rsa: add a structure for the padding

The rsa signature use a padding algorithm. By default, we use the
padding pkcs-1.5. In order to add some new padding algorithm, we
add a padding framework to manage several padding algorithm.
The choice of the padding is done in the file .its.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Philippe Reynes
2018-11-14 13:51:00 +01:00
committed by Tom Rini
parent 3b5d6979fc
commit 20031567e1
7 changed files with 116 additions and 23 deletions

View File

@@ -97,6 +97,10 @@ static inline int rsa_add_verify_data(struct image_sign_info *info,
int rsa_verify(struct image_sign_info *info,
const struct image_region region[], int region_count,
uint8_t *sig, uint sig_len);
int padding_pkcs_15_verify(struct image_sign_info *info,
uint8_t *msg, int msg_len,
const uint8_t *hash, int hash_len);
#else
static inline int rsa_verify(struct image_sign_info *info,
const struct image_region region[], int region_count,
@@ -104,8 +108,17 @@ static inline int rsa_verify(struct image_sign_info *info,
{
return -ENXIO;
}
static inline int padding_pkcs_15_verify(struct image_sign_info *info,
uint8_t *msg, int msg_len,
const uint8_t *hash, int hash_len)
{
return -ENXIO;
}
#endif
#define RSA_DEFAULT_PADDING_NAME "pkcs-1.5"
#define RSA2048_BYTES (2048 / 8)
#define RSA4096_BYTES (4096 / 8)