From 8bafa7f601fde14edda1f9a6c2a6804baab44aed Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 21 Mar 2022 11:02:19 -0700 Subject: [PATCH] Fix for KCAPI ECC sign (was not returning the signature, since ret always 0). --- wolfcrypt/src/port/kcapi/kcapi_ecc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/port/kcapi/kcapi_ecc.c b/wolfcrypt/src/port/kcapi/kcapi_ecc.c index 38592b43c..6a5b1514d 100644 --- a/wolfcrypt/src/port/kcapi/kcapi_ecc.c +++ b/wolfcrypt/src/port/kcapi/kcapi_ecc.c @@ -290,7 +290,7 @@ static int KcapiEcc_SetPrivKey(ecc_key* key) if (ret == 0) { priv[0] = ECDSA_KEY_VERSION; priv[1] = kcapiCurveId; - ret = wc_export_int(&key->k, priv + 2, &keySz, keySz, + ret = wc_export_int(&key->k, priv + KCAPI_PARAM_SZ, &keySz, keySz, WC_TYPE_UNSIGNED_BIN); } if (ret == 0) { @@ -359,10 +359,10 @@ int KcapiEcc_Sign(ecc_key* key, const byte* hash, word32 hashLen, byte* sig, ret = (int)kcapi_akcipher_sign(key->handle, hash_aligned, hashLen, sig_aligned, keySz*2, KCAPI_ACCESS_HEURISTIC); if (ret >= 0) { - ret = 0; if (sig_aligned != sig) { XMEMCPY(sig, sig_aligned, ret); } + ret = 0; /* mark success */ } }