Use BF_ecb_encrypt() instead of using BF_encrypt()/BF_decrypt()

directly.  Reviewed by itojun.
This commit is contained in:
thorpej 2003-08-27 00:08:31 +00:00
parent 24b18cc20a
commit 7b613a568e
1 changed files with 4 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_core.c,v 1.32 2003/08/26 16:37:37 thorpej Exp $ */
/* $NetBSD: esp_core.c,v 1.33 2003/08/27 00:08:31 thorpej Exp $ */
/* $KAME: esp_core.c,v 1.53 2001/11/27 09:47:30 sakane Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esp_core.c,v 1.32 2003/08/26 16:37:37 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: esp_core.c,v 1.33 2003/08/27 00:08:31 thorpej Exp $");
#include "opt_inet.h"
@ -481,16 +481,8 @@ esp_blowfish_blockdecrypt(algo, sav, s, d)
u_int8_t *s;
u_int8_t *d;
{
/* HOLY COW! BF_decrypt() takes values in host byteorder */
BF_LONG t[2];
bcopy(s, t, sizeof(t));
t[0] = ntohl(t[0]);
t[1] = ntohl(t[1]);
BF_decrypt(t, (BF_KEY *)sav->sched);
t[0] = htonl(t[0]);
t[1] = htonl(t[1]);
bcopy(t, d, sizeof(t));
BF_ecb_encrypt(s, d, (BF_KEY *)sav->sched, 0);
return 0;
}
@ -501,16 +493,8 @@ esp_blowfish_blockencrypt(algo, sav, s, d)
u_int8_t *s;
u_int8_t *d;
{
/* HOLY COW! BF_encrypt() takes values in host byteorder */
BF_LONG t[2];
bcopy(s, t, sizeof(t));
t[0] = ntohl(t[0]);
t[1] = ntohl(t[1]);
BF_encrypt(t, (BF_KEY *)sav->sched);
t[0] = htonl(t[0]);
t[1] = htonl(t[1]);
bcopy(t, d, sizeof(t));
BF_ecb_encrypt(s, d, (BF_KEY *)sav->sched, 1);
return 0;
}