mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
update pkey sz in actual length
This commit is contained in:
16
tests/api.c
16
tests/api.c
@@ -28802,6 +28802,9 @@ static void test_wolfSSL_PEM_PUBKEY(void)
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
byte* buf;
|
byte* buf;
|
||||||
|
|
||||||
|
EVP_PKEY* pkey2;
|
||||||
|
EC_KEY* ec_key;
|
||||||
|
|
||||||
file = XFOPEN(fname, "rb");
|
file = XFOPEN(fname, "rb");
|
||||||
AssertTrue((file != XBADFILE));
|
AssertTrue((file != XBADFILE));
|
||||||
XFSEEK(file, 0, XSEEK_END);
|
XFSEEK(file, 0, XSEEK_END);
|
||||||
@@ -28818,6 +28821,19 @@ static void test_wolfSSL_PEM_PUBKEY(void)
|
|||||||
XFREE(buf, NULL, DYNAMIC_TYPE_FILE);
|
XFREE(buf, NULL, DYNAMIC_TYPE_FILE);
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
bio = NULL;
|
bio = NULL;
|
||||||
|
|
||||||
|
/* Qt unit test case*/
|
||||||
|
AssertNotNull(pkey2 = EVP_PKEY_new());
|
||||||
|
AssertNotNull(ec_key = EVP_PKEY_get1_EC_KEY(pkey));
|
||||||
|
AssertIntEQ(EVP_PKEY_set1_EC_KEY(pkey2, ec_key), WOLFSSL_SUCCESS);
|
||||||
|
#ifdef WOLFSSL_ERROR_CODE_OPENSSL
|
||||||
|
AssertIntEQ(EVP_PKEY_cmp(pkey, pkey2), 1/* match */);
|
||||||
|
#else
|
||||||
|
AssertIntEQ(EVP_PKEY_cmp(pkey, pkey2), 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EC_KEY_free(ec_key);
|
||||||
|
EVP_PKEY_free(pkey2);
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
pkey = NULL;
|
pkey = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -6685,7 +6685,7 @@ static int ECC_populate_EVP_PKEY(EVP_PKEY* pkey, WOLFSSL_EC_KEY *key)
|
|||||||
DYNAMIC_TYPE_OPENSSL);
|
DYNAMIC_TYPE_OPENSSL);
|
||||||
if (derBuf != NULL) {
|
if (derBuf != NULL) {
|
||||||
pkey->pkey.ptr = (char*)derBuf;
|
pkey->pkey.ptr = (char*)derBuf;
|
||||||
if (wc_EccPublicKeyToDer(ecc, derBuf, derSz, 1) < 0) {
|
if ((derSz = wc_EccPublicKeyToDer(ecc, derBuf, derSz, 1)) < 0) {
|
||||||
XFREE(derBuf, NULL, DYNAMIC_TYPE_OPENSSL);
|
XFREE(derBuf, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||||
derBuf = NULL;
|
derBuf = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user