aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2009-03-12 18:38:13 +0000
committerTobias Brunner <tobias@strongswan.org>2009-03-12 18:38:13 +0000
commit6e7c0b1e444d55e389e70a10781553c61aa6b3ea (patch)
treecd75359fa1486ab905e94e4188fe7085ee9a02d9
parentd25ce3701e066121d2026b0dfd72a794f3bbee29 (diff)
downloadstrongswan-6e7c0b1e444d55e389e70a10781553c61aa6b3ea.tar.bz2
strongswan-6e7c0b1e444d55e389e70a10781553c61aa6b3ea.tar.xz
fixing DES ECB decryption
-rw-r--r--src/libstrongswan/plugins/des/des_crypter.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstrongswan/plugins/des/des_crypter.c b/src/libstrongswan/plugins/des/des_crypter.c
index 6709b7a94..51b65a768 100644
--- a/src/libstrongswan/plugins/des/des_crypter.c
+++ b/src/libstrongswan/plugins/des/des_crypter.c
@@ -1128,10 +1128,8 @@ static void des_ecb_encrypt(des_cblock *input, des_cblock *output, long length,
{
for (l-=8; l>=0; l-=8)
{
- c2l(in,tin0);
- c2l(in,tin1);
- tin[0]=tin0;
- tin[1]=tin1;
+ c2l(in,tin0); tin[0]=tin0;
+ c2l(in,tin1); tin[1]=tin1;
des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT);
tout0=tin[0]; l2c(tout0,out);
tout1=tin[1]; l2c(tout1,out);
@@ -1153,14 +1151,16 @@ static void des_ecb_encrypt(des_cblock *input, des_cblock *output, long length,
c2l(in,tin0); tin[0]=tin0;
c2l(in,tin1); tin[1]=tin1;
des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT);
- l2c(tout0,out);
- l2c(tout1,out);
+ tout0=tin[0]; l2c(tout0,out);
+ tout1=tin[1]; l2c(tout1,out);
}
if (l != -8)
{
c2l(in,tin0); tin[0]=tin0;
c2l(in,tin1); tin[1]=tin1;
des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT);
+ tout0=tin[0];
+ tout1=tin[1];
l2cn(tout0,tout1,out,l+8);
}
}