Add signed receipt ASN1 structures. Initial GENERAL_NAME utility functions.
[openssl.git] / crypto / cms / cms_asn1.c
index b9521c9a5af44cd487fa0833932454a6684828a1..bef043a8f005bc779c1e20f6812f7f60761ee429 100644 (file)
@@ -53,6 +53,7 @@
 
 #include <openssl/asn1t.h>
 #include <openssl/pem.h>
+#include <openssl/x509v3.h>
 #include "cms.h"
 #include "cms_lcl.h"
 
@@ -306,9 +307,11 @@ static int cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                                                        void *exarg)
        {
        ASN1_STREAM_ARG *sarg = exarg;
-       CMS_ContentInfo *cms;
+       CMS_ContentInfo *cms = NULL;
        if (pval)
                cms = (CMS_ContentInfo *)*pval;
+       else
+               return 1;
        switch(operation)
                {
 
@@ -355,3 +358,15 @@ ASN1_ITEM_TEMPLATE(CMS_Attributes_Verify) =
                                V_ASN1_SET, CMS_ATTRIBUTES, X509_ATTRIBUTE)
 ASN1_ITEM_TEMPLATE_END(CMS_Attributes_Verify)
 
+
+
+ASN1_CHOICE(CMS_ReceiptsFrom) = {
+  ASN1_IMP(CMS_ReceiptsFrom, d.allOrFirstTier, LONG, 0),
+  ASN1_IMP_SEQUENCE_OF(CMS_ReceiptsFrom, d.receiptList, GENERAL_NAME, 1)
+} ASN1_CHOICE_END(CMS_ReceiptsFrom)
+
+ASN1_SEQUENCE(CMS_ReceiptRequest) = {
+  ASN1_SIMPLE(CMS_ReceiptRequest, signedContentIdentifier, ASN1_OCTET_STRING),
+  ASN1_SIMPLE(CMS_ReceiptRequest, receiptsFrom, CMS_ReceiptsFrom)
+} ASN1_SEQUENCE_END(CMS_ReceiptRequest)
+