Mercurial > dropbear
comparison libtomcrypt/src/encauth/gcm/gcm_mult_h.c @ 1435:f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 17:50:50 +0800 |
parents | 0cbe8f6dbf9e |
children | 6dba84798cd5 |
comparison
equal
deleted
inserted
replaced
1434:27b9ddb06b09 | 1435:f849a5ca2efc |
---|---|
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.com | 9 * Tom St Denis, [email protected], http://libtom.org |
10 */ | 10 */ |
11 | 11 |
12 /** | 12 /** |
13 @file gcm_mult_h.c | 13 @file gcm_mult_h.c |
14 GCM implementation, do the GF mult, by Tom St Denis | 14 GCM implementation, do the GF mult, by Tom St Denis |
15 */ | 15 */ |
16 #include "tomcrypt.h" | 16 #include "tomcrypt.h" |
17 | 17 |
18 #if defined(GCM_MODE) | 18 #if defined(LTC_GCM_MODE) |
19 /** | 19 /** |
20 GCM multiply by H | 20 GCM multiply by H |
21 @param gcm The GCM state which holds the H value | 21 @param gcm The GCM state which holds the H value |
22 @param I The value to multiply H by | 22 @param I The value to multiply H by |
23 */ | 23 */ |
24 void gcm_mult_h(gcm_state *gcm, unsigned char *I) | 24 void gcm_mult_h(gcm_state *gcm, unsigned char *I) |
25 { | 25 { |
26 unsigned char T[16]; | 26 unsigned char T[16]; |
27 #ifdef GCM_TABLES | 27 #ifdef LTC_GCM_TABLES |
28 int x, y; | 28 int x, y; |
29 #ifdef GCM_TABLES_SSE2 | 29 #ifdef LTC_GCM_TABLES_SSE2 |
30 asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); | 30 asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); |
31 for (x = 1; x < 16; x++) { | 31 for (x = 1; x < 16; x++) { |
32 asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); | 32 asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); |
33 } | 33 } |
34 asm("movdqa %%xmm0,(%0)"::"r"(&T)); | 34 asm("movdqa %%xmm0,(%0)"::"r"(&T)); |
43 for (y = 0; y < 16; y++) { | 43 for (y = 0; y < 16; y++) { |
44 T[y] ^= gcm->PC[x][I[x]][y]; | 44 T[y] ^= gcm->PC[x][I[x]][y]; |
45 } | 45 } |
46 #endif /* LTC_FAST */ | 46 #endif /* LTC_FAST */ |
47 } | 47 } |
48 #endif /* GCM_TABLES_SSE2 */ | 48 #endif /* LTC_GCM_TABLES_SSE2 */ |
49 #else | 49 #else |
50 gcm_gf_mult(gcm->H, I, T); | 50 gcm_gf_mult(gcm->H, I, T); |
51 #endif | 51 #endif |
52 XMEMCPY(I, T, 16); | 52 XMEMCPY(I, T, 16); |
53 } | 53 } |
54 #endif | 54 #endif |
55 | 55 |
56 /* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_mult_h.c,v $ */ | 56 /* $Source$ */ |
57 /* $Revision: 1.4 $ */ | 57 /* $Revision$ */ |
58 /* $Date: 2006/08/23 20:40:23 $ */ | 58 /* $Date$ */ |