diff 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
line wrap: on
line diff
--- a/algo.h	Fri Nov 01 00:21:59 2013 +0800
+++ b/algo.h	Fri Nov 08 23:11:43 2013 +0800
@@ -56,6 +56,7 @@
 extern const struct dropbear_cipher dropbear_nocipher;
 extern const struct dropbear_cipher_mode dropbear_mode_none;
 extern const struct dropbear_hash dropbear_nohash;
+extern const struct dropbear_kex kex_curve25519;
 
 struct dropbear_cipher {
 	const struct ltc_cipher_descriptor *cipherdesc;
@@ -81,17 +82,27 @@
 	const unsigned char hashsize;
 };
 
+enum dropbear_kex_mode {
+	DROPBEAR_KEX_NORMAL_DH,
+	DROPBEAR_KEX_ECDH,
+	DROPBEAR_KEX_CURVE25519,
+};
+
 struct dropbear_kex {
-	// "normal" DH KEX
+	enum dropbear_kex_mode mode;
+	
+	/* "normal" DH KEX */
 	const unsigned char *dh_p_bytes;
 	const int dh_p_len;
 
-	// elliptic curve DH KEX
+	/* elliptic curve DH KEX */
 #ifdef DROPBEAR_ECDH
 	const struct dropbear_ecc_curve *ecc_curve;
+#else
+	const void* dummy;
 #endif
 
-	// both
+	/* both */
 	const struct ltc_hash_descriptor *hash_desc;
 };
 
@@ -117,12 +128,6 @@
 char * algolist_string(algo_type algos[]);
 #endif
 
-#ifdef DROPBEAR_ECDH
-#define IS_NORMAL_DH(algo) ((algo)->dh_p_bytes != NULL)
-#else
-#define IS_NORMAL_DH(algo) 1
-#endif
-
 enum {
 	DROPBEAR_COMP_NONE,
 	DROPBEAR_COMP_ZLIB,