summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
committerColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
commit6d5a72bc1d98a42ba42f082e50a22e911c1d82d3 (patch)
tree1bf23174bdb6fc71e2846dda0eca195a418484e7 /cipher.c
parent2ee26b431f98cf1dc0e4fb9809ad1e0c879b8c08 (diff)
parent58657d96514cd6f16d82add8d6f4adbb36765758 (diff)
Debian release 3.5p1-1.
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/cipher.c b/cipher.c
index 6db340d7a..1933d3eab 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: cipher.c,v 1.60 2002/06/23 03:26:52 deraadt Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.61 2002/07/12 15:50:17 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "log.h" 41#include "log.h"
@@ -437,6 +437,18 @@ swap_bytes(const u_char *src, u_char *dst, int n)
437 } 437 }
438} 438}
439 439
440#ifdef SSH_OLD_EVP
441static void bf_ssh1_init (EVP_CIPHER_CTX * ctx, const unsigned char *key,
442 const unsigned char *iv, int enc)
443{
444 if (iv != NULL)
445 memcpy (&(ctx->oiv[0]), iv, 8);
446 memcpy (&(ctx->iv[0]), &(ctx->oiv[0]), 8);
447 if (key != NULL)
448 BF_set_key (&(ctx->c.bf_ks), EVP_CIPHER_CTX_key_length (ctx),
449 key);
450}
451#endif
440static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; 452static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL;
441 453
442static int 454static int
@@ -458,6 +470,9 @@ evp_ssh1_bf(void)
458 memcpy(&ssh1_bf, EVP_bf_cbc(), sizeof(EVP_CIPHER)); 470 memcpy(&ssh1_bf, EVP_bf_cbc(), sizeof(EVP_CIPHER));
459 orig_bf = ssh1_bf.do_cipher; 471 orig_bf = ssh1_bf.do_cipher;
460 ssh1_bf.nid = NID_undef; 472 ssh1_bf.nid = NID_undef;
473#ifdef SSH_OLD_EVP
474 ssh1_bf.init = bf_ssh1_init;
475#endif
461 ssh1_bf.do_cipher = bf_ssh1_cipher; 476 ssh1_bf.do_cipher = bf_ssh1_cipher;
462 ssh1_bf.key_len = 32; 477 ssh1_bf.key_len = 32;
463 return (&ssh1_bf); 478 return (&ssh1_bf);
@@ -567,7 +582,7 @@ evp_rijndael(void)
567 rijndal_cbc.do_cipher = ssh_rijndael_cbc; 582 rijndal_cbc.do_cipher = ssh_rijndael_cbc;
568#ifndef SSH_OLD_EVP 583#ifndef SSH_OLD_EVP
569 rijndal_cbc.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | 584 rijndal_cbc.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH |
570 EVP_CIPH_ALWAYS_CALL_INIT; 585 EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV;
571#endif 586#endif
572 return (&rijndal_cbc); 587 return (&rijndal_cbc);
573} 588}