comparison algo.h @ 848:6c69e7df3621 ecc

curve25519
author Matt Johnston <matt@ucc.asn.au>
date Fri, 08 Nov 2013 23:11:43 +0800
parents 7dcb46da72d9
children 7540c0822374
comparison
equal deleted inserted replaced
845:774ad9b112ef 848:6c69e7df3621
54 extern algo_type ssh_nocompress[]; 54 extern algo_type ssh_nocompress[];
55 55
56 extern const struct dropbear_cipher dropbear_nocipher; 56 extern const struct dropbear_cipher dropbear_nocipher;
57 extern const struct dropbear_cipher_mode dropbear_mode_none; 57 extern const struct dropbear_cipher_mode dropbear_mode_none;
58 extern const struct dropbear_hash dropbear_nohash; 58 extern const struct dropbear_hash dropbear_nohash;
59 extern const struct dropbear_kex kex_curve25519;
59 60
60 struct dropbear_cipher { 61 struct dropbear_cipher {
61 const struct ltc_cipher_descriptor *cipherdesc; 62 const struct ltc_cipher_descriptor *cipherdesc;
62 const unsigned long keysize; 63 const unsigned long keysize;
63 const unsigned char blocksize; 64 const unsigned char blocksize;
79 // hashsize may be truncated from the size returned by hash_desc, 80 // hashsize may be truncated from the size returned by hash_desc,
80 // eg sha1-96 81 // eg sha1-96
81 const unsigned char hashsize; 82 const unsigned char hashsize;
82 }; 83 };
83 84
85 enum dropbear_kex_mode {
86 DROPBEAR_KEX_NORMAL_DH,
87 DROPBEAR_KEX_ECDH,
88 DROPBEAR_KEX_CURVE25519,
89 };
90
84 struct dropbear_kex { 91 struct dropbear_kex {
85 // "normal" DH KEX 92 enum dropbear_kex_mode mode;
93
94 /* "normal" DH KEX */
86 const unsigned char *dh_p_bytes; 95 const unsigned char *dh_p_bytes;
87 const int dh_p_len; 96 const int dh_p_len;
88 97
89 // elliptic curve DH KEX 98 /* elliptic curve DH KEX */
90 #ifdef DROPBEAR_ECDH 99 #ifdef DROPBEAR_ECDH
91 const struct dropbear_ecc_curve *ecc_curve; 100 const struct dropbear_ecc_curve *ecc_curve;
101 #else
102 const void* dummy;
92 #endif 103 #endif
93 104
94 // both 105 /* both */
95 const struct ltc_hash_descriptor *hash_desc; 106 const struct ltc_hash_descriptor *hash_desc;
96 }; 107 };
97 108
98 int have_algo(char* algo, size_t algolen, algo_type algos[]); 109 int have_algo(char* algo, size_t algolen, algo_type algos[]);
99 void buf_put_algolist(buffer * buf, algo_type localalgos[]); 110 void buf_put_algolist(buffer * buf, algo_type localalgos[]);
115 int check_user_algos(const char* user_algo_list, algo_type * algos, 126 int check_user_algos(const char* user_algo_list, algo_type * algos,
116 const char *algo_desc); 127 const char *algo_desc);
117 char * algolist_string(algo_type algos[]); 128 char * algolist_string(algo_type algos[]);
118 #endif 129 #endif
119 130
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 { 131 enum {
127 DROPBEAR_COMP_NONE, 132 DROPBEAR_COMP_NONE,
128 DROPBEAR_COMP_ZLIB, 133 DROPBEAR_COMP_ZLIB,
129 DROPBEAR_COMP_ZLIB_DELAY, 134 DROPBEAR_COMP_ZLIB_DELAY,
130 }; 135 };