Added deallocator function for PKCS7 initializer data.

This commit is contained in:
John Safranek
2014-01-20 10:51:26 -08:00
parent c4eb5642b1
commit 28f3a2dc21
3 changed files with 15 additions and 0 deletions

View File

@@ -177,6 +177,13 @@ int PKCS7_InitWithCert(PKCS7* pkcs7, byte* cert, word32 certSz)
} }
/* releases any memory allocated by a PKCS7 initializer */
void PKCS7_Free(PKCS7* pkcs7)
{
(void)pkcs7;
}
/* build PKCS#7 data content type */ /* build PKCS#7 data content type */
int PKCS7_EncodeData(PKCS7* pkcs7, byte* output, word32 outputSz) int PKCS7_EncodeData(PKCS7* pkcs7, byte* output, word32 outputSz)
{ {

View File

@@ -4114,6 +4114,7 @@ int pkcs7enveloped_test(void)
free(cert); free(cert);
free(privKey); free(privKey);
PKCS7_Free(&pkcs7);
if (ret > 0) if (ret > 0)
return 0; return 0;
@@ -4233,6 +4234,10 @@ int pkcs7signed_test(void)
} }
ret = PKCS7_EncodeSignedData(&msg, out, outSz); ret = PKCS7_EncodeSignedData(&msg, out, outSz);
if (ret < 0) { if (ret < 0) {
free(certDer);
free(keyDer);
free(out);
PKCS7_Free(&msg);
return -210; return -210;
} }
else else
@@ -4244,6 +4249,7 @@ int pkcs7signed_test(void)
free(certDer); free(certDer);
free(keyDer); free(keyDer);
free(out); free(out);
PKCS7_Free(&msg);
return -211; return -211;
} }
ret = (int)fwrite(out, outSz, 1, file); ret = (int)fwrite(out, outSz, 1, file);
@@ -4252,6 +4258,7 @@ int pkcs7signed_test(void)
free(certDer); free(certDer);
free(keyDer); free(keyDer);
free(out); free(out);
PKCS7_Free(&msg);
if (ret > 0) if (ret > 0)
return 0; return 0;

View File

@@ -99,6 +99,7 @@ CYASSL_LOCAL int CreateRecipientInfo(const byte* cert, word32 certSz,
int* keyEncSz, byte* out, word32 outSz); int* keyEncSz, byte* out, word32 outSz);
CYASSL_API int PKCS7_InitWithCert(PKCS7* pkcs7, byte* cert, word32 certSz); CYASSL_API int PKCS7_InitWithCert(PKCS7* pkcs7, byte* cert, word32 certSz);
CYASSL_API void PKCS7_Free(PKCS7* pkcs7);
CYASSL_API int PKCS7_EncodeData(PKCS7* pkcs7, byte* output, word32 outputSz); CYASSL_API int PKCS7_EncodeData(PKCS7* pkcs7, byte* output, word32 outputSz);
CYASSL_API int PKCS7_EncodeSignedData(PKCS7* pkcs7, CYASSL_API int PKCS7_EncodeSignedData(PKCS7* pkcs7,
byte* output, word32 outputSz); byte* output, word32 outputSz);