x86cpuid.pl: fix processor capability detection on pre-586.
[openssl.git] / crypto / cms / cms_lcl.h
index e33c274a105944b09bdc987672f40824218fc27e..0839ed67300d16c0a9f84d9d011f0c3386acae93 100644 (file)
@@ -91,7 +91,7 @@ typedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
 typedef struct CMS_KEKRecipientInfo_st CMS_KEKRecipientInfo;
 typedef struct CMS_PasswordRecipientInfo_st CMS_PasswordRecipientInfo;
 typedef struct CMS_OtherRecipientInfo_st CMS_OtherRecipientInfo;
-typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
+typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
 
 struct CMS_ContentInfo_st
        {
@@ -124,6 +124,8 @@ struct CMS_EncapsulatedContentInfo_st
        {
        ASN1_OBJECT *eContentType;
        ASN1_OCTET_STRING *eContent;
+       /* Set to 1 if incomplete structure only part set up */
+       int partial;
        };
 
 struct CMS_SignerInfo_st
@@ -169,6 +171,10 @@ struct CMS_EncryptedContentInfo_st
        ASN1_OBJECT *contentType;
        X509_ALGOR *contentEncryptionAlgorithm;
        ASN1_OCTET_STRING *encryptedContent;
+       /* Content encryption algorithm and key */
+       const EVP_CIPHER *cipher;
+       unsigned char *key;
+       size_t keylen;
        };
 
 struct CMS_RecipientInfo_st
@@ -183,12 +189,6 @@ struct CMS_RecipientInfo_st
                } d;
        };
 
-#define CMS_RECIPINFO_TRANS            0
-#define CMS_RECIPINFO_AGREE            1
-#define CMS_RECIPINFO_KEK              2
-#define CMS_RECIPINFO_PASS             3
-#define CMS_RECIPINFO_OTHER            4
-
 typedef CMS_SignerIdentifier CMS_RecipientIdentifier;
 
 struct CMS_KeyTransRecipientInfo_st
@@ -255,7 +255,7 @@ struct CMS_KEKRecipientInfo_st
        CMS_KEKIdentifier *kekid;
        X509_ALGOR *keyEncryptionAlgorithm;
        ASN1_OCTET_STRING *encryptedKey;
-       /* Extra Info symmetric key to use */
+       /* Extra info: symmetric key to use */
        unsigned char *key;
        size_t keylen;
        };
@@ -273,6 +273,9 @@ struct CMS_PasswordRecipientInfo_st
        X509_ALGOR *keyDerivationAlgorithm;
        X509_ALGOR *keyEncryptionAlgorithm;
        ASN1_OCTET_STRING *encryptedKey;
+       /* Extra info: password to use */
+       unsigned char *pass;
+       size_t passlen;
        };
 
 struct CMS_OtherRecipientInfo_st
@@ -375,11 +378,44 @@ struct CMS_OtherKeyAttribute_st
        ASN1_TYPE *keyAttr;
        };
 
+/* ESS structures */
+
+#ifdef HEADER_X509V3_H
+
+struct CMS_ReceiptRequest_st
+       {
+       ASN1_OCTET_STRING *signedContentIdentifier;
+       CMS_ReceiptsFrom *receiptsFrom;
+       STACK_OF(GENERAL_NAMES) *receiptsTo;
+       };
+
+
+struct CMS_ReceiptsFrom_st
+       {
+       int type;
+       union
+               {
+               long allOrFirstTier;
+               STACK_OF(GENERAL_NAMES) *receiptList;
+               } d;
+       };
+#endif
+
+struct CMS_Receipt_st
+       {
+       long version;
+       ASN1_OBJECT *contentType;
+       ASN1_OCTET_STRING *signedContentIdentifier;
+       ASN1_OCTET_STRING *originatorSignatureValue;
+       };
+
 DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
 DECLARE_ASN1_ITEM(CMS_SignerInfo)
 DECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
 DECLARE_ASN1_ITEM(CMS_Attributes_Sign)
 DECLARE_ASN1_ITEM(CMS_Attributes_Verify)
+DECLARE_ASN1_ITEM(CMS_RecipientInfo)
+DECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo)
 DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
 
 #define CMS_SIGNERINFO_ISSUER_SERIAL   0
@@ -407,10 +443,26 @@ int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);
 CMS_ContentInfo *cms_CompressedData_create(int comp_nid);
 BIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms);
 
-void cms_DigestAlgorithm_set(X509_ALGOR *alg, const EVP_MD *md);
 BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm);
 int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
                                        X509_ALGOR *mdalg);
+
+BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec);
+BIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms);
+int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, 
+                               const EVP_CIPHER *cipher,
+                               const unsigned char *key, size_t keylen);
+
+int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms);
+int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src);
+ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si);
+
+BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
+CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms);
+
+/* PWRI routines */
+int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
+                                                       int en_de);
        
 #ifdef  __cplusplus
 }