Enhancement to expose the PKCS 7 pad functionality (wc_PKCS7_PadData).

This commit is contained in:
David Garske
2018-01-23 13:21:56 -08:00
parent e476cb2958
commit 138bc3e6cc
3 changed files with 11 additions and 2 deletions

View File

@@ -3006,8 +3006,8 @@ static int wc_PKCS7_GetPadSize(word32 inputSz, word32 blockSz)
/* pad input data to blockSz chunk, place in outSz. out must be big enough
* for input + pad bytes. See wc_PKCS7_GetPadLength() helper. */
static int wc_PKCS7_PadData(byte* in, word32 inSz, byte* out, word32 outSz,
word32 blockSz)
int wc_PKCS7_PadData(byte* in, word32 inSz, byte* out, word32 outSz,
word32 blockSz)
{
int i, padSz;

View File

@@ -16429,6 +16429,12 @@ static int pkcs7signed_run_vectors(byte* rsaCert, word32 rsaCertSz,
if (out == NULL)
return -7700;
ret = wc_PKCS7_PadData((byte*)data, sizeof(data), out, outSz, 16);
if (ret < 0) {
XFREE(out, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
return -7710;
}
#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, devId);
#else

View File

@@ -146,6 +146,9 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
word32 pkiMsgSz, byte* output,
word32 outputSz);
WOLFSSL_API int wc_PKCS7_PadData(byte* in, word32 inSz, byte* out, word32 outSz,
word32 blockSz);
#ifndef NO_PKCS7_ENCRYPTED_DATA
WOLFSSL_API int wc_PKCS7_EncodeEncryptedData(PKCS7* pkcs7,
byte* output, word32 outputSz);