mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
Merge pull request #1284 from cconlon/fixes
scan-build, valgrind, and test.c fixes
This commit is contained in:
@@ -6022,6 +6022,9 @@ static void AddHandShakeHeader(byte* output, word32 length,
|
||||
|
||||
/* handshake header */
|
||||
hs = (HandShakeHeader*)output;
|
||||
if (hs == NULL)
|
||||
return;
|
||||
|
||||
hs->type = type;
|
||||
c32to24(length, hs->length); /* type and length same for each */
|
||||
#ifdef WOLFSSL_DTLS
|
||||
@@ -14098,6 +14101,8 @@ int SendAlert(WOLFSSL* ssl, int severity, int type)
|
||||
/* get output buffer */
|
||||
output = ssl->buffers.outputBuffer.buffer +
|
||||
ssl->buffers.outputBuffer.length;
|
||||
if (output == NULL)
|
||||
return BUFFER_E;
|
||||
|
||||
input[0] = (byte)severity;
|
||||
input[1] = (byte)type;
|
||||
|
@@ -2012,6 +2012,9 @@ void bench_aesccm(void)
|
||||
DECLARE_VAR(bench_additional, byte, AES_AUTH_ADD_SZ, HEAP_HINT);
|
||||
DECLARE_VAR(bench_tag, byte, AES_AUTH_TAG_SZ, HEAP_HINT);
|
||||
|
||||
XMEMSET(bench_tag, 0, AES_AUTH_TAG_SZ);
|
||||
XMEMSET(bench_additional, 0, AES_AUTH_ADD_SZ);
|
||||
|
||||
if ((ret = wc_AesCcmSetKey(&enc, bench_key, 16)) != 0) {
|
||||
printf("wc_AesCcmSetKey failed, ret = %d\n", ret);
|
||||
return;
|
||||
|
@@ -58,6 +58,12 @@
|
||||
if (sha == NULL || (data == NULL && len > 0)) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (data == NULL && len == 0) {
|
||||
/* valid, but do nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Sha256Update_fips(sha, data, len);
|
||||
}
|
||||
int wc_Sha256Final(wc_Sha256* sha, byte* out)
|
||||
@@ -433,6 +439,11 @@ static int InitSha256(wc_Sha256* sha256)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (data == NULL && len == 0) {
|
||||
/* valid arguments, but do nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do block size increments */
|
||||
local = (byte*)sha256->buffer;
|
||||
|
||||
@@ -671,6 +682,11 @@ static INLINE void AddLength(wc_Sha256* sha256, word32 len)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (data == NULL && len == 0) {
|
||||
/* valid, but do nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_SHA256)
|
||||
if (sha256->asyncDev.marker == WOLFSSL_ASYNC_MARKER_SHA256) {
|
||||
#if defined(HAVE_INTEL_QA)
|
||||
|
@@ -2915,9 +2915,9 @@ int fp_isprime_ex(fp_int *a, int t)
|
||||
|
||||
/* do trial division */
|
||||
for (r = 0; r < FP_PRIME_SIZE; r++) {
|
||||
fp_mod_d(a, primes[r], &d);
|
||||
if (d == 0) {
|
||||
return FP_NO;
|
||||
res = fp_mod_d(a, primes[r], &d);
|
||||
if (res != MP_OKAY || d == 0) {
|
||||
return FP_NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -446,9 +446,9 @@ int wolfcrypt_test(void* args)
|
||||
|
||||
#ifndef NO_ASN
|
||||
if ( (ret = asn_test()) != 0)
|
||||
return err_sys("base64 test failed!\n", ret);
|
||||
return err_sys("asn test failed!\n", ret);
|
||||
else
|
||||
printf( "base64 test passed!\n");
|
||||
printf( "asn test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_MD5
|
||||
|
Reference in New Issue
Block a user