comparison kex.h @ 1733:d529a52b2f7c coverity coverity

merge coverity from main
author Matt Johnston <matt@ucc.asn.au>
date Fri, 26 Jun 2020 21:07:34 +0800
parents 8f93f37c01de
children
comparison
equal deleted inserted replaced
1643:b59623a64678 1733:d529a52b2f7c
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,
63 void recv_msg_kexdh_init(void); /* server */ 65 void recv_msg_kexdh_init(void); /* server */
64 66
65 void send_msg_kexdh_init(void); /* client */ 67 void send_msg_kexdh_init(void); /* client */
66 void recv_msg_kexdh_reply(void); /* client */ 68 void recv_msg_kexdh_reply(void); /* client */
67 69
70 void recv_msg_ext_info(void);
71
68 struct KEXState { 72 struct KEXState {
69 73
70 unsigned sentkexinit : 1; /*set when we've sent/recv kexinit packet */ 74 unsigned sentkexinit : 1; /*set when we've sent/recv kexinit packet */
71 unsigned recvkexinit : 1; 75 unsigned recvkexinit : 1;
72 unsigned them_firstfollows : 1; /* true when first_kex_packet_follows is set */ 76 unsigned them_firstfollows : 1; /* true when first_kex_packet_follows is set */
73 unsigned sentnewkeys : 1; /* set once we've send MSG_NEWKEYS (will be cleared once we have also received */ 77 unsigned sentnewkeys : 1; /* set once we've send MSG_NEWKEYS (will be cleared once we have also received */
74 unsigned recvnewkeys : 1; /* set once we've received MSG_NEWKEYS (cleared once we have also sent */ 78 unsigned recvnewkeys : 1; /* set once we've received MSG_NEWKEYS (cleared once we have also sent */
75 79
76 unsigned donefirstkex : 1; /* Set to 1 after the first kex has completed, 80 unsigned int donefirstkex; /* Set to 1 after the first kex has completed,
77 ie the transport layer has been set up */ 81 ie the transport layer has been set up */
82 unsigned int donesecondkex; /* Set to 1 after the second kex has completed */
78 83
79 unsigned our_first_follows_matches : 1; 84 unsigned our_first_follows_matches : 1;
80 85
81 time_t lastkextime; /* time of the last kex */ 86 time_t lastkextime; /* time of the last kex */
82 unsigned int datatrans; /* data transmitted since last kex */ 87 unsigned int datatrans; /* data transmitted since last kex */
83 unsigned int datarecv; /* data received since last kex */ 88 unsigned int datarecv; /* data received since last kex */
84 89
85 }; 90 };
86 91
92 #if DROPBEAR_NORMAL_DH
87 struct kex_dh_param { 93 struct kex_dh_param {
88 mp_int pub; /* e */ 94 mp_int pub; /* e */
89 mp_int priv; /* x */ 95 mp_int priv; /* x */
90 }; 96 };
97 #endif
91 98
92 #if DROPBEAR_ECDH 99 #if DROPBEAR_ECDH
93 struct kex_ecdh_param { 100 struct kex_ecdh_param {
94 ecc_key key; 101 ecc_key key;
95 }; 102 };
99 #define CURVE25519_LEN 32 106 #define CURVE25519_LEN 32
100 struct kex_curve25519_param { 107 struct kex_curve25519_param {
101 unsigned char priv[CURVE25519_LEN]; 108 unsigned char priv[CURVE25519_LEN];
102 unsigned char pub[CURVE25519_LEN]; 109 unsigned char pub[CURVE25519_LEN];
103 }; 110 };
104
105 /* No header file for curve25519_donna */
106 int curve25519_donna(unsigned char *out, const unsigned char *secret, const unsigned char *other);
107 #endif 111 #endif
108 112
109 #endif /* DROPBEAR_KEX_H_ */ 113 #endif /* DROPBEAR_KEX_H_ */