summaryrefslogtreecommitdiffstats
path: root/crypto/ocsp
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2005-03-31 09:26:39 +0000
committerBen Laurie <ben@openssl.org>2005-03-31 09:26:39 +0000
commit41a15c4f0f2535591ba9f258cf76119f86477c43 (patch)
tree6aca3f255f97dc3e9bd18884beeddf7de26fa122 /crypto/ocsp
parentfea4280a8b1a37bfe1ae6ffaede58722ad71afa1 (diff)
Give everything prototypes (well, everything that's actually used).
Diffstat (limited to 'crypto/ocsp')
-rw-r--r--crypto/ocsp/ocsp.h24
-rw-r--r--crypto/ocsp/ocsp_ext.c36
2 files changed, 32 insertions, 28 deletions
diff --git a/crypto/ocsp/ocsp.h b/crypto/ocsp/ocsp.h
index fab3c03182..37375c15d3 100644
--- a/crypto/ocsp/ocsp.h
+++ b/crypto/ocsp/ocsp.h
@@ -349,13 +349,9 @@ typedef struct ocsp_service_locator_st
#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
-#define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
- OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
- (unsigned char **)(p))
+#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
-#define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
- OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
- (unsigned char **)(p))
+#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
(char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
@@ -371,11 +367,9 @@ typedef struct ocsp_service_locator_st
PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
bp,(char *)o, NULL,NULL,0,NULL,NULL)
-#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
- (unsigned char *)o)
+#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
-#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
- (unsigned char *)o)
+#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
#define OCSP_REQUEST_sign(o,pkey,md) \
ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
@@ -396,8 +390,7 @@ typedef struct ocsp_service_locator_st
#define ASN1_BIT_STRING_digest(data,type,md,len) \
ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
-#define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
- (char *(*)())d2i_OCSP_CERTID,(char *)(cid))
+#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)
#define OCSP_CERTSTATUS_dup(cs)\
(OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
@@ -473,8 +466,11 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
STACK_OF(X509) *certs, unsigned long flags);
-ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
- char *data, STACK_OF(ASN1_OBJECT) *sk);
+ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s,
+ int (*i2d)(void *,unsigned char **),
+ void *data, STACK_OF(ASN1_OBJECT) *sk);
+#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
+((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))ASN1_STRING_encode)(s,i2d,data,sk)
X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
diff --git a/crypto/ocsp/ocsp_ext.c b/crypto/ocsp/ocsp_ext.c
index 57399433fc..658a89161f 100644
--- a/crypto/ocsp/ocsp_ext.c
+++ b/crypto/ocsp/ocsp_ext.c
@@ -265,8 +265,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)
+ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s,
+ int (*i2d)(void *,unsigned char **),
+ void *data, STACK_OF(ASN1_OBJECT) *sk)
{
int i;
unsigned char *p, *b = NULL;
@@ -274,18 +275,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
{
@@ -439,7 +445,8 @@ X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim)
}
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)))
+ if (!(ASN1_STRING_encode_of(OCSP_CRLID,x->value,i2d_OCSP_CRLID,cid,
+ NULL)))
goto err;
OCSP_CRLID_free(cid);
return x;
@@ -467,7 +474,8 @@ X509_EXTENSION *OCSP_accept_responses_new(char **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)))
+ if (!(ASN1_STRING_encode_of(ASN1_OBJECT,x->value,i2d_ASN1_OBJECT,NULL,
+ sk)))
goto err;
sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free);
return x;
@@ -487,8 +495,8 @@ X509_EXTENSION *OCSP_archive_cutoff_new(char* tim)
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;
+ if (!(ASN1_STRING_encode_of(ASN1_GENERALIZEDTIME,x->value,
+ i2d_ASN1_GENERALIZEDTIME,gt,NULL))) goto err;
ASN1_GENERALIZEDTIME_free(gt);
return x;
err:
@@ -526,8 +534,8 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **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;
+ if (!(ASN1_STRING_encode_of(OCSP_SERVICELOC,x->value,
+ i2d_OCSP_SERVICELOC,sloc,NULL))) goto err;
OCSP_SERVICELOC_free(sloc);
return x;
err: