Commit 6c98ed52 authored by Richard Levitte's avatar Richard Levitte
Browse files

Correct AES counter mode, which incorrectly incremented the counter before

using it.
PR: 56
parent 37ceea73
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,8 +106,8 @@ void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,

	while (l--) {
		if (n == 0) {
			AES_ctr128_inc(counter);
			AES_encrypt(counter, tmp, key);
			AES_ctr128_inc(counter);
		}
		*(out++) = *(in++) ^ tmp[n];
		n = (n+1) % AES_BLOCK_SIZE;