static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
    pkt->curr += len;
    pkt->remaining -= len;
}
['static int validate_client_hello(BIO *wbio)\n{\n    PACKET pkt;\n    long len;\n    unsigned char *data;\n    int cookie_found = 0;\n    unsigned int u;\n    len = BIO_get_mem_data(wbio, (char **)&data);\n    if (!PACKET_buf_init(&pkt, data, len))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_HANDSHAKE)\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER)\n        return 0;\n    if (!PACKET_forward(&pkt, DTLS1_RT_HEADER_LENGTH - 3))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || u != SSL3_MT_CLIENT_HELLO)\n        return 0;\n    if (!PACKET_forward(&pkt, DTLS1_HM_HEADER_LENGTH - 1))\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || u != DTLS1_BAD_VER)\n        return 0;\n    if (!PACKET_copy_bytes(&pkt, client_random, SSL3_RANDOM_SIZE))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u))\n        return 0;\n    if (u != sizeof(session_id) || !PACKET_starts(&pkt, session_id, u))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u))\n        return 0;\n    if (u) {\n        if (u != sizeof(cookie) || !PACKET_starts(&pkt, cookie, u))\n            return 0;\n        cookie_found = 1;\n    }\n    if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (!PACKET_get_1(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (!PACKET_get_net_2(&pkt, &u) || !PACKET_forward(&pkt, u))\n        return 0;\n    if (PACKET_remaining(&pkt))\n        return 0;\n    if (cookie_found && !EVP_DigestUpdate(handshake_md, data + MAC_OFFSET,\n                                          len - MAC_OFFSET))\n            printf("EVP_DigestUpdate() failed\\n");\n    (void)BIO_reset(wbio);\n    return 1 + cookie_found;\n}', 'static ossl_inline int PACKET_starts(PACKET *pkt, const void *ptr,\n                                            size_t num)\n{\n    if (PACKET_remaining(pkt) < num)\n        return 0;\n    if (CRYPTO_memcmp(pkt->curr, ptr, num) != 0)\n        return 0;\n    packet_forward(pkt, num);\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}']