From e7af2d2ba918b62e31b36f30c7249cf8727d2096 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 12 Dec 2019 16:50:37 -0800 Subject: [PATCH] Fixed a couple initialization issues scan-build indicated. --- src/internal.c | 4 ++++ wolfcrypt/src/aes.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/internal.c b/src/internal.c index 6e6c2b590..0f3c126a3 100644 --- a/src/internal.c +++ b/src/internal.c @@ -24457,6 +24457,10 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, ERROR_OUT(MEMORY_E, exit_sske); } + if (args->output == NULL) { + ERROR_OUT(BUFFER_ERROR, exit_sske); + } + XMEMCPY(args->input, args->output + RECORD_HEADER_SZ, args->inputSz); ret = BuildMessage(ssl, args->output, args->sendSz, diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 85a6101ee..dc2a27b1b 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -5670,6 +5670,7 @@ int AES_GCM_encrypt_C(Aes* aes, byte* out, const byte* in, word32 sz, #endif ctr = counter; XMEMSET(initialCounter, 0, AES_BLOCK_SIZE); + XMEMSET(scratch, 0, AES_BLOCK_SIZE); if (ivSz == GCM_NONCE_MID_SZ) { XMEMCPY(initialCounter, iv, ivSz); initialCounter[AES_BLOCK_SIZE - 1] = 1; @@ -6681,6 +6682,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, authTagSz > AES_BLOCK_SIZE) return BAD_FUNC_ARG; + XMEMSET(A, 0, sizeof(A)); XMEMCPY(B+1, nonce, nonceSz); lenSz = AES_BLOCK_SIZE - 1 - (byte)nonceSz; B[0] = (authInSz > 0 ? 64 : 0)