wc_MakeRsKey with static mem pool

This commit is contained in:
Takashi Kojo 2022-06-05 09:04:42 +09:00
parent dbfa207344
commit 1b9f922ec3
3 changed files with 3 additions and 13 deletions

View File

@ -18392,7 +18392,7 @@ static int test_wc_MakeRsaKey (void)
printf(testingFmt, "wc_MakeRsaKey()");
ret = wc_InitRsaKey(&genKey, NULL);
ret = wc_InitRsaKey(&genKey, HEAP_HINT);
if (ret == 0) {
ret = wc_InitRng(&rng);
if (ret == 0) {

View File

@ -20593,16 +20593,11 @@ int wc_PemCertToDer_ex(const char* fileName, DerBuffer** der)
ret = BUFFER_E;
}
else if (sz > (long)sizeof(staticBuffer)) {
#ifdef WOLFSSL_STATIC_MEMORY
WOLFSSL_MSG("File was larger then static buffer");
ret = MEMORY_E;
#else
fileBuf = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_FILE);
if (fileBuf == NULL)
ret = MEMORY_E;
else
dynamic = 1;
#endif
}
if (ret == 0) {
@ -20679,16 +20674,11 @@ int wc_PemPubKeyToDer_ex(const char* fileName, DerBuffer** der)
ret = BUFFER_E;
}
else if (sz > (long)sizeof(staticBuffer)) {
#ifdef WOLFSSL_STATIC_MEMORY
WOLFSSL_MSG("File was larger then static buffer");
ret = MEMORY_E;
#else
fileBuf = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_FILE);
if (fileBuf == NULL)
ret = MEMORY_E;
else
dynamic = 1;
#endif
}
if (ret == 0) {
if ((size_t)XFREAD(fileBuf, 1, sz, file) != (size_t)sz) {

View File

@ -626,7 +626,7 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
sigLen = wc_RsaEncryptSize(key);
/* Sign and verify. */
sig = (byte*)XMALLOC(sigLen, NULL, DYNAMIC_TYPE_RSA);
sig = (byte*)XMALLOC(sigLen, key->heap, DYNAMIC_TYPE_RSA);
if (sig == NULL) {
return MEMORY_E;
}
@ -669,7 +669,7 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
ret = RSA_KEY_PAIR_E;
ForceZero(sig, sigLen);
XFREE(sig, NULL, DYNAMIC_TYPE_RSA);
XFREE(sig, key->heap, DYNAMIC_TYPE_RSA);
return ret;
}