ReactOS 0.4.15-dev-5667-ged97270
tomcrypt.h
Go to the documentation of this file.
1/*
2 * dlls/rsaenh/tomcrypt.h
3 * Function prototypes, type definitions and constant definitions
4 * for LibTomCrypt code.
5 *
6 * Copyright 2004 Michael Jung
7 * Based on public domain code by Tom St Denis (tomstdenis@iahu.ca)
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24/*
25 * This file contains code from the LibTomCrypt cryptographic
26 * library written by Tom St Denis (tomstdenis@iahu.ca). LibTomCrypt
27 * is in the public domain. The code in this file is tailored to
28 * special requirements. Take a look at http://libtomcrypt.org for the
29 * original version.
30 */
31
32#ifndef __WINE_TOMCRYPT_H_
33#define __WINE_TOMCRYPT_H_
34
35#include <stdio.h>
36#include <string.h>
37#include <stdlib.h>
38//#include <limits.h>
39#include <basetsd.h>
40
41/* error codes [will be expanded in future releases] */
42enum {
43 CRYPT_OK=0, /* Result OK */
44 CRYPT_ERROR, /* Generic Error */
45 CRYPT_NOP, /* Not a failure but no operation was performed */
46
47 CRYPT_INVALID_KEYSIZE, /* Invalid key size given */
48 CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */
49 CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */
50
51 CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */
52 CRYPT_INVALID_PACKET, /* Invalid input packet given */
53
54 CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */
55 CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */
56
57 CRYPT_INVALID_CIPHER, /* Invalid cipher specified */
58 CRYPT_INVALID_HASH, /* Invalid hash specified */
59 CRYPT_INVALID_PRNG, /* Invalid PRNG specified */
60
61 CRYPT_MEM, /* Out of memory */
62
63 CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */
64 CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */
65
66 CRYPT_INVALID_ARG, /* Generic invalid argument */
67 CRYPT_FILE_NOTFOUND, /* File Not Found */
68
69 CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */
70 CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */
71 CRYPT_PK_DUP, /* Duplicate key already in key ring */
72 CRYPT_PK_NOT_FOUND, /* Key not found in keyring */
73 CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */
74
75 CRYPT_INVALID_PRIME_SIZE/* Invalid size of prime requested */
76};
77
78#define CONST64(a,b) ((((ULONG64)(a)) << 32) | (b))
80
81/* this is the "32-bit at least" data type
82 * Re-define it to suit your platform but it must be at least 32-bits
83 */
85
86/* ---- HELPER MACROS ---- */
87#define STORE32H(x, y) \
88 { (y)[0] = (unsigned char)(((x)>>24)&255); (y)[1] = (unsigned char)(((x)>>16)&255); \
89 (y)[2] = (unsigned char)(((x)>>8)&255); (y)[3] = (unsigned char)((x)&255); }
90
91#define LOAD32H(x, y) \
92 { x = ((unsigned long)((y)[0] & 255)<<24) | \
93 ((unsigned long)((y)[1] & 255)<<16) | \
94 ((unsigned long)((y)[2] & 255)<<8) | \
95 ((unsigned long)((y)[3] & 255)); }
96
97#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(INTEL_CC)
98
99static inline unsigned ROR(unsigned word, int i)
100{
101 __asm__("rorl %%cl,%0"
102 :"=r" (word)
103 :"0" (word),"c" (i));
104 return word;
105}
106
107#else
108
109/* rotates the hard way */
110#define ROR(x, y) ( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | \
111 ((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL)
112
113#endif
114
115#undef MIN
116#define MIN(x, y) ( ((x)<(y))?(x):(y) )
117
118#define byte(x, n) (((x) >> (8 * (n))) & 255)
119
120typedef struct tag_rc2_key {
121 unsigned xkey[64];
123
124typedef struct tag_des_key {
125 ulong32 ek[32], dk[32];
127
128typedef struct tag_des3_key {
129 ulong32 ek[3][32], dk[3][32];
131
132typedef struct tag_aes_key {
133 ulong32 eK[64], dK[64];
134 int Nr;
136
137int rc2_setup(const unsigned char *key, int keylen, int bits, int num_rounds, rc2_key *skey);
138void rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, rc2_key *key);
139void rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, rc2_key *key);
140
141int des_setup(const unsigned char *key, int keylen, int num_rounds, des_key *skey);
142void des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const des_key *key);
143void des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const des_key *key);
144
145int des3_setup(const unsigned char *key, int keylen, int num_rounds, des3_key *skey);
146void des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const des3_key *key);
147void des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const des3_key *key);
148
149int aes_setup(const unsigned char *key, int keylen, int rounds, aes_key *skey);
150void aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_key *skey);
151void aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_key *skey);
152
153typedef struct tag_md2_state {
154 unsigned char chksum[16], X[48], buf[16];
155 unsigned long curlen;
157
158int md2_init(md2_state * md);
159int md2_process(md2_state * md, const unsigned char *buf, unsigned long len);
160int md2_done(md2_state * md, unsigned char *hash);
161
162struct rc4_prng {
163 int x, y;
164 unsigned char buf[256];
165};
166
167typedef union Prng_state {
168 struct rc4_prng rc4;
170
171int rc4_start(prng_state *prng);
172int rc4_add_entropy(const unsigned char *buf, unsigned long len, prng_state *prng);
173int rc4_ready(prng_state *prng);
174unsigned long rc4_read(unsigned char *buf, unsigned long len, prng_state *prng);
175
176/* some default configurations.
177 *
178 * A "mp_digit" must be able to hold DIGIT_BIT + 1 bits
179 * A "mp_word" must be able to hold 2*DIGIT_BIT + 1 bits
180 *
181 * At the very least a mp_digit must be able to hold 7 bits
182 * [any size beyond that is ok provided it doesn't overflow the data type]
183 */
184typedef unsigned long mp_digit;
186#define DIGIT_BIT 28
187
188#define MP_DIGIT_BIT DIGIT_BIT
189#define MP_MASK ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
190#define MP_DIGIT_MAX MP_MASK
191
192/* equalities */
193#define MP_LT -1 /* less than */
194#define MP_EQ 0 /* equal to */
195#define MP_GT 1 /* greater than */
196
197#define MP_ZPOS 0 /* positive integer */
198#define MP_NEG 1 /* negative */
199
200#define MP_OKAY 0 /* ok result */
201#define MP_MEM -2 /* out of mem */
202#define MP_VAL -3 /* invalid input */
203#define MP_RANGE MP_VAL
204
205#define MP_YES 1 /* yes response */
206#define MP_NO 0 /* no response */
207
208/* Primality generation flags */
209#define LTM_PRIME_BBS 0x0001 /* BBS style prime */
210#define LTM_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */
211#define LTM_PRIME_2MSB_OFF 0x0004 /* force 2nd MSB to 0 */
212#define LTM_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */
213
214typedef int mp_err;
215
216/* define this to use lower memory usage routines (exptmods mostly) */
217/* #define MP_LOW_MEM */
218
219#define MP_PREC 64 /* default digits of precision */
220
221/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
222#define MP_WARRAY (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
223
224/* the infamous mp_int structure */
225typedef struct {
228} mp_int;
229
230/* callback for mp_prime_random, should fill dst with random bytes and return how many read [up to len] */
231typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
232
233#define DIGIT(m,k) ((m)->dp[(k)])
234
235/* error code to char* string */
237
238/* init a null terminated series of arguments */
239int mp_init_multi(mp_int *mp, ...);
240
241/* clear a null terminated series of arguments */
242void mp_clear_multi(mp_int *mp, ...);
243
244/* shrink ram required for a bignum */
245int mp_shrink(mp_int *a);
246
247/* ---> Basic Manipulations <--- */
248#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
249#define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
250#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
251
252/* set a 32-bit const */
253int mp_set_int(mp_int *a, unsigned long b);
254
255/* get a 32-bit value */
256unsigned long mp_get_int(const mp_int * a);
257
258/* initialize and set a digit */
260
261/* initialize and set 32-bit value */
262int mp_init_set_int (mp_int * a, unsigned long b);
263
264/* copy, b = a */
265int mp_copy(const mp_int *a, mp_int *b);
266
267/* inits and copies, a = b */
268int mp_init_copy(mp_int *a, const mp_int *b);
269
270/* ---> digit manipulation <--- */
271
272/* I Love Earth! */
273
274/* makes a pseudo-random int of a given size */
276
277/* ---> binary operations <--- */
278/* c = a XOR b */
280
281/* c = a OR b */
283
284/* c = a AND b */
286
287/* ---> Basic arithmetic <--- */
288
289/* b = -a */
291
292/* compare a to b */
293int mp_cmp(const mp_int *a, const mp_int *b);
294
295/* c = a + b */
296int mp_add(mp_int *a, mp_int *b, mp_int *c);
297
298/* c = a - b */
299int mp_sub(mp_int *a, mp_int *b, mp_int *c);
300
301/* c = a * b */
302int mp_mul(const mp_int *a, const mp_int *b, mp_int *c);
303
304/* c = a mod b, 0 <= c < b */
305int mp_mod(const mp_int *a, mp_int *b, mp_int *c);
306
307/* ---> single digit functions <--- */
308
309/* compare against a single digit */
310int mp_cmp_d(const mp_int *a, mp_digit b);
311
312/* c = a - b */
314
315/* a/3 => 3c + d == a */
317
318/* c = a**b */
320
321/* ---> number theory <--- */
322
323/* d = a + b (mod c) */
325
326/* d = a - b (mod c) */
328
329/* d = a * b (mod c) */
330int mp_mulmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d);
331
332/* c = 1/a (mod b) */
333int mp_invmod(const mp_int *a, mp_int *b, mp_int *c);
334
335/* c = (a, b) */
336int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c);
337
338/* produces value such that U1*a + U2*b = U3 */
340
341/* c = [a, b] or (a*b)/(a, b) */
342int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c);
343
344/* finds one of the b'th root of a, such that |c|**b <= |a|
345 *
346 * returns error if a < 0 and b is even
347 */
349
350/* special sqrt algo */
352
353/* is number a square? */
355
356/* computes the jacobi c = (a | n) (or Legendre if b is prime) */
357int mp_jacobi(mp_int *a, mp_int *n, int *c);
358
359/* returns 1 if a is a valid DR modulus */
361
362/* returns true if a can be reduced with mp_reduce_2k */
364
365/* d = a**b (mod c) */
366int mp_exptmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d);
367
368/* ---> Primes <--- */
369
370/* number of primes */
371#define PRIME_SIZE 256
372
373/* performs one Fermat test of "a" using base "b".
374 * Sets result to 0 if composite or 1 if probable prime
375 */
377
378/* This gives [for a given bit size] the number of trials required
379 * such that Miller-Rabin gives a prob of failure lower than 2^-96
380 */
382
383/* finds the next prime after the number "a" using "t" trials
384 * of Miller-Rabin.
385 *
386 * bbs_style = 1 means the prime must be congruent to 3 mod 4
387 */
388int mp_prime_next_prime(mp_int *a, int t, int bbs_style);
389
390/* makes a truly random prime of a given size (bytes),
391 * call with bbs = 1 if you want it to be congruent to 3 mod 4
392 *
393 * You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
394 * have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
395 * so it can be NULL
396 *
397 * The prime generated will be larger than 2^(8*size).
398 */
399#define mp_prime_random(a, t, size, bbs, cb, dat) mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)
400
401/* makes a truly random prime of a given size (bits),
402 *
403 * Flags are as follows:
404 *
405 * LTM_PRIME_BBS - make prime congruent to 3 mod 4
406 * LTM_PRIME_SAFE - make sure (p-1)/2 is prime as well (implies LTM_PRIME_BBS)
407 * LTM_PRIME_2MSB_OFF - make the 2nd highest bit zero
408 * LTM_PRIME_2MSB_ON - make the 2nd highest bit one
409 *
410 * You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
411 * have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
412 * so it can be NULL
413 *
414 */
415int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat);
416
417/* ---> radix conversion <--- */
418int mp_count_bits(const mp_int *a);
419
420int mp_unsigned_bin_size(const mp_int *a);
421int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c);
422int mp_to_unsigned_bin(const mp_int *a, unsigned char *b);
423
424int mp_read_signed_bin(mp_int *a, unsigned char *b, int c);
425int mp_to_signed_bin(mp_int *a, unsigned char *b);
426
427int mp_read_radix(mp_int *a, char *str, int radix);
428int mp_toradix(mp_int *a, char *str, int radix);
429int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen);
430int mp_radix_size(mp_int *a, int radix, int *size);
431
432int mp_fread(mp_int *a, int radix, FILE *stream);
433int mp_fwrite(mp_int *a, int radix, FILE *stream);
434
435#define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len))
436#define mp_raw_size(mp) mp_signed_bin_size(mp)
437#define mp_toraw(mp, str) mp_to_signed_bin((mp), (str))
438#define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len))
439#define mp_mag_size(mp) mp_unsigned_bin_size(mp)
440#define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str))
441
442#define mp_tobinary(M, S) mp_toradix((M), (S), 2)
443#define mp_tooctal(M, S) mp_toradix((M), (S), 8)
444#define mp_todecimal(M, S) mp_toradix((M), (S), 10)
445#define mp_tohex(M, S) mp_toradix((M), (S), 16)
446
447extern const char *mp_s_rmap;
448
449#define PK_PRIVATE 0 /* PK private keys */
450#define PK_PUBLIC 1 /* PK public keys */
451
452/* Min and Max RSA key sizes (in bits) */
453#define MIN_RSA_SIZE 384
454#define MAX_RSA_SIZE 16384
455
456typedef struct Rsa_key {
457 int type;
458 mp_int e, d, N, p, q, qP, dP, dQ;
460
461int rsa_make_key(int size, long e, rsa_key *key);
462
463int rsa_exptmod(const unsigned char *in, unsigned long inlen,
464 unsigned char *out, unsigned long *outlen, int which,
465 rsa_key *key);
466
467void rsa_free(rsa_key *key);
468
469#endif /* __WINE_TOMCRYPT_H_ */
static int used
Definition: adh-main.c:39
#define U3(x)
Definition: wordpad.c:47
#define U2(x)
Definition: wordpad.c:46
unsigned int ULONG32
Definition: basetsd.h:125
#define rsa_free
Definition: compat-1.3.h:2238
#define md2_process
Definition: compat-1.3.h:2020
#define md
Definition: compat-1.3.h:2013
#define md2_init
Definition: compat-1.3.h:2019
int mp_copy(const mp_int *a, mp_int *b)
Definition: mpi.c:1156
int mp_n_root(mp_int *a, mp_digit b, mp_int *c)
int mp_read_radix(mp_int *a, char *str, int radix)
int mp_rand(mp_int *a, int digits)
int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d)
int mp_exptmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
Definition: mpi.c:1917
unsigned long rc4_read(unsigned char *buf, unsigned long len, prng_state *prng)
Definition: rc4.c:89
int mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
Definition: mpi.c:3875
int rsa_make_key(int size, long e, rsa_key *key)
Definition: rsa.c:87
int mp_div_3(mp_int *a, mp_int *c, mp_digit *d)
void mp_clear_multi(mp_int *mp,...)
Definition: mpi.c:1032
int mp_jacobi(mp_int *a, mp_int *n, int *c)
int mp_init_set_int(mp_int *a, unsigned long b)
int mp_fread(mp_int *a, int radix, FILE *stream)
void des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const des3_key *key)
Definition: des.c:1485
int rc4_ready(prng_state *prng)
Definition: rc4.c:61
@ CRYPT_ERROR
Definition: tomcrypt.h:44
@ CRYPT_MEM
Definition: tomcrypt.h:61
@ CRYPT_PK_INVALID_TYPE
Definition: tomcrypt.h:69
@ CRYPT_INVALID_CIPHER
Definition: tomcrypt.h:57
@ CRYPT_PK_TYPE_MISMATCH
Definition: tomcrypt.h:63
@ CRYPT_INVALID_PRIME_SIZE
Definition: tomcrypt.h:75
@ CRYPT_PK_INVALID_SYSTEM
Definition: tomcrypt.h:70
@ CRYPT_INVALID_PRNG
Definition: tomcrypt.h:59
@ CRYPT_ERROR_READPRNG
Definition: tomcrypt.h:55
@ CRYPT_INVALID_ROUNDS
Definition: tomcrypt.h:48
@ CRYPT_PK_NOT_FOUND
Definition: tomcrypt.h:72
@ CRYPT_INVALID_ARG
Definition: tomcrypt.h:66
@ CRYPT_INVALID_PACKET
Definition: tomcrypt.h:52
@ CRYPT_FILE_NOTFOUND
Definition: tomcrypt.h:67
@ CRYPT_INVALID_KEYSIZE
Definition: tomcrypt.h:47
@ CRYPT_PK_NOT_PRIVATE
Definition: tomcrypt.h:64
@ CRYPT_INVALID_PRNGSIZE
Definition: tomcrypt.h:54
@ CRYPT_NOP
Definition: tomcrypt.h:45
@ CRYPT_BUFFER_OVERFLOW
Definition: tomcrypt.h:51
@ CRYPT_OK
Definition: tomcrypt.h:43
@ CRYPT_PK_INVALID_SIZE
Definition: tomcrypt.h:73
@ CRYPT_PK_DUP
Definition: tomcrypt.h:71
@ CRYPT_INVALID_HASH
Definition: tomcrypt.h:58
@ CRYPT_FAIL_TESTVECTOR
Definition: tomcrypt.h:49
int mp_dr_is_modulus(mp_int *a)
int mp_neg(mp_int *a, mp_int *b)
unsigned long mp_get_int(const mp_int *a)
Definition: mpi.c:2320
int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen)
int mp_read_signed_bin(mp_int *a, unsigned char *b, int c)
void des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const des_key *key)
Definition: des.c:1463
struct tag_rc2_key rc2_key
int mp_unsigned_bin_size(const mp_int *a)
Definition: mpi.c:3899
int mp_shrink(mp_int *a)
Definition: mpi.c:3714
int mp_fwrite(mp_int *a, int radix, FILE *stream)
int mp_prime_rabin_miller_trials(int size)
Definition: mpi.c:3382
int mp_add(mp_int *a, mp_int *b, mp_int *c)
Definition: mpi.c:891
char * mp_error_to_string(int code)
int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d)
int mp_sub(mp_int *a, mp_int *b, mp_int *c)
Definition: mpi.c:3771
ULONG32 ulong32
Definition: tomcrypt.h:84
struct Rsa_key rsa_key
int mp_invmod(const mp_int *a, mp_int *b, mp_int *c)
Definition: mpi.c:2391
const char * mp_s_rmap
int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c)
Definition: mpi.c:2228
int des3_setup(const unsigned char *key, int keylen, int num_rounds, des3_key *skey)
Definition: des.c:1432
int mp_count_bits(const mp_int *a)
Definition: mpi.c:1203
int md2_done(md2_state *md, unsigned char *hash)
Definition: md2.c:125
int mp_mod(const mp_int *a, mp_int *b, mp_int *c)
Definition: mpi.c:2847
int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c)
Definition: mpi.c:2807
unsigned long mp_digit
Definition: tomcrypt.h:184
int mp_init_set(mp_int *a, mp_digit b)
int mp_sub_d(mp_int *a, mp_digit b, mp_int *c)
Definition: mpi.c:3808
int mp_toradix(mp_int *a, char *str, int radix)
struct tag_aes_key aes_key
int mp_err
Definition: tomcrypt.h:214
#define ROR(x, y)
Definition: tomcrypt.h:110
struct tag_des_key des_key
int mp_cmp_d(const mp_int *a, mp_digit b)
Definition: mpi.c:1067
int mp_to_signed_bin(mp_int *a, unsigned char *b)
int mp_cmp(const mp_int *a, const mp_int *b)
Definition: mpi.c:1046
int rc4_start(prng_state *prng)
Definition: rc4.c:33
int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat)
Definition: mpi.c:3412
int rc4_add_entropy(const unsigned char *buf, unsigned long len, prng_state *prng)
Definition: rc4.c:41
int rc2_setup(const unsigned char *key, int keylen, int bits, int num_rounds, rc2_key *skey)
Definition: rc2.c:53
void des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const des3_key *key)
Definition: des.c:1473
int mp_prime_fermat(mp_int *a, mp_int *b, int *result)
int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3)
ulong64 mp_word
Definition: tomcrypt.h:185
int mp_mulmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
Definition: mpi.c:3138
void des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const des_key *key)
Definition: des.c:1453
int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c)
Definition: mpi.c:3502
void aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_key *skey)
Definition: aes.c:1064
int mp_radix_size(mp_int *a, int radix, int *size)
int mp_expt_d(mp_int *a, mp_digit b, mp_int *c)
int mp_init_copy(mp_int *a, const mp_int *b)
Definition: mpi.c:2344
int mp_xor(mp_int *a, mp_int *b, mp_int *c)
int des_setup(const unsigned char *key, int keylen, int num_rounds, des_key *skey)
Definition: des.c:1416
int mp_is_square(mp_int *arg, int *ret)
void aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_key *skey)
Definition: aes.c:1165
int rsa_exptmod(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, int which, rsa_key *key)
Definition: rsa.c:180
ULONG64 ulong64
Definition: tomcrypt.h:79
int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
Definition: mpi.c:3107
int mp_set_int(mp_int *a, unsigned long b)
Definition: mpi.c:3687
struct tag_des3_key des3_key
struct tag_md2_state md2_state
union Prng_state prng_state
int mp_sqrt(mp_int *arg, mp_int *ret)
int mp_and(mp_int *a, mp_int *b, mp_int *c)
void rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, rc2_key *key)
Definition: rc2.c:159
int mp_or(mp_int *a, mp_int *b, mp_int *c)
int mp_reduce_is_2k(mp_int *a)
int mp_init_multi(mp_int *mp,...)
Definition: mpi.c:2354
int ltm_prime_callback(unsigned char *dst, int len, void *dat)
Definition: tomcrypt.h:231
int mp_prime_next_prime(mp_int *a, int t, int bbs_style)
int aes_setup(const unsigned char *key, int keylen, int rounds, aes_key *skey)
Definition: aes.c:937
void rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, rc2_key *key)
Definition: rc2.c:111
#define pt(x, y)
Definition: drawing.c:79
GLdouble GLdouble t
Definition: gl.h:2047
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const int digits[]
Definition: decode.c:71
const WCHAR * word
Definition: lex.c:36
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define sign(x)
Definition: mapdesc.cc:613
unsigned __int64 ULONG64
Definition: imports.h:198
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tmov %rdx, %rbp\n" "\tjmp *%rax\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
static FILE * out
Definition: regtests2xml.c:44
const WCHAR * str
#define U1(x)
Definition: test.h:199
ULONG32 ulong32
Definition: tomcrypt.h:84
unsigned long mp_digit
Definition: tomcrypt.h:184
mp_int p
Definition: tomcrypt.h:458
mp_int N
Definition: tomcrypt.h:458
mp_int q
Definition: tomcrypt.h:458
mp_int dP
Definition: tomcrypt.h:458
mp_int dQ
Definition: tomcrypt.h:458
mp_int e
Definition: tomcrypt.h:458
mp_int qP
Definition: tomcrypt.h:458
mp_int d
Definition: tomcrypt.h:458
int type
Definition: tomcrypt.h:457
Definition: inflate.c:139
Definition: _hash_fun.h:40
Definition: copy.c:22
mp_digit * dp
Definition: tomcrypt.h:227
int alloc
Definition: tomcrypt.h:226
int x
Definition: tomcrypt.h:163
int y
Definition: tomcrypt.h:163
Definition: parse.h:23
ulong32 eK[64]
Definition: tomcrypt.h:133
ulong32 dK[64]
Definition: tomcrypt.h:133
ulong32 dk[3][32]
Definition: tomcrypt.h:129
ulong32 ek[3][32]
Definition: tomcrypt.h:129
ulong32 dk[32]
Definition: tomcrypt.h:125
ulong32 ek[32]
Definition: tomcrypt.h:125
unsigned char chksum[16]
Definition: tomcrypt.h:154
unsigned long curlen
Definition: tomcrypt.h:155
unsigned xkey[64]
Definition: tomcrypt.h:121
struct rc4_prng rc4
Definition: tomcrypt.h:168
int ret
static GLenum which
Definition: wgl_font.c:159