summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-09-10 22:26:17 +1000
committerDamien Miller <djm@mindrot.org>2002-09-10 22:26:17 +1000
commitc34e03e4711cabffae3504bcfdac26b67250c45d (patch)
tree553d6d95bc205aca9b207be241b3d6f467e0e93e /cipher.c
parente9994cb4d77d36f54af146a9ca0ea4db03b861b6 (diff)
downloadopenssh-git-c34e03e4711cabffae3504bcfdac26b67250c45d.tar.gz
- (djm) Bug #138: Make protocol 1 blowfish work with old OpenSSL.
Patch from Robert Halubek <rob@adso.com.pl>
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/cipher.c b/cipher.c
index 9e8ef999..1933d3ea 100644
--- a/cipher.c
+++ b/cipher.c
@@ -437,6 +437,18 @@ swap_bytes(const u_char *src, u_char *dst, int n)
}
}
+#ifdef SSH_OLD_EVP
+static void bf_ssh1_init (EVP_CIPHER_CTX * ctx, const unsigned char *key,
+ const unsigned char *iv, int enc)
+{
+ if (iv != NULL)
+ memcpy (&(ctx->oiv[0]), iv, 8);
+ memcpy (&(ctx->iv[0]), &(ctx->oiv[0]), 8);
+ if (key != NULL)
+ BF_set_key (&(ctx->c.bf_ks), EVP_CIPHER_CTX_key_length (ctx),
+ key);
+}
+#endif
static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL;
static int
@@ -458,6 +470,9 @@ evp_ssh1_bf(void)
memcpy(&ssh1_bf, EVP_bf_cbc(), sizeof(EVP_CIPHER));
orig_bf = ssh1_bf.do_cipher;
ssh1_bf.nid = NID_undef;
+#ifdef SSH_OLD_EVP
+ ssh1_bf.init = bf_ssh1_init;
+#endif
ssh1_bf.do_cipher = bf_ssh1_cipher;
ssh1_bf.key_len = 32;
return (&ssh1_bf);