test/poly1305_internal_test.c:1571: error: INTEGER_OVERFLOW_L2
  ([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update`.
Showing all 8 steps of the trace


test/poly1305_internal_test.c:1561:5: Assignment
1559.       const TESTDATA test = tests[idx];
1560.       const unsigned char *in = test.input.data;
1561.       size_t inlen = test.input.size;
            ^
1562.       const unsigned char *key = test.key.data;
1563.       const unsigned char *expected = test.expected.data;

test/poly1305_internal_test.c:1571:5: Call
1569.   
1570.       Poly1305_Init(&poly1305, key);
1571.       Poly1305_Update(&poly1305, in, inlen);
            ^
1572.       Poly1305_Final(&poly1305, out);
1573.   

crypto/poly1305/poly1305.c:471:1: <LHS trace>
469.   #endif
470.   
471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
472.   {
473.   #ifdef POLY1305_ASM

crypto/poly1305/poly1305.c:471:1: Parameter `len`
  469.   #endif
  470.   
  471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
  472.   {
  473.   #ifdef POLY1305_ASM

crypto/poly1305/poly1305.c:471:1: <RHS trace>
469.   #endif
470.   
471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
472.   {
473.   #ifdef POLY1305_ASM

crypto/poly1305/poly1305.c:471:1: Parameter `len`
  469.   #endif
  470.   
  471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
  472.   {
  473.   #ifdef POLY1305_ASM

crypto/poly1305/poly1305.c:499:5: Assignment
  497.       }
  498.   
  499.       rem = len % POLY1305_BLOCK_SIZE;
             ^
  500.       len -= rem;
  501.   

crypto/poly1305/poly1305.c:500:5: Binary operation: ([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update` 
  498.   
  499.       rem = len % POLY1305_BLOCK_SIZE;
  500.       len -= rem;
             ^
  501.   
  502.       if (len >= POLY1305_BLOCK_SIZE) {

void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
{
#ifdef POLY1305_ASM
    poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;
#endif
    size_t rem, num;
    if ((num = ctx->num)) {
        rem = POLY1305_BLOCK_SIZE - num;
        if (len >= rem) {
            memcpy(ctx->data + num, inp, rem);
            poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
            inp += rem;
            len -= rem;
        } else {
            memcpy(ctx->data + num, inp, len);
            ctx->num = num + len;
            return;
        }
    }
    rem = len % POLY1305_BLOCK_SIZE;
    len -= rem;
    if (len >= POLY1305_BLOCK_SIZE) {
        poly1305_blocks(ctx->opaque, inp, len, 1);
        inp += len;
    }
    if (rem)
        memcpy(ctx->data, inp, rem);
    ctx->num = rem;
}
['static int test_poly1305(int idx)\n{\n    POLY1305 poly1305;\n    const TESTDATA test = tests[idx];\n    const unsigned char *in = test.input.data;\n    size_t inlen = test.input.size;\n    const unsigned char *key = test.key.data;\n    const unsigned char *expected = test.expected.data;\n    size_t expectedlen = test.expected.size;\n    unsigned char out[16];\n    if (expectedlen != sizeof(out))\n        return 0;\n    Poly1305_Init(&poly1305, key);\n    Poly1305_Update(&poly1305, in, inlen);\n    Poly1305_Final(&poly1305, out);\n    if (memcmp(out, expected, expectedlen) != 0) {\n        fprintf(stderr, "Poly1305 test #%d failed.\\n", idx);\n        fprintf(stderr, "got:      ");\n        hexdump(out, sizeof(out));\n        fprintf(stderr, "\\nexpected: ");\n        hexdump(expected, expectedlen);\n        fprintf(stderr, "\\n");\n        return 0;\n    }\n    if (inlen > 16) {\n        Poly1305_Init(&poly1305, key);\n        Poly1305_Update(&poly1305, in, 1);\n        Poly1305_Update(&poly1305, in+1, inlen-1);\n        Poly1305_Final(&poly1305, out);\n        if (memcmp(out, expected, expectedlen) != 0) {\n            fprintf(stderr, "Poly1305 test #%d/1+(N-1) failed.\\n", idx);\n            fprintf(stderr, "got:      ");\n            hexdump(out, sizeof(out));\n            fprintf(stderr, "\\nexpected: ");\n            hexdump(expected, expectedlen);\n            fprintf(stderr, "\\n");\n            return 0;\n        }\n    }\n    if (inlen > 32) {\n        size_t half = inlen / 2;\n        Poly1305_Init(&poly1305, key);\n        Poly1305_Update(&poly1305, in, half);\n        Poly1305_Update(&poly1305, in+half, inlen-half);\n        Poly1305_Final(&poly1305, out);\n        if (memcmp(out, expected, expectedlen) != 0) {\n            fprintf(stderr, "Poly1305 test #%d/2 failed.\\n", idx);\n            fprintf(stderr, "got:      ");\n            hexdump(out, sizeof(out));\n            fprintf(stderr, "\\nexpected: ");\n            hexdump(expected, expectedlen);\n            fprintf(stderr, "\\n");\n            return 0;\n        }\n        for (half = 16; half < inlen; half += 16) {\n            Poly1305_Init(&poly1305, key);\n            Poly1305_Update(&poly1305, in, half);\n            Poly1305_Update(&poly1305, in+half, inlen-half);\n            Poly1305_Final(&poly1305, out);\n            if (memcmp(out, expected, expectedlen) != 0) {\n                fprintf(stderr, "Poly1305 test #%d/%" OSSLzu "+%" OSSLzu " failed.\\n",\n                       idx, half, inlen-half);\n                fprintf(stderr, "got:      ");\n                hexdump(out, sizeof(out));\n                fprintf(stderr, "\\nexpected: ");\n                hexdump(expected, expectedlen);\n                fprintf(stderr, "\\n");\n                return 0;\n            }\n        }\n    }\n    return 1;\n}', 'void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)\n{\n#ifdef POLY1305_ASM\n    poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;\n#endif\n    size_t rem, num;\n    if ((num = ctx->num)) {\n        rem = POLY1305_BLOCK_SIZE - num;\n        if (len >= rem) {\n            memcpy(ctx->data + num, inp, rem);\n            poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);\n            inp += rem;\n            len -= rem;\n        } else {\n            memcpy(ctx->data + num, inp, len);\n            ctx->num = num + len;\n            return;\n        }\n    }\n    rem = len % POLY1305_BLOCK_SIZE;\n    len -= rem;\n    if (len >= POLY1305_BLOCK_SIZE) {\n        poly1305_blocks(ctx->opaque, inp, len, 1);\n        inp += len;\n    }\n    if (rem)\n        memcpy(ctx->data, inp, rem);\n    ctx->num = rem;\n}']