Mercurial > dropbear
comparison crypto_desc.c @ 910:89555751c489 asm
merge up to 2013.63, improve ASM makefile rules a bit
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 27 Feb 2014 21:35:58 +0800 |
parents | e465ed10c51d |
children |
comparison
equal
deleted
inserted
replaced
909:e4b75744acab | 910:89555751c489 |
---|---|
1 #include "includes.h" | |
2 #include "dbutil.h" | |
3 #include "crypto_desc.h" | |
4 #include "ltc_prng.h" | |
5 #include "ecc.h" | |
6 | |
7 #ifdef DROPBEAR_LTC_PRNG | |
8 int dropbear_ltc_prng = -1; | |
9 #endif | |
10 | |
11 /* Register the compiled in ciphers. | |
12 * This should be run before using any of the ciphers/hashes */ | |
13 void crypto_init() { | |
14 | |
15 const struct ltc_cipher_descriptor *regciphers[] = { | |
16 #ifdef DROPBEAR_AES | |
17 &DROPBEAR_AES_DESC, | |
18 #endif | |
19 #ifdef DROPBEAR_BLOWFISH | |
20 &blowfish_desc, | |
21 #endif | |
22 #ifdef DROPBEAR_TWOFISH | |
23 &twofish_desc, | |
24 #endif | |
25 #ifdef DROPBEAR_3DES | |
26 &des3_desc, | |
27 #endif | |
28 NULL | |
29 }; | |
30 | |
31 const struct ltc_hash_descriptor *reghashes[] = { | |
32 /* we need sha1 for hostkey stuff regardless */ | |
33 &DROPBEAR_SHA1_DESC, | |
34 #ifdef DROPBEAR_MD5_HMAC | |
35 &md5_desc, | |
36 #endif | |
37 #ifdef DROPBEAR_SHA256 | |
38 &sha256_desc, | |
39 #endif | |
40 #ifdef DROPBEAR_SHA384 | |
41 &sha384_desc, | |
42 #endif | |
43 #ifdef DROPBEAR_SHA512 | |
44 &sha512_desc, | |
45 #endif | |
46 NULL | |
47 }; | |
48 int i; | |
49 | |
50 for (i = 0; regciphers[i] != NULL; i++) { | |
51 if (register_cipher(regciphers[i]) == -1) { | |
52 dropbear_exit("Error registering crypto"); | |
53 } | |
54 } | |
55 | |
56 for (i = 0; reghashes[i] != NULL; i++) { | |
57 if (register_hash(reghashes[i]) == -1) { | |
58 dropbear_exit("Error registering crypto"); | |
59 } | |
60 } | |
61 | |
62 #ifdef DROPBEAR_LTC_PRNG | |
63 dropbear_ltc_prng = register_prng(&dropbear_prng_desc); | |
64 if (dropbear_ltc_prng == -1) { | |
65 dropbear_exit("Error registering crypto"); | |
66 } | |
67 #endif | |
68 | |
69 #ifdef DROPBEAR_ECC | |
70 ltc_mp = ltm_desc; | |
71 dropbear_ecc_fill_dp(); | |
72 #endif | |
73 } | |
74 |