Skip to content

Commit da4f854

Browse files
committed
make sure chacha_crypt() can only be called after setting the IV
1 parent 342a10c commit da4f854

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/stream/chacha/chacha_crypt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen,
5757
unsigned long i, j;
5858

5959
if (inlen == 0) return CRYPT_OK; /* nothing to do */
60-
LTC_ARGCHK(st != NULL);
61-
LTC_ARGCHK(in != NULL);
62-
LTC_ARGCHK(out != NULL);
60+
61+
LTC_ARGCHK(st != NULL);
62+
LTC_ARGCHK(in != NULL);
63+
LTC_ARGCHK(out != NULL);
64+
LTC_ARGCHK(st->ivlen != 0);
6365

6466
if (st->ksleft > 0) {
6567
j = MIN(st->ksleft, inlen);

0 commit comments

Comments
 (0)