diff options
Diffstat (limited to 'src/lib/libcrypto/ocsp/ocsp_ext.c')
-rw-r--r-- | src/lib/libcrypto/ocsp/ocsp_ext.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/lib/libcrypto/ocsp/ocsp_ext.c b/src/lib/libcrypto/ocsp/ocsp_ext.c index 815cc29d58..57399433fc 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ext.c +++ b/src/lib/libcrypto/ocsp/ocsp_ext.c | |||
@@ -265,8 +265,8 @@ int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc) | |||
265 | 265 | ||
266 | /* also CRL Entry Extensions */ | 266 | /* also CRL Entry Extensions */ |
267 | 267 | ||
268 | ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | 268 | ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(), |
269 | void *data, STACK_OF(ASN1_OBJECT) *sk) | 269 | char *data, STACK_OF(ASN1_OBJECT) *sk) |
270 | { | 270 | { |
271 | int i; | 271 | int i; |
272 | unsigned char *p, *b = NULL; | 272 | unsigned char *p, *b = NULL; |
@@ -274,23 +274,18 @@ ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | |||
274 | if (data) | 274 | if (data) |
275 | { | 275 | { |
276 | if ((i=i2d(data,NULL)) <= 0) goto err; | 276 | if ((i=i2d(data,NULL)) <= 0) goto err; |
277 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | 277 | if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i))) |
278 | goto err; | 278 | goto err; |
279 | if (i2d(data, &p) <= 0) goto err; | 279 | if (i2d(data, &p) <= 0) goto err; |
280 | } | 280 | } |
281 | else if (sk) | 281 | else if (sk) |
282 | { | 282 | { |
283 | if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL, | 283 | if ((i=i2d_ASN1_SET_OF_ASN1_OBJECT(sk,NULL,i2d,V_ASN1_SEQUENCE, |
284 | (I2D_OF(ASN1_OBJECT))i2d, | 284 | V_ASN1_UNIVERSAL,IS_SEQUENCE))<=0) goto err; |
285 | V_ASN1_SEQUENCE, | 285 | if (!(b=p=(unsigned char*)OPENSSL_malloc((unsigned int)i))) |
286 | V_ASN1_UNIVERSAL, | ||
287 | IS_SEQUENCE))<=0) goto err; | ||
288 | if (!(b=p=OPENSSL_malloc((unsigned int)i))) | ||
289 | goto err; | 286 | goto err; |
290 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d, | 287 | if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,i2d,V_ASN1_SEQUENCE, |
291 | V_ASN1_SEQUENCE, | 288 | V_ASN1_UNIVERSAL,IS_SEQUENCE)<=0) goto err; |
292 | V_ASN1_UNIVERSAL, | ||
293 | IS_SEQUENCE)<=0) goto err; | ||
294 | } | 289 | } |
295 | else | 290 | else |
296 | { | 291 | { |
@@ -444,8 +439,7 @@ X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim) | |||
444 | } | 439 | } |
445 | if (!(x = X509_EXTENSION_new())) goto err; | 440 | if (!(x = X509_EXTENSION_new())) goto err; |
446 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err; | 441 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err; |
447 | if (!(ASN1_STRING_encode_of(OCSP_CRLID,x->value,i2d_OCSP_CRLID,cid, | 442 | if (!(ASN1_STRING_encode(x->value,i2d_OCSP_CRLID,(char*)cid,NULL))) |
448 | NULL))) | ||
449 | goto err; | 443 | goto err; |
450 | OCSP_CRLID_free(cid); | 444 | OCSP_CRLID_free(cid); |
451 | return x; | 445 | return x; |
@@ -473,8 +467,7 @@ X509_EXTENSION *OCSP_accept_responses_new(char **oids) | |||
473 | if (!(x = X509_EXTENSION_new())) goto err; | 467 | if (!(x = X509_EXTENSION_new())) goto err; |
474 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses))) | 468 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses))) |
475 | goto err; | 469 | goto err; |
476 | if (!(ASN1_STRING_encode_of(ASN1_OBJECT,x->value,i2d_ASN1_OBJECT,NULL, | 470 | if (!(ASN1_STRING_encode(x->value,i2d_ASN1_OBJECT,NULL,sk))) |
477 | sk))) | ||
478 | goto err; | 471 | goto err; |
479 | sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); | 472 | sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); |
480 | return x; | 473 | return x; |
@@ -494,8 +487,8 @@ X509_EXTENSION *OCSP_archive_cutoff_new(char* tim) | |||
494 | if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err; | 487 | if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err; |
495 | if (!(x = X509_EXTENSION_new())) goto err; | 488 | if (!(x = X509_EXTENSION_new())) goto err; |
496 | if (!(x->object=OBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err; | 489 | if (!(x->object=OBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err; |
497 | if (!(ASN1_STRING_encode_of(ASN1_GENERALIZEDTIME,x->value, | 490 | if (!(ASN1_STRING_encode(x->value,i2d_ASN1_GENERALIZEDTIME, |
498 | i2d_ASN1_GENERALIZEDTIME,gt,NULL))) goto err; | 491 | (char*)gt,NULL))) goto err; |
499 | ASN1_GENERALIZEDTIME_free(gt); | 492 | ASN1_GENERALIZEDTIME_free(gt); |
500 | return x; | 493 | return x; |
501 | err: | 494 | err: |
@@ -533,8 +526,8 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls) | |||
533 | if (!(x = X509_EXTENSION_new())) goto err; | 526 | if (!(x = X509_EXTENSION_new())) goto err; |
534 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator))) | 527 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator))) |
535 | goto err; | 528 | goto err; |
536 | if (!(ASN1_STRING_encode_of(OCSP_SERVICELOC,x->value, | 529 | if (!(ASN1_STRING_encode(x->value, i2d_OCSP_SERVICELOC, |
537 | i2d_OCSP_SERVICELOC,sloc,NULL))) goto err; | 530 | (char*)sloc, NULL))) goto err; |
538 | OCSP_SERVICELOC_free(sloc); | 531 | OCSP_SERVICELOC_free(sloc); |
539 | return x; | 532 | return x; |
540 | err: | 533 | err: |