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


apps/gendsa.c:264:8: Call
262.   
263.   	BIO_printf(bio_err,"Generating DSA key, %d bits\n",
264.   							BN_num_bits(dsa->p));
              ^
265.   	if (!DSA_generate_key(dsa)) goto end;
266.   

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_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]));
	}
['int MAIN(int argc, char **argv)\n\t{\n#ifndef OPENSSL_NO_ENGINE\n\tENGINE *e = NULL;\n#endif\n\tDSA *dsa=NULL;\n\tint ret=1;\n\tchar *outfile=NULL;\n\tchar *inrand=NULL,*dsaparams=NULL;\n\tchar *passargout = NULL, *passout = NULL;\n\tBIO *out=NULL,*in=NULL;\n\tconst EVP_CIPHER *enc=NULL;\n#ifndef OPENSSL_NO_ENGINE\n\tchar *engine=NULL;\n#endif\n\tapps_startup();\n\tif (bio_err == NULL)\n\t\tif ((bio_err=BIO_new(BIO_s_file())) != NULL)\n\t\t\tBIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);\n\tif (!load_config(bio_err, NULL))\n\t\tgoto end;\n\targv++;\n\targc--;\n\tfor (;;)\n\t\t{\n\t\tif (argc <= 0) break;\n\t\tif (strcmp(*argv,"-out") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\toutfile= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-passout") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tpassargout= *(++argv);\n\t\t\t}\n#ifndef OPENSSL_NO_ENGINE\n\t\telse if (strcmp(*argv,"-engine") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tengine= *(++argv);\n\t\t\t}\n#endif\n\t\telse if (strcmp(*argv,"-rand") == 0)\n\t\t\t{\n\t\t\tif (--argc < 1) goto bad;\n\t\t\tinrand= *(++argv);\n\t\t\t}\n\t\telse if (strcmp(*argv,"-") == 0)\n\t\t\tgoto bad;\n#ifndef OPENSSL_NO_DES\n\t\telse if (strcmp(*argv,"-des") == 0)\n\t\t\tenc=EVP_des_cbc();\n\t\telse if (strcmp(*argv,"-des3") == 0)\n\t\t\tenc=EVP_des_ede3_cbc();\n#endif\n#ifndef OPENSSL_NO_IDEA\n\t\telse if (strcmp(*argv,"-idea") == 0)\n\t\t\tenc=EVP_idea_cbc();\n#endif\n#ifndef OPENSSL_NO_SEED\n\t\telse if (strcmp(*argv,"-seed") == 0)\n\t\t\tenc=EVP_seed_cbc();\n#endif\n#ifndef OPENSSL_NO_AES\n\t\telse if (strcmp(*argv,"-aes128") == 0)\n\t\t\tenc=EVP_aes_128_cbc();\n\t\telse if (strcmp(*argv,"-aes192") == 0)\n\t\t\tenc=EVP_aes_192_cbc();\n\t\telse if (strcmp(*argv,"-aes256") == 0)\n\t\t\tenc=EVP_aes_256_cbc();\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n\t\telse if (strcmp(*argv,"-camellia128") == 0)\n\t\t\tenc=EVP_camellia_128_cbc();\n\t\telse if (strcmp(*argv,"-camellia192") == 0)\n\t\t\tenc=EVP_camellia_192_cbc();\n\t\telse if (strcmp(*argv,"-camellia256") == 0)\n\t\t\tenc=EVP_camellia_256_cbc();\n#endif\n\t\telse if (**argv != \'-\' && dsaparams == NULL)\n\t\t\t{\n\t\t\tdsaparams = *argv;\n\t\t\t}\n\t\telse\n\t\t\tgoto bad;\n\t\targv++;\n\t\targc--;\n\t\t}\n\tif (dsaparams == NULL)\n\t\t{\nbad:\n\t\tBIO_printf(bio_err,"usage: gendsa [args] dsaparam-file\\n");\n\t\tBIO_printf(bio_err," -out file - output the key to \'file\'\\n");\n#ifndef OPENSSL_NO_DES\n\t\tBIO_printf(bio_err," -des      - encrypt the generated key with DES in cbc mode\\n");\n\t\tBIO_printf(bio_err," -des3     - encrypt the generated key with DES in ede cbc mode (168 bit key)\\n");\n#endif\n#ifndef OPENSSL_NO_IDEA\n\t\tBIO_printf(bio_err," -idea     - encrypt the generated key with IDEA in cbc mode\\n");\n#endif\n#ifndef OPENSSL_NO_SEED\n\t\tBIO_printf(bio_err," -seed\\n");\n\t\tBIO_printf(bio_err,"                 encrypt PEM output with cbc seed\\n");\n#endif\n#ifndef OPENSSL_NO_AES\n\t\tBIO_printf(bio_err," -aes128, -aes192, -aes256\\n");\n\t\tBIO_printf(bio_err,"                 encrypt PEM output with cbc aes\\n");\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\n\t\tBIO_printf(bio_err," -camellia128, -camellia192, -camellia256\\n");\n\t\tBIO_printf(bio_err,"                 encrypt PEM output with cbc camellia\\n");\n#endif\n#ifndef OPENSSL_NO_ENGINE\n\t\tBIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\\n");\n#endif\n\t\tBIO_printf(bio_err," -rand file%cfile%c...\\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);\n\t\tBIO_printf(bio_err,"           - load the file (or the files in the directory) into\\n");\n\t\tBIO_printf(bio_err,"             the random number generator\\n");\n\t\tBIO_printf(bio_err," dsaparam-file\\n");\n\t\tBIO_printf(bio_err,"           - a DSA parameter file as generated by the dsaparam command\\n");\n\t\tgoto end;\n\t\t}\n#ifndef OPENSSL_NO_ENGINE\n        e = setup_engine(bio_err, engine, 0);\n#endif\n\tif(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {\n\t\tBIO_printf(bio_err, "Error getting password\\n");\n\t\tgoto end;\n\t}\n\tin=BIO_new(BIO_s_file());\n\tif (!(BIO_read_filename(in,dsaparams)))\n\t\t{\n\t\tperror(dsaparams);\n\t\tgoto end;\n\t\t}\n\tif ((dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL)) == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"unable to load DSA parameter file\\n");\n\t\tgoto end;\n\t\t}\n\tBIO_free(in);\n\tin = NULL;\n\tout=BIO_new(BIO_s_file());\n\tif (out == NULL) goto end;\n\tif (outfile == NULL)\n\t\t{\n\t\tBIO_set_fp(out,stdout,BIO_NOCLOSE);\n#ifdef OPENSSL_SYS_VMS\n\t\t{\n\t\tBIO *tmpbio = BIO_new(BIO_f_linebuffer());\n\t\tout = BIO_push(tmpbio, out);\n\t\t}\n#endif\n\t\t}\n\telse\n\t\t{\n\t\tif (BIO_write_filename(out,outfile) <= 0)\n\t\t\t{\n\t\t\tperror(outfile);\n\t\t\tgoto end;\n\t\t\t}\n\t\t}\n\tif (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)\n\t\t{\n\t\tBIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\\n");\n\t\t}\n\tif (inrand != NULL)\n\t\tBIO_printf(bio_err,"%ld semi-random bytes loaded\\n",\n\t\t\tapp_RAND_load_files(inrand));\n\tBIO_printf(bio_err,"Generating DSA key, %d bits\\n",\n\t\t\t\t\t\t\tBN_num_bits(dsa->p));\n\tif (!DSA_generate_key(dsa)) goto end;\n\tapp_RAND_write_file(NULL, bio_err);\n\tif (!PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,NULL, passout))\n\t\tgoto end;\n\tret=0;\nend:\n\tif (ret != 0)\n\t\tERR_print_errors(bio_err);\n\tif (in != NULL) BIO_free(in);\n\tif (out != NULL) BIO_free_all(out);\n\tif (dsa != NULL) DSA_free(dsa);\n\tif(passout) OPENSSL_free(passout);\n\tapps_shutdown();\n\tOPENSSL_EXIT(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}']