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_stoc_supported_groups(SSL *s, WPACKET *pkt,\n                                        unsigned int context, X509 *x,\n                                        size_t chainidx, int *al)\n{\n    const unsigned char *groups;\n    size_t numgroups, i, first = 1;\n    if (s->s3->group_id == 0)\n        return 1;\n    if (!tls1_get_curvelist(s, 0, &groups, &numgroups) || numgroups == 0) {\n        SSLerr(SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    for (i = 0; i < numgroups; i++, groups += 2) {\n        if (tls_curve_allowed(s, groups, SSL_SECOP_CURVE_SUPPORTED)) {\n            if (first) {\n                if (s->s3->group_id == GET_GROUP_ID(groups, 0))\n                    return 1;\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_STOC_SUPPORTED_GROUPS,\n                           ERR_R_INTERNAL_ERROR);\n                    return 0;\n                }\n                first = 0;\n            }\n            if (!WPACKET_put_bytes_u16(pkt, GET_GROUP_ID(groups, 0))) {\n                    SSLerr(SSL_F_TLS_CONSTRUCT_STOC_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_STOC_SUPPORTED_GROUPS, ERR_R_INTERNAL_ERROR);\n        return 0;\n    }\n    return 1;\n}', 'int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)\n{\n    unsigned char *data;\n    assert(size <= sizeof(unsigned int));\n    if (size > sizeof(unsigned int)\n            || !WPACKET_allocate_bytes(pkt, size, &data)\n            || !put_value(data, val, size))\n        return 0;\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}']