Aliasing
This commit is contained in:
parent
03973542c7
commit
c84ba1d17a
@ -96,15 +96,22 @@ typedef struct chacha_ctx chacha_ctx;
|
||||
|
||||
static void
|
||||
chacha_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint64_t ic)
|
||||
{
|
||||
uint32_t iv_low;
|
||||
uint32_t iv_high;
|
||||
|
||||
memcpy(&iv_low, iv, 4);
|
||||
memcpy(&iv_high, iv + 4, 4);
|
||||
{
|
||||
const vec s3 = {
|
||||
(uint32_t) ic,
|
||||
(uint32_t) (ic >> 32),
|
||||
((const uint32_t *) (const void *) iv)[0],
|
||||
((const uint32_t *) (const void *) iv)[1]
|
||||
iv_low,
|
||||
iv_high
|
||||
};
|
||||
ctx->s3 = s3;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
chacha_ietf_ivsetup(chacha_ctx *ctx, const uint8_t *iv, uint32_t ic)
|
||||
|
Loading…
Reference in New Issue
Block a user