From 91f0d8bfef7d1f0881b53ec67b16333ef3cfe372 Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Tue, 27 Oct 2020 21:10:27 -0500 Subject: [PATCH 1/2] Fix MSVC compile issue in chacha.c. MSVC generates a syntax error when you initialize an array with {}. {0} has the same effect and compiles. --- wolfcrypt/src/chacha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/chacha.c b/wolfcrypt/src/chacha.c index 9ca0c770d..e109c44da 100644 --- a/wolfcrypt/src/chacha.c +++ b/wolfcrypt/src/chacha.c @@ -442,7 +442,7 @@ int wc_Chacha_Process(ChaCha* ctx, byte* output, const byte* input, void wc_Chacha_purge_current_block(ChaCha* ctx) { if (ctx->left > 0) { - byte scratch[CHACHA_CHUNK_BYTES] = {}; + byte scratch[CHACHA_CHUNK_BYTES] = {0}; (void)wc_Chacha_Process(ctx, scratch, scratch, CHACHA_CHUNK_BYTES - ctx->left); } } From 90258b6f3433e0e6742ae85caa5342a01d259b48 Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Tue, 27 Oct 2020 21:10:27 -0500 Subject: [PATCH 2/2] Fix MSVC compile issue in chacha.c. Use XMEMSET instead of initializing with {}. --- wolfcrypt/src/chacha.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/chacha.c b/wolfcrypt/src/chacha.c index e109c44da..32feccf86 100644 --- a/wolfcrypt/src/chacha.c +++ b/wolfcrypt/src/chacha.c @@ -442,7 +442,8 @@ int wc_Chacha_Process(ChaCha* ctx, byte* output, const byte* input, void wc_Chacha_purge_current_block(ChaCha* ctx) { if (ctx->left > 0) { - byte scratch[CHACHA_CHUNK_BYTES] = {0}; + byte scratch[CHACHA_CHUNK_BYTES]; + XMEMSET(scratch, 0, sizeof(scratch)); (void)wc_Chacha_Process(ctx, scratch, scratch, CHACHA_CHUNK_BYTES - ctx->left); } }