comparison algo.h @ 854:ccc76acaf4c7

merge ecc again
author Matt Johnston <matt@ucc.asn.au>
date Thu, 14 Nov 2013 20:45:46 +0800
parents 7540c0822374
children c19acba28590
comparison
equal deleted inserted replaced
845:774ad9b112ef 854:ccc76acaf4c7
79 // hashsize may be truncated from the size returned by hash_desc, 79 // hashsize may be truncated from the size returned by hash_desc,
80 // eg sha1-96 80 // eg sha1-96
81 const unsigned char hashsize; 81 const unsigned char hashsize;
82 }; 82 };
83 83
84 enum dropbear_kex_mode {
85 DROPBEAR_KEX_NORMAL_DH,
86 DROPBEAR_KEX_ECDH,
87 DROPBEAR_KEX_CURVE25519,
88 };
89
84 struct dropbear_kex { 90 struct dropbear_kex {
85 // "normal" DH KEX 91 enum dropbear_kex_mode mode;
92
93 /* "normal" DH KEX */
86 const unsigned char *dh_p_bytes; 94 const unsigned char *dh_p_bytes;
87 const int dh_p_len; 95 const int dh_p_len;
88 96
89 // elliptic curve DH KEX 97 /* elliptic curve DH KEX */
90 #ifdef DROPBEAR_ECDH 98 #ifdef DROPBEAR_ECDH
91 const struct dropbear_ecc_curve *ecc_curve; 99 const struct dropbear_ecc_curve *ecc_curve;
100 #else
101 const void* dummy;
92 #endif 102 #endif
93 103
94 // both 104 /* both */
95 const struct ltc_hash_descriptor *hash_desc; 105 const struct ltc_hash_descriptor *hash_desc;
96 }; 106 };
97 107
98 int have_algo(char* algo, size_t algolen, algo_type algos[]); 108 int have_algo(char* algo, size_t algolen, algo_type algos[]);
99 void buf_put_algolist(buffer * buf, algo_type localalgos[]); 109 void buf_put_algolist(buffer * buf, algo_type localalgos[]);
115 int check_user_algos(const char* user_algo_list, algo_type * algos, 125 int check_user_algos(const char* user_algo_list, algo_type * algos,
116 const char *algo_desc); 126 const char *algo_desc);
117 char * algolist_string(algo_type algos[]); 127 char * algolist_string(algo_type algos[]);
118 #endif 128 #endif
119 129
120 #ifdef DROPBEAR_ECDH
121 #define IS_NORMAL_DH(algo) ((algo)->dh_p_bytes != NULL)
122 #else
123 #define IS_NORMAL_DH(algo) 1
124 #endif
125
126 enum { 130 enum {
127 DROPBEAR_COMP_NONE, 131 DROPBEAR_COMP_NONE,
128 DROPBEAR_COMP_ZLIB, 132 DROPBEAR_COMP_ZLIB,
129 DROPBEAR_COMP_ZLIB_DELAY, 133 DROPBEAR_COMP_ZLIB_DELAY,
130 }; 134 };