comparison cli-kex.c @ 1295:750ec4ec4cbe

Convert #ifdef to #if, other build changes
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 May 2016 15:33:40 +0200
parents 56aba7dedbea
children 06d52bcb8094
comparison
equal deleted inserted replaced
1294:56aba7dedbea 1295:750ec4ec4cbe
58 cli_ses.dh_param = gen_kexdh_param(); 58 cli_ses.dh_param = gen_kexdh_param();
59 } 59 }
60 buf_putmpint(ses.writepayload, &cli_ses.dh_param->pub); 60 buf_putmpint(ses.writepayload, &cli_ses.dh_param->pub);
61 break; 61 break;
62 #endif 62 #endif
63 #ifdef DROPBEAR_ECDH 63 #if DROPBEAR_ECDH
64 case DROPBEAR_KEX_ECDH: 64 case DROPBEAR_KEX_ECDH:
65 if (ses.newkeys->algo_kex != cli_ses.param_kex_algo 65 if (ses.newkeys->algo_kex != cli_ses.param_kex_algo
66 || !cli_ses.ecdh_param) { 66 || !cli_ses.ecdh_param) {
67 if (cli_ses.ecdh_param) { 67 if (cli_ses.ecdh_param) {
68 free_kexecdh_param(cli_ses.ecdh_param); 68 free_kexecdh_param(cli_ses.ecdh_param);
70 cli_ses.ecdh_param = gen_kexecdh_param(); 70 cli_ses.ecdh_param = gen_kexecdh_param();
71 } 71 }
72 buf_put_ecc_raw_pubkey_string(ses.writepayload, &cli_ses.ecdh_param->key); 72 buf_put_ecc_raw_pubkey_string(ses.writepayload, &cli_ses.ecdh_param->key);
73 break; 73 break;
74 #endif 74 #endif
75 #ifdef DROPBEAR_CURVE25519 75 #if DROPBEAR_CURVE25519
76 case DROPBEAR_KEX_CURVE25519: 76 case DROPBEAR_KEX_CURVE25519:
77 if (ses.newkeys->algo_kex != cli_ses.param_kex_algo 77 if (ses.newkeys->algo_kex != cli_ses.param_kex_algo
78 || !cli_ses.curve25519_param) { 78 || !cli_ses.curve25519_param) {
79 if (cli_ses.curve25519_param) { 79 if (cli_ses.curve25519_param) {
80 free_kexcurve25519_param(cli_ses.curve25519_param); 80 free_kexcurve25519_param(cli_ses.curve25519_param);
133 kexdh_comb_key(cli_ses.dh_param, &dh_f, hostkey); 133 kexdh_comb_key(cli_ses.dh_param, &dh_f, hostkey);
134 mp_clear(&dh_f); 134 mp_clear(&dh_f);
135 } 135 }
136 break; 136 break;
137 #endif 137 #endif
138 #ifdef DROPBEAR_ECDH 138 #if DROPBEAR_ECDH
139 case DROPBEAR_KEX_ECDH: 139 case DROPBEAR_KEX_ECDH:
140 { 140 {
141 buffer *ecdh_qs = buf_getstringbuf(ses.payload); 141 buffer *ecdh_qs = buf_getstringbuf(ses.payload);
142 kexecdh_comb_key(cli_ses.ecdh_param, ecdh_qs, hostkey); 142 kexecdh_comb_key(cli_ses.ecdh_param, ecdh_qs, hostkey);
143 buf_free(ecdh_qs); 143 buf_free(ecdh_qs);
144 } 144 }
145 break; 145 break;
146 #endif 146 #endif
147 #ifdef DROPBEAR_CURVE25519 147 #if DROPBEAR_CURVE25519
148 case DROPBEAR_KEX_CURVE25519: 148 case DROPBEAR_KEX_CURVE25519:
149 { 149 {
150 buffer *ecdh_qs = buf_getstringbuf(ses.payload); 150 buffer *ecdh_qs = buf_getstringbuf(ses.payload);
151 kexcurve25519_comb_key(cli_ses.curve25519_param, ecdh_qs, hostkey); 151 kexcurve25519_comb_key(cli_ses.curve25519_param, ecdh_qs, hostkey);
152 buf_free(ecdh_qs); 152 buf_free(ecdh_qs);
157 157
158 if (cli_ses.dh_param) { 158 if (cli_ses.dh_param) {
159 free_kexdh_param(cli_ses.dh_param); 159 free_kexdh_param(cli_ses.dh_param);
160 cli_ses.dh_param = NULL; 160 cli_ses.dh_param = NULL;
161 } 161 }
162 #ifdef DROPBEAR_ECDH 162 #if DROPBEAR_ECDH
163 if (cli_ses.ecdh_param) { 163 if (cli_ses.ecdh_param) {
164 free_kexecdh_param(cli_ses.ecdh_param); 164 free_kexecdh_param(cli_ses.ecdh_param);
165 cli_ses.ecdh_param = NULL; 165 cli_ses.ecdh_param = NULL;
166 } 166 }
167 #endif 167 #endif
168 #ifdef DROPBEAR_CURVE25519 168 #if DROPBEAR_CURVE25519
169 if (cli_ses.curve25519_param) { 169 if (cli_ses.curve25519_param) {
170 free_kexcurve25519_param(cli_ses.curve25519_param); 170 free_kexcurve25519_param(cli_ses.curve25519_param);
171 cli_ses.curve25519_param = NULL; 171 cli_ses.curve25519_param = NULL;
172 } 172 }
173 #endif 173 #endif