diff --git a/src/ltc/stream/rabbit/rabbit.c b/src/ltc/stream/rabbit/rabbit.c index ffc38ba..dffe24e 100644 --- a/src/ltc/stream/rabbit/rabbit.c +++ b/src/ltc/stream/rabbit/rabbit.c @@ -211,8 +211,7 @@ st->work_ctx.c[i] = st->master_ctx.c[i]; } st->work_ctx.carry = st->master_ctx.carry; - - /* reset keystream buffer and unused count */ + /* ...and prepare block for crypt() */ XMEMSET(&(st->block), 0, sizeof(st->block)); st->unused = 0; @@ -228,11 +227,11 @@ unsigned char tmpiv[8] = {0}; LTC_ARGCHK(st != NULL); + LTC_ARGCHK(iv != NULL || ivlen == 0); LTC_ARGCHK(ivlen <= 8); - LTC_ARGCHK(iv != NULL || ivlen == 0); /* pad iv in tmpiv */ - if (ivlen > 0) XMEMCPY(tmpiv, iv, ivlen); + if (iv && ivlen > 0) XMEMCPY(tmpiv, iv, ivlen); /* Generate four subvectors */ LOAD32L(i0, tmpiv+0);