-X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls)
- {
- X509_EXTENSION *x = NULL;
- ASN1_IA5STRING *ia5 = NULL;
- OCSP_SERVICELOC *sloc = NULL;
- ACCESS_DESCRIPTION *ad = NULL;
-
- if (!(sloc = OCSP_SERVICELOC_new())) goto err;
- if (!(sloc->issuer = X509_NAME_dup(issuer))) goto err;
- if (urls && *urls && !(sloc->locator = sk_ACCESS_DESCRIPTION_new_null())) goto err;
- while (urls && *urls)
- {
- if (!(ad = ACCESS_DESCRIPTION_new())) goto err;
- if (!(ad->method=OBJ_nid2obj(NID_ad_OCSP))) goto err;
- if (!(ad->location = GENERAL_NAME_new())) goto err;
- if (!(ia5 = ASN1_IA5STRING_new())) goto err;
- if (!ASN1_STRING_set((ASN1_STRING*)ia5, *urls, -1)) goto err;
- ad->location->type = GEN_URI;
- ad->location->d.ia5 = ia5;
- if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad)) goto err;
- urls++;
- }
- if (!(x = X509_EXTENSION_new())) goto err;
- if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator)))
- goto err;
- if (!(ASN1_STRING_encode(x->value, i2d_OCSP_SERVICELOC,
- (char*)sloc, NULL))) goto err;
- OCSP_SERVICELOC_free(sloc);
- return x;
-err:
- if (x) X509_EXTENSION_free(x);
- if (sloc) OCSP_SERVICELOC_free(sloc);
- return NULL;
- }
-
+X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, char **urls)
+{
+ X509_EXTENSION *x = NULL;
+ ASN1_IA5STRING *ia5 = NULL;
+ OCSP_SERVICELOC *sloc = NULL;
+ ACCESS_DESCRIPTION *ad = NULL;
+
+ if (!(sloc = OCSP_SERVICELOC_new()))
+ goto err;
+ if (!(sloc->issuer = X509_NAME_dup(issuer)))
+ goto err;
+ if (urls && *urls && !(sloc->locator = sk_ACCESS_DESCRIPTION_new_null()))
+ goto err;
+ while (urls && *urls) {
+ if (!(ad = ACCESS_DESCRIPTION_new()))
+ goto err;
+ if (!(ad->method = OBJ_nid2obj(NID_ad_OCSP)))
+ goto err;
+ if (!(ad->location = GENERAL_NAME_new()))
+ goto err;
+ if (!(ia5 = ASN1_IA5STRING_new()))
+ goto err;
+ if (!ASN1_STRING_set((ASN1_STRING *)ia5, *urls, -1))
+ goto err;
+ ad->location->type = GEN_URI;
+ ad->location->d.ia5 = ia5;
+ if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad))
+ goto err;
+ urls++;
+ }
+ x = X509V3_EXT_i2d(NID_id_pkix_OCSP_serviceLocator, 0, sloc);
+ err:
+ if (sloc)
+ OCSP_SERVICELOC_free(sloc);
+ return x;
+}