diff options
author | Tom Rini <trini@konsulko.com> | 2021-07-29 12:10:23 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-29 12:10:55 -0400 |
commit | 15f7e0dc01d8a851fb1bfbf0e47eab5b67ed26b3 (patch) | |
tree | a05518590771cfaff996f35856b9d9d8edfa7221 /lib | |
parent | 38436abd5e58044eccddbcd7ec3610a9104e86b6 (diff) | |
parent | 62b27a561c2868d95445905ad554297e43cc0f2b (diff) |
Merge branch '2021-07-28-assorted-fixes'
- Assorted bugfixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rsa/rsa-sign.c | 13 | ||||
-rw-r--r-- | lib/rsa/rsa-verify.c | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index f4ed11e74a..085dc89bf7 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -338,6 +338,7 @@ static int rsa_init(void) static int rsa_engine_init(const char *engine_id, ENGINE **pe) { + const char *key_pass; ENGINE *e; int ret; @@ -362,10 +363,20 @@ static int rsa_engine_init(const char *engine_id, ENGINE **pe) goto err_set_rsa; } + key_pass = getenv("MKIMAGE_SIGN_PIN"); + if (key_pass) { + if (!ENGINE_ctrl_cmd_string(e, "PIN", key_pass, 0)) { + fprintf(stderr, "Couldn't set PIN\n"); + ret = -1; + goto err_set_pin; + } + } + *pe = e; return 0; +err_set_pin: err_set_rsa: ENGINE_finish(e); err_engine_init: @@ -473,7 +484,7 @@ static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo, #endif EVP_MD_CTX_destroy(context); - debug("Got signature: %d bytes, expected %zu\n", *sig_size, size); + debug("Got signature: %zu bytes, expected %d\n", size, EVP_PKEY_size(pkey)); *sigp = sig; *sig_size = size; diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index bb8cc61d94..3840764e42 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -556,7 +556,7 @@ int rsa_verify(struct image_sign_info *info, */ if (info->checksum->checksum_len > info->crypto->key_len) { - debug("%s: invlaid checksum-algorithm %s for %s\n", + debug("%s: invalid checksum-algorithm %s for %s\n", __func__, info->checksum->name, info->crypto->name); return -EINVAL; } |