Skip to content

Commit 8e5f314

Browse files
Add Ed25519 key clean up
1 parent 64867cf commit 8e5f314

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/internal.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5014,8 +5014,13 @@ static int ParseEd25519PubKey(WOLFSSH *ssh,
50145014
if (ret == WS_SUCCESS) {
50155015
ret = wc_ed25519_import_public(encA, encASz,
50165016
&sigKeyBlock_ptr->sk.ed25519.key);
5017-
if (ret != 0)
5018-
ret = WS_ED25519_E;
5017+
}
5018+
5019+
if (ret == 0) {
5020+
sigKeyBlock_ptr->keyAllocated = 1;
5021+
}
5022+
else {
5023+
ret = WS_ED25519_E;
50195024
}
50205025
return ret;
50215026
}
@@ -5328,6 +5333,11 @@ static void FreePubKey(struct wolfSSH_sigKeyBlock *p)
53285333
wc_ecc_free(&p->sk.ecc.key);
53295334
#endif
53305335
}
5336+
else if (p->useEd25519) {
5337+
#ifndef WOLFSSH_NO_ED25519
5338+
wc_ed25519_free(p->sk.ed25519.key);
5339+
#endif
5340+
}
53315341
p->keyAllocated = 0;
53325342
}
53335343
}

0 commit comments

Comments
 (0)