Skip to content

Commit d782897

Browse files
pass in multi bio if found
1 parent fad7bc2 commit d782897

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

pkcs7/smime-verify.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static int Verify(byte* smime, int smimeSz, byte* ca, int caSz, byte* contentIn,
3333
{
3434
WOLFSSL_PKCS7* pkcs7Compat = NULL;
3535
WOLFSSL_BIO *in, *content = NULL;
36+
WOLFSSL_BIO *multi = NULL;
3637
WOLFSSL_X509* x509 = NULL;
3738
WOLFSSL_X509_STORE* store = NULL;
3839
int ret = 0;
@@ -43,7 +44,6 @@ static int Verify(byte* smime, int smimeSz, byte* ca, int caSz, byte* contentIn,
4344
}
4445

4546
if (ret == 0) {
46-
WOLFSSL_BIO *multi = NULL;
4747

4848
wolfSSL_BIO_write(in, smime, smimeSz);
4949
pkcs7Compat = (WOLFSSL_PKCS7*)wolfSSL_SMIME_read_PKCS7(in, &multi);
@@ -61,7 +61,6 @@ static int Verify(byte* smime, int smimeSz, byte* ca, int caSz, byte* contentIn,
6161
for (i = 0; i < ptSz; i ++)
6262
printf("%02X", pt[i]);
6363
printf("\n");
64-
wolfSSL_BIO_free(multi);
6564
}
6665
}
6766

@@ -98,7 +97,7 @@ static int Verify(byte* smime, int smimeSz, byte* ca, int caSz, byte* contentIn,
9897

9998
if (ret == 0) {
10099
content = wolfSSL_BIO_new(wolfSSL_BIO_s_mem());
101-
ret = wolfSSL_PKCS7_verify((PKCS7*)pkcs7Compat, NULL, store, NULL,
100+
ret = wolfSSL_PKCS7_verify((PKCS7*)pkcs7Compat, NULL, store, multi,
102101
content, detached);
103102
if (ret == WOLFSSL_SUCCESS) {
104103
ret = 0;
@@ -131,6 +130,7 @@ static int Verify(byte* smime, int smimeSz, byte* ca, int caSz, byte* contentIn,
131130

132131
wolfSSL_BIO_free(in);
133132
wolfSSL_BIO_free(content);
133+
wolfSSL_BIO_free(multi);
134134
wolfSSL_PKCS7_free((PKCS7*)pkcs7Compat);
135135
wolfSSL_X509_free(x509);
136136
wolfSSL_X509_STORE_free(store);
@@ -230,6 +230,10 @@ int main(int argc, char** argv)
230230
return -1;
231231
}
232232

233+
#ifdef DEBUG_WOLFSSL
234+
wolfSSL_Debugging_ON();
235+
#endif
236+
233237
if (wolfSSL_Init() != WOLFSSL_SUCCESS) {
234238
printf("Failure to initialize wolfSSL library\n");
235239
return -1;

0 commit comments

Comments
 (0)