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