diff options
author | Tom Rini <trini@ti.com> | 2014-04-17 14:33:25 -0400 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-04-17 14:33:25 -0400 |
commit | 0f507779ca00d90cdd4bcc8252630370339b7ea6 (patch) | |
tree | a91a89ac67dcbd42c8a4357501d155a129fa1e5a /lib/rsa/rsa-sign.c | |
parent | 0f605c1501f6e82553e9affc6e17876a85db408c (diff) | |
parent | ece0d370144fdecb6f3ed5738ffe96f5b12f9e96 (diff) |
Merge branch 'next'
Diffstat (limited to 'lib/rsa/rsa-sign.c')
-rw-r--r-- | lib/rsa/rsa-sign.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 549130eda1f..ca8c120d97c 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -159,8 +159,9 @@ static void rsa_remove(void) EVP_cleanup(); } -static int rsa_sign_with_key(RSA *rsa, const struct image_region region[], - int region_count, uint8_t **sigp, uint *sig_size) +static int rsa_sign_with_key(RSA *rsa, struct checksum_algo *checksum_algo, + const struct image_region region[], int region_count, + uint8_t **sigp, uint *sig_size) { EVP_PKEY *key; EVP_MD_CTX *context; @@ -192,7 +193,7 @@ static int rsa_sign_with_key(RSA *rsa, const struct image_region region[], goto err_create; } EVP_MD_CTX_init(context); - if (!EVP_SignInit(context, EVP_sha1())) { + if (!EVP_SignInit(context, checksum_algo->calculate_sign())) { ret = rsa_err("Signer setup failed"); goto err_sign; } @@ -242,7 +243,8 @@ int rsa_sign(struct image_sign_info *info, ret = rsa_get_priv_key(info->keydir, info->keyname, &rsa); if (ret) goto err_priv; - ret = rsa_sign_with_key(rsa, region, region_count, sigp, sig_len); + ret = rsa_sign_with_key(rsa, info->algo->checksum, region, + region_count, sigp, sig_len); if (ret) goto err_sign; |