mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 01:18:06 +00:00
Fix support for ECDSA and ECDSA-SHAx signatures.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
693c890663
commit
8988d1cf15
1 changed files with 7 additions and 0 deletions
|
|
@ -1403,6 +1403,7 @@ static int cmd_signature() {
|
|||
else if (p2 == ALGO_EC_RAW || p2 == ALGO_EC_SHA1 || p2 == ALGO_EC_SHA224 || p2 == ALGO_EC_SHA256) {
|
||||
mbedtls_ecdsa_context ctx;
|
||||
mbedtls_ecdsa_init(&ctx);
|
||||
md = MBEDTLS_MD_SHA256;
|
||||
if (p2 == ALGO_EC_RAW) {
|
||||
if (apdu.cmd_apdu_data_len == 32)
|
||||
md = MBEDTLS_MD_SHA256;
|
||||
|
|
@ -1415,6 +1416,12 @@ static int cmd_signature() {
|
|||
else if (apdu.cmd_apdu_data_len == 64)
|
||||
md = MBEDTLS_MD_SHA512;
|
||||
}
|
||||
if (p2 == ALGO_EC_SHA1)
|
||||
md = MBEDTLS_MD_SHA1;
|
||||
else if (p2 == ALGO_EC_SHA224)
|
||||
md = MBEDTLS_MD_SHA224;
|
||||
else if (p2 == ALGO_EC_SHA256)
|
||||
md = MBEDTLS_MD_SHA256;
|
||||
int r;
|
||||
r = load_private_key_ecdsa(&ctx, fkey);
|
||||
if (r != HSM_OK)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue