2 typedef struct Hmac_state {
9 int hmac_init(hmac_state *hmac,
int hash,
const unsigned char *key,
unsigned long keylen);
10 int hmac_process(hmac_state *hmac,
const unsigned char *in,
unsigned long inlen);
11 int hmac_done(hmac_state *hmac,
unsigned char *out,
unsigned long *outlen);
13 int hmac_memory(
int hash,
14 const unsigned char *key,
unsigned long keylen,
15 const unsigned char *in,
unsigned long inlen,
16 unsigned char *out,
unsigned long *outlen);
17 int hmac_memory_multi(
int hash,
18 const unsigned char *key,
unsigned long keylen,
19 unsigned char *out,
unsigned long *outlen,
20 const unsigned char *in,
unsigned long inlen, ...);
21 int hmac_file(
int hash,
const char *fname,
const unsigned char *key,
23 unsigned char *dst,
unsigned long *dstlen);
38 int omac_init(omac_state *omac,
int cipher,
const unsigned char *key,
unsigned long keylen);
39 int omac_process(omac_state *omac,
const unsigned char *in,
unsigned long inlen);
40 int omac_done(omac_state *omac,
unsigned char *out,
unsigned long *outlen);
41 int omac_memory(
int cipher,
42 const unsigned char *key,
unsigned long keylen,
43 const unsigned char *in,
unsigned long inlen,
44 unsigned char *out,
unsigned long *outlen);
45 int omac_memory_multi(
int cipher,
46 const unsigned char *key,
unsigned long keylen,
47 unsigned char *out,
unsigned long *outlen,
48 const unsigned char *in,
unsigned long inlen, ...);
49 int omac_file(
int cipher,
50 const unsigned char *key,
unsigned long keylen,
52 unsigned char *out,
unsigned long *outlen);
66 unsigned long block_index;
72 int pmac_init(pmac_state *pmac,
int cipher,
const unsigned char *key,
unsigned long keylen);
73 int pmac_process(pmac_state *pmac,
const unsigned char *in,
unsigned long inlen);
74 int pmac_done(pmac_state *pmac,
unsigned char *out,
unsigned long *outlen);
76 int pmac_memory(
int cipher,
77 const unsigned char *key,
unsigned long keylen,
78 const unsigned char *msg,
unsigned long msglen,
79 unsigned char *out,
unsigned long *outlen);
81 int pmac_memory_multi(
int cipher,
82 const unsigned char *key,
unsigned long keylen,
83 unsigned char *out,
unsigned long *outlen,
84 const unsigned char *in,
unsigned long inlen, ...);
86 int pmac_file(
int cipher,
87 const unsigned char *key,
unsigned long keylen,
89 unsigned char *out,
unsigned long *outlen);
94 int pmac_ntz(
unsigned long x);
95 void pmac_shift_xor(pmac_state *pmac);
101 #if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE))
102 #error LTC_EAX_MODE requires LTC_OMAC and CTR
108 omac_state headeromac, ctomac;
111 int eax_init(eax_state *eax,
int cipher,
const unsigned char *key,
unsigned long keylen,
112 const unsigned char *nonce,
unsigned long noncelen,
113 const unsigned char *header,
unsigned long headerlen);
115 int eax_encrypt(eax_state *eax,
const unsigned char *pt,
unsigned char *ct,
unsigned long length);
116 int eax_decrypt(eax_state *eax,
const unsigned char *ct,
unsigned char *pt,
unsigned long length);
117 int eax_addheader(eax_state *eax,
const unsigned char *header,
unsigned long length);
118 int eax_done(eax_state *eax,
unsigned char *tag,
unsigned long *taglen);
120 int eax_encrypt_authenticate_memory(
int cipher,
121 const unsigned char *key,
unsigned long keylen,
122 const unsigned char *nonce,
unsigned long noncelen,
123 const unsigned char *header,
unsigned long headerlen,
124 const unsigned char *pt,
unsigned long ptlen,
126 unsigned char *tag,
unsigned long *taglen);
128 int eax_decrypt_verify_memory(
int cipher,
129 const unsigned char *key,
unsigned long keylen,
130 const unsigned char *nonce,
unsigned long noncelen,
131 const unsigned char *header,
unsigned long headerlen,
132 const unsigned char *ct,
unsigned long ctlen,
134 unsigned char *tag,
unsigned long taglen,
150 unsigned long block_index;
155 int ocb_init(ocb_state *ocb,
int cipher,
156 const unsigned char *key,
unsigned long keylen,
const unsigned char *nonce);
158 int ocb_encrypt(ocb_state *ocb,
const unsigned char *pt,
unsigned char *ct);
159 int ocb_decrypt(ocb_state *ocb,
const unsigned char *ct,
unsigned char *pt);
161 int ocb_done_encrypt(ocb_state *ocb,
162 const unsigned char *pt,
unsigned long ptlen,
164 unsigned char *tag,
unsigned long *taglen);
166 int ocb_done_decrypt(ocb_state *ocb,
167 const unsigned char *ct,
unsigned long ctlen,
169 const unsigned char *tag,
unsigned long taglen,
int *stat);
171 int ocb_encrypt_authenticate_memory(
int cipher,
172 const unsigned char *key,
unsigned long keylen,
173 const unsigned char *nonce,
174 const unsigned char *pt,
unsigned long ptlen,
176 unsigned char *tag,
unsigned long *taglen);
178 int ocb_decrypt_verify_memory(
int cipher,
179 const unsigned char *key,
unsigned long keylen,
180 const unsigned char *nonce,
181 const unsigned char *ct,
unsigned long ctlen,
183 const unsigned char *tag,
unsigned long taglen,
189 void ocb_shift_xor(ocb_state *ocb,
unsigned char *
Z);
190 int ocb_ntz(
unsigned long x);
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);
198 #define CCM_ENCRYPT 0
199 #define CCM_DECRYPT 1
201 int ccm_memory(
int cipher,
202 const unsigned char *key,
unsigned long keylen,
204 const unsigned char *nonce,
unsigned long noncelen,
205 const unsigned char *header,
unsigned long headerlen,
206 unsigned char *pt,
unsigned long ptlen,
208 unsigned char *tag,
unsigned long *taglen,
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);
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[];
227 #define GCM_ENCRYPT 0
228 #define GCM_DECRYPT 1
230 #define LTC_GCM_MODE_IV 0
231 #define LTC_GCM_MODE_AAD 1
232 #define LTC_GCM_MODE_TEXT 2
250 #ifdef LTC_GCM_TABLES
251 unsigned char PC[16][256][16]
252 #ifdef LTC_GCM_TABLES_SSE2
259 void gcm_mult_h(gcm_state *gcm,
unsigned char *
I);
261 int gcm_init(gcm_state *gcm,
int cipher,
262 const unsigned char *key,
int keylen);
264 int gcm_reset(gcm_state *gcm);
266 int gcm_add_iv(gcm_state *gcm,
267 const unsigned char *IV,
unsigned long IVlen);
269 int gcm_add_aad(gcm_state *gcm,
270 const unsigned char *adata,
unsigned long adatalen);
272 int gcm_process(gcm_state *gcm,
273 unsigned char *pt,
unsigned long ptlen,
277 int gcm_done(gcm_state *gcm,
278 unsigned char *tag,
unsigned long *taglen);
280 int gcm_memory(
int cipher,
281 const unsigned char *key,
unsigned long keylen,
282 const unsigned char *IV,
unsigned long IVlen,
283 const unsigned char *adata,
unsigned long adatalen,
284 unsigned char *pt,
unsigned long ptlen,
286 unsigned char *tag,
unsigned long *taglen,
294 typedef struct pelican_state
297 unsigned char state[16];
301 int pelican_init(pelican_state *pelmac,
const unsigned char *key,
unsigned long keylen);
302 int pelican_process(pelican_state *pelmac,
const unsigned char *in,
unsigned long inlen);
303 int pelican_done(pelican_state *pelmac,
unsigned char *out);
304 int pelican_test(
void);
306 int pelican_memory(
const unsigned char *key,
unsigned long keylen,
307 const unsigned char *in,
unsigned long inlen,
315 #define LTC_XCBC_PURE 0x8000UL
328 int xcbc_init(xcbc_state *xcbc,
int cipher,
const unsigned char *key,
unsigned long keylen);
329 int xcbc_process(xcbc_state *xcbc,
const unsigned char *in,
unsigned long inlen);
330 int xcbc_done(xcbc_state *xcbc,
unsigned char *out,
unsigned long *outlen);
331 int xcbc_memory(
int cipher,
332 const unsigned char *key,
unsigned long keylen,
333 const unsigned char *in,
unsigned long inlen,
334 unsigned char *out,
unsigned long *outlen);
335 int xcbc_memory_multi(
int cipher,
336 const unsigned char *key,
unsigned long keylen,
337 unsigned char *out,
unsigned long *outlen,
338 const unsigned char *in,
unsigned long inlen, ...);
339 int xcbc_file(
int cipher,
340 const unsigned char *key,
unsigned long keylen,
341 const char *filename,
342 unsigned char *out,
unsigned long *outlen);
362 int f9_init(f9_state *f9,
int cipher,
const unsigned char *key,
unsigned long keylen);
363 int f9_process(f9_state *f9,
const unsigned char *in,
unsigned long inlen);
364 int f9_done(f9_state *f9,
unsigned char *out,
unsigned long *outlen);
365 int f9_memory(
int cipher,
366 const unsigned char *key,
unsigned long keylen,
367 const unsigned char *in,
unsigned long inlen,
368 unsigned char *out,
unsigned long *outlen);
369 int f9_memory_multi(
int cipher,
370 const unsigned char *key,
unsigned long keylen,
371 unsigned char *out,
unsigned long *outlen,
372 const unsigned char *in,
unsigned long inlen, ...);
373 int f9_file(
int cipher,
374 const unsigned char *key,
unsigned long keylen,
375 const char *filename,
376 unsigned char *out,
unsigned long *outlen);
#define Z
Definition: CollisionDetection.cpp:2283
#define hash
Definition: private_namespace.h:186
#define MAXBLOCKSIZE
Definition: tomcrypt.h:23
#define X
Definition: CollisionDetection.cpp:2281
LinuxKernelCmpxchgFunc pLinuxKernelCmpxchg __attribute__((weak))
unsigned long long ulong64
Definition: tomcrypt_macros.h:7
Definition: tomcrypt_hash.h:105
float length(float v)
Definition: vectorMath.h:208
int prev(int i, int n)
Definition: RecastContour.cpp:468
Definition: tomcrypt_cipher.h:141
G3D::int16 x
Definition: Vector2int16.h:37
#define Y
Definition: CollisionDetection.cpp:2282