engines/e_ubsec.c:725: error: INTEGER_OVERFLOW_L2
  ([0, `m->top`] - 1):unsigned64 by call to `ubsec_mod_exp`.
Showing all 9 steps of the trace


engines/e_ubsec.c:710:1: Parameter `m->top`
708.    * This function is aliased to mod_exp (with the mont stuff dropped).
709.    */
710. > static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
711.   		const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
712.           {

engines/e_ubsec.c:717:6: Call
715.   #ifndef OPENSSL_NO_RSA
716.    	/* Do in software if the key is too large for the hardware. */
717.   	if (BN_num_bits(m) > max_key_len)
            ^
718.                   {
719.   		const RSA_METHOD *meth = RSA_PKCS1_SSLeay();

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:725:9: Call
723.   #endif
724.                   {
725.   		ret = ubsec_mod_exp(r, a, p, m, ctx);
               ^
726.                   }
727.   	

engines/e_ubsec.c:556:1: Parameter `m->top`
  554.   	}
  555.   
  556. > static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
  557.   		const BIGNUM *m, BN_CTX *ctx)
  558.   	{

engines/e_ubsec.c:569:10: Call
  567.   
  568.   	/* Check if hardware can't handle this argument. */
  569.   	y_len = BN_num_bits(m);
                  ^
  570.   	if (y_len > max_key_len) {
  571.   		UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL);

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, m->top] - 1):unsigned64 by call to `ubsec_mod_exp` 
    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_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\t\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n        {\n\tint ret = 0;\n#ifndef OPENSSL_NO_RSA\n\tif (BN_num_bits(m) > max_key_len)\n                {\n\t\tconst RSA_METHOD *meth = RSA_PKCS1_SSLeay();\n\t\tret = (*meth->bn_mod_exp)(r, a, p, m, ctx, m_ctx);\n                }\n        else\n#endif\n                {\n\t\tret = ubsec_mod_exp(r, a, p, m, ctx);\n                }\n\treturn ret;\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}', 'static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\t\tconst BIGNUM *m, BN_CTX *ctx)\n\t{\n\tint \ty_len = 0;\n\tint \tfd;\n\tif(ubsec_dso == NULL)\n\t{\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_NOT_LOADED);\n\t\treturn 0;\n\t}\n\ty_len = BN_num_bits(m);\n\tif (y_len > max_key_len) {\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n                return BN_mod_exp(r, a, p, m, ctx);\n\t}\n\tif(!bn_wexpand(r, m->top))\n\t{\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP, 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, UBSEC_R_UNIT_FAILURE);\n                return BN_mod_exp(r, a, p, m, ctx);\n\t}\n\tif (p_UBSEC_rsa_mod_exp_ioctl(fd, (unsigned char *)a->d, BN_num_bits(a),\n\t\t(unsigned char *)m->d, BN_num_bits(m), (unsigned char *)p->d,\n\t\tBN_num_bits(p), (unsigned char *)r->d, &y_len) != 0)\n\t{\n\t\tUBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_REQUEST_FAILED);\n                p_UBSEC_ubsec_close(fd);\n                return BN_mod_exp(r, a, p, m, ctx);\n\t}\n\tp_UBSEC_ubsec_close(fd);\n\tr->top = (BN_num_bits(m)+BN_BITS2-1)/BN_BITS2;\n\treturn 1;\n\t}']