summaryrefslogtreecommitdiff
path: root/crypto/ocsp/ocsp_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ocsp/ocsp_ext.c')
-rw-r--r--crypto/ocsp/ocsp_ext.c66
1 files changed, 23 insertions, 43 deletions
diff --git a/crypto/ocsp/ocsp_ext.c b/crypto/ocsp/ocsp_ext.c
index 57399433fc..ec884cb08f 100644
--- a/crypto/ocsp/ocsp_ext.c
+++ b/crypto/ocsp/ocsp_ext.c
@@ -264,9 +264,9 @@ int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc)
}
/* also CRL Entry Extensions */
-
-ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
- char *data, STACK_OF(ASN1_OBJECT) *sk)
+#if 0
+ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
+ void *data, STACK_OF(ASN1_OBJECT) *sk)
{
int i;
unsigned char *p, *b = NULL;
@@ -274,18 +274,23 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
if (data)
{
if ((i=i2d(data,NULL)) <= 0) goto err;
- if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i)))
+ if (!(b=p=OPENSSL_malloc((unsigned int)i)))
goto err;
if (i2d(data, &p) <= 0) goto err;
}
else if (sk)
{
- if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL,i2d,V_ASN1_SEQUENCE,
- V_ASN1_UNIVERSAL,IS_SEQUENCE))<=0) goto err;
- if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i)))
+ if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL,
+ (I2D_OF(ASN1_OBJECT))i2d,
+ V_ASN1_SEQUENCE,
+ V_ASN1_UNIVERSAL,
+ IS_SEQUENCE))<=0) goto err;
+ if (!(b=p=OPENSSL_malloc((unsigned int)i)))
goto err;
- if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,i2d,V_ASN1_SEQUENCE,
- V_ASN1_UNIVERSAL,IS_SEQUENCE)<=0) goto err;
+ if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d,
+ V_ASN1_SEQUENCE,
+ V_ASN1_UNIVERSAL,
+ IS_SEQUENCE)<=0) goto err;
}
else
{
@@ -300,6 +305,7 @@ err:
if (b) OPENSSL_free(b);
return NULL;
}
+#endif
/* Nonce handling functions */
@@ -437,16 +443,10 @@ X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim)
if (!(ASN1_GENERALIZEDTIME_set_string(cid->crlTime, tim)))
goto err;
}
- if (!(x = X509_EXTENSION_new())) goto err;
- if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err;
- if (!(ASN1_STRING_encode(x->value,i2d_OCSP_CRLID,(char*)cid,NULL)))
- goto err;
- OCSP_CRLID_free(cid);
- return x;
+ x = X509V3_EXT_i2d(NID_id_pkix_OCSP_CrlID, 0, cid);
err:
- if (x) X509_EXTENSION_free(x);
if (cid) OCSP_CRLID_free(cid);
- return NULL;
+ return x;
}
/* AcceptableResponses ::= SEQUENCE OF OBJECT IDENTIFIER */
@@ -464,17 +464,10 @@ X509_EXTENSION *OCSP_accept_responses_new(char **oids)
sk_ASN1_OBJECT_push(sk, o);
oids++;
}
- if (!(x = X509_EXTENSION_new())) goto err;
- if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses)))
- goto err;
- if (!(ASN1_STRING_encode(x->value,i2d_ASN1_OBJECT,NULL,sk)))
- goto err;
- sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
- return x;
+ x = X509V3_EXT_i2d(NID_id_pkix_OCSP_acceptableResponses, 0, sk);
err:
- if (x) X509_EXTENSION_free(x);
if (sk) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
- return NULL;
+ return x;
}
/* ArchiveCutoff ::= GeneralizedTime */
@@ -485,16 +478,10 @@ X509_EXTENSION *OCSP_archive_cutoff_new(char* tim)
if (!(gt = ASN1_GENERALIZEDTIME_new())) goto err;
if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err;
- if (!(x = X509_EXTENSION_new())) goto err;
- if (!(x->object=OBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err;
- if (!(ASN1_STRING_encode(x->value,i2d_ASN1_GENERALIZEDTIME,
- (char*)gt,NULL))) goto err;
- ASN1_GENERALIZEDTIME_free(gt);
- return x;
+ x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
err:
if (gt) ASN1_GENERALIZEDTIME_free(gt);
- if (x) X509_EXTENSION_free(x);
- return NULL;
+ return x;
}
/* per ACCESS_DESCRIPTION parameter are oids, of which there are currently
@@ -523,16 +510,9 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls)
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;
+ x = X509V3_EXT_i2d(NID_id_pkix_OCSP_serviceLocator, 0, sloc);
err:
- if (x) X509_EXTENSION_free(x);
if (sloc) OCSP_SERVICELOC_free(sloc);
- return NULL;
+ return x;
}