Skip to content

Commit b0e424e

Browse files
committed
Missing wc_ecc_init() Before ECC Key Import
1. Call `wc_ecc_init()` on an ECC key before importing it. 2. Incidental: `PostLock()` and `PostUnlock()` needed their agent pointers tagged as unused. Affected functions: SignHashEcc. PostLock and PostUnlock. Issue: F-211
1 parent 2da0942 commit b0e424e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/agent.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ static int PostLock(WOLFSSH_AGENT_CTX* agent,
374374
word32 ppSz;
375375

376376
WLOG(WS_LOG_AGENT, "Posting lock to agent %p", agent);
377+
WOLFSSH_UNUSED(agent);
377378

378379
ppSz = sizeof(pp) - 1;
379380
if (passphraseSz < ppSz)
@@ -395,6 +396,7 @@ static int PostUnlock(WOLFSSH_AGENT_CTX* agent,
395396
word32 ppSz;
396397

397398
WLOG(WS_LOG_AGENT, "Posting unlock to agent %p", agent);
399+
WOLFSSH_UNUSED(agent);
398400

399401
ppSz = sizeof(pp) - 1;
400402
if (passphraseSz < ppSz)
@@ -730,8 +732,12 @@ static int SignHashEcc(WOLFSSH_AGENT_KEY_ECDSA* rawKey, int curveId,
730732
ecc_key key;
731733
int ret;
732734

733-
ret = wc_ecc_import_private_key_ex(rawKey->d, rawKey->dSz,
734-
rawKey->q, rawKey->qSz, &key, curveId);
735+
ret = wc_ecc_init(&key);
736+
737+
if (ret == 0) {
738+
ret = wc_ecc_import_private_key_ex(rawKey->d, rawKey->dSz,
739+
rawKey->q, rawKey->qSz, &key, curveId);
740+
}
735741

736742
if (ret == 0) {
737743
ret = wc_ecc_sign_hash(digest, digestSz, sig, sigSz, rng, &key);

0 commit comments

Comments
 (0)