summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2000-12-02 19:03:54 +0000
committerBen Lindstrom <mouring@eviladmin.org>2000-12-02 19:03:54 +0000
commitc72745afa96a87d41a22804f48499db12d95dfcd (patch)
treef4c529e4effe1a7f0c9b818bd198a305c73efeb9 /cipher.c
parenta15e39b05fa013e16bbe293244cb49b0f27e2901 (diff)
20001203
- (bal) OpenBSD CVS updates: - markus@cvs.openbsd.org 2000/11/30 22:54:31 [channels.c] debug->warn if tried to do -R style fwd w/o client requesting this; ok neils@ - markus@cvs.openbsd.org 2000/11/29 20:39:17 [cipher.c] des_cbc_encrypt -> des_ncbc_encrypt since it already updates the IV - markus@cvs.openbsd.org 2000/11/30 18:33:05 [ssh-agent.c] agents must not dump core, ok niels@ - markus@cvs.openbsd.org 2000/11/30 07:04:02 [ssh.1] T is for both protocols - markus@cvs.openbsd.org 2000/12/01 00:00:51 [ssh.1] typo; from green@FreeBSD.org - markus@cvs.openbsd.org 2000/11/30 07:02:35 [ssh.c] check -T before isatty() - provos@cvs.openbsd.org 2000/11/29 13:51:27 [sshconnect.c] show IP address and hostname when new key is encountered. okay markus@ - markus@cvs.openbsd.org 2000/11/30 22:53:35 [sshconnect.c] disable agent/x11/port fwding if hostkey has changed; ok niels@ - marksu@cvs.openbsd.org 2000/11/29 21:11:59 [sshd.c] sshd -D, startup w/o deamon(), for monitoring scripts or inittab; from handler@sub-rosa.com and eric@urbanrange.com; ok niels@
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/cipher.c b/cipher.c
index 65cde4732..f9091453e 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.37 2000/10/23 19:31:54 markus Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.38 2000/11/29 20:39:17 markus Exp $");
39 39
40#include "ssh.h" 40#include "ssh.h"
41#include "xmalloc.h" 41#include "xmalloc.h"
@@ -154,14 +154,9 @@ des3_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src,
154 154
155 memcpy(&iv1, iv2, 8); 155 memcpy(&iv1, iv2, 8);
156 156
157 des_cbc_encrypt(src, dest, len, cc->u.des3.key1, &iv1, DES_ENCRYPT); 157 des_ncbc_encrypt(src, dest, len, cc->u.des3.key1, &iv1, DES_ENCRYPT);
158 memcpy(&iv1, dest + len - 8, 8); 158 des_ncbc_encrypt(dest, dest, len, cc->u.des3.key2, iv2, DES_DECRYPT);
159 159 des_ncbc_encrypt(dest, dest, len, cc->u.des3.key3, iv3, DES_ENCRYPT);
160 des_cbc_encrypt(dest, dest, len, cc->u.des3.key2, iv2, DES_DECRYPT);
161 memcpy(iv2, &iv1, 8); /* Note how iv1 == iv2 on entry and exit. */
162
163 des_cbc_encrypt(dest, dest, len, cc->u.des3.key3, iv3, DES_ENCRYPT);
164 memcpy(iv3, dest + len - 8, 8);
165} 160}
166void 161void
167des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, 162des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src,
@@ -173,15 +168,9 @@ des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src,
173 168
174 memcpy(&iv1, iv2, 8); 169 memcpy(&iv1, iv2, 8);
175 170
176 des_cbc_encrypt(src, dest, len, cc->u.des3.key3, iv3, DES_DECRYPT); 171 des_ncbc_encrypt(src, dest, len, cc->u.des3.key3, iv3, DES_DECRYPT);
177 memcpy(iv3, src + len - 8, 8); 172 des_ncbc_encrypt(dest, dest, len, cc->u.des3.key2, iv2, DES_ENCRYPT);
178 173 des_ncbc_encrypt(dest, dest, len, cc->u.des3.key1, &iv1, DES_DECRYPT);
179 des_cbc_encrypt(dest, dest, len, cc->u.des3.key2, iv2, DES_ENCRYPT);
180 memcpy(iv2, dest + len - 8, 8);
181
182 des_cbc_encrypt(dest, dest, len, cc->u.des3.key1, &iv1, DES_DECRYPT);
183 /* memcpy(&iv1, iv2, 8); */
184 /* Note how iv1 == iv2 on entry and exit. */
185} 174}
186 175
187/* Blowfish */ 176/* Blowfish */