diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_io.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/lib/libcrypto/cms/cms_io.c b/src/lib/libcrypto/cms/cms_io.c index 9af30424e5..56d7cd68e1 100644 --- a/src/lib/libcrypto/cms/cms_io.c +++ b/src/lib/libcrypto/cms/cms_io.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_io.c,v 1.7 2019/08/10 16:03:54 jsing Exp $ */ | 1 | /* $OpenBSD: cms_io.c,v 1.8 2019/08/10 16:42:20 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -61,73 +61,73 @@ | |||
| 61 | 61 | ||
| 62 | int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) | 62 | int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms) |
| 63 | { | 63 | { |
| 64 | ASN1_OCTET_STRING **pos; | 64 | ASN1_OCTET_STRING **pos; |
| 65 | pos = CMS_get0_content(cms); | 65 | pos = CMS_get0_content(cms); |
| 66 | if (pos == NULL) | 66 | if (pos == NULL) |
| 67 | return 0; | 67 | return 0; |
| 68 | if (*pos == NULL) | 68 | if (*pos == NULL) |
| 69 | *pos = ASN1_OCTET_STRING_new(); | 69 | *pos = ASN1_OCTET_STRING_new(); |
| 70 | if (*pos != NULL) { | 70 | if (*pos != NULL) { |
| 71 | (*pos)->flags |= ASN1_STRING_FLAG_NDEF; | 71 | (*pos)->flags |= ASN1_STRING_FLAG_NDEF; |
| 72 | (*pos)->flags &= ~ASN1_STRING_FLAG_CONT; | 72 | (*pos)->flags &= ~ASN1_STRING_FLAG_CONT; |
| 73 | *boundary = &(*pos)->data; | 73 | *boundary = &(*pos)->data; |
| 74 | return 1; | 74 | return 1; |
| 75 | } | 75 | } |
| 76 | CMSerr(CMS_F_CMS_STREAM, ERR_R_MALLOC_FAILURE); | 76 | CMSerr(CMS_F_CMS_STREAM, ERR_R_MALLOC_FAILURE); |
| 77 | return 0; | 77 | return 0; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) | 80 | CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) |
| 81 | { | 81 | { |
| 82 | return ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); | 82 | return ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms) | 85 | int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms) |
| 86 | { | 86 | { |
| 87 | return ASN1_item_i2d_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); | 87 | return ASN1_item_i2d_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | IMPLEMENT_PEM_rw_const(CMS, CMS_ContentInfo, PEM_STRING_CMS, CMS_ContentInfo) | 90 | IMPLEMENT_PEM_rw_const(CMS, CMS_ContentInfo, PEM_STRING_CMS, CMS_ContentInfo) |
| 91 | 91 | ||
| 92 | BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) | 92 | BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms) |
| 93 | { | 93 | { |
| 94 | return BIO_new_NDEF(out, (ASN1_VALUE *)cms, | 94 | return BIO_new_NDEF(out, (ASN1_VALUE *)cms, |
| 95 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 95 | ASN1_ITEM_rptr(CMS_ContentInfo)); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | /* CMS wrappers round generalised stream and MIME routines */ | 98 | /* CMS wrappers round generalised stream and MIME routines */ |
| 99 | 99 | ||
| 100 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) | 100 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags) |
| 101 | { | 101 | { |
| 102 | return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags, | 102 | return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)cms, in, flags, |
| 103 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 103 | ASN1_ITEM_rptr(CMS_ContentInfo)); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, | 106 | int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, |
| 107 | int flags) | 107 | int flags) |
| 108 | { | 108 | { |
| 109 | return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)cms, in, flags, | 109 | return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *)cms, in, flags, |
| 110 | "CMS", ASN1_ITEM_rptr(CMS_ContentInfo)); | 110 | "CMS", ASN1_ITEM_rptr(CMS_ContentInfo)); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) | 113 | int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) |
| 114 | { | 114 | { |
| 115 | STACK_OF(X509_ALGOR) *mdalgs; | 115 | STACK_OF(X509_ALGOR) *mdalgs; |
| 116 | int ctype_nid = OBJ_obj2nid(cms->contentType); | 116 | int ctype_nid = OBJ_obj2nid(cms->contentType); |
| 117 | int econt_nid = OBJ_obj2nid(CMS_get0_eContentType(cms)); | 117 | int econt_nid = OBJ_obj2nid(CMS_get0_eContentType(cms)); |
| 118 | if (ctype_nid == NID_pkcs7_signed) | 118 | if (ctype_nid == NID_pkcs7_signed) |
| 119 | mdalgs = cms->d.signedData->digestAlgorithms; | 119 | mdalgs = cms->d.signedData->digestAlgorithms; |
| 120 | else | 120 | else |
| 121 | mdalgs = NULL; | 121 | mdalgs = NULL; |
| 122 | 122 | ||
| 123 | return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags, | 123 | return SMIME_write_ASN1(bio, (ASN1_VALUE *)cms, data, flags, |
| 124 | ctype_nid, econt_nid, mdalgs, | 124 | ctype_nid, econt_nid, mdalgs, |
| 125 | ASN1_ITEM_rptr(CMS_ContentInfo)); | 125 | ASN1_ITEM_rptr(CMS_ContentInfo)); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont) | 128 | CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont) |
| 129 | { | 129 | { |
| 130 | return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont, | 130 | return (CMS_ContentInfo *)SMIME_read_ASN1(bio, bcont, |
| 131 | ASN1_ITEM_rptr | 131 | ASN1_ITEM_rptr |
| 132 | (CMS_ContentInfo)); | 132 | (CMS_ContentInfo)); |
| 133 | } | 133 | } |
