diff options
author | Ben Laurie <ben@openssl.org> | 2012-11-05 14:23:55 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2012-11-05 14:23:55 +0000 |
commit | da01515c404fcfc389d437fc07ac6734e9aea20d (patch) | |
tree | a55ba0b2c205012b005638a21fb9be852b528ca1 /crypto/modes | |
parent | 7c43ea50fdecdbb743a6b2c24898ef038d3a3bc9 (diff) |
More strict aliasing fix.
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/gcm128.c | 7 | ||||
-rw-r--r-- | crypto/modes/modes_lcl.h | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/crypto/modes/gcm128.c b/crypto/modes/gcm128.c index db576aab2f..8f5ce98858 100644 --- a/crypto/modes/gcm128.c +++ b/crypto/modes/gcm128.c @@ -962,15 +962,16 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, size_t j=GHASH_CHUNK; while (j) { + size_t *out_t=(size_t *)out, *ivec_t=(size_t *)ivec; + const size_t *in_t=(const size_t *)in; (*block)(ctx->Yi.c,ctx->EKi.c,key); ++ctr; if (is_endian.little) PUTU32(ctx->Yi.c+12,ctr); else ctx->Yi.d[3] = ctr; - for (i=0; i<16; i+=sizeof(size_t)) - *(size_t *)(out+i) = - *(size_t *)(in+i)^*(size_t *)(ctx->EKi.c+i); + for (i=0; i<16/sizeof(size_t); ++i) + out_t[i] = in_t[i] ^ ctx->EKi.t[i]; out += 16; in += 16; j -= 16; diff --git a/crypto/modes/modes_lcl.h b/crypto/modes/modes_lcl.h index b6dc3c336f..40a6d5a642 100644 --- a/crypto/modes/modes_lcl.h +++ b/crypto/modes/modes_lcl.h @@ -101,8 +101,8 @@ typedef struct { u64 hi,lo; } u128; struct gcm128_context { /* Following 6 names follow names in GCM specification */ - union { u64 u[2]; u32 d[4]; u8 c[16]; } Yi,EKi,EK0,len, - Xi,H; + union { u64 u[2]; u32 d[4]; u8 c[16]; size_t t[16/sizeof(size_t)]; } + Yi,EKi,EK0,len,Xi,H; /* Relative position of Xi, H and pre-computed Htable is used * in some assembler modules, i.e. don't change the order! */ #if TABLE_BITS==8 |