engines/e_ubsec.c:638: error: INTEGER_OVERFLOW_L2
  ([0, `q->top`] - 1):unsigned64 by call to `BN_num_bits`.
Showing all 7 steps of the trace


engines/e_ubsec.c:629:1: Parameter `q->top`
627.   #endif
628.   
629. > static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
630.   			const BIGNUM *q, const BIGNUM *dp,
631.   			const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx)

engines/e_ubsec.c:637:28: Call
635.   		fd;
636.   
637.   	m_len = BN_num_bytes(p) + BN_num_bytes(q) + 1;
                                  ^
638.   	y_len = BN_num_bits(p) + BN_num_bits(q);
639.   

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;

engines/e_ubsec.c:638:27: Call
636.   
637.   	m_len = BN_num_bytes(p) + BN_num_bytes(q) + 1;
638.   	y_len = BN_num_bits(p) + BN_num_bits(q);
                                 ^
639.   
640.   	/* Check if hardware can't handle this argument. */

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, q->top] - 1):unsigned64 by call to `BN_num_bits` 
  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 int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\t\t\tconst BIGNUM *q, const BIGNUM *dp,\n\t\t\tconst BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx)\n\t{\n\tint\ty_len,\n\t\tm_len,\n\t\tfd;\n\tm_len = BN_num_bytes(p) + BN_num_bytes(q) + 1;\n\ty_len = BN_num_bits(p) + BN_num_bits(q);\n\tif (y_len > max_key_len) {\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP_CRT, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n\t\treturn FAIL_TO_SOFTWARE;\n\t}\n\tif (!bn_wexpand(r, p->top + q->top + 1)) {\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP_CRT, UBSEC_R_BN_EXPAND_FAIL);\n\t\treturn 0;\n\t}\n\tif ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) {\n\t\tfd = 0;\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP_CRT, UBSEC_R_UNIT_FAILURE);\n\t\treturn FAIL_TO_SOFTWARE;\n\t}\n\tif (p_UBSEC_rsa_mod_exp_crt_ioctl(fd,\n\t\t(unsigned char *)a->d, BN_num_bits(a),\n\t\t(unsigned char *)qinv->d, BN_num_bits(qinv),\n\t\t(unsigned char *)dp->d, BN_num_bits(dp),\n\t\t(unsigned char *)p->d, BN_num_bits(p),\n\t\t(unsigned char *)dq->d, BN_num_bits(dq),\n\t\t(unsigned char *)q->d, BN_num_bits(q),\n\t\t(unsigned char *)r->d,  &y_len) != 0) {\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP_CRT, UBSEC_R_REQUEST_FAILED);\n                p_UBSEC_ubsec_close(fd);\n\t\treturn FAIL_TO_SOFTWARE;\n\t}\n\tp_UBSEC_ubsec_close(fd);\n\tr->top = (BN_num_bits(p) + BN_num_bits(q) + BN_BITS2 - 1)/BN_BITS2;\n\treturn 1;\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}']