X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fchacha%2Fchacha_enc.c;h=239f68ab825e3f613169075947dfe50a1319bbf8;hb=871c675b8592261abb7de294b40f2c6f7311fa58;hp=13720d0cc5f93366a186645acfd2678eea59052e;hpb=b1322259d93cf6b6286f9febcd468b6a9f577d91;p=oweals%2Fopenssl.git diff --git a/crypto/chacha/chacha_enc.c b/crypto/chacha/chacha_enc.c index 13720d0cc5..239f68ab82 100644 --- a/crypto/chacha/chacha_enc.c +++ b/crypto/chacha/chacha_enc.c @@ -110,8 +110,12 @@ void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, inp += todo; len -= todo; - /* advance counter */ - if (++input[12] == 0) - input[13]++; + /* + * Advance 32-bit counter. Note that as subroutine is so to + * say nonce-agnostic, this limited counter width doesn't + * prevent caller from implementing wider counter. It would + * simply take two calls split on counter overflow... + */ + input[12]++; } }