Skip to content

Commit 8017c81

Browse files
check on RNG init return with test, and make input const
1 parent 5adad7d commit 8017c81

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

tests/api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51097,11 +51097,11 @@ static int test_wc_PKCS7_signed_enveloped(void)
5109751097

5109851098
{
5109951099
/* arbitrary custom SKID */
51100-
byte customSKID[] = {
51100+
const byte customSKID[] = {
5110151101
0x40, 0x25, 0x77, 0x56
5110251102
};
5110351103

51104-
wc_InitRng(&rng);
51104+
ExpectIntEQ(wc_InitRng(&rng), 0);
5110551105
sigSz = FOURK_BUF * 2;
5110651106
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
5110751107
if (pkcs7 != NULL) {

wolfcrypt/src/pkcs7.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,7 @@ int wc_PKCS7_EncodeSignedData_ex(PKCS7* pkcs7, const byte* hashBuf,
34433443

34443444
/* Sets a custom SKID in PKCS7 struct, used before calling an encode operation
34453445
* Returns 0 on success, negative upon error. */
3446-
int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, byte* in, word16 inSz)
3446+
int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, const byte* in, word16 inSz)
34473447
{
34483448
int ret = 0;
34493449

wolfssl/wolfcrypt/pkcs7.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ WOLFSSL_API int wc_PKCS7_EncodeData(PKCS7* pkcs7, byte* output,
395395
word32 outputSz);
396396

397397
/* CMS/PKCS#7 SignedData */
398-
WOLFSSL_API int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, byte* in, word16 inSz);
398+
WOLFSSL_API int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, const byte* in,
399+
word16 inSz);
399400
WOLFSSL_API int wc_PKCS7_SetDetached(PKCS7* pkcs7, word16 flag);
400401
WOLFSSL_API int wc_PKCS7_NoDefaultSignedAttribs(PKCS7* pkcs7);
401402
WOLFSSL_API int wc_PKCS7_SetDefaultSignedAttribs(PKCS7* pkcs7, word16 flag);

0 commit comments

Comments
 (0)