int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
{
    int rv, start_idx, i;
    if (x == NULL) {
        x = sk_X509_value(sk, 0);
        start_idx = 1;
    } else
        start_idx = 0;
    rv = ssl_security_cert(s, NULL, x, vfy, 1);
    if (rv != 1)
        return rv;
    for (i = start_idx; i < sk_X509_num(sk); i++) {
        x = sk_X509_value(sk, i);
        rv = ssl_security_cert(s, NULL, x, vfy, 0);
        if (rv != 1)
            return rv;
    }
    return 1;
}
['int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)\n{\n    int rv, start_idx, i;\n    if (x == NULL) {\n        x = sk_X509_value(sk, 0);\n        start_idx = 1;\n    } else\n        start_idx = 0;\n    rv = ssl_security_cert(s, NULL, x, vfy, 1);\n    if (rv != 1)\n        return rv;\n    for (i = start_idx; i < sk_X509_num(sk); i++) {\n        x = sk_X509_value(sk, i);\n        rv = ssl_security_cert(s, NULL, x, vfy, 0);\n        if (rv != 1)\n            return rv;\n    }\n    return 1;\n}', 'DEFINE_STACK_OF(X509)', 'void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)\n{\n    if (st == NULL || i < 0 || i >= st->num)\n        return NULL;\n    return (void *)st->data[i];\n}']