Correct AES counter mode, which incorrectly incremented the counter before
using it. PR: 56
This commit is contained in:
parent
6cbe638294
commit
dbdc5d14d3
@ -106,8 +106,8 @@ void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
|||||||
|
|
||||||
while (l--) {
|
while (l--) {
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
AES_ctr128_inc(counter);
|
|
||||||
AES_encrypt(counter, tmp, key);
|
AES_encrypt(counter, tmp, key);
|
||||||
|
AES_ctr128_inc(counter);
|
||||||
}
|
}
|
||||||
*(out++) = *(in++) ^ tmp[n];
|
*(out++) = *(in++) ^ tmp[n];
|
||||||
n = (n+1) % AES_BLOCK_SIZE;
|
n = (n+1) % AES_BLOCK_SIZE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user