diff options
Diffstat (limited to 'src/lib/libcrypto')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_lcl.h | 415 |
1 files changed, 205 insertions, 210 deletions
diff --git a/src/lib/libcrypto/cms/cms_lcl.h b/src/lib/libcrypto/cms/cms_lcl.h index ae80ee365b..3dbfa43f20 100644 --- a/src/lib/libcrypto/cms/cms_lcl.h +++ b/src/lib/libcrypto/cms/cms_lcl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_lcl.h,v 1.7 2019/08/10 16:03:54 jsing Exp $ */ | 1 | /* $OpenBSD: cms_lcl.h,v 1.8 2019/08/10 18:27:49 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. |
| @@ -53,9 +53,9 @@ | |||
| 53 | */ | 53 | */ |
| 54 | 54 | ||
| 55 | #ifndef HEADER_CMS_LCL_H | 55 | #ifndef HEADER_CMS_LCL_H |
| 56 | # define HEADER_CMS_LCL_H | 56 | #define HEADER_CMS_LCL_H |
| 57 | 57 | ||
| 58 | # include <openssl/x509.h> | 58 | #include <openssl/x509.h> |
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * Cryptographic message syntax (CMS) structures: taken from RFC3852 | 61 | * Cryptographic message syntax (CMS) structures: taken from RFC3852 |
| @@ -90,259 +90,259 @@ typedef struct CMS_OtherRecipientInfo_st CMS_OtherRecipientInfo; | |||
| 90 | typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom; | 90 | typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom; |
| 91 | 91 | ||
| 92 | struct CMS_ContentInfo_st { | 92 | struct CMS_ContentInfo_st { |
| 93 | ASN1_OBJECT *contentType; | 93 | ASN1_OBJECT *contentType; |
| 94 | union { | 94 | union { |
| 95 | ASN1_OCTET_STRING *data; | 95 | ASN1_OCTET_STRING *data; |
| 96 | CMS_SignedData *signedData; | 96 | CMS_SignedData *signedData; |
| 97 | CMS_EnvelopedData *envelopedData; | 97 | CMS_EnvelopedData *envelopedData; |
| 98 | CMS_DigestedData *digestedData; | 98 | CMS_DigestedData *digestedData; |
| 99 | CMS_EncryptedData *encryptedData; | 99 | CMS_EncryptedData *encryptedData; |
| 100 | CMS_AuthenticatedData *authenticatedData; | 100 | CMS_AuthenticatedData *authenticatedData; |
| 101 | CMS_CompressedData *compressedData; | 101 | CMS_CompressedData *compressedData; |
| 102 | ASN1_TYPE *other; | 102 | ASN1_TYPE *other; |
| 103 | /* Other types ... */ | 103 | /* Other types ... */ |
| 104 | void *otherData; | 104 | void *otherData; |
| 105 | } d; | 105 | } d; |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | DEFINE_STACK_OF(CMS_CertificateChoices) | 108 | DEFINE_STACK_OF(CMS_CertificateChoices) |
| 109 | 109 | ||
| 110 | struct CMS_SignedData_st { | 110 | struct CMS_SignedData_st { |
| 111 | int32_t version; | 111 | int32_t version; |
| 112 | STACK_OF(X509_ALGOR) *digestAlgorithms; | 112 | STACK_OF(X509_ALGOR) *digestAlgorithms; |
| 113 | CMS_EncapsulatedContentInfo *encapContentInfo; | 113 | CMS_EncapsulatedContentInfo *encapContentInfo; |
| 114 | STACK_OF(CMS_CertificateChoices) *certificates; | 114 | STACK_OF(CMS_CertificateChoices) *certificates; |
| 115 | STACK_OF(CMS_RevocationInfoChoice) *crls; | 115 | STACK_OF(CMS_RevocationInfoChoice) *crls; |
| 116 | STACK_OF(CMS_SignerInfo) *signerInfos; | 116 | STACK_OF(CMS_SignerInfo) *signerInfos; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | struct CMS_EncapsulatedContentInfo_st { | 119 | struct CMS_EncapsulatedContentInfo_st { |
| 120 | ASN1_OBJECT *eContentType; | 120 | ASN1_OBJECT *eContentType; |
| 121 | ASN1_OCTET_STRING *eContent; | 121 | ASN1_OCTET_STRING *eContent; |
| 122 | /* Set to 1 if incomplete structure only part set up */ | 122 | /* Set to 1 if incomplete structure only part set up */ |
| 123 | int partial; | 123 | int partial; |
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | struct CMS_SignerInfo_st { | 126 | struct CMS_SignerInfo_st { |
| 127 | int32_t version; | 127 | int32_t version; |
| 128 | CMS_SignerIdentifier *sid; | 128 | CMS_SignerIdentifier *sid; |
| 129 | X509_ALGOR *digestAlgorithm; | 129 | X509_ALGOR *digestAlgorithm; |
| 130 | STACK_OF(X509_ATTRIBUTE) *signedAttrs; | 130 | STACK_OF(X509_ATTRIBUTE) *signedAttrs; |
| 131 | X509_ALGOR *signatureAlgorithm; | 131 | X509_ALGOR *signatureAlgorithm; |
| 132 | ASN1_OCTET_STRING *signature; | 132 | ASN1_OCTET_STRING *signature; |
| 133 | STACK_OF(X509_ATTRIBUTE) *unsignedAttrs; | 133 | STACK_OF(X509_ATTRIBUTE) *unsignedAttrs; |
| 134 | /* Signing certificate and key */ | 134 | /* Signing certificate and key */ |
| 135 | X509 *signer; | 135 | X509 *signer; |
| 136 | EVP_PKEY *pkey; | 136 | EVP_PKEY *pkey; |
| 137 | /* Digest and public key context for alternative parameters */ | 137 | /* Digest and public key context for alternative parameters */ |
| 138 | EVP_MD_CTX *mctx; | 138 | EVP_MD_CTX *mctx; |
| 139 | EVP_PKEY_CTX *pctx; | 139 | EVP_PKEY_CTX *pctx; |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| 142 | struct CMS_SignerIdentifier_st { | 142 | struct CMS_SignerIdentifier_st { |
| 143 | int type; | 143 | int type; |
| 144 | union { | 144 | union { |
| 145 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; | 145 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; |
| 146 | ASN1_OCTET_STRING *subjectKeyIdentifier; | 146 | ASN1_OCTET_STRING *subjectKeyIdentifier; |
| 147 | } d; | 147 | } d; |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | struct CMS_EnvelopedData_st { | 150 | struct CMS_EnvelopedData_st { |
| 151 | int32_t version; | 151 | int32_t version; |
| 152 | CMS_OriginatorInfo *originatorInfo; | 152 | CMS_OriginatorInfo *originatorInfo; |
| 153 | STACK_OF(CMS_RecipientInfo) *recipientInfos; | 153 | STACK_OF(CMS_RecipientInfo) *recipientInfos; |
| 154 | CMS_EncryptedContentInfo *encryptedContentInfo; | 154 | CMS_EncryptedContentInfo *encryptedContentInfo; |
| 155 | STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs; | 155 | STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs; |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | struct CMS_OriginatorInfo_st { | 158 | struct CMS_OriginatorInfo_st { |
| 159 | STACK_OF(CMS_CertificateChoices) *certificates; | 159 | STACK_OF(CMS_CertificateChoices) *certificates; |
| 160 | STACK_OF(CMS_RevocationInfoChoice) *crls; | 160 | STACK_OF(CMS_RevocationInfoChoice) *crls; |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | struct CMS_EncryptedContentInfo_st { | 163 | struct CMS_EncryptedContentInfo_st { |
| 164 | ASN1_OBJECT *contentType; | 164 | ASN1_OBJECT *contentType; |
| 165 | X509_ALGOR *contentEncryptionAlgorithm; | 165 | X509_ALGOR *contentEncryptionAlgorithm; |
| 166 | ASN1_OCTET_STRING *encryptedContent; | 166 | ASN1_OCTET_STRING *encryptedContent; |
| 167 | /* Content encryption algorithm and key */ | 167 | /* Content encryption algorithm and key */ |
| 168 | const EVP_CIPHER *cipher; | 168 | const EVP_CIPHER *cipher; |
| 169 | unsigned char *key; | 169 | unsigned char *key; |
| 170 | size_t keylen; | 170 | size_t keylen; |
| 171 | /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */ | 171 | /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */ |
| 172 | int debug; | 172 | int debug; |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | struct CMS_RecipientInfo_st { | 175 | struct CMS_RecipientInfo_st { |
| 176 | int type; | 176 | int type; |
| 177 | union { | 177 | union { |
| 178 | CMS_KeyTransRecipientInfo *ktri; | 178 | CMS_KeyTransRecipientInfo *ktri; |
| 179 | CMS_KeyAgreeRecipientInfo *kari; | 179 | CMS_KeyAgreeRecipientInfo *kari; |
| 180 | CMS_KEKRecipientInfo *kekri; | 180 | CMS_KEKRecipientInfo *kekri; |
| 181 | CMS_PasswordRecipientInfo *pwri; | 181 | CMS_PasswordRecipientInfo *pwri; |
| 182 | CMS_OtherRecipientInfo *ori; | 182 | CMS_OtherRecipientInfo *ori; |
| 183 | } d; | 183 | } d; |
| 184 | }; | 184 | }; |
| 185 | 185 | ||
| 186 | typedef CMS_SignerIdentifier CMS_RecipientIdentifier; | 186 | typedef CMS_SignerIdentifier CMS_RecipientIdentifier; |
| 187 | 187 | ||
| 188 | struct CMS_KeyTransRecipientInfo_st { | 188 | struct CMS_KeyTransRecipientInfo_st { |
| 189 | int32_t version; | 189 | int32_t version; |
| 190 | CMS_RecipientIdentifier *rid; | 190 | CMS_RecipientIdentifier *rid; |
| 191 | X509_ALGOR *keyEncryptionAlgorithm; | 191 | X509_ALGOR *keyEncryptionAlgorithm; |
| 192 | ASN1_OCTET_STRING *encryptedKey; | 192 | ASN1_OCTET_STRING *encryptedKey; |
| 193 | /* Recipient Key and cert */ | 193 | /* Recipient Key and cert */ |
| 194 | X509 *recip; | 194 | X509 *recip; |
| 195 | EVP_PKEY *pkey; | 195 | EVP_PKEY *pkey; |
| 196 | /* Public key context for this operation */ | 196 | /* Public key context for this operation */ |
| 197 | EVP_PKEY_CTX *pctx; | 197 | EVP_PKEY_CTX *pctx; |
| 198 | }; | 198 | }; |
| 199 | 199 | ||
| 200 | struct CMS_KeyAgreeRecipientInfo_st { | 200 | struct CMS_KeyAgreeRecipientInfo_st { |
| 201 | int32_t version; | 201 | int32_t version; |
| 202 | CMS_OriginatorIdentifierOrKey *originator; | 202 | CMS_OriginatorIdentifierOrKey *originator; |
| 203 | ASN1_OCTET_STRING *ukm; | 203 | ASN1_OCTET_STRING *ukm; |
| 204 | X509_ALGOR *keyEncryptionAlgorithm; | 204 | X509_ALGOR *keyEncryptionAlgorithm; |
| 205 | STACK_OF(CMS_RecipientEncryptedKey) *recipientEncryptedKeys; | 205 | STACK_OF(CMS_RecipientEncryptedKey) *recipientEncryptedKeys; |
| 206 | /* Public key context associated with current operation */ | 206 | /* Public key context associated with current operation */ |
| 207 | EVP_PKEY_CTX *pctx; | 207 | EVP_PKEY_CTX *pctx; |
| 208 | /* Cipher context for CEK wrapping */ | 208 | /* Cipher context for CEK wrapping */ |
| 209 | EVP_CIPHER_CTX *ctx; | 209 | EVP_CIPHER_CTX *ctx; |
| 210 | }; | 210 | }; |
| 211 | 211 | ||
| 212 | struct CMS_OriginatorIdentifierOrKey_st { | 212 | struct CMS_OriginatorIdentifierOrKey_st { |
| 213 | int type; | 213 | int type; |
| 214 | union { | 214 | union { |
| 215 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; | 215 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; |
| 216 | ASN1_OCTET_STRING *subjectKeyIdentifier; | 216 | ASN1_OCTET_STRING *subjectKeyIdentifier; |
| 217 | CMS_OriginatorPublicKey *originatorKey; | 217 | CMS_OriginatorPublicKey *originatorKey; |
| 218 | } d; | 218 | } d; |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | struct CMS_OriginatorPublicKey_st { | 221 | struct CMS_OriginatorPublicKey_st { |
| 222 | X509_ALGOR *algorithm; | 222 | X509_ALGOR *algorithm; |
| 223 | ASN1_BIT_STRING *publicKey; | 223 | ASN1_BIT_STRING *publicKey; |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| 226 | struct CMS_RecipientEncryptedKey_st { | 226 | struct CMS_RecipientEncryptedKey_st { |
| 227 | CMS_KeyAgreeRecipientIdentifier *rid; | 227 | CMS_KeyAgreeRecipientIdentifier *rid; |
| 228 | ASN1_OCTET_STRING *encryptedKey; | 228 | ASN1_OCTET_STRING *encryptedKey; |
| 229 | /* Public key associated with this recipient */ | 229 | /* Public key associated with this recipient */ |
| 230 | EVP_PKEY *pkey; | 230 | EVP_PKEY *pkey; |
| 231 | }; | 231 | }; |
| 232 | 232 | ||
| 233 | struct CMS_KeyAgreeRecipientIdentifier_st { | 233 | struct CMS_KeyAgreeRecipientIdentifier_st { |
| 234 | int type; | 234 | int type; |
| 235 | union { | 235 | union { |
| 236 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; | 236 | CMS_IssuerAndSerialNumber *issuerAndSerialNumber; |
| 237 | CMS_RecipientKeyIdentifier *rKeyId; | 237 | CMS_RecipientKeyIdentifier *rKeyId; |
| 238 | } d; | 238 | } d; |
| 239 | }; | 239 | }; |
| 240 | 240 | ||
| 241 | struct CMS_RecipientKeyIdentifier_st { | 241 | struct CMS_RecipientKeyIdentifier_st { |
| 242 | ASN1_OCTET_STRING *subjectKeyIdentifier; | 242 | ASN1_OCTET_STRING *subjectKeyIdentifier; |
| 243 | ASN1_GENERALIZEDTIME *date; | 243 | ASN1_GENERALIZEDTIME *date; |
| 244 | CMS_OtherKeyAttribute *other; | 244 | CMS_OtherKeyAttribute *other; |
| 245 | }; | 245 | }; |
| 246 | 246 | ||
| 247 | struct CMS_KEKRecipientInfo_st { | 247 | struct CMS_KEKRecipientInfo_st { |
| 248 | int32_t version; | 248 | int32_t version; |
| 249 | CMS_KEKIdentifier *kekid; | 249 | CMS_KEKIdentifier *kekid; |
| 250 | X509_ALGOR *keyEncryptionAlgorithm; | 250 | X509_ALGOR *keyEncryptionAlgorithm; |
| 251 | ASN1_OCTET_STRING *encryptedKey; | 251 | ASN1_OCTET_STRING *encryptedKey; |
| 252 | /* Extra info: symmetric key to use */ | 252 | /* Extra info: symmetric key to use */ |
| 253 | unsigned char *key; | 253 | unsigned char *key; |
| 254 | size_t keylen; | 254 | size_t keylen; |
| 255 | }; | 255 | }; |
| 256 | 256 | ||
| 257 | struct CMS_KEKIdentifier_st { | 257 | struct CMS_KEKIdentifier_st { |
| 258 | ASN1_OCTET_STRING *keyIdentifier; | 258 | ASN1_OCTET_STRING *keyIdentifier; |
| 259 | ASN1_GENERALIZEDTIME *date; | 259 | ASN1_GENERALIZEDTIME *date; |
| 260 | CMS_OtherKeyAttribute *other; | 260 | CMS_OtherKeyAttribute *other; |
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| 263 | struct CMS_PasswordRecipientInfo_st { | 263 | struct CMS_PasswordRecipientInfo_st { |
| 264 | int32_t version; | 264 | int32_t version; |
| 265 | X509_ALGOR *keyDerivationAlgorithm; | 265 | X509_ALGOR *keyDerivationAlgorithm; |
| 266 | X509_ALGOR *keyEncryptionAlgorithm; | 266 | X509_ALGOR *keyEncryptionAlgorithm; |
| 267 | ASN1_OCTET_STRING *encryptedKey; | 267 | ASN1_OCTET_STRING *encryptedKey; |
| 268 | /* Extra info: password to use */ | 268 | /* Extra info: password to use */ |
| 269 | unsigned char *pass; | 269 | unsigned char *pass; |
| 270 | size_t passlen; | 270 | size_t passlen; |
| 271 | }; | 271 | }; |
| 272 | 272 | ||
| 273 | struct CMS_OtherRecipientInfo_st { | 273 | struct CMS_OtherRecipientInfo_st { |
| 274 | ASN1_OBJECT *oriType; | 274 | ASN1_OBJECT *oriType; |
| 275 | ASN1_TYPE *oriValue; | 275 | ASN1_TYPE *oriValue; |
| 276 | }; | 276 | }; |
| 277 | 277 | ||
| 278 | struct CMS_DigestedData_st { | 278 | struct CMS_DigestedData_st { |
| 279 | int32_t version; | 279 | int32_t version; |
| 280 | X509_ALGOR *digestAlgorithm; | 280 | X509_ALGOR *digestAlgorithm; |
| 281 | CMS_EncapsulatedContentInfo *encapContentInfo; | 281 | CMS_EncapsulatedContentInfo *encapContentInfo; |
| 282 | ASN1_OCTET_STRING *digest; | 282 | ASN1_OCTET_STRING *digest; |
| 283 | }; | 283 | }; |
| 284 | 284 | ||
| 285 | struct CMS_EncryptedData_st { | 285 | struct CMS_EncryptedData_st { |
| 286 | int32_t version; | 286 | int32_t version; |
| 287 | CMS_EncryptedContentInfo *encryptedContentInfo; | 287 | CMS_EncryptedContentInfo *encryptedContentInfo; |
| 288 | STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs; | 288 | STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs; |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | struct CMS_AuthenticatedData_st { | 291 | struct CMS_AuthenticatedData_st { |
| 292 | int32_t version; | 292 | int32_t version; |
| 293 | CMS_OriginatorInfo *originatorInfo; | 293 | CMS_OriginatorInfo *originatorInfo; |
| 294 | STACK_OF(CMS_RecipientInfo) *recipientInfos; | 294 | STACK_OF(CMS_RecipientInfo) *recipientInfos; |
| 295 | X509_ALGOR *macAlgorithm; | 295 | X509_ALGOR *macAlgorithm; |
| 296 | X509_ALGOR *digestAlgorithm; | 296 | X509_ALGOR *digestAlgorithm; |
| 297 | CMS_EncapsulatedContentInfo *encapContentInfo; | 297 | CMS_EncapsulatedContentInfo *encapContentInfo; |
| 298 | STACK_OF(X509_ATTRIBUTE) *authAttrs; | 298 | STACK_OF(X509_ATTRIBUTE) *authAttrs; |
| 299 | ASN1_OCTET_STRING *mac; | 299 | ASN1_OCTET_STRING *mac; |
| 300 | STACK_OF(X509_ATTRIBUTE) *unauthAttrs; | 300 | STACK_OF(X509_ATTRIBUTE) *unauthAttrs; |
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | struct CMS_CompressedData_st { | 303 | struct CMS_CompressedData_st { |
| 304 | int32_t version; | 304 | int32_t version; |
| 305 | X509_ALGOR *compressionAlgorithm; | 305 | X509_ALGOR *compressionAlgorithm; |
| 306 | STACK_OF(CMS_RecipientInfo) *recipientInfos; | 306 | STACK_OF(CMS_RecipientInfo) *recipientInfos; |
| 307 | CMS_EncapsulatedContentInfo *encapContentInfo; | 307 | CMS_EncapsulatedContentInfo *encapContentInfo; |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | struct CMS_RevocationInfoChoice_st { | 310 | struct CMS_RevocationInfoChoice_st { |
| 311 | int type; | 311 | int type; |
| 312 | union { | 312 | union { |
| 313 | X509_CRL *crl; | 313 | X509_CRL *crl; |
| 314 | CMS_OtherRevocationInfoFormat *other; | 314 | CMS_OtherRevocationInfoFormat *other; |
| 315 | } d; | 315 | } d; |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | # define CMS_REVCHOICE_CRL 0 | 318 | #define CMS_REVCHOICE_CRL 0 |
| 319 | # define CMS_REVCHOICE_OTHER 1 | 319 | #define CMS_REVCHOICE_OTHER 1 |
| 320 | 320 | ||
| 321 | struct CMS_OtherRevocationInfoFormat_st { | 321 | struct CMS_OtherRevocationInfoFormat_st { |
| 322 | ASN1_OBJECT *otherRevInfoFormat; | 322 | ASN1_OBJECT *otherRevInfoFormat; |
| 323 | ASN1_TYPE *otherRevInfo; | 323 | ASN1_TYPE *otherRevInfo; |
| 324 | }; | 324 | }; |
| 325 | 325 | ||
| 326 | struct CMS_CertificateChoices { | 326 | struct CMS_CertificateChoices { |
| 327 | int type; | 327 | int type; |
| 328 | union { | 328 | union { |
| 329 | X509 *certificate; | 329 | X509 *certificate; |
| 330 | ASN1_STRING *extendedCertificate; /* Obsolete */ | 330 | ASN1_STRING *extendedCertificate; /* Obsolete */ |
| 331 | ASN1_STRING *v1AttrCert; /* Left encoded for now */ | 331 | ASN1_STRING *v1AttrCert; /* Left encoded for now */ |
| 332 | ASN1_STRING *v2AttrCert; /* Left encoded for now */ | 332 | ASN1_STRING *v2AttrCert; /* Left encoded for now */ |
| 333 | CMS_OtherCertificateFormat *other; | 333 | CMS_OtherCertificateFormat *other; |
| 334 | } d; | 334 | } d; |
| 335 | }; | 335 | }; |
| 336 | 336 | ||
| 337 | # define CMS_CERTCHOICE_CERT 0 | 337 | #define CMS_CERTCHOICE_CERT 0 |
| 338 | # define CMS_CERTCHOICE_EXCERT 1 | 338 | #define CMS_CERTCHOICE_EXCERT 1 |
| 339 | # define CMS_CERTCHOICE_V1ACERT 2 | 339 | #define CMS_CERTCHOICE_V1ACERT 2 |
| 340 | # define CMS_CERTCHOICE_V2ACERT 3 | 340 | #define CMS_CERTCHOICE_V2ACERT 3 |
| 341 | # define CMS_CERTCHOICE_OTHER 4 | 341 | #define CMS_CERTCHOICE_OTHER 4 |
| 342 | 342 | ||
| 343 | struct CMS_OtherCertificateFormat_st { | 343 | struct CMS_OtherCertificateFormat_st { |
| 344 | ASN1_OBJECT *otherCertFormat; | 344 | ASN1_OBJECT *otherCertFormat; |
| 345 | ASN1_TYPE *otherCert; | 345 | ASN1_TYPE *otherCert; |
| 346 | }; | 346 | }; |
| 347 | 347 | ||
| 348 | /* | 348 | /* |
| @@ -351,39 +351,39 @@ struct CMS_OtherCertificateFormat_st { | |||
| 351 | */ | 351 | */ |
| 352 | 352 | ||
| 353 | struct CMS_IssuerAndSerialNumber_st { | 353 | struct CMS_IssuerAndSerialNumber_st { |
| 354 | X509_NAME *issuer; | 354 | X509_NAME *issuer; |
| 355 | ASN1_INTEGER *serialNumber; | 355 | ASN1_INTEGER *serialNumber; |
| 356 | }; | 356 | }; |
| 357 | 357 | ||
| 358 | struct CMS_OtherKeyAttribute_st { | 358 | struct CMS_OtherKeyAttribute_st { |
| 359 | ASN1_OBJECT *keyAttrId; | 359 | ASN1_OBJECT *keyAttrId; |
| 360 | ASN1_TYPE *keyAttr; | 360 | ASN1_TYPE *keyAttr; |
| 361 | }; | 361 | }; |
| 362 | 362 | ||
| 363 | /* ESS structures */ | 363 | /* ESS structures */ |
| 364 | 364 | ||
| 365 | # ifdef HEADER_X509V3_H | 365 | #ifdef HEADER_X509V3_H |
| 366 | 366 | ||
| 367 | struct CMS_ReceiptRequest_st { | 367 | struct CMS_ReceiptRequest_st { |
| 368 | ASN1_OCTET_STRING *signedContentIdentifier; | 368 | ASN1_OCTET_STRING *signedContentIdentifier; |
| 369 | CMS_ReceiptsFrom *receiptsFrom; | 369 | CMS_ReceiptsFrom *receiptsFrom; |
| 370 | STACK_OF(GENERAL_NAMES) *receiptsTo; | 370 | STACK_OF(GENERAL_NAMES) *receiptsTo; |
| 371 | }; | 371 | }; |
| 372 | 372 | ||
| 373 | struct CMS_ReceiptsFrom_st { | 373 | struct CMS_ReceiptsFrom_st { |
| 374 | int type; | 374 | int type; |
| 375 | union { | 375 | union { |
| 376 | int32_t allOrFirstTier; | 376 | int32_t allOrFirstTier; |
| 377 | STACK_OF(GENERAL_NAMES) *receiptList; | 377 | STACK_OF(GENERAL_NAMES) *receiptList; |
| 378 | } d; | 378 | } d; |
| 379 | }; | 379 | }; |
| 380 | # endif | 380 | #endif |
| 381 | 381 | ||
| 382 | struct CMS_Receipt_st { | 382 | struct CMS_Receipt_st { |
| 383 | int32_t version; | 383 | int32_t version; |
| 384 | ASN1_OBJECT *contentType; | 384 | ASN1_OBJECT *contentType; |
| 385 | ASN1_OCTET_STRING *signedContentIdentifier; | 385 | ASN1_OCTET_STRING *signedContentIdentifier; |
| 386 | ASN1_OCTET_STRING *originatorSignatureValue; | 386 | ASN1_OCTET_STRING *originatorSignatureValue; |
| 387 | }; | 387 | }; |
| 388 | 388 | ||
| 389 | DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) | 389 | DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) |
| @@ -395,18 +395,18 @@ DECLARE_ASN1_ITEM(CMS_RecipientInfo) | |||
| 395 | DECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo) | 395 | DECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo) |
| 396 | DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber) | 396 | DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber) |
| 397 | 397 | ||
| 398 | # define CMS_SIGNERINFO_ISSUER_SERIAL 0 | 398 | #define CMS_SIGNERINFO_ISSUER_SERIAL 0 |
| 399 | # define CMS_SIGNERINFO_KEYIDENTIFIER 1 | 399 | #define CMS_SIGNERINFO_KEYIDENTIFIER 1 |
| 400 | 400 | ||
| 401 | # define CMS_RECIPINFO_ISSUER_SERIAL 0 | 401 | #define CMS_RECIPINFO_ISSUER_SERIAL 0 |
| 402 | # define CMS_RECIPINFO_KEYIDENTIFIER 1 | 402 | #define CMS_RECIPINFO_KEYIDENTIFIER 1 |
| 403 | 403 | ||
| 404 | # define CMS_REK_ISSUER_SERIAL 0 | 404 | #define CMS_REK_ISSUER_SERIAL 0 |
| 405 | # define CMS_REK_KEYIDENTIFIER 1 | 405 | #define CMS_REK_KEYIDENTIFIER 1 |
| 406 | 406 | ||
| 407 | # define CMS_OIK_ISSUER_SERIAL 0 | 407 | #define CMS_OIK_ISSUER_SERIAL 0 |
| 408 | # define CMS_OIK_KEYIDENTIFIER 1 | 408 | #define CMS_OIK_KEYIDENTIFIER 1 |
| 409 | # define CMS_OIK_PUBKEY 2 | 409 | #define CMS_OIK_PUBKEY 2 |
| 410 | 410 | ||
| 411 | BIO *cms_content_bio(CMS_ContentInfo *cms); | 411 | BIO *cms_content_bio(CMS_ContentInfo *cms); |
| 412 | 412 | ||
| @@ -418,12 +418,9 @@ int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify); | |||
| 418 | 418 | ||
| 419 | BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms); | 419 | BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms); |
| 420 | int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain); | 420 | int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain); |
| 421 | int cms_set1_SignerIdentifier(CMS_SignerIdentifier *sid, X509 *cert, | 421 | int cms_set1_SignerIdentifier(CMS_SignerIdentifier *sid, X509 *cert, int type); |
| 422 | int type); | ||
| 423 | int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid, | 422 | int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid, |
| 424 | ASN1_OCTET_STRING **keyid, | 423 | ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); |
| 425 | X509_NAME **issuer, | ||
| 426 | ASN1_INTEGER **sno); | ||
| 427 | int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert); | 424 | int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert); |
| 428 | 425 | ||
| 429 | CMS_ContentInfo *cms_CompressedData_create(int comp_nid); | 426 | CMS_ContentInfo *cms_CompressedData_create(int comp_nid); |
| @@ -431,7 +428,7 @@ BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms); | |||
| 431 | 428 | ||
| 432 | BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm); | 429 | BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm); |
| 433 | int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, | 430 | int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, |
| 434 | X509_ALGOR *mdalg); | 431 | X509_ALGOR *mdalg); |
| 435 | 432 | ||
| 436 | int cms_ias_cert_cmp(CMS_IssuerAndSerialNumber *ias, X509 *cert); | 433 | int cms_ias_cert_cmp(CMS_IssuerAndSerialNumber *ias, X509 *cert); |
| 437 | int cms_keyid_cert_cmp(ASN1_OCTET_STRING *keyid, X509 *cert); | 434 | int cms_keyid_cert_cmp(ASN1_OCTET_STRING *keyid, X509 *cert); |
| @@ -441,8 +438,7 @@ int cms_set1_keyid(ASN1_OCTET_STRING **pkeyid, X509 *cert); | |||
| 441 | BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec); | 438 | BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec); |
| 442 | BIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms); | 439 | BIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms); |
| 443 | int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, | 440 | int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, |
| 444 | const EVP_CIPHER *cipher, | 441 | const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen); |
| 445 | const unsigned char *key, size_t keylen); | ||
| 446 | 442 | ||
| 447 | int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms); | 443 | int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms); |
| 448 | int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src); | 444 | int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src); |
| @@ -454,13 +450,12 @@ int cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd); | |||
| 454 | int cms_pkey_get_ri_type(EVP_PKEY *pk); | 450 | int cms_pkey_get_ri_type(EVP_PKEY *pk); |
| 455 | /* KARI routines */ | 451 | /* KARI routines */ |
| 456 | int cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, | 452 | int cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, |
| 457 | EVP_PKEY *pk, unsigned int flags); | 453 | EVP_PKEY *pk, unsigned int flags); |
| 458 | int cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms, | 454 | int cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); |
| 459 | CMS_RecipientInfo *ri); | ||
| 460 | 455 | ||
| 461 | /* PWRI routines */ | 456 | /* PWRI routines */ |
| 462 | int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | 457 | int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, |
| 463 | int en_de); | 458 | int en_de); |
| 464 | 459 | ||
| 465 | DECLARE_ASN1_ITEM(CMS_CertificateChoices) | 460 | DECLARE_ASN1_ITEM(CMS_CertificateChoices) |
| 466 | DECLARE_ASN1_ITEM(CMS_DigestedData) | 461 | DECLARE_ASN1_ITEM(CMS_DigestedData) |
