Lines Matching full:yarrow
14 @file yarrow.c
15 Yarrow PRNG, Tom St Denis
18 #ifdef YARROW
22 "yarrow", 64,
47 prng->yarrow.cipher = register_cipher(&rijndael_enc_desc);
49 prng->yarrow.cipher = register_cipher(&aes_enc_desc);
51 prng->yarrow.cipher = register_cipher(&rijndael_desc);
53 prng->yarrow.cipher = register_cipher(&aes_desc);
56 prng->yarrow.cipher = register_cipher(&blowfish_desc);
58 prng->yarrow.cipher = register_cipher(&twofish_desc);
60 prng->yarrow.cipher = register_cipher(&rc6_desc);
62 prng->yarrow.cipher = register_cipher(&rc5_desc);
64 prng->yarrow.cipher = register_cipher(&saferp_desc);
66 prng->yarrow.cipher = register_cipher(&rc2_desc);
68 prng->yarrow.cipher = register_cipher(&noekeon_desc);
70 prng->yarrow.cipher = register_cipher(&anubis_desc);
72 prng->yarrow.cipher = register_cipher(&kseed_desc);
74 prng->yarrow.cipher = register_cipher(&khazad_desc);
76 prng->yarrow.cipher = register_cipher(&cast5_desc);
78 prng->yarrow.cipher = register_cipher(&xtea_desc);
80 prng->yarrow.cipher = register_cipher(&safer_sk128_desc);
82 prng->yarrow.cipher = register_cipher(&des3_desc);
84 #error YARROW needs at least one CIPHER
86 if ((err = cipher_is_valid(prng->yarrow.cipher)) != CRYPT_OK) {
91 prng->yarrow.hash = register_hash(&sha256_desc);
93 prng->yarrow.hash = register_hash(&sha512_desc);
95 prng->yarrow.hash = register_hash(&tiger_desc);
97 prng->yarrow.hash = register_hash(&sha1_desc);
99 prng->yarrow.hash = register_hash(&rmd320_desc);
101 prng->yarrow.hash = register_hash(&rmd256_desc);
103 prng->yarrow.hash = register_hash(&rmd160_desc);
105 prng->yarrow.hash = register_hash(&rmd128_desc);
107 prng->yarrow.hash = register_hash(&md5_desc);
109 prng->yarrow.hash = register_hash(&md4_desc);
111 prng->yarrow.hash = register_hash(&md2_desc);
113 prng->yarrow.hash = register_hash(&whirlpool_desc);
115 #error YARROW needs at least one HASH
117 if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) {
122 zeromem(prng->yarrow.pool, sizeof(prng->yarrow.pool));
123 LTC_MUTEX_INIT(&prng->yarrow.prng_lock)
143 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
145 if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) {
146 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
151 if ((err = hash_descriptor[prng->yarrow.hash].init(&md)) != CRYPT_OK) {
152 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
157 if ((err = hash_descriptor[prng->yarrow.hash].process(&md, prng->yarrow.pool,
158 hash_descriptor[prng->yarrow.hash].hashsize)) != CRYPT_OK) {
159 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
164 if ((err = hash_descriptor[prng->yarrow.hash].process(&md, in, inlen)) != CRYPT_OK) {
165 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
170 if ((err = hash_descriptor[prng->yarrow.hash].done(&md, prng->yarrow.pool)) != CRYPT_OK) {
171 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
175 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
189 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
191 if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) {
192 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
196 if ((err = cipher_is_valid(prng->yarrow.cipher)) != CRYPT_OK) {
197 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
202 ks = (int)hash_descriptor[prng->yarrow.hash].hashsize;
203 if ((err = cipher_descriptor[prng->yarrow.cipher].keysize(&ks)) != CRYPT_OK) {
204 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
208 if ((err = ctr_start(prng->yarrow.cipher, /* what cipher to use */
209 prng->yarrow.pool, /* IV */
210 prng->yarrow.pool, ks, /* KEY and key size */
213 &prng->yarrow.ctr)) != CRYPT_OK) {
214 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
217 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
233 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
239 if (ctr_encrypt(out, out, outlen, &prng->yarrow.ctr) != CRYPT_OK) {
240 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
243 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
257 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
262 err = ctr_done(&prng->yarrow.ctr);
264 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
281 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
285 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
291 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
313 LTC_MUTEX_LOCK(&prng->yarrow.prng_lock);
316 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
321 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
325 LTC_MUTEX_UNLOCK(&prng->yarrow.prng_lock);
346 if ((err = cipher_descriptor[prng.yarrow.cipher].test()) != CRYPT_OK) {
349 if ((err = hash_descriptor[prng.yarrow.hash].test()) != CRYPT_OK) {
360 /* $Source: /cvs/libtom/libtomcrypt/src/prngs/yarrow.c,v $ */