fix check on ret value and add test case

This commit is contained in:
Jacob Barthelmeh
2019-06-03 10:28:10 +07:00
parent f79a119c82
commit d33a95352a
2 changed files with 2 additions and 2 deletions

View File

@ -17467,8 +17467,8 @@ static void test_PKCS7_signed_enveloped(void)
pkcs7->rng = &rng;
AssertIntEQ(wc_PKCS7_SetSignerIdentifierType(pkcs7, DEGENERATE_SID), 0);
AssertIntGT((sigSz = wc_PKCS7_EncodeSignedData(pkcs7, sig, sigSz)), 0);
wc_FreeRng(&rng);
wc_PKCS7_Free(pkcs7);
wc_FreeRng(&rng);
/* check verify */
AssertNotNull(pkcs7 = wc_PKCS7_New(NULL, 0));

View File

@ -2131,7 +2131,6 @@ static int PKCS7_EncodeSigned(PKCS7* pkcs7, ESD* esd,
}
esd->digAlgoIdSetSz = SetSet(esd->singleDigAlgoIdSz, esd->digAlgoIdSet);
if (pkcs7->version == 3) {
/* RFC 4108 version MUST be 3 for firmware package signer */
esd->versionSz = SetMyVersion(3, esd->version, 0);
@ -3704,6 +3703,7 @@ static int wc_PKCS7_ParseSignerInfo(PKCS7* pkcs7, byte* in, int inSz,
WOLFSSL_MSG("Failed to set public key OID from signature");
}
else {
/* if previous return was positive then was success */
ret = 0;
}
}