Skip to content

Commit

Permalink
check on RNG init return with test, and make input const
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Sep 20, 2024
1 parent 5adad7d commit 8017c81
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -51097,11 +51097,11 @@ static int test_wc_PKCS7_signed_enveloped(void)

{
/* arbitrary custom SKID */
byte customSKID[] = {
const byte customSKID[] = {
0x40, 0x25, 0x77, 0x56
};

wc_InitRng(&rng);
ExpectIntEQ(wc_InitRng(&rng), 0);
sigSz = FOURK_BUF * 2;
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
if (pkcs7 != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@ int wc_PKCS7_EncodeSignedData_ex(PKCS7* pkcs7, const byte* hashBuf,

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

Expand Down
3 changes: 2 additions & 1 deletion wolfssl/wolfcrypt/pkcs7.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ WOLFSSL_API int wc_PKCS7_EncodeData(PKCS7* pkcs7, byte* output,
word32 outputSz);

/* CMS/PKCS#7 SignedData */
WOLFSSL_API int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, byte* in, word16 inSz);
WOLFSSL_API int wc_PKCS7_SetCustomSKID(PKCS7* pkcs7, const byte* in,
word16 inSz);
WOLFSSL_API int wc_PKCS7_SetDetached(PKCS7* pkcs7, word16 flag);
WOLFSSL_API int wc_PKCS7_NoDefaultSignedAttribs(PKCS7* pkcs7);
WOLFSSL_API int wc_PKCS7_SetDefaultSignedAttribs(PKCS7* pkcs7, word16 flag);
Expand Down

0 comments on commit 8017c81

Please sign in to comment.