crypto/evp/e_chacha20_poly1305.c:145: error: INTEGER_OVERFLOW_L2
  ([1, 17179869184] - [1, 64]):unsigned64 by call to `ChaCha20_ctr32`.
Showing all 8 steps of the trace


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:145:9: Call
143.           }
144.           blocks *= CHACHA_BLK_SIZE;
145.           ChaCha20_ctr32(out, inp, blocks, key->key.d, key->counter);
               ^
146.           len -= blocks;
147.           inp += blocks;

crypto/chacha/chacha_enc.c:112:1: <LHS trace>
110.   }
111.   
112. > void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
113.                       size_t len, const unsigned int key[8],
114.                       const unsigned int counter[4])

crypto/chacha/chacha_enc.c:112:1: Parameter `len`
  110.   }
  111.   
  112. > void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
  113.                       size_t len, const unsigned int key[8],
  114.                       const unsigned int counter[4])

crypto/chacha/chacha_enc.c:112:1: <RHS trace>
110.   }
111.   
112. > void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
113.                       size_t len, const unsigned int key[8],
114.                       const unsigned int counter[4])

crypto/chacha/chacha_enc.c:112:1: Parameter `len`
  110.   }
  111.   
  112. > void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
  113.                       size_t len, const unsigned int key[8],
  114.                       const unsigned int counter[4])

crypto/chacha/chacha_enc.c:151:9: Binary operation: ([1, 17179869184] - [1, 64]):unsigned64 by call to `ChaCha20_ctr32` 
  149.           out += todo;
  150.           inp += todo;
  151.           len -= todo;
                 ^
  152.   
  153.           /* advance counter */

void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
                    size_t len, const unsigned int key[8],
                    const unsigned int counter[4])
{
    u32 input[16];
    chacha_buf buf;
    size_t todo, i;
    input[0] = ((u32)'e') | ((u32)'x'<<8) | ((u32)'p'<<16) | ((u32)'a'<<24);
    input[1] = ((u32)'n') | ((u32)'d'<<8) | ((u32)' '<<16) | ((u32)'3'<<24);
    input[2] = ((u32)'2') | ((u32)'-'<<8) | ((u32)'b'<<16) | ((u32)'y'<<24);
    input[3] = ((u32)'t') | ((u32)'e'<<8) | ((u32)' '<<16) | ((u32)'k'<<24);
    input[4] = key[0];
    input[5] = key[1];
    input[6] = key[2];
    input[7] = key[3];
    input[8] = key[4];
    input[9] = key[5];
    input[10] = key[6];
    input[11] = key[7];
    input[12] = counter[0];
    input[13] = counter[1];
    input[14] = counter[2];
    input[15] = counter[3];
    while (len > 0) {
        todo = sizeof(buf);
        if (len < todo)
            todo = len;
        chacha20_core(&buf, input);
        for (i = 0; i < todo; i++)
            out[i] = inp[i] ^ buf.c[i];
        out += todo;
        inp += todo;
        len -= todo;
        if (++input[12] == 0)
            input[13]++;
    }
}
['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}', "void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,\n                    size_t len, const unsigned int key[8],\n                    const unsigned int counter[4])\n{\n    u32 input[16];\n    chacha_buf buf;\n    size_t todo, i;\n    input[0] = ((u32)'e') | ((u32)'x'<<8) | ((u32)'p'<<16) | ((u32)'a'<<24);\n    input[1] = ((u32)'n') | ((u32)'d'<<8) | ((u32)' '<<16) | ((u32)'3'<<24);\n    input[2] = ((u32)'2') | ((u32)'-'<<8) | ((u32)'b'<<16) | ((u32)'y'<<24);\n    input[3] = ((u32)'t') | ((u32)'e'<<8) | ((u32)' '<<16) | ((u32)'k'<<24);\n    input[4] = key[0];\n    input[5] = key[1];\n    input[6] = key[2];\n    input[7] = key[3];\n    input[8] = key[4];\n    input[9] = key[5];\n    input[10] = key[6];\n    input[11] = key[7];\n    input[12] = counter[0];\n    input[13] = counter[1];\n    input[14] = counter[2];\n    input[15] = counter[3];\n    while (len > 0) {\n        todo = sizeof(buf);\n        if (len < todo)\n            todo = len;\n        chacha20_core(&buf, input);\n        for (i = 0; i < todo; i++)\n            out[i] = inp[i] ^ buf.c[i];\n        out += todo;\n        inp += todo;\n        len -= todo;\n        if (++input[12] == 0)\n            input[13]++;\n    }\n}"]