crypto/bn/bn_gf2m.c:593: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `BN_GF2m_mod_inv`.
Showing all 12 steps of the trace


crypto/bn/bn_gf2m.c:591:7: Call
589.   	BN_CTX_start(ctx);
590.   	if ((field = BN_CTX_get(ctx)) == NULL) goto err;
591.   	if (!BN_GF2m_arr2poly(p, field)) goto err;
             ^
592.   	
593.   	ret = BN_GF2m_mod_inv(r, xx, field, ctx);

crypto/bn/bn_gf2m.c:1018:1: Parameter `a->top`
  1016.    * bit-string.  The array must be terminated by -1.
  1017.    */
  1018. > int BN_GF2m_arr2poly(const int p[], BIGNUM *a)
  1019.   	{
  1020.   	int i;

crypto/bn/bn_gf2m.c:1023:2: Call
  1021.   
  1022.   	bn_check_top(a);
  1023.   	BN_zero(a);
           ^
  1024.   	for (i = 0; p[i] != -1; i++)
  1025.   		{

crypto/bn/bn_lib.c:586:1: Parameter `a->top`
    584.   	}
    585.   
    586. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    587.   	{
    588.   	bn_check_top(a);

crypto/bn/bn_gf2m.c:593:8: Call
591.   	if (!BN_GF2m_arr2poly(p, field)) goto err;
592.   	
593.   	ret = BN_GF2m_mod_inv(r, xx, field, ctx);
              ^
594.   	bn_check_top(r);
595.   

crypto/bn/bn_gf2m.c:521:1: Parameter `p->top`
  519.    *     of Elliptic Curve Cryptography Over Binary Fields".
  520.    */
  521. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
  522.   	{
  523.   	BIGNUM *b, *c, *u, *v, *tmp;

crypto/bn/bn_gf2m.c:538:7: Call
  536.   
  537.   	if (!BN_one(b)) goto err;
  538.   	if (!BN_GF2m_mod(u, a, p)) goto err;
               ^
  539.   	if (!BN_copy(v, p)) goto err;
  540.   

crypto/bn/bn_gf2m.c:359:1: Parameter `p->top`
    357.    * BN_GF2m_mod_arr function.
    358.    */
    359. > int	BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p)
    360.   	{
    361.   	int ret = 0;

crypto/bn/bn_gf2m.c:362:18: Call
    360.   	{
    361.   	int ret = 0;
    362.   	const int max = BN_num_bits(p) + 1;
                            ^
    363.   	int *arr=NULL;
    364.   	bn_check_top(a);

crypto/bn/bn_lib.c:248:1: <LHS trace>
246.   	}
247.   
248. > int BN_num_bits(const BIGNUM *a)
249.   	{
250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:248:1: Parameter `a->top`
      246.   	}
      247.   
      248. > int BN_num_bits(const BIGNUM *a)
      249.   	{
      250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:250:2: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BN_GF2m_mod_inv` 
      248.   int BN_num_bits(const BIGNUM *a)
      249.   	{
      250.   	int i = a->top - 1;
              ^
      251.   	bn_check_top(a);
      252.   

int BN_num_bits(const BIGNUM *a)
	{
	int i = a->top - 1;
	bn_check_top(a);
	if (BN_is_zero(a)) return 0;
	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
	}
['int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], BN_CTX *ctx)\n\t{\n\tBIGNUM *field;\n\tint ret = 0;\n\tbn_check_top(xx);\n\tBN_CTX_start(ctx);\n\tif ((field = BN_CTX_get(ctx)) == NULL) goto err;\n\tif (!BN_GF2m_arr2poly(p, field)) goto err;\n\tret = BN_GF2m_mod_inv(r, xx, field, ctx);\n\tbn_check_top(r);\nerr:\n\tBN_CTX_end(ctx);\n\treturn ret;\n\t}', 'int BN_GF2m_arr2poly(const int p[], BIGNUM *a)\n\t{\n\tint i;\n\tbn_check_top(a);\n\tBN_zero(a);\n\tfor (i = 0; p[i] != -1; i++)\n\t\t{\n\t\tif (BN_set_bit(a, p[i]) == 0)\n\t\t\treturn 0;\n\t\t}\n\tbn_check_top(a);\n\treturn 1;\n\t}', 'int BN_set_word(BIGNUM *a, BN_ULONG w)\n\t{\n\tbn_check_top(a);\n\tif (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);\n\ta->neg = 0;\n\ta->d[0] = w;\n\ta->top = (w ? 1 : 0);\n\tbn_check_top(a);\n\treturn(1);\n\t}', 'int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)\n\t{\n\tBIGNUM *b, *c, *u, *v, *tmp;\n\tint ret = 0;\n\tbn_check_top(a);\n\tbn_check_top(p);\n\tBN_CTX_start(ctx);\n\tb = BN_CTX_get(ctx);\n\tc = BN_CTX_get(ctx);\n\tu = BN_CTX_get(ctx);\n\tv = BN_CTX_get(ctx);\n\tif (v == NULL) goto err;\n\tif (!BN_one(b)) goto err;\n\tif (!BN_GF2m_mod(u, a, p)) goto err;\n\tif (!BN_copy(v, p)) goto err;\n\tif (BN_is_zero(u)) goto err;\n\twhile (1)\n\t\t{\n\t\twhile (!BN_is_odd(u))\n\t\t\t{\n\t\t\tif (!BN_rshift1(u, u)) goto err;\n\t\t\tif (BN_is_odd(b))\n\t\t\t\t{\n\t\t\t\tif (!BN_GF2m_add(b, b, p)) goto err;\n\t\t\t\t}\n\t\t\tif (!BN_rshift1(b, b)) goto err;\n\t\t\t}\n\t\tif (BN_abs_is_word(u, 1)) break;\n\t\tif (BN_num_bits(u) < BN_num_bits(v))\n\t\t\t{\n\t\t\ttmp = u; u = v; v = tmp;\n\t\t\ttmp = b; b = c; c = tmp;\n\t\t\t}\n\t\tif (!BN_GF2m_add(u, u, v)) goto err;\n\t\tif (!BN_GF2m_add(b, b, c)) goto err;\n\t\t}\n\tif (!BN_copy(r, b)) goto err;\n\tbn_check_top(r);\n\tret = 1;\nerr:\n  \tBN_CTX_end(ctx);\n\treturn ret;\n\t}', 'int\tBN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p)\n\t{\n\tint ret = 0;\n\tconst int max = BN_num_bits(p) + 1;\n\tint *arr=NULL;\n\tbn_check_top(a);\n\tbn_check_top(p);\n\tif ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;\n\tret = BN_GF2m_poly2arr(p, arr, max);\n\tif (!ret || ret > max)\n\t\t{\n\t\tBNerr(BN_F_BN_GF2M_MOD,BN_R_INVALID_LENGTH);\n\t\tgoto err;\n\t\t}\n\tret = BN_GF2m_mod_arr(r, a, arr);\n\tbn_check_top(r);\nerr:\n\tif (arr) OPENSSL_free(arr);\n\treturn ret;\n\t}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tint i = a->top - 1;\n\tbn_check_top(a);\n\tif (BN_is_zero(a)) return 0;\n\treturn ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));\n\t}']