ltc sync
Karel Miko
7 years ago
32 | 32 |
|
33 | 33 |
#ifndef XCLOCK
|
34 | 34 |
#define XCLOCK clock
|
35 | |
#endif
|
36 | |
#ifndef XCLOCKS_PER_SEC
|
37 | |
#define XCLOCKS_PER_SEC CLOCKS_PER_SEC
|
38 | 35 |
#endif
|
39 | 36 |
|
40 | 37 |
#ifndef XQSORT
|
|
105 | 102 |
|
106 | 103 |
/* The minimal set of functionality to run the tests */
|
107 | 104 |
#ifdef LTC_MINIMAL
|
|
105 |
#define LTC_RIJNDAEL
|
108 | 106 |
#define LTC_SHA256
|
|
107 |
#define LTC_YARROW
|
109 | 108 |
#define LTC_CTR_MODE
|
|
109 |
|
110 | 110 |
#define LTC_RNG_MAKE_PRNG
|
111 | 111 |
#define LTC_RNG_GET_BYTES
|
112 | |
#define LTC_YARROW
|
113 | 112 |
#define LTC_DEVRANDOM
|
114 | 113 |
#define LTC_TRY_URANDOM_FIRST
|
115 | 114 |
|
|
150 | 149 |
/* TomsFastMath */
|
151 | 150 |
/* #define TFM_DESC */
|
152 | 151 |
|
153 | |
#endif /* LTC_NO_MATH */
|
154 | |
|
155 | 152 |
/* GNU Multiple Precision Arithmetic Library */
|
156 | 153 |
/* #define GMP_DESC */
|
|
154 |
|
|
155 |
#endif /* LTC_NO_MATH */
|
157 | 156 |
|
158 | 157 |
/* ---> Symmetric Block Ciphers <--- */
|
159 | 158 |
#ifndef LTC_NO_CIPHERS
|
|
281 | 280 |
|
282 | 281 |
/* Yarrow */
|
283 | 282 |
#define LTC_YARROW
|
284 | |
/* which descriptor of AES to use? */
|
285 | |
/* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
|
286 | |
#ifdef ENCRYPT_ONLY
|
287 | |
#define LTC_YARROW_AES 0
|
288 | |
#else
|
289 | |
#define LTC_YARROW_AES 2
|
290 | |
#endif
|
291 | 283 |
|
292 | 284 |
/* a PRNG that simply reads from an available system source */
|
293 | 285 |
#define LTC_SPRNG
|
|
312 | 304 |
#define LTC_RNG_MAKE_PRNG
|
313 | 305 |
|
314 | 306 |
#endif /* LTC_NO_PRNGS */
|
|
307 |
|
|
308 |
#ifdef LTC_YARROW
|
|
309 |
|
|
310 |
/* which descriptor of AES to use? */
|
|
311 |
/* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
|
|
312 |
#ifdef ENCRYPT_ONLY
|
|
313 |
#define LTC_YARROW_AES 0
|
|
314 |
#else
|
|
315 |
#define LTC_YARROW_AES 2
|
|
316 |
#endif
|
|
317 |
|
|
318 |
#endif
|
315 | 319 |
|
316 | 320 |
#ifdef LTC_FORTUNA
|
317 | 321 |
|
110 | 110 |
int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key);
|
111 | 111 |
int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
|
112 | 112 |
int rsa_import_pkcs8(unsigned char *in, unsigned long inlen, rsa_key *key);
|
|
113 |
|
113 | 114 |
int rsa_import_radix(int radix, char *N, char *e, char *d, char *p, char *q, char *dP, char *dQ, char *qP, rsa_key *key);
|
114 | |
|
115 | 115 |
#endif
|
116 | 116 |
|
117 | 117 |
/* ---- Katja ---- */
|
92 | 92 |
switch (size) {
|
93 | 93 |
default:
|
94 | 94 |
h[3] = ctx->s[0] & 0x0ff;
|
95 | |
/* no break */
|
|
95 |
/* FALLTHROUGH */
|
96 | 96 |
case 3:
|
97 | 97 |
h[2] = (ctx->s[0] >> 8) & 0x0ff;
|
98 | |
/* no break */
|
|
98 |
/* FALLTHROUGH */
|
99 | 99 |
case 2:
|
100 | 100 |
h[1] = ctx->s[1] & 0x0ff;
|
101 | |
/* no break */
|
|
101 |
/* FALLTHROUGH */
|
102 | 102 |
case 1:
|
103 | 103 |
h[0] = (ctx->s[1] >> 8) & 0x0ff;
|
104 | |
/* no break */
|
|
104 |
/* FALLTHROUGH */
|
105 | 105 |
case 0:
|
106 | 106 |
;
|
107 | 107 |
}
|
|
118 | 118 |
adler32_state ctx;
|
119 | 119 |
adler32_init(&ctx);
|
120 | 120 |
adler32_update(&ctx, in, strlen(in));
|
121 | |
adler32_finish(&ctx, &out, 4);
|
|
121 |
adler32_finish(&ctx, out, 4);
|
122 | 122 |
if (XMEMCMP(adler32, out, 4)) {
|
123 | 123 |
#ifdef LTC_TEST_DBG
|
124 | 124 |
ulong32 _out, _adler32;
|
8 | 8 |
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
9 | 9 |
*/
|
10 | 10 |
#include "tomcrypt.h"
|
11 | |
#include <stdarg.h>
|
12 | 11 |
|
13 | 12 |
|
14 | 13 |
/**
|
8 | 8 |
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
9 | 9 |
*/
|
10 | 10 |
#include "tomcrypt.h"
|
11 | |
#include <stdarg.h>
|
12 | 11 |
|
13 | 12 |
|
14 | 13 |
/**
|