diff options
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.44 2002/02/11 16:10:15 markus Exp $"); | 26 | RCSID("$OpenBSD: kex.c,v 1.45 2002/02/14 23:41:01 markus Exp $"); |
27 | 27 | ||
28 | #include <openssl/crypto.h> | 28 | #include <openssl/crypto.h> |
29 | 29 | ||
@@ -232,13 +232,14 @@ choose_enc(Enc *enc, char *client, char *server) | |||
232 | char *name = match_list(client, server, NULL); | 232 | char *name = match_list(client, server, NULL); |
233 | if (name == NULL) | 233 | if (name == NULL) |
234 | fatal("no matching cipher found: client %s server %s", client, server); | 234 | fatal("no matching cipher found: client %s server %s", client, server); |
235 | enc->cipher = cipher_by_name(name); | 235 | if ((enc->cipher = cipher_by_name(name)) == NULL) |
236 | if (enc->cipher == NULL) | ||
237 | fatal("matching cipher is not supported: %s", name); | 236 | fatal("matching cipher is not supported: %s", name); |
238 | enc->name = name; | 237 | enc->name = name; |
239 | enc->enabled = 0; | 238 | enc->enabled = 0; |
240 | enc->iv = NULL; | 239 | enc->iv = NULL; |
241 | enc->key = NULL; | 240 | enc->key = NULL; |
241 | enc->key_len = cipher_keylen(enc->cipher); | ||
242 | enc->block_size = cipher_blocksize(enc->cipher); | ||
242 | } | 243 | } |
243 | static void | 244 | static void |
244 | choose_mac(Mac *mac, char *client, char *server) | 245 | choose_mac(Mac *mac, char *client, char *server) |
@@ -341,10 +342,10 @@ kex_choose_conf(Kex *kex) | |||
341 | need = 0; | 342 | need = 0; |
342 | for (mode = 0; mode < MODE_MAX; mode++) { | 343 | for (mode = 0; mode < MODE_MAX; mode++) { |
343 | newkeys = kex->newkeys[mode]; | 344 | newkeys = kex->newkeys[mode]; |
344 | if (need < newkeys->enc.cipher->key_len) | 345 | if (need < newkeys->enc.key_len) |
345 | need = newkeys->enc.cipher->key_len; | 346 | need = newkeys->enc.key_len; |
346 | if (need < newkeys->enc.cipher->block_size) | 347 | if (need < newkeys->enc.block_size) |
347 | need = newkeys->enc.cipher->block_size; | 348 | need = newkeys->enc.block_size; |
348 | if (need < newkeys->mac.key_len) | 349 | if (need < newkeys->mac.key_len) |
349 | need = newkeys->mac.key_len; | 350 | need = newkeys->mac.key_len; |
350 | } | 351 | } |