summaryrefslogtreecommitdiffhomepage
path: root/algo.h
diff options
context:
space:
mode:
Diffstat (limited to 'algo.h')
-rw-r--r--algo.h40
1 files changed, 33 insertions, 7 deletions
diff --git a/algo.h b/algo.h
index ad40c0d..dbbafd0 100644
--- a/algo.h
+++ b/algo.h
@@ -35,7 +35,7 @@
struct Algo_Type {
- unsigned char *name; /* identifying name */
+ const unsigned char *name; /* identifying name */
char val; /* a value for this cipher, or -1 for invalid */
const void *data; /* algorithm specific data */
char usable; /* whether we can use this algorithm */
@@ -59,8 +59,8 @@ extern const struct dropbear_hash dropbear_nohash;
struct dropbear_cipher {
const struct ltc_cipher_descriptor *cipherdesc;
- unsigned long keysize;
- unsigned char blocksize;
+ const unsigned long keysize;
+ const unsigned char blocksize;
};
struct dropbear_cipher_mode {
@@ -74,12 +74,27 @@ struct dropbear_cipher_mode {
};
struct dropbear_hash {
- const struct ltc_hash_descriptor *hashdesc;
- unsigned long keysize;
- unsigned char hashsize;
+ const struct ltc_hash_descriptor *hash_desc;
+ const unsigned long keysize;
+ // hashsize may be truncated from the size returned by hash_desc,
+ // eg sha1-96
+ const unsigned char hashsize;
+};
+
+struct dropbear_kex {
+ // "normal" DH KEX
+ const unsigned char *dh_p_bytes;
+ const int dh_p_len;
+
+ // elliptic curve DH KEX
+#ifdef DROPBEAR_ECDH
+ const struct dropbear_ecc_curve *ecc_curve;
+#endif
+
+ // both
+ const struct ltc_hash_descriptor *hash_desc;
};
-void crypto_init();
int have_algo(char* algo, size_t algolen, algo_type algos[]);
void buf_put_algolist(buffer * buf, algo_type localalgos[]);
@@ -102,5 +117,16 @@ int check_user_algos(const char* user_algo_list, algo_type * algos,
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,
+ DROPBEAR_COMP_ZLIB_DELAY,
+};
#endif /* _ALGO_H_ */