X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) { const unsigned char *q = *pp; X509 *ret; int freeret = 0; if (!a || *a == NULL) freeret = 1; ret = d2i_X509(a, &q, length); /* If certificate unreadable then forget it */ if (!ret) return NULL; /* update length */ length -= q - *pp; /* Parse auxiliary information if there is any. */ if (length > 0 && !d2i_X509_CERT_AUX(&ret->aux, &q, length)) goto err; *pp = q; return ret; err: if (freeret) { X509_free(ret); if (a) *a = NULL; } return NULL; }
X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) { const unsigned char *q; X509 *ret; int freeret = 0; /* Save start position */ q = *pp; if (a == NULL || *a == NULL) freeret = 1; ret = d2i_X509(a, &q, length); /* If certificate unreadable then forget it */ if (ret == NULL) return NULL; /* update length */ length -= q - *pp; if (length > 0 && !d2i_X509_CERT_AUX(&ret->aux, &q, length)) goto err; *pp = q; return ret; err: if (freeret) { X509_free(ret); if (a) *a = NULL; } return NULL; }
X509 * d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) { const unsigned char *q; X509 *ret; /* Save start position */ q = *pp; ret = d2i_X509(NULL, pp, length); /* If certificate unreadable then forget it */ if (!ret) return NULL; /* update length */ length -= *pp - q; if (length > 0) { if (!d2i_X509_CERT_AUX(&ret->aux, pp, length)) goto err; } if (a != NULL) { X509_free(*a); *a = ret; } return ret; err: X509_free(ret); return NULL; }