apps/apps.c:2490: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `JPAKE_STEP1_process`.
Showing all 16 steps of the trace


apps/apps.c:2489:2: Call
2487.   	JPAKE_STEP1_init(&s1);
2488.   	jpake_receive_part(&s1.p1, bconn);
2489.   	jpake_receive_part(&s1.p2, bconn);
         ^
2490.   	if(!JPAKE_STEP1_process(ctx, &s1))
2491.   		{

apps/apps.c:2479:2: Call
  2477.   	{
  2478.   	readbn(&p->gx, bconn);
  2479.   	readbn(&p->zkpx.gr, bconn);
           ^
  2480.   	readbn(&p->zkpx.b, bconn);
  2481.   	}

apps/apps.c:2473:2: Call
    2471.   	assert(buf[l-1] == '\n');
    2472.   	buf[l-1] = '\0';
    2473.   	BN_hex2bn(bn, buf);
             ^
    2474.   	}
    2475.   

crypto/bn/bn_print.c:172:1: Parameter `(*bn)->top`
      170.   	}
      171.   
      172. > int BN_hex2bn(BIGNUM **bn, const char *a)
      173.   	{
      174.   	BIGNUM *ret=NULL;

apps/apps.c:2490:6: Call
2488.   	jpake_receive_part(&s1.p1, bconn);
2489.   	jpake_receive_part(&s1.p2, bconn);
2490.   	if(!JPAKE_STEP1_process(ctx, &s1))
             ^
2491.   		{
2492.   		ERR_print_errors(bio_err);

crypto/jpake/jpake.c:285:1: Parameter `ctx->p.g->top`
  283.       }
  284.   
  285. > int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received)
  286.       {
  287.      /* verify their ZKP(xc) */

crypto/jpake/jpake.c:288:9: Call
  286.       {
  287.      /* verify their ZKP(xc) */
  288.       if(!verify_zkp(&received->p1, ctx->p.g, ctx))
                 ^
  289.   	{
  290.   	JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED);

crypto/jpake/jpake.c:214:1: Parameter `zkpg->top`
    212.       }
    213.   
    214. > static int verify_zkp(const JPAKE_STEP_PART *p, const BIGNUM *zkpg,
    215.   		      JPAKE_CTX *ctx)
    216.       {

crypto/jpake/jpake.c:223:5: Call
    221.       int ret = 0;
    222.   
    223.       zkp_hash(h, zkpg, p, ctx->p.peer_name);
               ^
    224.   
    225.      /* t1 = g^b */

crypto/jpake/jpake.c:162:1: Parameter `zkpg->top`
      160.   
      161.   /* h=hash(g, g^r, g^x, name) */
      162. > static void zkp_hash(BIGNUM *h, const BIGNUM *zkpg, const JPAKE_STEP_PART *p,
      163.   		     const char *proof_name)
      164.       {

crypto/jpake/jpake.c:173:5: Call
      171.       */
      172.       SHA1_Init(&sha);
      173.       hashbn(&sha, zkpg);
                 ^
      174.       OPENSSL_assert(!BN_is_zero(p->zkpx.gr));
      175.       hashbn(&sha, p->zkpx.gr);

crypto/jpake/jpake.c:150:1: Parameter `bn->top`
        148.       }
        149.   
        150. > static void hashbn(SHA_CTX *sha, const BIGNUM *bn)
        151.       {
        152.       size_t l = BN_num_bytes(bn);

crypto/jpake/jpake.c:152:16: Call
        150.   static void hashbn(SHA_CTX *sha, const BIGNUM *bn)
        151.       {
        152.       size_t l = BN_num_bytes(bn);
                              ^
        153.       unsigned char *bin = OPENSSL_malloc(l);
        154.   

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 `JPAKE_STEP1_process` 
          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]));
	}
['static void jpake_receive_step1(JPAKE_CTX *ctx, BIO *bconn)\n\t{\n\tJPAKE_STEP1 s1;\n\tJPAKE_STEP1_init(&s1);\n\tjpake_receive_part(&s1.p1, bconn);\n\tjpake_receive_part(&s1.p2, bconn);\n\tif(!JPAKE_STEP1_process(ctx, &s1))\n\t\t{\n\t\tERR_print_errors(bio_err);\n\t\texit(1);\n\t\t}\n\tJPAKE_STEP1_release(&s1);\n\t}', 'static void jpake_receive_part(JPAKE_STEP_PART *p, BIO *bconn)\n\t{\n\treadbn(&p->gx, bconn);\n\treadbn(&p->zkpx.gr, bconn);\n\treadbn(&p->zkpx.b, bconn);\n\t}', "static void readbn(BIGNUM **bn, BIO *bconn)\n\t{\n\tchar buf[10240];\n\tint l;\n\tl = BIO_gets(bconn, buf, sizeof buf);\n\tassert(l >= 0);\n\tassert(buf[l-1] == '\\n');\n\tbuf[l-1] = '\\0';\n\tBN_hex2bn(bn, buf);\n\t}", "int BN_hex2bn(BIGNUM **bn, const char *a)\n\t{\n\tBIGNUM *ret=NULL;\n\tBN_ULONG l=0;\n\tint neg=0,h,m,i,j,k,c;\n\tint num;\n\tif ((a == NULL) || (*a == '\\0')) return(0);\n\tif (*a == '-') { neg=1; a++; }\n\tfor (i=0; isxdigit((unsigned char) a[i]); i++)\n\t\t;\n\tnum=i+neg;\n\tif (bn == NULL) return(num);\n\tif (*bn == NULL)\n\t\t{\n\t\tif ((ret=BN_new()) == NULL) return(0);\n\t\t}\n\telse\n\t\t{\n\t\tret= *bn;\n\t\tBN_zero(ret);\n\t\t}\n\tif (bn_expand(ret,i*4) == NULL) goto err;\n\tj=i;\n\tm=0;\n\th=0;\n\twhile (j > 0)\n\t\t{\n\t\tm=((BN_BYTES*2) <= j)?(BN_BYTES*2):j;\n\t\tl=0;\n\t\tfor (;;)\n\t\t\t{\n\t\t\tc=a[j-m];\n\t\t\tif ((c >= '0') && (c <= '9')) k=c-'0';\n\t\t\telse if ((c >= 'a') && (c <= 'f')) k=c-'a'+10;\n\t\t\telse if ((c >= 'A') && (c <= 'F')) k=c-'A'+10;\n\t\t\telse k=0;\n\t\t\tl=(l<<4)|k;\n\t\t\tif (--m <= 0)\n\t\t\t\t{\n\t\t\t\tret->d[h++]=l;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tj-=(BN_BYTES*2);\n\t\t}\n\tret->top=h;\n\tbn_correct_top(ret);\n\tret->neg=neg;\n\t*bn=ret;\n\tbn_check_top(ret);\n\treturn(num);\nerr:\n\tif (*bn == NULL) BN_free(ret);\n\treturn(0);\n\t}", 'int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received)\n    {\n    if(!verify_zkp(&received->p1, ctx->p.g, ctx))\n\t{\n\tJPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED);\n\treturn 0;\n\t}\n    if(!verify_zkp(&received->p2, ctx->p.g, ctx))\n\t{\n\tJPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X4_FAILED);\n\treturn 0;\n\t}\n    if(BN_is_one(received->p2.gx))\n\t{\n\tJPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_ONE);\n\treturn 0;\n\t}\n    BN_copy(ctx->p.gxc, received->p1.gx);\n    BN_copy(ctx->p.gxd, received->p2.gx);\n    return 1;\n    }', 'static int verify_zkp(const JPAKE_STEP_PART *p, const BIGNUM *zkpg,\n\t\t      JPAKE_CTX *ctx)\n    {\n    BIGNUM *h = BN_new();\n    BIGNUM *t1 = BN_new();\n    BIGNUM *t2 = BN_new();\n    BIGNUM *t3 = BN_new();\n    int ret = 0;\n    zkp_hash(h, zkpg, p, ctx->p.peer_name);\n    BN_mod_exp(t1, zkpg, p->zkpx.b, ctx->p.p, ctx->ctx);\n    BN_mod_exp(t2, p->gx, h, ctx->p.p, ctx->ctx);\n    BN_mod_mul(t3, t1, t2, ctx->p.p, ctx->ctx);\n    if(BN_cmp(t3, p->zkpx.gr) == 0)\n\tret = 1;\n    else\n\tJPAKEerr(JPAKE_F_VERIFY_ZKP, JPAKE_R_ZKP_VERIFY_FAILED);\n    BN_free(t3);\n    BN_free(t2);\n    BN_free(t1);\n    BN_free(h);\n    return ret;\n    }', 'static void zkp_hash(BIGNUM *h, const BIGNUM *zkpg, const JPAKE_STEP_PART *p,\n\t\t     const char *proof_name)\n    {\n    unsigned char md[SHA_DIGEST_LENGTH];\n    SHA_CTX sha;\n    SHA1_Init(&sha);\n    hashbn(&sha, zkpg);\n    OPENSSL_assert(!BN_is_zero(p->zkpx.gr));\n    hashbn(&sha, p->zkpx.gr);\n    hashbn(&sha, p->gx);\n    hashstring(&sha, proof_name);\n    SHA1_Final(md, &sha);\n    BN_bin2bn(md, SHA_DIGEST_LENGTH, h);\n    }', 'static void hashbn(SHA_CTX *sha, const BIGNUM *bn)\n    {\n    size_t l = BN_num_bytes(bn);\n    unsigned char *bin = OPENSSL_malloc(l);\n    hashlength(sha, l);\n    BN_bn2bin(bn, bin);\n    SHA1_Update(sha, bin, l);\n    OPENSSL_free(bin);\n    }', '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}']