comparison algo.h @ 756:bf9dc2d9c2b1 ecc

more bits on ecc branch
author Matt Johnston <matt@ucc.asn.au>
date Wed, 27 Mar 2013 00:38:03 +0800
parents b07eb3dc23ec
children 76fba0856749
comparison
equal deleted inserted replaced
755:b07eb3dc23ec 756:bf9dc2d9c2b1
77 const struct ltc_hash_descriptor *hashdesc; 77 const struct ltc_hash_descriptor *hashdesc;
78 unsigned long keysize; 78 unsigned long keysize;
79 unsigned char hashsize; 79 unsigned char hashsize;
80 }; 80 };
81 81
82 struct dropbear_kex {
83 // "normal" DH KEX
84 unsigned char *dh_p_bytes;
85 int dh_p_len;
86
87 // elliptic curve DH KEX
88 #ifdef DROPBEAR_ECDH
89 const struct dropbear_ecc_curve *ecc_curve;
90 #endif
91
92 // both
93 const struct ltc_hash_descriptor *hashdesc;
94 };
95
82 void crypto_init(); 96 void crypto_init();
83 int have_algo(char* algo, size_t algolen, algo_type algos[]); 97 int have_algo(char* algo, size_t algolen, algo_type algos[]);
84 void buf_put_algolist(buffer * buf, algo_type localalgos[]); 98 void buf_put_algolist(buffer * buf, algo_type localalgos[]);
85 99
86 algo_type * svr_buf_match_algo(buffer* buf, algo_type localalgos[], 100 algo_type * svr_buf_match_algo(buffer* buf, algo_type localalgos[],
92 int check_user_algos(const char* user_algo_list, algo_type * algos, 106 int check_user_algos(const char* user_algo_list, algo_type * algos,
93 const char *algo_desc); 107 const char *algo_desc);
94 char * algolist_string(algo_type algos[]); 108 char * algolist_string(algo_type algos[]);
95 #endif 109 #endif
96 110
97 enum { 111 enum kex_type {
98 DROPBEAR_KEX_DH_GROUP1, 112 DROPBEAR_KEX_DH_GROUP1,
99 DROPBEAR_KEX_DH_GROUP14, 113 DROPBEAR_KEX_DH_GROUP14,
100 DROPBEAR_KEX_ECDH_SECP256R1, 114 DROPBEAR_KEX_ECDH_SECP256R1,
115 DROPBEAR_KEX_ECDH_SECP384R1,
116 DROPBEAR_KEX_ECDH_SECP521R1,
101 }; 117 };
102 118
103 #ifdef DROPBEAR_ECDH 119 #ifdef DROPBEAR_ECDH
104 #define IS_NORMAL_DH(algo) ((algo) == DROPBEAR_KEX_DH_GROUP1 || (algo) == DROPBEAR_KEX_DH_GROUP14) 120 #define IS_NORMAL_DH(algo) ((algo)->dh_p_bytes != NULL)
105 #else 121 #else
106 #define IS_NORMAL_DH(algo) 1 122 #define IS_NORMAL_DH(algo) 1
107 #endif 123 #endif
108 124
109 enum { 125 enum {