padlen in chacha20poly1305_decrypt

This commit is contained in:
Karel Miko 2017-03-30 17:42:15 +02:00
parent 5797b0cc1e
commit 31b52a354d

View File

@ -29,7 +29,8 @@ int chacha20poly1305_decrypt(chachapoly_state *st, const unsigned char *in, unsi
LTC_ARGCHK(st != NULL);
if (st->aadflg) {
if ((padlen = 16 - (st->aadlen % 16)) < 16) {
padlen = 16 - (st->aadlen % 16);
if (padlen < 16) {
if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err;
}
st->aadflg = 0; /* no more AAD */