crypto/evp/e_chacha20_poly1305.c:146: error: INTEGER_OVERFLOW_L2
  ([64, +oo] - [-17179868992, 17179869184]):unsigned64.
Showing all 7 steps of the trace


crypto/evp/e_chacha20_poly1305.c:96:1: <LHS trace>
94.   }
95.   
96. > static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out,
97.                            const unsigned char *inp, size_t len)
98.   {

crypto/evp/e_chacha20_poly1305.c:96:1: Parameter `len`
94.   }
95.   
96. > static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out,
97.                            const unsigned char *inp, size_t len)
98.   {

crypto/evp/e_chacha20_poly1305.c:121:5: Assignment
119.   
120.       rem = (unsigned int)(len % CHACHA_BLK_SIZE);
121.       len -= rem;
           ^
122.       ctr32 = key->counter[0];
123.       while (len >= CHACHA_BLK_SIZE) {

crypto/evp/e_chacha20_poly1305.c:131:13: <RHS trace>
129.            */
130.           if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
131.               blocks = (1U<<28);
                   ^
132.   
133.           /*

crypto/evp/e_chacha20_poly1305.c:131:13: Assignment
129.            */
130.           if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
131.               blocks = (1U<<28);
                   ^
132.   
133.           /*

crypto/evp/e_chacha20_poly1305.c:144:9: Assignment
142.               ctr32 = 0;
143.           }
144.           blocks *= CHACHA_BLK_SIZE;
               ^
145.           ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter);
146.           len -= blocks;

crypto/evp/e_chacha20_poly1305.c:146:9: Binary operation: ([64, +oo] - [-17179868992, 17179869184]):unsigned64
144.           blocks *= CHACHA_BLK_SIZE;
145.           ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter);
146.           len -= blocks;
               ^
147.           inp += blocks;
148.           out += blocks;

static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out,
                         const unsigned char *inp, size_t len)
{
    EVP_CHACHA_KEY *key = data(ctx);
    unsigned int n, rem, ctr32;
    if ((n = key->partial_len)) {
        while (len && n < CHACHA_BLK_SIZE) {
            *out++ = *inp++ ^ key->buf[n++];
            len--;
        }
        key->partial_len = n;
        if (len == 0)
            return 1;
        if (n == CHACHA_BLK_SIZE) {
            key->partial_len = 0;
            key->counter[0]++;
            if (key->counter[0] == 0)
                key->counter[1]++;
        }
    }
    rem = (unsigned int)(len % CHACHA_BLK_SIZE);
    len -= rem;
    ctr32 = key->counter[0];
    while (len >= CHACHA_BLK_SIZE) {
        size_t blocks = len / CHACHA_BLK_SIZE;
        if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
            blocks = (1U<<28);
        ctr32 += (unsigned int)blocks;
        if (ctr32 < blocks) {
            blocks -= ctr32;
            ctr32 = 0;
        }
        blocks *= CHACHA_BLK_SIZE;
        ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter);
        len -= blocks;
        inp += blocks;
        out += blocks;
        key->counter[0] = ctr32;
        if (ctr32 == 0) key->counter[1]++;
    }
    if (rem) {
        memset(key->buf, 0, sizeof(key->buf));
        ChaCha20_ctr32(key->buf, key->buf, CHACHA_BLK_SIZE,
                       key->key.d, key->counter);
        for (n = 0; n < rem; n++)
            out[n] = inp[n] ^ key->buf[n];
        key->partial_len = rem;
    }
    return 1;
}
['static int chacha_cipher(EVP_CIPHER_CTX * ctx, unsigned char *out,\n                         const unsigned char *inp, size_t len)\n{\n    EVP_CHACHA_KEY *key = data(ctx);\n    unsigned int n, rem, ctr32;\n    if ((n = key->partial_len)) {\n        while (len && n < CHACHA_BLK_SIZE) {\n            *out++ = *inp++ ^ key->buf[n++];\n            len--;\n        }\n        key->partial_len = n;\n        if (len == 0)\n            return 1;\n        if (n == CHACHA_BLK_SIZE) {\n            key->partial_len = 0;\n            key->counter[0]++;\n            if (key->counter[0] == 0)\n                key->counter[1]++;\n        }\n    }\n    rem = (unsigned int)(len % CHACHA_BLK_SIZE);\n    len -= rem;\n    ctr32 = key->counter[0];\n    while (len >= CHACHA_BLK_SIZE) {\n        size_t blocks = len / CHACHA_BLK_SIZE;\n        if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))\n            blocks = (1U<<28);\n        ctr32 += (unsigned int)blocks;\n        if (ctr32 < blocks) {\n            blocks -= ctr32;\n            ctr32 = 0;\n        }\n        blocks *= CHACHA_BLK_SIZE;\n        ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter);\n        len -= blocks;\n        inp += blocks;\n        out += blocks;\n        key->counter[0] = ctr32;\n        if (ctr32 == 0) key->counter[1]++;\n    }\n    if (rem) {\n        memset(key->buf, 0, sizeof(key->buf));\n        ChaCha20_ctr32(key->buf, key->buf, CHACHA_BLK_SIZE,\n                       key->key.d, key->counter);\n        for (n = 0; n < rem; n++)\n            out[n] = inp[n] ^ key->buf[n];\n        key->partial_len = rem;\n    }\n    return 1;\n}']