int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)
{
    const tls_curve_info *cinfo;
    if (curve[0])
        return 1;
    if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))
        return 0;
    cinfo = &nid_list[curve[1] - 1];
# ifdef OPENSSL_NO_EC2M
    if (cinfo->flags & TLS_CURVE_CHAR2)
        return 0;
# endif
    return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);
}
['int tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt, X509 *x,\n                                        size_t chain, int *al)\n{\n    const unsigned char *pcurves = NULL, *pcurvestmp;\n    size_t num_curves = 0, i;\n    if (!use_ecc(s))\n        return 1;\n    pcurves = s->tlsext_supportedgroupslist;\n    if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,\n               ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    pcurvestmp = pcurves;\n    if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_groups)\n            || !WPACKET_start_sub_packet_u16(pkt)\n            || !WPACKET_start_sub_packet_u16(pkt)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,\n               ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    for (i = 0; i < num_curves; i++, pcurvestmp += 2) {\n        if (tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED)) {\n            if (!WPACKET_put_bytes_u8(pkt, pcurvestmp[0])\n                || !WPACKET_put_bytes_u8(pkt, pcurvestmp[1])) {\n                    SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,\n                           ERR_R_INTERNAL_ERROR);\n                    return 0;\n                }\n        }\n    }\n    if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,\n               ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    return 1;\n}', 'int tls_curve_allowed(SSL *s, const unsigned char *curve, int op)\n{\n    const tls_curve_info *cinfo;\n    if (curve[0])\n        return 1;\n    if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list)))\n        return 0;\n    cinfo = &nid_list[curve[1] - 1];\n# ifdef OPENSSL_NO_EC2M\n    if (cinfo->flags & TLS_CURVE_CHAR2)\n        return 0;\n# endif\n    return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve);\n}']