I keep forgetting to fix this: update the IV! Most important!
This commit is contained in:
parent
233bf734d3
commit
05861c77e7
2 changed files with 9 additions and 0 deletions
3
CHANGES
3
CHANGES
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
Changes between 0.9.3a and 0.9.4
|
Changes between 0.9.3a and 0.9.4
|
||||||
|
|
||||||
|
*) DES CBC did not update the IV. Weird.
|
||||||
|
[Ben Laurie]
|
||||||
|
|
||||||
*) When bntest is run from "make test" it drives bc to check its
|
*) When bntest is run from "make test" it drives bc to check its
|
||||||
calculations, as well as internally checking them. If an internal check
|
calculations, as well as internally checking them. If an internal check
|
||||||
fails, it needs to cause bc to give a non-zero result or make test carries
|
fails, it needs to cause bc to give a non-zero result or make test carries
|
||||||
|
|
|
@ -94,6 +94,9 @@ void des_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||||
tout0=tin[0]; l2c(tout0,out);
|
tout0=tin[0]; l2c(tout0,out);
|
||||||
tout1=tin[1]; l2c(tout1,out);
|
tout1=tin[1]; l2c(tout1,out);
|
||||||
}
|
}
|
||||||
|
iv = &(*ivec)[0];
|
||||||
|
l2c(tout0,iv);
|
||||||
|
l2c(tout1,iv);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -122,6 +125,9 @@ void des_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||||
/* xor0=tin0;
|
/* xor0=tin0;
|
||||||
xor1=tin1; */
|
xor1=tin1; */
|
||||||
}
|
}
|
||||||
|
iv = &(*ivec)[0];
|
||||||
|
l2c(xor0,iv);
|
||||||
|
l2c(xor1,iv);
|
||||||
}
|
}
|
||||||
tin0=tin1=tout0=tout1=xor0=xor1=0;
|
tin0=tin1=tout0=tout1=xor0=xor1=0;
|
||||||
tin[0]=tin[1]=0;
|
tin[0]=tin[1]=0;
|
||||||
|
|
Loading…
Reference in a new issue