/* Not strictly speaking an "up_ref" as a STACK doesn't have a reference count but it has the same effect by duping the STACK and upping the ref of each X509 structure.  */
STACK_OF(X509)
/* Not strictly speaking an "up_ref" as a STACK doesn't have a reference count but it has the same effect by duping the STACK and upping the ref of each X509 structure.  */
STACK_OF(X509)
{
    STACK_OF(X509) *ret;
    size_t i;
    ret = sk_X509_dup(chain);
    for (i = 0; i < sk_X509_num(ret); i++) {
        X509_up_ref(sk_X509_value(ret, i));
    }
    return ret;
}