comparison crypto_desc.c @ 1318:10e2a7727253 coverity

merge coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 22 Jul 2016 00:08:02 +0800
parents 750ec4ec4cbe
children 34d9d3c022ce
comparison
equal deleted inserted replaced
1286:7d02b83c61fd 1318:10e2a7727253
2 #include "dbutil.h" 2 #include "dbutil.h"
3 #include "crypto_desc.h" 3 #include "crypto_desc.h"
4 #include "ltc_prng.h" 4 #include "ltc_prng.h"
5 #include "ecc.h" 5 #include "ecc.h"
6 6
7 #ifdef DROPBEAR_LTC_PRNG 7 #if DROPBEAR_LTC_PRNG
8 int dropbear_ltc_prng = -1; 8 int dropbear_ltc_prng = -1;
9 #endif 9 #endif
10 10
11 11
12 /* Register the compiled in ciphers. 12 /* Register the compiled in ciphers.
13 * This should be run before using any of the ciphers/hashes */ 13 * This should be run before using any of the ciphers/hashes */
14 void crypto_init() { 14 void crypto_init() {
15 15
16 const struct ltc_cipher_descriptor *regciphers[] = { 16 const struct ltc_cipher_descriptor *regciphers[] = {
17 #ifdef DROPBEAR_AES 17 #if DROPBEAR_AES
18 &aes_desc, 18 &aes_desc,
19 #endif 19 #endif
20 #ifdef DROPBEAR_BLOWFISH 20 #if DROPBEAR_BLOWFISH
21 &blowfish_desc, 21 &blowfish_desc,
22 #endif 22 #endif
23 #ifdef DROPBEAR_TWOFISH 23 #if DROPBEAR_TWOFISH
24 &twofish_desc, 24 &twofish_desc,
25 #endif 25 #endif
26 #ifdef DROPBEAR_3DES 26 #if DROPBEAR_3DES
27 &des3_desc, 27 &des3_desc,
28 #endif 28 #endif
29 NULL 29 NULL
30 }; 30 };
31 31
32 const struct ltc_hash_descriptor *reghashes[] = { 32 const struct ltc_hash_descriptor *reghashes[] = {
33 /* we need sha1 for hostkey stuff regardless */ 33 /* we need sha1 for hostkey stuff regardless */
34 &sha1_desc, 34 &sha1_desc,
35 #ifdef DROPBEAR_MD5_HMAC 35 #if DROPBEAR_MD5_HMAC
36 &md5_desc, 36 &md5_desc,
37 #endif 37 #endif
38 #ifdef DROPBEAR_SHA256 38 #if DROPBEAR_SHA256
39 &sha256_desc, 39 &sha256_desc,
40 #endif 40 #endif
41 #ifdef DROPBEAR_SHA384 41 #if DROPBEAR_SHA384
42 &sha384_desc, 42 &sha384_desc,
43 #endif 43 #endif
44 #ifdef DROPBEAR_SHA512 44 #if DROPBEAR_SHA512
45 &sha512_desc, 45 &sha512_desc,
46 #endif 46 #endif
47 NULL 47 NULL
48 }; 48 };
49 int i; 49 int i;
58 if (register_hash(reghashes[i]) == -1) { 58 if (register_hash(reghashes[i]) == -1) {
59 dropbear_exit("Error registering crypto"); 59 dropbear_exit("Error registering crypto");
60 } 60 }
61 } 61 }
62 62
63 #ifdef DROPBEAR_LTC_PRNG 63 #if DROPBEAR_LTC_PRNG
64 dropbear_ltc_prng = register_prng(&dropbear_prng_desc); 64 dropbear_ltc_prng = register_prng(&dropbear_prng_desc);
65 if (dropbear_ltc_prng == -1) { 65 if (dropbear_ltc_prng == -1) {
66 dropbear_exit("Error registering crypto"); 66 dropbear_exit("Error registering crypto");
67 } 67 }
68 #endif 68 #endif
69 69
70 #ifdef DROPBEAR_ECC 70 #if DROPBEAR_ECC
71 ltc_mp = ltm_desc; 71 ltc_mp = ltm_desc;
72 dropbear_ecc_fill_dp(); 72 dropbear_ecc_fill_dp();
73 #endif 73 #endif
74 } 74 }
75 75