From ed64bfdf17fb9b00f27a538460be4fd7709441dd Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 25 Nov 2015 16:41:36 +0100 Subject: [PATCH] C++ compat --- .../chacha20/vec/stream_chacha20_vec.c | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c b/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c index 88f435b0..245ce1b4 100644 --- a/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c +++ b/src/libsodium/crypto_stream/chacha20/vec/stream_chacha20_vec.c @@ -115,19 +115,25 @@ typedef struct chacha_ctx chacha_ctx; static void chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint64_t ic) { - ctx->s3[0] = (uint32_t) ic; - ctx->s3[1] = (uint32_t) (ic >> 32); - ctx->s3[2] = ((uint32_t *) iv)[0]; - ctx->s3[3] = ((uint32_t *) iv)[1]; + const vec s3 = { + (uint32_t) ic, + (uint32_t) (ic >> 32), + ((uint32_t *) iv)[0], + ((uint32_t *) iv)[1] + }; + ctx->s3 = s3; } static void chacha_ietf_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint32_t ic) { - ctx->s3[0] = ic; - ctx->s3[1] = ((uint32_t *) iv)[0]; - ctx->s3[2] = ((uint32_t *) iv)[1]; - ctx->s3[3] = ((uint32_t *) iv)[2]; + const vec s3 = { + ic, + ((uint32_t *) iv)[0], + ((uint32_t *) iv)[1], + ((uint32_t *) iv)[2] + }; + ctx->s3 = s3; } static void