diff options
author | 2000-06-18 19:08:44 +0000 | |
---|---|---|
committer | 2000-06-18 19:08:44 +0000 | |
commit | cbc3e3f5f409385689258dc4e6cb5010b17fff6b (patch) | |
tree | 5b6365cac5e41109f5f01febe8ed8e901faac710 | |
parent | remove remains from NRL ipsec code (diff) | |
download | wireguard-openbsd-cbc3e3f5f409385689258dc4e6cb5010b17fff6b.tar.xz wireguard-openbsd-cbc3e3f5f409385689258dc4e6cb5010b17fff6b.zip |
fix 3des decryption
-rw-r--r-- | sys/miscfs/tcfs/tcfs_cipher_TDES.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/miscfs/tcfs/tcfs_cipher_TDES.c b/sys/miscfs/tcfs/tcfs_cipher_TDES.c index 4e88df37929..8c186528306 100644 --- a/sys/miscfs/tcfs/tcfs_cipher_TDES.c +++ b/sys/miscfs/tcfs/tcfs_cipher_TDES.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcfs_cipher_TDES.c,v 1.4 2000/06/18 16:23:10 provos Exp $ */ +/* $OpenBSD: tcfs_cipher_TDES.c,v 1.5 2000/06/18 19:08:44 provos Exp $ */ /* * Copyright 2000 The TCFS Project at http://tcfs.dia.unisa.it/ * All rights reserved. @@ -45,10 +45,10 @@ TDES_init_key (char *key) char digest[16]; MD5_CTX ctx; int i; - /* Fold the bigger key into a Triple-DES suitable one */ bcopy (key, dkey, sizeof(dkey)); + MD5Init(&ctx); MD5Update(&ctx, key, KEYSIZE); MD5Final(digest, &ctx); @@ -90,13 +90,13 @@ TDES_encrypt(char *block, int nb, void *key) xi = (u_int32_t *)block; tmp = block; des_ecb3_encrypt((des_cblock *)tmp, (des_cblock *)tmp, - ks[0], ks[1], ks[2],DES_ENCRYPT); + ks[2], ks[1], ks[0], DES_ENCRYPT); tmp += 8; - for (i = 1;i < nb/8;i++) { + for (i = 1;i < nb/8; i++) { *(xi+2) ^= *xi; *(xi+3) ^= *(xi + 1); des_ecb3_encrypt((des_cblock *)tmp, (des_cblock *)tmp, - ks[0], ks[1], ks[2], DES_ENCRYPT); + ks[2], ks[1], ks[0], DES_ENCRYPT); tmp += 8; xi += 2; } |