summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-10-28 14:19:58 +1100
committerDamien Miller <djm@mindrot.org>2000-10-28 14:19:58 +1100
commit69b69aa50d0effadc8b7e9c564f7a2ee223ac6b5 (patch)
tree4aea8b2b116123812ade69ae73fde80fee8e0f41 /cipher.c
parentc05e01875bab590584f51bbeb464dd23c64f27fa (diff)
- (djm) Sync with OpenBSD:
- markus@cvs.openbsd.org 2000/10/16 15:46:32 [ssh.1] fixes from pekkas@netcore.fi - markus@cvs.openbsd.org 2000/10/17 14:28:11 [atomicio.c] return number of characters processed; ok deraadt@ - markus@cvs.openbsd.org 2000/10/18 12:04:02 [atomicio.c] undo - markus@cvs.openbsd.org 2000/10/18 12:23:02 [scp.c] replace atomicio(read,...) with read(); ok deraadt@ - markus@cvs.openbsd.org 2000/10/18 12:42:00 [session.c] restore old record login behaviour - deraadt@cvs.openbsd.org 2000/10/19 10:41:13 [auth-skey.c] fmt string problem in unused code - provos@cvs.openbsd.org 2000/10/19 10:45:16 [sshconnect2.c] don't reference freed memory. okay deraadt@ - markus@cvs.openbsd.org 2000/10/21 11:04:23 [canohost.c] typo, eramore@era-t.ericsson.se; ok niels@ - markus@cvs.openbsd.org 2000/10/23 13:31:55 [cipher.c] non-alignment dependent swap_bytes(); from simonb@wasabisystems.com/netbsd - markus@cvs.openbsd.org 2000/10/26 12:38:28 [compat.c] add older vandyke products - markus@cvs.openbsd.org 2000/10/27 01:32:19 [channels.c channels.h clientloop.c serverloop.c session.c] [ssh.c util.c] enable non-blocking IO on channels, and tty's (except for the client ttys). - markus@cvs.openbsd.org 2000/10/27 01:48:22 channels.c channels.h clientloop.c deny agent/x11 forwarding unless requested; thanks to jwl@pobox.com
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/cipher.c b/cipher.c
index b9c1b28ab..65cde4732 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.36 2000/10/14 10:01:15 markus Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.37 2000/10/23 19:31:54 markus Exp $");
39 39
40#include "ssh.h" 40#include "ssh.h"
41#include "xmalloc.h" 41#include "xmalloc.h"
@@ -218,28 +218,21 @@ blowfish_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src,
218 * and after encryption/decryption. Thus the swap_bytes stuff (yuk). 218 * and after encryption/decryption. Thus the swap_bytes stuff (yuk).
219 */ 219 */
220static void 220static void
221swap_bytes(const unsigned char *src, unsigned char *dst_, int n) 221swap_bytes(const unsigned char *src, unsigned char *dst, int n)
222{ 222{
223 /* dst must be properly aligned. */ 223 char c[4];
224 u_int32_t *dst = (u_int32_t *) dst_; 224
225 union { 225 /* Process 4 bytes every lap. */
226 u_int32_t i; 226 for (n = n / 4; n > 0; n--) {
227 char c[4]; 227 c[3] = *src++;
228 } t; 228 c[2] = *src++;
229 229 c[1] = *src++;
230 /* Process 8 bytes every lap. */ 230 c[0] = *src++;
231 for (n = n / 8; n > 0; n--) { 231
232 t.c[3] = *src++; 232 *dst++ = c[0];
233 t.c[2] = *src++; 233 *dst++ = c[1];
234 t.c[1] = *src++; 234 *dst++ = c[2];
235 t.c[0] = *src++; 235 *dst++ = c[3];
236 *dst++ = t.i;
237
238 t.c[3] = *src++;
239 t.c[2] = *src++;
240 t.c[1] = *src++;
241 t.c[0] = *src++;
242 *dst++ = t.i;
243 } 236 }
244} 237}
245 238