static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
	{
	tls_curve_info *cinfo;
	if (curve[0])
		return 1;
	if ((curve[1] < 1) || ((size_t)curve[1] >
				sizeof(nid_list)/sizeof(nid_list[0])))
		return 0;
	cinfo = &nid_list[curve[1]-1];
	return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
	}
['int tls1_shared_curve(SSL *s, int nmatch)\n\t{\n\tconst unsigned char *pref, *supp;\n\tsize_t preflen, supplen, i, j;\n\tint k;\n\tif (s->server == 0)\n\t\treturn -1;\n\tif (nmatch == -2)\n\t\t{\n\t\tif (tls1_suiteb(s))\n\t\t\t{\n\t\t\tunsigned long cid = s->s3->tmp.new_cipher->id;\n\t\t\tif (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)\n\t\t\t\treturn NID_X9_62_prime256v1;\n\t\t\tif (cid == TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384)\n\t\t\t\treturn NID_secp384r1;\n\t\t\treturn NID_undef;\n\t\t\t}\n\t\tnmatch = 0;\n\t\t}\n\ttls1_get_curvelist(s, !!(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE),\n\t\t\t\t&supp, &supplen);\n\ttls1_get_curvelist(s, !(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE),\n\t\t\t\t&pref, &preflen);\n\tpreflen /= 2;\n\tsupplen /= 2;\n\tk = 0;\n\tfor (i = 0; i < preflen; i++, pref+=2)\n\t\t{\n\t\tconst unsigned char *tsupp = supp;\n\t\tfor (j = 0; j < supplen; j++, tsupp+=2)\n\t\t\t{\n\t\t\tif (pref[0] == tsupp[0] && pref[1] == tsupp[1])\n\t\t\t\t{\n\t\t\t\tif (!tls_curve_allowed(s, pref, SSL_SECOP_CURVE_SHARED))\n\t\t\t\t\tcontinue;\n\t\t\t\tif (nmatch == k)\n\t\t\t\t\t{\n\t\t\t\t\tint id = (pref[0] << 8) | pref[1];\n\t\t\t\t\treturn tls1_ec_curve_id2nid(id);\n\t\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tif (nmatch == -1)\n\t\treturn k;\n\treturn 0;\n\t}', 'static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)\n\t{\n\ttls_curve_info *cinfo;\n\tif (curve[0])\n\t\treturn 1;\n\tif ((curve[1] < 1) || ((size_t)curve[1] >\n\t\t\t\tsizeof(nid_list)/sizeof(nid_list[0])))\n\t\treturn 0;\n\tcinfo = &nid_list[curve[1]-1];\n\treturn ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);\n\t}']