summaryrefslogtreecommitdiffstats
path: root/crypto/aes/aes_ctr.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-10-11 22:42:34 +0000
committerRichard Levitte <levitte@openssl.org>2002-10-11 22:42:34 +0000
commit4006c56036b1a2613acc77ff60c3c71e62aae962 (patch)
tree880fb2788e45dcb13a7fdefb70dfbbd08b927e90 /crypto/aes/aes_ctr.c
parent1729588435f4c380f4c3c61e2ee6515cffc6d4ba (diff)
Add more commentary. Check that *num is smaller than the block size.
Diffstat (limited to 'crypto/aes/aes_ctr.c')
-rw-r--r--crypto/aes/aes_ctr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/aes/aes_ctr.c b/crypto/aes/aes_ctr.c
index 6a89f4def2..142ca4a142 100644
--- a/crypto/aes/aes_ctr.c
+++ b/crypto/aes/aes_ctr.c
@@ -90,7 +90,10 @@ static void AES_ctr128_inc(unsigned char *counter) {
/* The input encrypted as though 128bit counter mode is being
* used. The extra state information to record how much of the
- * 128bit block we have used is contained in *num;
+ * 128bit block we have used is contained in *num, and the
+ * encrypted counter is kept in ecount_buf. Both *num and
+ * ecount_buf must be initialised with zeros before the first
+ * call to AES_ctr128_encrypt().
*/
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
const unsigned long length, const AES_KEY *key,
@@ -102,6 +105,7 @@ void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
unsigned long l=length;
assert(in && out && key && counter && num);
+ assert(*num < AES_BLOCK_SIZE);
n = *num;