Skip to content

Commit 807214d

Browse files
committed
Avoid unneeded temporary stack buffer; remove redundant check
1 parent 58a2784 commit 807214d

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/ocsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
759759
single = single->next;
760760
}
761761

762-
if (single == NULL || single->status == NULL)
762+
if (single == NULL)
763763
return WOLFSSL_FAILURE;
764764

765765
if (status != NULL)

wolfcrypt/src/evp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,19 +4317,17 @@ int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret,
43174317
#ifndef NO_DSA
43184318
case WC_EVP_PKEY_DSA: {
43194319
int bytes;
4320-
unsigned char tmpSig[DSA_MAX_SIG_SIZE];
4321-
ret = wolfSSL_DSA_do_sign(md, tmpSig, pkey->dsa);
4322-
/* wolfSSL_DSA_do_sign() can return WOLFSSL_FATAL_ERROR */
4323-
if (ret != WOLFSSL_SUCCESS)
4324-
return ret;
43254320
bytes = wolfSSL_BN_num_bytes(pkey->dsa->q);
43264321
if (bytes == WC_NO_ERR_TRACE(WOLFSSL_FAILURE) ||
43274322
bytes > DSA_MAX_HALF_SIZE ||
43284323
bytes * 2 > (int)*siglen)
43294324
{
43304325
return WOLFSSL_FAILURE;
43314326
}
4332-
XMEMCPY(sigret, tmpSig, bytes * 2);
4327+
ret = wolfSSL_DSA_do_sign(md, sigret, pkey->dsa);
4328+
/* wolfSSL_DSA_do_sign() can return WOLFSSL_FATAL_ERROR */
4329+
if (ret != WOLFSSL_SUCCESS)
4330+
return ret;
43334331
*siglen = (unsigned int)(bytes * 2);
43344332
return WOLFSSL_SUCCESS;
43354333
}

0 commit comments

Comments
 (0)