fix for warnings and add guard on WOLFSSL_USER_SETTINGS define

pull/425/head
JacobBarthelmeh 2024-03-11 16:27:07 +07:00
parent 72dd37e11c
commit 5cb510a48a
4 changed files with 23 additions and 12 deletions

View File

@ -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 <wolfssl/options.h>
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/pkcs7.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
@ -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];

View File

@ -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 <wolfssl/options.h>
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/pkcs7.h>
#include <wolfssl/wolfcrypt/error-crypt.h>

View File

@ -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 <wolfssl/options.h>
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/logging.h>
#include <wolfssl/wolfcrypt/pkcs7.h>
@ -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;
}

View File

@ -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 <wolfssl/options.h>
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/pkcs7.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
@ -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;
}