From 31b52a354d35b7eb35255a40f162841882c1dd91 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Thu, 30 Mar 2017 17:42:15 +0200 Subject: [PATCH] padlen in chacha20poly1305_decrypt --- src/encauth/chachapoly/chacha20poly1305_decrypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/encauth/chachapoly/chacha20poly1305_decrypt.c b/src/encauth/chachapoly/chacha20poly1305_decrypt.c index e62dd6a..bc8b6c1 100644 --- a/src/encauth/chachapoly/chacha20poly1305_decrypt.c +++ b/src/encauth/chachapoly/chacha20poly1305_decrypt.c @@ -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 */