Merge pull request #7064 from philljj/fix_infer_issues

Fix issues from infer diff report.
This commit is contained in:
Chris Conlon
2023-12-14 12:27:34 -07:00
committed by GitHub
4 changed files with 37 additions and 12 deletions

View File

@ -950,8 +950,18 @@ cleanup:
const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_aead(WOLFSSL* ssl) const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_aead(WOLFSSL* ssl)
{ {
WOLFSSL_CIPHER* cipher = wolfSSL_get_current_cipher(ssl); WOLFSSL_CIPHER* cipher = NULL;
const WOLFSSL_EVP_CIPHER* evp_cipher; const WOLFSSL_EVP_CIPHER* evp_cipher = NULL;
if (ssl == NULL) {
return NULL;
}
cipher = wolfSSL_get_current_cipher(ssl);
if (cipher == NULL) {
return NULL;
}
switch (cipher->cipherSuite) { switch (cipher->cipherSuite) {
#if !defined(NO_AES) && defined(HAVE_AESGCM) #if !defined(NO_AES) && defined(HAVE_AESGCM)
@ -997,8 +1007,18 @@ static int evp_cipher_eq(const WOLFSSL_EVP_CIPHER* c1,
const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_hp(WOLFSSL* ssl) const WOLFSSL_EVP_CIPHER* wolfSSL_quic_get_hp(WOLFSSL* ssl)
{ {
WOLFSSL_CIPHER* cipher = wolfSSL_get_current_cipher(ssl); WOLFSSL_CIPHER* cipher = NULL;
const WOLFSSL_EVP_CIPHER* evp_cipher; const WOLFSSL_EVP_CIPHER* evp_cipher = NULL;
if (ssl == NULL) {
return NULL;
}
cipher = wolfSSL_get_current_cipher(ssl);
if (cipher == NULL) {
return NULL;
}
switch (cipher->cipherSuite) { switch (cipher->cipherSuite) {
#if !defined(NO_AES) && defined(HAVE_AESGCM) #if !defined(NO_AES) && defined(HAVE_AESGCM)

View File

@ -45099,8 +45099,8 @@ static int test_wolfSSL_cert_cb_dyn_ciphers_certCB(WOLFSSL* ssl, void* arg)
haveECC = 0; haveECC = 0;
} }
for (idx = 0; idx < hashSigAlgoSz; idx += 2) { for (idx = 0; idx < hashSigAlgoSz; idx += 2) {
int hashAlgo; int hashAlgo = 0;
int sigAlgo; int sigAlgo = 0;
if (wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1], if (wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1],
&hashAlgo, &sigAlgo) != 0) &hashAlgo, &sigAlgo) != 0)
@ -45317,8 +45317,8 @@ static int test_wolfSSL_sigalg_info(void)
InitSuitesHashSigAlgo_ex2(hashSigAlgo, allSigAlgs, 1, 0xFFFFFFFF, &len); InitSuitesHashSigAlgo_ex2(hashSigAlgo, allSigAlgs, 1, 0xFFFFFFFF, &len);
for (idx = 0; idx < len; idx += 2) { for (idx = 0; idx < len; idx += 2) {
int hashAlgo; int hashAlgo = 0;
int sigAlgo; int sigAlgo = 0;
ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0],
hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0); hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0);
@ -45330,8 +45330,8 @@ static int test_wolfSSL_sigalg_info(void)
InitSuitesHashSigAlgo_ex2(hashSigAlgo, allSigAlgs | SIG_ANON, 1, InitSuitesHashSigAlgo_ex2(hashSigAlgo, allSigAlgs | SIG_ANON, 1,
0xFFFFFFFF, &len); 0xFFFFFFFF, &len);
for (idx = 0; idx < len; idx += 2) { for (idx = 0; idx < len; idx += 2) {
int hashAlgo; int hashAlgo = 0;
int sigAlgo; int sigAlgo = 0;
ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0],
hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0); hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0);

View File

@ -543,10 +543,11 @@ static int ctx_send_alert(WOLFSSL *ssl, WOLFSSL_ENCRYPTION_LEVEL level, uint8_t
{ {
QuicTestContext *ctx = (QuicTestContext*)wolfSSL_get_app_data(ssl); QuicTestContext *ctx = (QuicTestContext*)wolfSSL_get_app_data(ssl);
AssertNotNull(ctx);
if (ctx->verbose) { if (ctx->verbose) {
printf("[%s] send_alert: level=%d, err=%d\n", ctx->name, level, err); printf("[%s] send_alert: level=%d, err=%d\n", ctx->name, level, err);
} }
AssertNotNull(ctx);
ctx->alert_level = level; ctx->alert_level = level;
ctx->alert = alert; ctx->alert = alert;
return 1; return 1;
@ -559,6 +560,8 @@ static int ctx_session_ticket_cb(WOLFSSL* ssl,
{ {
QuicTestContext *ctx = (QuicTestContext*)wolfSSL_get_app_data(ssl); QuicTestContext *ctx = (QuicTestContext*)wolfSSL_get_app_data(ssl);
AssertNotNull(ctx);
(void)cb_ctx; (void)cb_ctx;
if (ticketSz < 0 || (size_t)ticketSz > sizeof(ctx->ticket)) { if (ticketSz < 0 || (size_t)ticketSz > sizeof(ctx->ticket)) {
printf("SESSION TICKET callback: ticket given is too large: %d bytes\n", ticketSz); printf("SESSION TICKET callback: ticket given is too large: %d bytes\n", ticketSz);
@ -1535,6 +1538,8 @@ static int new_session_cb(WOLFSSL *ssl, WOLFSSL_SESSION *session)
int ret = 0; int ret = 0;
int sz; int sz;
AssertNotNull(ctx);
sz = wolfSSL_i2d_SSL_SESSION(session, NULL); sz = wolfSSL_i2d_SSL_SESSION(session, NULL);
if (sz <= 0) { if (sz <= 0) {
printf("[%s] session serialization error: %d <- ", ctx->name, sz); printf("[%s] session serialization error: %d <- ", ctx->name, sz);

View File

@ -2495,7 +2495,7 @@ static int RsaFunctionPrivate(mp_int* tmp, RsaKey* key, WC_RNG* rng)
{ {
int ret = 0; int ret = 0;
#if defined(WC_RSA_BLINDING) && !defined(WC_NO_RNG) #if defined(WC_RSA_BLINDING) && !defined(WC_NO_RNG)
mp_digit mp; mp_digit mp = 0;
DECL_MP_INT_SIZE_DYN(rnd, mp_bitsused(&key->n), RSA_MAX_SIZE); DECL_MP_INT_SIZE_DYN(rnd, mp_bitsused(&key->n), RSA_MAX_SIZE);
DECL_MP_INT_SIZE_DYN(rndi, mp_bitsused(&key->n), RSA_MAX_SIZE); DECL_MP_INT_SIZE_DYN(rndi, mp_bitsused(&key->n), RSA_MAX_SIZE);
#endif /* WC_RSA_BLINDING && !WC_NO_RNG */ #endif /* WC_RSA_BLINDING && !WC_NO_RNG */