Skip to content

Commit 5cb510a

Browse files
fix for warnings and add guard on WOLFSSL_USER_SETTINGS define
1 parent 72dd37e commit 5cb510a

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

pkcs7/envelopedData-ktri-stream.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* envelopedData-ktri-stream.c
22
*
3-
* Copyright (C) 2006-2020 wolfSSL Inc.
3+
* Copyright (C) 2006-2024 wolfSSL Inc.
44
*
55
* This file is part of wolfSSL. (formerly known as CyaSSL)
66
*
@@ -19,7 +19,9 @@
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2020
*/
2121

22-
#include <wolfssl/options.h>
22+
#ifndef WOLFSSL_USER_SETTINGS
23+
#include <wolfssl/options.h>
24+
#endif
2325
#include <wolfssl/wolfcrypt/settings.h>
2426
#include <wolfssl/wolfcrypt/pkcs7.h>
2527
#include <wolfssl/wolfcrypt/error-crypt.h>
@@ -195,7 +197,7 @@ int main(int argc, char** argv)
195197
{
196198
int ret = 0;
197199
int encryptedSz = 0, decryptedSz;
198-
word32 certSz, keySz, contentSz;
200+
word32 certSz, keySz, contentSz = 0;
199201

200202
byte cert[2048];
201203
byte key[2048];

pkcs7/signedData-cryptocb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2020
*/
21-
#include <wolfssl/options.h>
21+
22+
#ifndef WOLFSSL_USER_SETTINGS
23+
#include <wolfssl/options.h>
24+
#endif
2225
#include <wolfssl/wolfcrypt/settings.h>
2326
#include <wolfssl/wolfcrypt/pkcs7.h>
2427
#include <wolfssl/wolfcrypt/error-crypt.h>

pkcs7/signedData-p7b.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* signedData-p7b.c
22
*
3-
* Copyright (C) 2006-2020 wolfSSL Inc.
3+
* Copyright (C) 2006-2024 wolfSSL Inc.
44
*
55
* This file is part of wolfSSL. (formerly known as CyaSSL)
66
*
@@ -28,7 +28,10 @@
2828
* This is only provided as an example and may need modification if integrated
2929
* into a production application.
3030
*/
31-
#include <wolfssl/options.h>
31+
32+
#ifndef WOLFSSL_USER_SETTINGS
33+
#include <wolfssl/options.h>
34+
#endif
3235
#include <wolfssl/wolfcrypt/settings.h>
3336
#include <wolfssl/wolfcrypt/logging.h>
3437
#include <wolfssl/wolfcrypt/pkcs7.h>
@@ -114,8 +117,8 @@ int main(int argc, char** argv)
114117
singleCertPemSz = wc_DerToPem(singleCertDer, singleCertDerSz,
115118
singleCertPem, singleCertPemSz,
116119
CERT_TYPE);
117-
if (singleCertPem < 0) {
118-
printf("Error converting DER to PEM, ret = %d\n", ret);
120+
if (singleCertPemSz < 0) {
121+
printf("Error converting DER to PEM, ret = %d\n", singleCertPemSz);
119122
XFREE(singleCertPem, NULL, DYNAMIC_TYPE_TMP_BUFFER);
120123
break;
121124
}

pkcs7/signedData-verifyFile.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* signedData-verifyFile.c
22
*
3-
* Copyright (C) 2006-2023 wolfSSL Inc.
3+
* Copyright (C) 2006-2024 wolfSSL Inc.
44
*
55
* This file is part of wolfSSL. (formerly known as CyaSSL)
66
*
@@ -18,7 +18,10 @@
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2020
*/
21-
#include <wolfssl/options.h>
21+
22+
#ifndef WOLFSSL_USER_SETTINGS
23+
#include <wolfssl/options.h>
24+
#endif
2225
#include <wolfssl/wolfcrypt/settings.h>
2326
#include <wolfssl/wolfcrypt/pkcs7.h>
2427
#include <wolfssl/wolfcrypt/error-crypt.h>
@@ -115,8 +118,8 @@ static int VerifySignedData(byte* bundleBytes, word32 bundleSz,
115118
singleCertPemSz = wc_DerToPem(singleCertDer, singleCertDerSz,
116119
singleCertPem, singleCertPemSz,
117120
CERT_TYPE);
118-
if (singleCertPem < 0) {
119-
printf("Error converting DER to PEM, ret = %d\n", ret);
121+
if (singleCertPemSz < 0) {
122+
printf("Error converting DER to PEM, ret = %d\n", singleCertPemSz);
120123
XFREE(singleCertPem, NULL, DYNAMIC_TYPE_TMP_BUFFER);
121124
break;
122125
}

0 commit comments

Comments
 (0)