This commit is contained in:
Frank Denis 2015-12-17 08:36:49 +01:00
parent 03973542c7
commit c84ba1d17a

View File

@ -97,13 +97,20 @@ typedef struct chacha_ctx chacha_ctx;
static void static void
chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint64_t ic) chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint64_t ic)
{ {
const vec s3 = { uint32_t iv_low;
(uint32_t) ic, uint32_t iv_high;
(uint32_t) (ic >> 32),
((const uint32_t *) (const void *) iv)[0], memcpy(&iv_low, iv, 4);
((const uint32_t *) (const void *) iv)[1] memcpy(&iv_high, iv + 4, 4);
}; {
ctx->s3 = s3; const vec s3 = {
(uint32_t) ic,
(uint32_t) (ic >> 32),
iv_low,
iv_high
};
ctx->s3 = s3;
}
} }
static void static void