Old Compiler Warning Cleanup (GCC 4.0.2)

ecc.c,api.c: Initialize some variables to fix warning for possible
uninitialized variable use.
This commit is contained in:
John Safranek 2022-01-14 17:27:59 -08:00
parent e724622506
commit 2cf21a3f69
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
2 changed files with 20 additions and 20 deletions

View File

@ -18803,7 +18803,7 @@ static int test_wc_RsaPSS_VerifyCheck (void)
int sz = 256; /* 2048/8 */
byte* pt;
byte digest[32];
word32 digestSz;
word32 digestSz = sizeof(digest);
unsigned char pSignature[2048/8]; /* 2048 is RSA_KEY_SIZE */
word32 pSignatureSz = sizeof(pSignature);
unsigned char pDecrypted[2048/8];
@ -18898,7 +18898,7 @@ static int test_wc_RsaPSS_VerifyCheckInline (void)
int sz = 256;
byte* pt;
byte digest[32];
word32 digestSz;
word32 digestSz = sizeof(digest);
unsigned char pSignature[2048/8]; /* 2048 is RSA_KEY_SIZE */
unsigned char pDecrypted[2048/8];
pt = pDecrypted;

View File

@ -11924,12 +11924,12 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx)
{
int ret = 0;
word32 blockSz;
word32 blockSz = 0;
#ifndef WOLFSSL_ECIES_OLD
byte iv[ECC_MAX_IV_SIZE];
word32 pubKeySz;
word32 pubKeySz = 0;
#endif
word32 digestSz;
word32 digestSz = 0;
ecEncCtx localCtx;
#ifdef WOLFSSL_SMALL_STACK
byte* sharedSecret;
@ -11948,13 +11948,13 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
/* 'Uncompressed' byte | public key x | public key y | secret */
word32 sharedSz = 1 + ECC_MAXSIZE * 3;
#endif
int keysLen;
int encKeySz;
int ivSz;
int keysLen = 0;
int encKeySz = 0;
int ivSz = 0;
int offset = 0; /* keys offset if doing msg exchange */
byte* encKey;
byte* encIv;
byte* macKey;
byte* encKey = NULL;
byte* encIv = NULL;
byte* macKey = NULL;
if (privKey == NULL || pubKey == NULL || msg == NULL || out == NULL ||
outSz == NULL)
@ -12191,17 +12191,17 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
word32 msgSz, byte* out, word32* outSz, ecEncCtx* ctx)
{
int ret = 0;
word32 blockSz;
word32 blockSz = 0;
#ifndef WOLFSSL_ECIES_OLD
byte iv[ECC_MAX_IV_SIZE];
word32 pubKeySz;
word32 pubKeySz = 0;
#ifdef WOLFSSL_SMALL_STACK
ecc_key* peerKey = NULL;
#else
ecc_key peerKey[1];
#endif
#endif
word32 digestSz;
word32 digestSz = 0;
ecEncCtx localCtx;
#ifdef WOLFSSL_SMALL_STACK
byte* sharedSecret;
@ -12219,13 +12219,13 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
#else
word32 sharedSz = ECC_MAXSIZE * 3 + 1;
#endif
int keysLen;
int encKeySz;
int ivSz;
int keysLen = 0;
int encKeySz = 0;
int ivSz = 0;
int offset = 0; /* in case using msg exchange */
byte* encKey;
byte* encIv;
byte* macKey;
byte* encKey = NULL;
byte* encIv = NULL;
byte* macKey = NULL;
if (privKey == NULL || msg == NULL || out == NULL || outSz == NULL)