crypto/ecdsa/ecdsatest.c:428: error: UNINITIALIZED_VALUE
  The value read from signature was never initialized.
Showing all 1 steps of the trace


crypto/ecdsa/ecdsatest.c:428:6: 
426.   	if (wrong_eckey)
427.   		EC_KEY_free(wrong_eckey);
428. > 	if (signature);
429.   		OPENSSL_free(signature);
430.   	if (curves)

int test_builtin(BIO *out)
	{
	EC_builtin_curve *curves = NULL;
	size_t		crv_len = 0, n = 0;
	EC_KEY		*eckey = NULL, *wrong_eckey = NULL;
	unsigned char	digest[20], wrong_digest[20];
	unsigned char	*signature;
	unsigned int	sig_len;
	int		nid, ret =  0;
	if (!RAND_pseudo_bytes(digest, 20) ||
	    !RAND_pseudo_bytes(wrong_digest, 20))
		{
		BIO_printf(out, "ERROR: unable to get random data\n");
		goto builtin_err;
		}
	BIO_printf(out, "\ntesting ECDSA_sign() and ECDSA_verify() "
		"with some internal curves:\n");
	crv_len = EC_get_builtin_curves(NULL, 0);
	curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);
	if (curves == NULL)
		{
		BIO_printf(out, "malloc error\n");
		goto builtin_err;
		}
	if (!EC_get_builtin_curves(curves, crv_len))
		{
		BIO_printf(out, "unable to get internal curves\n");
		goto builtin_err;
		}
	for (n = 0; n < crv_len; n++)
		{
		nid = curves[n].nid;
		if ((eckey = EC_KEY_new()) == NULL)
			goto builtin_err;
		if ((eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)
			goto builtin_err;
		if (EC_GROUP_get_degree(eckey->group) < 160)
			{
			EC_KEY_free(eckey);
			eckey = NULL;
			continue;
			}
		BIO_printf(out, "%s: ", OBJ_nid2sn(nid));
		if (!EC_KEY_generate_key(eckey))
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		if ((wrong_eckey = EC_KEY_new()) == NULL)
			goto builtin_err;
		if ((wrong_eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)
			goto builtin_err;
		if (!EC_KEY_generate_key(wrong_eckey))
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		if (!EC_KEY_check_key(eckey))
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		sig_len = ECDSA_size(eckey);
		if ((signature = OPENSSL_malloc(sig_len)) == NULL)
			goto builtin_err;
                if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey))
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		if (ECDSA_verify(0, digest, 20, signature, sig_len,
			wrong_eckey) == 1)
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
			eckey) == 1)
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		signature[((int)signature[0])%sig_len] ^=
			signature[((int)signature[1])%sig_len];
		if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)
			{
			BIO_printf(out, " failed\n");
			goto builtin_err;
			}
		BIO_printf(out, ".");
		BIO_flush(out);
		BIO_printf(out, " ok\n");
		OPENSSL_free(signature);
		signature = NULL;
		EC_KEY_free(eckey);
		eckey = NULL;
		EC_KEY_free(wrong_eckey);
		wrong_eckey = NULL;
		}
	ret = 1;
builtin_err:
	if (eckey)
		EC_KEY_free(eckey);
	if (wrong_eckey)
		EC_KEY_free(wrong_eckey);
	if (signature);
		OPENSSL_free(signature);
	if (curves)
		OPENSSL_free(curves);
	return ret;
	}
['int test_builtin(BIO *out)\n\t{\n\tEC_builtin_curve *curves = NULL;\n\tsize_t\t\tcrv_len = 0, n = 0;\n\tEC_KEY\t\t*eckey = NULL, *wrong_eckey = NULL;\n\tunsigned char\tdigest[20], wrong_digest[20];\n\tunsigned char\t*signature;\n\tunsigned int\tsig_len;\n\tint\t\tnid, ret =  0;\n\tif (!RAND_pseudo_bytes(digest, 20) ||\n\t    !RAND_pseudo_bytes(wrong_digest, 20))\n\t\t{\n\t\tBIO_printf(out, "ERROR: unable to get random data\\n");\n\t\tgoto builtin_err;\n\t\t}\n\tBIO_printf(out, "\\ntesting ECDSA_sign() and ECDSA_verify() "\n\t\t"with some internal curves:\\n");\n\tcrv_len = EC_get_builtin_curves(NULL, 0);\n\tcurves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);\n\tif (curves == NULL)\n\t\t{\n\t\tBIO_printf(out, "malloc error\\n");\n\t\tgoto builtin_err;\n\t\t}\n\tif (!EC_get_builtin_curves(curves, crv_len))\n\t\t{\n\t\tBIO_printf(out, "unable to get internal curves\\n");\n\t\tgoto builtin_err;\n\t\t}\n\tfor (n = 0; n < crv_len; n++)\n\t\t{\n\t\tnid = curves[n].nid;\n\t\tif ((eckey = EC_KEY_new()) == NULL)\n\t\t\tgoto builtin_err;\n\t\tif ((eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)\n\t\t\tgoto builtin_err;\n\t\tif (EC_GROUP_get_degree(eckey->group) < 160)\n\t\t\t{\n\t\t\tEC_KEY_free(eckey);\n\t\t\teckey = NULL;\n\t\t\tcontinue;\n\t\t\t}\n\t\tBIO_printf(out, "%s: ", OBJ_nid2sn(nid));\n\t\tif (!EC_KEY_generate_key(eckey))\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tif ((wrong_eckey = EC_KEY_new()) == NULL)\n\t\t\tgoto builtin_err;\n\t\tif ((wrong_eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)\n\t\t\tgoto builtin_err;\n\t\tif (!EC_KEY_generate_key(wrong_eckey))\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tif (!EC_KEY_check_key(eckey))\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tsig_len = ECDSA_size(eckey);\n\t\tif ((signature = OPENSSL_malloc(sig_len)) == NULL)\n\t\t\tgoto builtin_err;\n                if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey))\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tif (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tif (ECDSA_verify(0, digest, 20, signature, sig_len,\n\t\t\twrong_eckey) == 1)\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tif (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,\n\t\t\teckey) == 1)\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tsignature[((int)signature[0])%sig_len] ^=\n\t\t\tsignature[((int)signature[1])%sig_len];\n\t\tif (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)\n\t\t\t{\n\t\t\tBIO_printf(out, " failed\\n");\n\t\t\tgoto builtin_err;\n\t\t\t}\n\t\tBIO_printf(out, ".");\n\t\tBIO_flush(out);\n\t\tBIO_printf(out, " ok\\n");\n\t\tOPENSSL_free(signature);\n\t\tsignature = NULL;\n\t\tEC_KEY_free(eckey);\n\t\teckey = NULL;\n\t\tEC_KEY_free(wrong_eckey);\n\t\twrong_eckey = NULL;\n\t\t}\n\tret = 1;\nbuiltin_err:\n\tif (eckey)\n\t\tEC_KEY_free(eckey);\n\tif (wrong_eckey)\n\t\tEC_KEY_free(wrong_eckey);\n\tif (signature);\n\t\tOPENSSL_free(signature);\n\tif (curves)\n\t\tOPENSSL_free(curves);\n\treturn ret;\n\t}']