providers/common/ciphers/cipher_ccm.c:266: error: INTEGER_OVERFLOW_L1
  (0 - [8+max(0, `vctx->m`), 8+max(0, `vctx->m`)]):unsigned64 by call to `ccm_cipher_internal`.
Showing all 9 steps of the trace


providers/common/ciphers/cipher_ccm.c:260:1: Parameter `vctx->m`
258.   }
259.   
260. > int ccm_stream_final(void *vctx, unsigned char *out, size_t *outl,
261.                               size_t outsize)
262.   {

providers/common/ciphers/cipher_ccm.c:266:9: Call
264.       int i;
265.   
266.       i = ccm_cipher_internal(ctx, out, outl, NULL, 0);
               ^
267.       if (i <= 0)
268.           return 0;

providers/common/ciphers/cipher_ccm.c:347:1: Parameter `len`
  345.   }
  346.   
  347. > static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
  348.                                  size_t *padlen, const unsigned char *in,
  349.                                  size_t len)

providers/common/ciphers/cipher_ccm.c:360:16: Call
  358.   
  359.       if (ctx->tls_aad_len != UNINITIALISED_SIZET)
  360.           return ccm_tls_cipher(ctx, out, padlen, in, len);
                        ^
  361.   
  362.       /* EVP_*Final() doesn't return any data */

providers/common/ciphers/cipher_ccm.c:303:1: <LHS trace>
301.   }
302.   
303. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
304.                             unsigned char *out, size_t *padlen,
305.                             const unsigned char *in, size_t len)

providers/common/ciphers/cipher_ccm.c:303:1: Parameter `len`
    301.   }
    302.   
    303. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
    304.                             unsigned char *out, size_t *padlen,
    305.                             const unsigned char *in, size_t len)

providers/common/ciphers/cipher_ccm.c:303:1: <RHS trace>
301.   }
302.   
303. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
304.                             unsigned char *out, size_t *padlen,
305.                             const unsigned char *in, size_t len)

providers/common/ciphers/cipher_ccm.c:303:1: Parameter `len`
    301.   }
    302.   
    303. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
    304.                             unsigned char *out, size_t *padlen,
    305.                             const unsigned char *in, size_t len)

providers/common/ciphers/cipher_ccm.c:320:5: Binary operation: (0 - [8+max(0, vctx->m), 8+max(0, vctx->m)]):unsigned64 by call to `ccm_cipher_internal` 
    318.       memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);
    319.       /* Correct length value */
    320.       len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;
               ^
    321.       if (!ccm_set_iv(ctx, len))
    322.           goto err;

static int ccm_tls_cipher(PROV_CCM_CTX *ctx,
                          unsigned char *out, size_t *padlen,
                          const unsigned char *in, size_t len)
{
    int rv = 0;
    size_t olen = 0;
    if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)ctx->m))
        goto err;
    if (ctx->enc)
        memcpy(out, ctx->buf, EVP_CCM_TLS_EXPLICIT_IV_LEN);
    memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);
    len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;
    if (!ccm_set_iv(ctx, len))
        goto err;
    if (!ctx->hw->setaad(ctx, ctx->buf, ctx->tls_aad_len))
        goto err;
    in += EVP_CCM_TLS_EXPLICIT_IV_LEN;
    out += EVP_CCM_TLS_EXPLICIT_IV_LEN;
    if (ctx->enc) {
        if (!ctx->hw->auth_encrypt(ctx, in, out, len,  out + len, ctx->m))
            goto err;
        olen = len + EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;
    } else {
        if (!ctx->hw->auth_decrypt(ctx, in, out, len,
                                   (unsigned char *)in + len, ctx->m))
            goto err;
        olen = len;
    }
    rv = 1;
err:
    *padlen = olen;
    return rv;
}
['int ccm_stream_final(void *vctx, unsigned char *out, size_t *outl,\n                            size_t outsize)\n{\n    PROV_CCM_CTX *ctx = (PROV_CCM_CTX *)vctx;\n    int i;\n    i = ccm_cipher_internal(ctx, out, outl, NULL, 0);\n    if (i <= 0)\n        return 0;\n    *outl = 0;\n    return 1;\n}', 'static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,\n                               size_t *padlen, const unsigned char *in,\n                               size_t len)\n{\n    int rv = 0;\n    size_t olen = 0;\n    const PROV_CCM_HW *hw = ctx->hw;\n    if (!ctx->key_set)\n        return 0;\n    if (ctx->tls_aad_len != UNINITIALISED_SIZET)\n        return ccm_tls_cipher(ctx, out, padlen, in, len);\n    if (in == NULL && out != NULL)\n        goto finish;\n    if (!ctx->iv_set)\n        goto err;\n    if (out == NULL) {\n        if (in == NULL) {\n            if (!ccm_set_iv(ctx, len))\n                goto err;\n        } else {\n            if (!ctx->len_set && len)\n                goto err;\n            if (!hw->setaad(ctx, in, len))\n                goto err;\n        }\n    } else {\n        if (!ctx->len_set && !ccm_set_iv(ctx, len))\n            goto err;\n        if (ctx->enc) {\n            if (!hw->auth_encrypt(ctx, in, out, len, NULL, 0))\n                goto err;\n            ctx->tag_set = 1;\n        } else {\n            if (!ctx->tag_set)\n                goto err;\n            if (!hw->auth_decrypt(ctx, in, out, len, ctx->buf, ctx->m))\n                goto err;\n            ctx->iv_set = 0;\n            ctx->tag_set = 0;\n            ctx->len_set = 0;\n        }\n    }\n    olen = len;\nfinish:\n    rv = 1;\nerr:\n    *padlen = olen;\n    return rv;\n}', 'static int ccm_tls_cipher(PROV_CCM_CTX *ctx,\n                          unsigned char *out, size_t *padlen,\n                          const unsigned char *in, size_t len)\n{\n    int rv = 0;\n    size_t olen = 0;\n    if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)ctx->m))\n        goto err;\n    if (ctx->enc)\n        memcpy(out, ctx->buf, EVP_CCM_TLS_EXPLICIT_IV_LEN);\n    memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN);\n    len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;\n    if (!ccm_set_iv(ctx, len))\n        goto err;\n    if (!ctx->hw->setaad(ctx, ctx->buf, ctx->tls_aad_len))\n        goto err;\n    in += EVP_CCM_TLS_EXPLICIT_IV_LEN;\n    out += EVP_CCM_TLS_EXPLICIT_IV_LEN;\n    if (ctx->enc) {\n        if (!ctx->hw->auth_encrypt(ctx, in, out, len,  out + len, ctx->m))\n            goto err;\n        olen = len + EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m;\n    } else {\n        if (!ctx->hw->auth_decrypt(ctx, in, out, len,\n                                   (unsigned char *)in + len, ctx->m))\n            goto err;\n        olen = len;\n    }\n    rv = 1;\nerr:\n    *padlen = olen;\n    return rv;\n}']