diff signkey.h @ 795:7f604f9b3756 ecc

ecdsa is working
author Matt Johnston <matt@ucc.asn.au>
date Fri, 03 May 2013 23:07:48 +0800
parents d386defb5376
children 75509065db53
line wrap: on
line diff
--- a/signkey.h	Sun Apr 28 23:17:43 2013 +0800
+++ b/signkey.h	Fri May 03 23:07:48 2013 +0800
@@ -37,15 +37,9 @@
 	DROPBEAR_SIGNKEY_DSS,
 #endif
 #ifdef DROPBEAR_ECDSA
-#ifdef DROPBEAR_ECC_256
 	DROPBEAR_SIGNKEY_ECDSA_NISTP256,
-#endif
-#ifdef DROPBEAR_ECC_384
 	DROPBEAR_SIGNKEY_ECDSA_NISTP384,
-#endif
-#ifdef DROPBEAR_ECC_521
 	DROPBEAR_SIGNKEY_ECDSA_NISTP521,
-#endif
 	DROPBEAR_SIGNKEY_ECDSA_KEYGEN, // just "ecdsa" for keygen
 #endif // DROPBEAR_ECDSA
 	DROPBEAR_SIGNKEY_NUM_NAMED,
@@ -63,11 +57,9 @@
 
 struct SIGN_key {
 
-	int type; /* The type of key (dss or rsa) */
+	enum signkey_type type;
 	signkey_source source;
 	char *filename;
-	/* the buffer? for encrypted keys, so we can later get
-	 * the private key portion */
 
 #ifdef DROPBEAR_DSS
 	dropbear_dss_key * dsskey;
@@ -76,7 +68,7 @@
 	dropbear_rsa_key * rsakey;
 #endif
 #ifdef DROPBEAR_ECDSA
-	ecc_key *ecckey;
+	ecc_key * ecckey;
 #endif
 };
 
@@ -99,4 +91,12 @@
 					const unsigned char* algoname, unsigned int algolen, 
 					buffer * line, char ** fingerprint);
 
+#ifdef DROPBEAR_ECDSA
+#define IS_ECDSA_KEY(type) \
+	((type) == DROPBEAR_SIGNKEY_ECDSA_NISTP256 \
+		|| (type) == DROPBEAR_SIGNKEY_ECDSA_NISTP384 \
+		|| (type) == DROPBEAR_SIGNKEY_ECDSA_NISTP521 \
+		|| (type) == DROPBEAR_SIGNKEY_ECDSA_KEYGEN)
+#endif
+
 #endif /* _SIGNKEY_H_ */