static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,\n                             int isv2format, STACK_OF(SSL_CIPHER) **sk,\n                             STACK_OF(SSL_CIPHER) **scsvs)\n{\n    int alert;\n    PACKET pkt;\n    if (!PACKET_buf_init(&pkt, bytes, len))\n        return 0;\n    return bytes_to_cipher_list(s, &pkt, sk, scsvs, isv2format, &alert);\n}', 'static ossl_inline int PACKET_buf_init(PACKET *pkt,\n                                              const unsigned char *buf,\n                                              size_t len)\n{\n    if (len > (size_t)(SIZE_MAX / 2))\n        return 0;\n    pkt->curr = buf;\n    pkt->remaining = len;\n    return 1;\n}', "int bytes_to_cipher_list(SSL *s, PACKET *cipher_suites,\n                         STACK_OF(SSL_CIPHER) **skp,\n                         STACK_OF(SSL_CIPHER) **scsvs_out,\n                         int sslv2format, int *al)\n{\n    const SSL_CIPHER *c;\n    STACK_OF(SSL_CIPHER) *sk = NULL;\n    STACK_OF(SSL_CIPHER) *scsvs = NULL;\n    int n;\n    unsigned char cipher[SSLV2_CIPHER_LEN];\n    n = sslv2format ? SSLV2_CIPHER_LEN : TLS_CIPHER_LEN;\n    if (PACKET_remaining(cipher_suites) == 0) {\n        SSLerr(SSL_F_BYTES_TO_CIPHER_LIST, SSL_R_NO_CIPHERS_SPECIFIED);\n        *al = SSL_AD_ILLEGAL_PARAMETER;\n        return 0;\n    }\n    if (PACKET_remaining(cipher_suites) % n != 0) {\n        SSLerr(SSL_F_BYTES_TO_CIPHER_LIST,\n               SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);\n        *al = SSL_AD_DECODE_ERROR;\n        return 0;\n    }\n    sk = sk_SSL_CIPHER_new_null();\n    scsvs = sk_SSL_CIPHER_new_null();\n    if (sk == NULL || scsvs == NULL) {\n        SSLerr(SSL_F_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE);\n        *al = SSL_AD_INTERNAL_ERROR;\n        goto err;\n    }\n    while (PACKET_copy_bytes(cipher_suites, cipher, n)) {\n        if (sslv2format && cipher[0] != '\\0')\n            continue;\n        c = ssl_get_cipher_by_char(s, sslv2format ? &cipher[1] : cipher, 1);\n        if (c != NULL) {\n            if ((c->valid && !sk_SSL_CIPHER_push(sk, c)) ||\n                (!c->valid && !sk_SSL_CIPHER_push(scsvs, c))) {\n                SSLerr(SSL_F_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE);\n                *al = SSL_AD_INTERNAL_ERROR;\n                goto err;\n            }\n        }\n    }\n    if (PACKET_remaining(cipher_suites) > 0) {\n        *al = SSL_AD_INTERNAL_ERROR;\n        SSLerr(SSL_F_BYTES_TO_CIPHER_LIST, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    if (skp != NULL)\n        *skp = sk;\n    else\n        sk_SSL_CIPHER_free(sk);\n    if (scsvs_out != NULL)\n        *scsvs_out = scsvs;\n    else\n        sk_SSL_CIPHER_free(scsvs);\n    return 1;\n err:\n    sk_SSL_CIPHER_free(sk);\n    sk_SSL_CIPHER_free(scsvs);\n    return 0;\n}", 'static ossl_inline int PACKET_copy_bytes(PACKET *pkt,\n                                                unsigned char *data, size_t len)\n{\n    if (!PACKET_peek_copy_bytes(pkt, data, len))\n        return 0;\n    packet_forward(pkt, len);\n    return 1;\n}', 'static ossl_inline void packet_forward(PACKET *pkt, size_t len)\n{\n    pkt->curr += len;\n    pkt->remaining -= len;\n}']