Mercurial > dropbear
comparison libtomcrypt/src/headers/tomcrypt_mac.h @ 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 |
---|---|
49 int omac_file(int cipher, | 49 int omac_file(int cipher, |
50 const unsigned char *key, unsigned long keylen, | 50 const unsigned char *key, unsigned long keylen, |
51 const char *filename, | 51 const char *filename, |
52 unsigned char *out, unsigned long *outlen); | 52 unsigned char *out, unsigned long *outlen); |
53 int omac_test(void); | 53 int omac_test(void); |
54 #endif /* OMAC */ | 54 #endif /* LTC_OMAC */ |
55 | 55 |
56 #ifdef LTC_PMAC | 56 #ifdef LTC_PMAC |
57 | 57 |
58 typedef struct { | 58 typedef struct { |
59 unsigned char Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ | 59 unsigned char Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ |
94 int pmac_ntz(unsigned long x); | 94 int pmac_ntz(unsigned long x); |
95 void pmac_shift_xor(pmac_state *pmac); | 95 void pmac_shift_xor(pmac_state *pmac); |
96 | 96 |
97 #endif /* PMAC */ | 97 #endif /* PMAC */ |
98 | 98 |
99 #ifdef EAX_MODE | 99 #ifdef LTC_EAX_MODE |
100 | 100 |
101 #if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE)) | 101 #if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE)) |
102 #error EAX_MODE requires OMAC and CTR | 102 #error LTC_EAX_MODE requires LTC_OMAC and CTR |
103 #endif | 103 #endif |
104 | 104 |
105 typedef struct { | 105 typedef struct { |
106 unsigned char N[MAXBLOCKSIZE]; | 106 unsigned char N[MAXBLOCKSIZE]; |
107 symmetric_CTR ctr; | 107 symmetric_CTR ctr; |
135 int *stat); | 135 int *stat); |
136 | 136 |
137 int eax_test(void); | 137 int eax_test(void); |
138 #endif /* EAX MODE */ | 138 #endif /* EAX MODE */ |
139 | 139 |
140 #ifdef OCB_MODE | 140 #ifdef LTC_OCB_MODE |
141 typedef struct { | 141 typedef struct { |
142 unsigned char L[MAXBLOCKSIZE], /* L value */ | 142 unsigned char L[MAXBLOCKSIZE], /* L value */ |
143 Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ | 143 Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ |
144 Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */ | 144 Li[MAXBLOCKSIZE], /* value of Li [current value, we calc from previous recall] */ |
145 Lr[MAXBLOCKSIZE], /* L * x^-1 */ | 145 Lr[MAXBLOCKSIZE], /* L * x^-1 */ |
189 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z); | 189 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z); |
190 int ocb_ntz(unsigned long x); | 190 int ocb_ntz(unsigned long x); |
191 int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen, | 191 int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen, |
192 unsigned char *ct, unsigned char *tag, unsigned long *taglen, int mode); | 192 unsigned char *ct, unsigned char *tag, unsigned long *taglen, int mode); |
193 | 193 |
194 #endif /* OCB_MODE */ | 194 #endif /* LTC_OCB_MODE */ |
195 | 195 |
196 #ifdef CCM_MODE | 196 #ifdef LTC_CCM_MODE |
197 | 197 |
198 #define CCM_ENCRYPT 0 | 198 #define CCM_ENCRYPT 0 |
199 #define CCM_DECRYPT 1 | 199 #define CCM_DECRYPT 1 |
200 | 200 |
201 int ccm_memory(int cipher, | 201 int ccm_memory(int cipher, |
208 unsigned char *tag, unsigned long *taglen, | 208 unsigned char *tag, unsigned long *taglen, |
209 int direction); | 209 int direction); |
210 | 210 |
211 int ccm_test(void); | 211 int ccm_test(void); |
212 | 212 |
213 #endif /* CCM_MODE */ | 213 #endif /* LTC_CCM_MODE */ |
214 | 214 |
215 #if defined(LRW_MODE) || defined(GCM_MODE) | 215 #if defined(LRW_MODE) || defined(LTC_GCM_MODE) |
216 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c); | 216 void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c); |
217 #endif | 217 #endif |
218 | 218 |
219 | 219 |
220 /* table shared between GCM and LRW */ | 220 /* table shared between GCM and LRW */ |
221 #if defined(GCM_TABLES) || defined(LRW_TABLES) || ((defined(GCM_MODE) || defined(GCM_MODE)) && defined(LTC_FAST)) | 221 #if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) |
222 extern const unsigned char gcm_shift_table[]; | 222 extern const unsigned char gcm_shift_table[]; |
223 #endif | 223 #endif |
224 | 224 |
225 #ifdef GCM_MODE | 225 #ifdef LTC_GCM_MODE |
226 | 226 |
227 #define GCM_ENCRYPT 0 | 227 #define GCM_ENCRYPT 0 |
228 #define GCM_DECRYPT 1 | 228 #define GCM_DECRYPT 1 |
229 | 229 |
230 #define GCM_MODE_IV 0 | 230 #define LTC_GCM_MODE_IV 0 |
231 #define GCM_MODE_AAD 1 | 231 #define LTC_GCM_MODE_AAD 1 |
232 #define GCM_MODE_TEXT 2 | 232 #define LTC_GCM_MODE_TEXT 2 |
233 | 233 |
234 typedef struct { | 234 typedef struct { |
235 symmetric_key K; | 235 symmetric_key K; |
236 unsigned char H[16], /* multiplier */ | 236 unsigned char H[16], /* multiplier */ |
237 X[16], /* accumulator */ | 237 X[16], /* accumulator */ |
245 buflen; /* length of data in buf */ | 245 buflen; /* length of data in buf */ |
246 | 246 |
247 ulong64 totlen, /* 64-bit counter used for IV and AAD */ | 247 ulong64 totlen, /* 64-bit counter used for IV and AAD */ |
248 pttotlen; /* 64-bit counter for the PT */ | 248 pttotlen; /* 64-bit counter for the PT */ |
249 | 249 |
250 #ifdef GCM_TABLES | 250 #ifdef LTC_GCM_TABLES |
251 unsigned char PC[16][256][16] /* 16 tables of 8x128 */ | 251 unsigned char PC[16][256][16] /* 16 tables of 8x128 */ |
252 #ifdef GCM_TABLES_SSE2 | 252 #ifdef LTC_GCM_TABLES_SSE2 |
253 __attribute__ ((aligned (16))) | 253 __attribute__ ((aligned (16))) |
254 #endif | 254 #endif |
255 ; | 255 ; |
256 #endif | 256 #endif |
257 } gcm_state; | 257 } gcm_state; |
285 unsigned char *ct, | 285 unsigned char *ct, |
286 unsigned char *tag, unsigned long *taglen, | 286 unsigned char *tag, unsigned long *taglen, |
287 int direction); | 287 int direction); |
288 int gcm_test(void); | 288 int gcm_test(void); |
289 | 289 |
290 #endif /* GCM_MODE */ | 290 #endif /* LTC_GCM_MODE */ |
291 | 291 |
292 #ifdef PELICAN | 292 #ifdef LTC_PELICAN |
293 | 293 |
294 typedef struct pelican_state | 294 typedef struct pelican_state |
295 { | 295 { |
296 symmetric_key K; | 296 symmetric_key K; |
297 unsigned char state[16]; | 297 unsigned char state[16]; |
308 unsigned char *out); | 308 unsigned char *out); |
309 | 309 |
310 #endif | 310 #endif |
311 | 311 |
312 #ifdef LTC_XCBC | 312 #ifdef LTC_XCBC |
313 | |
314 /* add this to "keylen" to xcbc_init to use a pure three-key XCBC MAC */ | |
315 #define LTC_XCBC_PURE 0x8000UL | |
313 | 316 |
314 typedef struct { | 317 typedef struct { |
315 unsigned char K[3][MAXBLOCKSIZE], | 318 unsigned char K[3][MAXBLOCKSIZE], |
316 IV[MAXBLOCKSIZE]; | 319 IV[MAXBLOCKSIZE]; |
317 | 320 |
374 int f9_test(void); | 377 int f9_test(void); |
375 | 378 |
376 #endif | 379 #endif |
377 | 380 |
378 | 381 |
379 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_mac.h,v $ */ | 382 /* $Source$ */ |
380 /* $Revision: 1.20 $ */ | 383 /* $Revision$ */ |
381 /* $Date: 2006/11/08 21:57:04 $ */ | 384 /* $Date$ */ |