summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-19 15:21:23 +1100
committerDamien Miller <djm@mindrot.org>2002-02-19 15:21:23 +1100
commit963f6b25e28ff55290ae45f540b7f7148a3622a9 (patch)
tree48d1a96683326594903955672277fe008bf622e4 /kex.c
parent19a59451050446bb8656d1b72a8787e97cd1c99b (diff)
- markus@cvs.openbsd.org 2002/02/14 23:41:01
[authfile.c cipher.c cipher.h kex.c kex.h packet.c] hide some more implementation details of cipher.[ch] and prepares for move to EVP, ok deraadt@
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kex.c b/kex.c
index 02c9780ad..e9f944b05 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kex.c,v 1.44 2002/02/11 16:10:15 markus Exp $"); 26RCSID("$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}
243static void 244static void
244choose_mac(Mac *mac, char *client, char *server) 245choose_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 }