Mercurial > dropbear
comparison libtomcrypt/src/encauth/gcm/gcm_memory.c @ 1439:8d24733026c5 coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 23:33:16 +0800 |
parents | f849a5ca2efc |
children | 6dba84798cd5 |
comparison
equal
deleted
inserted
replaced
1400:238a439670f5 | 1439:8d24733026c5 |
---|---|
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_memory.c | 13 @file gcm_memory.c |
14 GCM implementation, process a packet, by Tom St Denis | 14 GCM implementation, process a packet, by Tom St Denis |
15 */ | 15 */ |
16 #include "tomcrypt.h" | 16 #include "tomcrypt.h" |
17 | 17 |
18 #ifdef GCM_MODE | 18 #ifdef LTC_GCM_MODE |
19 | 19 |
20 /** | 20 /** |
21 Process an entire GCM packet in one call. | 21 Process an entire GCM packet in one call. |
22 @param cipher Index of cipher to use | 22 @param cipher Index of cipher to use |
23 @param key The secret key | 23 @param key The secret key |
63 direction); | 63 direction); |
64 } | 64 } |
65 | 65 |
66 | 66 |
67 | 67 |
68 #ifndef GCM_TABLES_SSE2 | 68 #ifndef LTC_GCM_TABLES_SSE2 |
69 orig = gcm = XMALLOC(sizeof(*gcm)); | 69 orig = gcm = XMALLOC(sizeof(*gcm)); |
70 #else | 70 #else |
71 orig = gcm = XMALLOC(sizeof(*gcm) + 16); | 71 orig = gcm = XMALLOC(sizeof(*gcm) + 16); |
72 #endif | 72 #endif |
73 if (gcm == NULL) { | 73 if (gcm == NULL) { |
76 | 76 |
77 /* Force GCM to be on a multiple of 16 so we can use 128-bit aligned operations | 77 /* Force GCM to be on a multiple of 16 so we can use 128-bit aligned operations |
78 * note that we only modify gcm and keep orig intact. This code is not portable | 78 * note that we only modify gcm and keep orig intact. This code is not portable |
79 * but again it's only for SSE2 anyways, so who cares? | 79 * but again it's only for SSE2 anyways, so who cares? |
80 */ | 80 */ |
81 #ifdef GCM_TABLES_SSE2 | 81 #ifdef LTC_GCM_TABLES_SSE2 |
82 if ((unsigned long)gcm & 15) { | 82 if ((unsigned long)gcm & 15) { |
83 gcm = (gcm_state *)((unsigned long)gcm + (16 - ((unsigned long)gcm & 15))); | 83 gcm = (gcm_state *)((unsigned long)gcm + (16 - ((unsigned long)gcm & 15))); |
84 } | 84 } |
85 #endif | 85 #endif |
86 | 86 |
102 return err; | 102 return err; |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 | 106 |
107 /* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_memory.c,v $ */ | 107 /* $Source$ */ |
108 /* $Revision: 1.23 $ */ | 108 /* $Revision$ */ |
109 /* $Date: 2006/09/07 10:00:57 $ */ | 109 /* $Date$ */ |