if (signature);
if (signature)
int test_builtin(BIO *out)	{	EC_builtin_curve *curves = NULL;	size_t		crv_len = 0, n = 0;	EC_KEY		*eckey = NULL, *wrong_eckey = NULL;	EC_GROUP	*group;	unsigned char	digest[20], wrong_digest[20];	unsigned char	*signature = NULL; 	unsigned int	sig_len;	int		nid, ret =  0;		/* fill digest values with some random data */	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;		}	/* create and verify a ecdsa signature with every availble curve	 * (with ) */	BIO_printf(out, "\ntesting ECDSA_sign() and ECDSA_verify() "		"with some internal curves:\n");	/* get a list of all internal curves */	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;		}	/* now create and verify a signature for every curve */	for (n = 0; n < crv_len; n++)		{		unsigned char dirt, offset;		nid = curves[n].nid;		if (nid == NID_ipsec4)			continue;		/* create new ecdsa key (== EC_KEY) */		if ((eckey = EC_KEY_new()) == NULL)			goto builtin_err;		group = EC_GROUP_new_by_curve_name(nid);		if (group == NULL)			goto builtin_err;		if (EC_KEY_set_group(eckey, group) == 0)			goto builtin_err;		EC_GROUP_free(group);		if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160)			/* drop the curve */ 			{			EC_KEY_free(eckey);			eckey = NULL;			continue;			}		BIO_printf(out, "%s: ", OBJ_nid2sn(nid));		/* create key */		if (!EC_KEY_generate_key(eckey))			{			BIO_printf(out, " failed\n");			goto builtin_err;			}		/* create second key */		if ((wrong_eckey = EC_KEY_new()) == NULL)			goto builtin_err;		group = EC_GROUP_new_by_curve_name(nid);		if (group == NULL)			goto builtin_err;		if (EC_KEY_set_group(wrong_eckey, group) == 0)			goto builtin_err;		EC_GROUP_free(group);		if (!EC_KEY_generate_key(wrong_eckey))			{			BIO_printf(out, " failed\n");			goto builtin_err;			}		BIO_printf(out, ".");		BIO_flush(out);		/* check key */		if (!EC_KEY_check_key(eckey))			{			BIO_printf(out, " failed\n");			goto builtin_err;			}		BIO_printf(out, ".");		BIO_flush(out);		/* create signature */		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);		/* verify signature */		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);		/* verify signature with the wrong key */		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);		/* wrong digest */		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);		/* modify a single byte of the signature */		offset = signature[10] % sig_len;		dirt   = signature[11];		signature[offset] ^= dirt ? dirt : 1; 		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");		/* cleanup */		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;	}