comparison crypto_desc.c @ 766:d1575fdc29a6 ecc

start on ecdsa keys
author Matt Johnston <matt@ucc.asn.au>
date Tue, 09 Apr 2013 00:36:04 +0800
parents
children e465ed10c51d
comparison
equal deleted inserted replaced
765:5503e05ab3a4 766:d1575fdc29a6
1 #include "includes.h"
2 #include "dbutil.h"
3 #include "crypto_desc.h"
4 #include "ltc_prng.h"
5
6 #ifdef DROPBEAR_LTC_PRNG
7 int dropbear_ltc_prng = -1;
8 #endif
9
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 &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 &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 #endif
72 }
73