forked from wolfSSL/wolfssl
Fix for new test_wolfSSL_PKCS8
changes to init/free the ecc_key.
This commit is contained in:
@ -3540,6 +3540,7 @@ static void test_wolfSSL_PKCS8(void)
|
|||||||
XFILE f;
|
XFILE f;
|
||||||
int bytes;
|
int bytes;
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
|
int ret;
|
||||||
ecc_key key;
|
ecc_key key;
|
||||||
word32 x = 0;
|
word32 x = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -3603,7 +3604,12 @@ static void test_wolfSSL_PKCS8(void)
|
|||||||
/* decrypt PKCS8 PEM to key in DER format with not using WOLFSSL_CTX */
|
/* decrypt PKCS8 PEM to key in DER format with not using WOLFSSL_CTX */
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
AssertIntGT((bytes = wc_KeyPemToDer(buffer, bytes, der, FOURK_BUF, NULL)), 0);
|
AssertIntGT((bytes = wc_KeyPemToDer(buffer, bytes, der, FOURK_BUF, NULL)), 0);
|
||||||
AssertIntEQ(wc_EccPrivateKeyDecode(der, &x, &key, bytes), 0);
|
ret = wc_ecc_init(&key);
|
||||||
|
if (ret == 0) {
|
||||||
|
ret = wc_EccPrivateKeyDecode(der, &x, &key, bytes);
|
||||||
|
wc_ecc_free(&key);
|
||||||
|
}
|
||||||
|
AssertIntEQ(ret, 0);
|
||||||
#else
|
#else
|
||||||
AssertIntEQ((bytes = wc_KeyPemToDer(buffer, bytes, der, FOURK_BUF, NULL)),
|
AssertIntEQ((bytes = wc_KeyPemToDer(buffer, bytes, der, FOURK_BUF, NULL)),
|
||||||
ASN_NO_PEM_HEADER);
|
ASN_NO_PEM_HEADER);
|
||||||
|
Reference in New Issue
Block a user