|
11 | 11 | /* Prototypes */ |
12 | 12 | static int pkcs7_set_content_blob(PKCS7 *sig, PKCS7 *cursig); |
13 | 13 | static SpcSpOpusInfo *spc_sp_opus_info_create(FILE_FORMAT_CTX *ctx); |
14 | | -static int X509_attribute_chain_append_signature(STACK_OF(X509_ATTRIBUTE) **unauth_attr, u_char *p, int len); |
15 | 14 | static int spc_indirect_data_content_get(u_char **blob, int *len, FILE_FORMAT_CTX *ctx); |
16 | 15 | static int pkcs7_set_spc_indirect_data_content(PKCS7 *p7, BIO *hash, u_char *buf, int len); |
17 | 16 | static int pkcs7_signer_info_add_spc_sp_opus_info(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX *ctx); |
18 | 17 | static int pkcs7_signer_info_add_purpose(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX *ctx); |
19 | | -static int pkcs7_signer_info_add_signing_time(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX *ctx); |
20 | 18 |
|
21 | 19 | /* |
22 | 20 | * Common functions |
@@ -174,7 +172,7 @@ static int pkcs7_signer_info_add_purpose(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX |
174 | 172 | * [in] ctx: structure holds input and output data |
175 | 173 | * [returns] 0 on error or 1 on success |
176 | 174 | */ |
177 | | -static int pkcs7_signer_info_add_signing_time(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX *ctx) |
| 175 | +int pkcs7_signer_info_add_signing_time(PKCS7_SIGNER_INFO *si, FILE_FORMAT_CTX *ctx) |
178 | 176 | { |
179 | 177 | if (ctx->options->time == INVALID_TIME) /* -time option was not specified */ |
180 | 178 | return 1; /* SUCCESS */ |
@@ -380,44 +378,6 @@ static int pkcs7_set_content_blob(PKCS7 *sig, PKCS7 *cursig) |
380 | 378 | return 1; /* OK */ |
381 | 379 | } |
382 | 380 |
|
383 | | -/* |
384 | | - * Add the new signature to the current signature as a nested signature: |
385 | | - * new unauthorized SPC_NESTED_SIGNATURE_OBJID attribute |
386 | | - * [out] cursig: current PKCS#7 signature |
387 | | - * [in] p7: new PKCS#7 signature |
388 | | - * [in] ctx: structure holds input and output data |
389 | | - * [returns] 0 on error or 1 on success |
390 | | - */ |
391 | | -int cursig_set_nested(PKCS7 *cursig, PKCS7 *p7, FILE_FORMAT_CTX *ctx) |
392 | | -{ |
393 | | - u_char *p = NULL; |
394 | | - int len = 0; |
395 | | - PKCS7_SIGNER_INFO *si; |
396 | | - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; |
397 | | - |
398 | | - if (!cursig) |
399 | | - return 0; /* FAILED */ |
400 | | - signer_info = PKCS7_get_signer_info(cursig); |
401 | | - if (!signer_info) |
402 | | - return 0; /* FAILED */ |
403 | | - si = sk_PKCS7_SIGNER_INFO_value(signer_info, 0); |
404 | | - if (!si) |
405 | | - return 0; /* FAILED */ |
406 | | - if (((len = i2d_PKCS7(p7, NULL)) <= 0) || |
407 | | - (p = OPENSSL_malloc((size_t)len)) == NULL) |
408 | | - return 0; /* FAILED */ |
409 | | - i2d_PKCS7(p7, &p); |
410 | | - p -= len; |
411 | | - |
412 | | - pkcs7_signer_info_add_signing_time(si, ctx); |
413 | | - if (!X509_attribute_chain_append_signature(&(si->unauth_attr), p, len)) { |
414 | | - OPENSSL_free(p); |
415 | | - return 0; /* FAILED */ |
416 | | - } |
417 | | - OPENSSL_free(p); |
418 | | - return 1; /* OK */ |
419 | | -} |
420 | | - |
421 | 381 | /* Return the header length (tag and length octets) of the ASN.1 type |
422 | 382 | * [in] p: ASN.1 data |
423 | 383 | * [in] len: ASN.1 data length |
@@ -603,44 +563,6 @@ static SpcSpOpusInfo *spc_sp_opus_info_create(FILE_FORMAT_CTX *ctx) |
603 | 563 | return info; |
604 | 564 | } |
605 | 565 |
|
606 | | -/* |
607 | | - * [in, out] unauth_attr: unauthorized attributes list |
608 | | - * [in] p: PKCS#7 data |
609 | | - * [in] len: PKCS#7 data length |
610 | | - * [returns] 0 on error or 1 on success |
611 | | - */ |
612 | | -static int X509_attribute_chain_append_signature(STACK_OF(X509_ATTRIBUTE) **unauth_attr, u_char *p, int len) |
613 | | -{ |
614 | | - X509_ATTRIBUTE *attr = NULL; |
615 | | - int nid = OBJ_txt2nid(SPC_NESTED_SIGNATURE_OBJID); |
616 | | - |
617 | | - if (*unauth_attr == NULL) { |
618 | | - if ((*unauth_attr = sk_X509_ATTRIBUTE_new_null()) == NULL) |
619 | | - return 0; /* FAILED */ |
620 | | - } else { |
621 | | - /* try to find SPC_NESTED_SIGNATURE_OBJID attribute */ |
622 | | - int i; |
623 | | - for (i = 0; i < sk_X509_ATTRIBUTE_num(*unauth_attr); i++) { |
624 | | - attr = sk_X509_ATTRIBUTE_value(*unauth_attr, i); |
625 | | - if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) { |
626 | | - /* append p to the V_ASN1_SEQUENCE */ |
627 | | - if (!X509_ATTRIBUTE_set1_data(attr, V_ASN1_SEQUENCE, p, len)) |
628 | | - return 0; /* FAILED */ |
629 | | - return 1; /* OK */ |
630 | | - } |
631 | | - } |
632 | | - } |
633 | | - /* create new unauthorized SPC_NESTED_SIGNATURE_OBJID attribute */ |
634 | | - attr = X509_ATTRIBUTE_create_by_NID(NULL, nid, V_ASN1_SEQUENCE, p, len); |
635 | | - if (!attr) |
636 | | - return 0; /* FAILED */ |
637 | | - if (!sk_X509_ATTRIBUTE_push(*unauth_attr, attr)) { |
638 | | - X509_ATTRIBUTE_free(attr); |
639 | | - return 0; /* FAILED */ |
640 | | - } |
641 | | - return 1; /* OK */ |
642 | | -} |
643 | | - |
644 | 566 | /* |
645 | 567 | * [out] blob: SpcIndirectDataContent data |
646 | 568 | * [out] len: SpcIndirectDataContent data length |
|
0 commit comments