comparison kex.h @ 1702:8f93f37c01de

Allow DH to be completely disabled (#97) Reduces binary size by ~2kB by default and by 21kB with no other libtommath functions users, ex. with curve25519 kex and ed25519 key only.
author Vladislav Grishenko <themiron@users.noreply.github.com>
date Thu, 28 May 2020 20:01:48 +0500
parents 435cfb9ec96e
children
comparison
equal deleted inserted replaced
1701:6e5037ae2c1c 1702:8f93f37c01de
34 void send_msg_newkeys(void); 34 void send_msg_newkeys(void);
35 void recv_msg_newkeys(void); 35 void recv_msg_newkeys(void);
36 void kexfirstinitialise(void); 36 void kexfirstinitialise(void);
37 void finish_kexhashbuf(void); 37 void finish_kexhashbuf(void);
38 38
39 #if DROPBEAR_NORMAL_DH
39 struct kex_dh_param *gen_kexdh_param(void); 40 struct kex_dh_param *gen_kexdh_param(void);
40 void free_kexdh_param(struct kex_dh_param *param); 41 void free_kexdh_param(struct kex_dh_param *param);
41 void kexdh_comb_key(struct kex_dh_param *param, mp_int *dh_pub_them, 42 void kexdh_comb_key(struct kex_dh_param *param, mp_int *dh_pub_them,
42 sign_key *hostkey); 43 sign_key *hostkey);
44 #endif
43 45
44 #if DROPBEAR_ECDH 46 #if DROPBEAR_ECDH
45 struct kex_ecdh_param *gen_kexecdh_param(void); 47 struct kex_ecdh_param *gen_kexecdh_param(void);
46 void free_kexecdh_param(struct kex_ecdh_param *param); 48 void free_kexecdh_param(struct kex_ecdh_param *param);
47 void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them, 49 void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them,
85 unsigned int datatrans; /* data transmitted since last kex */ 87 unsigned int datatrans; /* data transmitted since last kex */
86 unsigned int datarecv; /* data received since last kex */ 88 unsigned int datarecv; /* data received since last kex */
87 89
88 }; 90 };
89 91
92 #if DROPBEAR_NORMAL_DH
90 struct kex_dh_param { 93 struct kex_dh_param {
91 mp_int pub; /* e */ 94 mp_int pub; /* e */
92 mp_int priv; /* x */ 95 mp_int priv; /* x */
93 }; 96 };
97 #endif
94 98
95 #if DROPBEAR_ECDH 99 #if DROPBEAR_ECDH
96 struct kex_ecdh_param { 100 struct kex_ecdh_param {
97 ecc_key key; 101 ecc_key key;
98 }; 102 };
102 #define CURVE25519_LEN 32 106 #define CURVE25519_LEN 32
103 struct kex_curve25519_param { 107 struct kex_curve25519_param {
104 unsigned char priv[CURVE25519_LEN]; 108 unsigned char priv[CURVE25519_LEN];
105 unsigned char pub[CURVE25519_LEN]; 109 unsigned char pub[CURVE25519_LEN];
106 }; 110 };
107
108 /* No header file for curve25519_donna */
109 int curve25519_donna(unsigned char *out, const unsigned char *secret, const unsigned char *other);
110 #endif 111 #endif
111 112
112 #endif /* DROPBEAR_KEX_H_ */ 113 #endif /* DROPBEAR_KEX_H_ */