From 5cb510a48a03c205fea7d67973033b10ffaf5e9b Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 11 Mar 2024 16:27:07 +0700 Subject: [PATCH] fix for warnings and add guard on WOLFSSL_USER_SETTINGS define --- pkcs7/envelopedData-ktri-stream.c | 8 +++++--- pkcs7/signedData-cryptocb.c | 5 ++++- pkcs7/signedData-p7b.c | 11 +++++++---- pkcs7/signedData-verifyFile.c | 11 +++++++---- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/pkcs7/envelopedData-ktri-stream.c b/pkcs7/envelopedData-ktri-stream.c index d68c7dad..ff1a4719 100644 --- a/pkcs7/envelopedData-ktri-stream.c +++ b/pkcs7/envelopedData-ktri-stream.c @@ -1,6 +1,6 @@ /* envelopedData-ktri-stream.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -19,7 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include #include @@ -195,7 +197,7 @@ int main(int argc, char** argv) { int ret = 0; int encryptedSz = 0, decryptedSz; - word32 certSz, keySz, contentSz; + word32 certSz, keySz, contentSz = 0; byte cert[2048]; byte key[2048]; diff --git a/pkcs7/signedData-cryptocb.c b/pkcs7/signedData-cryptocb.c index 9c28988d..a811cec4 100644 --- a/pkcs7/signedData-cryptocb.c +++ b/pkcs7/signedData-cryptocb.c @@ -18,7 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include + +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include #include diff --git a/pkcs7/signedData-p7b.c b/pkcs7/signedData-p7b.c index b84e8f24..2735046b 100644 --- a/pkcs7/signedData-p7b.c +++ b/pkcs7/signedData-p7b.c @@ -1,6 +1,6 @@ /* signedData-p7b.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -28,7 +28,10 @@ * This is only provided as an example and may need modification if integrated * into a production application. */ -#include + +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include #include @@ -114,8 +117,8 @@ int main(int argc, char** argv) singleCertPemSz = wc_DerToPem(singleCertDer, singleCertDerSz, singleCertPem, singleCertPemSz, CERT_TYPE); - if (singleCertPem < 0) { - printf("Error converting DER to PEM, ret = %d\n", ret); + if (singleCertPemSz < 0) { + printf("Error converting DER to PEM, ret = %d\n", singleCertPemSz); XFREE(singleCertPem, NULL, DYNAMIC_TYPE_TMP_BUFFER); break; } diff --git a/pkcs7/signedData-verifyFile.c b/pkcs7/signedData-verifyFile.c index 38430dbe..5f4c6197 100644 --- a/pkcs7/signedData-verifyFile.c +++ b/pkcs7/signedData-verifyFile.c @@ -1,6 +1,6 @@ /* signedData-verifyFile.c * - * Copyright (C) 2006-2023 wolfSSL Inc. + * Copyright (C) 2006-2024 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -18,7 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include + +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include #include @@ -115,8 +118,8 @@ static int VerifySignedData(byte* bundleBytes, word32 bundleSz, singleCertPemSz = wc_DerToPem(singleCertDer, singleCertDerSz, singleCertPem, singleCertPemSz, CERT_TYPE); - if (singleCertPem < 0) { - printf("Error converting DER to PEM, ret = %d\n", ret); + if (singleCertPemSz < 0) { + printf("Error converting DER to PEM, ret = %d\n", singleCertPemSz); XFREE(singleCertPem, NULL, DYNAMIC_TYPE_TMP_BUFFER); break; }