Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:48

0001 /*
0002  * WARNING: do not edit!
0003  * Generated by Makefile from include/openssl/pkcs7.h.in
0004  *
0005  * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
0006  *
0007  * Licensed under the Apache License 2.0 (the "License").  You may not use
0008  * this file except in compliance with the License.  You can obtain a copy
0009  * in the file LICENSE in the source distribution or at
0010  * https://www.openssl.org/source/license.html
0011  */
0012 
0013 
0014 
0015 #ifndef OPENSSL_PKCS7_H
0016 # define OPENSSL_PKCS7_H
0017 # pragma once
0018 
0019 # include <openssl/macros.h>
0020 # ifndef OPENSSL_NO_DEPRECATED_3_0
0021 #  define HEADER_PKCS7_H
0022 # endif
0023 
0024 # include <openssl/asn1.h>
0025 # include <openssl/bio.h>
0026 # include <openssl/e_os2.h>
0027 
0028 # include <openssl/symhacks.h>
0029 # include <openssl/types.h>
0030 # include <openssl/pkcs7err.h>
0031 # ifndef OPENSSL_NO_STDIO
0032 #  include <stdio.h>
0033 # endif
0034 
0035 #ifdef  __cplusplus
0036 extern "C" {
0037 #endif
0038 
0039 
0040 /*-
0041 Encryption_ID           DES-CBC
0042 Digest_ID               MD5
0043 Digest_Encryption_ID    rsaEncryption
0044 Key_Encryption_ID       rsaEncryption
0045 */
0046 
0047 typedef struct PKCS7_CTX_st {
0048     OSSL_LIB_CTX *libctx;
0049     char *propq;
0050 } PKCS7_CTX;
0051 
0052 typedef struct pkcs7_issuer_and_serial_st {
0053     X509_NAME *issuer;
0054     ASN1_INTEGER *serial;
0055 } PKCS7_ISSUER_AND_SERIAL;
0056 
0057 typedef struct pkcs7_signer_info_st {
0058     ASN1_INTEGER *version;      /* version 1 */
0059     PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
0060     X509_ALGOR *digest_alg;
0061     STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
0062     X509_ALGOR *digest_enc_alg; /* confusing name, actually used for signing */
0063     ASN1_OCTET_STRING *enc_digest; /* confusing name, actually signature */
0064     STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
0065     /* The private key to sign with */
0066     EVP_PKEY *pkey;
0067     const PKCS7_CTX *ctx;
0068 } PKCS7_SIGNER_INFO;
0069 SKM_DEFINE_STACK_OF_INTERNAL(PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO)
0070 #define sk_PKCS7_SIGNER_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk))
0071 #define sk_PKCS7_SIGNER_INFO_value(sk, idx) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_value(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk), (idx)))
0072 #define sk_PKCS7_SIGNER_INFO_new(cmp) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new(ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp)))
0073 #define sk_PKCS7_SIGNER_INFO_new_null() ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new_null())
0074 #define sk_PKCS7_SIGNER_INFO_new_reserve(cmp, n) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp), (n)))
0075 #define sk_PKCS7_SIGNER_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (n))
0076 #define sk_PKCS7_SIGNER_INFO_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk))
0077 #define sk_PKCS7_SIGNER_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk))
0078 #define sk_PKCS7_SIGNER_INFO_delete(sk, i) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_delete(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (i)))
0079 #define sk_PKCS7_SIGNER_INFO_delete_ptr(sk, ptr) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr)))
0080 #define sk_PKCS7_SIGNER_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr))
0081 #define sk_PKCS7_SIGNER_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr))
0082 #define sk_PKCS7_SIGNER_INFO_pop(sk) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_pop(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk)))
0083 #define sk_PKCS7_SIGNER_INFO_shift(sk) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_shift(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk)))
0084 #define sk_PKCS7_SIGNER_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk),ossl_check_PKCS7_SIGNER_INFO_freefunc_type(freefunc))
0085 #define sk_PKCS7_SIGNER_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr), (idx))
0086 #define sk_PKCS7_SIGNER_INFO_set(sk, idx, ptr) ((PKCS7_SIGNER_INFO *)OPENSSL_sk_set(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), (idx), ossl_check_PKCS7_SIGNER_INFO_type(ptr)))
0087 #define sk_PKCS7_SIGNER_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr))
0088 #define sk_PKCS7_SIGNER_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr))
0089 #define sk_PKCS7_SIGNER_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_type(ptr), pnum)
0090 #define sk_PKCS7_SIGNER_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk))
0091 #define sk_PKCS7_SIGNER_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk))
0092 #define sk_PKCS7_SIGNER_INFO_dup(sk) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk)))
0093 #define sk_PKCS7_SIGNER_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7_SIGNER_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_copyfunc_type(copyfunc), ossl_check_PKCS7_SIGNER_INFO_freefunc_type(freefunc)))
0094 #define sk_PKCS7_SIGNER_INFO_set_cmp_func(sk, cmp) ((sk_PKCS7_SIGNER_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_SIGNER_INFO_sk_type(sk), ossl_check_PKCS7_SIGNER_INFO_compfunc_type(cmp)))
0095 
0096 
0097 typedef struct pkcs7_recip_info_st {
0098     ASN1_INTEGER *version;      /* version 0 */
0099     PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
0100     X509_ALGOR *key_enc_algor;
0101     ASN1_OCTET_STRING *enc_key;
0102     X509 *cert;                 /* get the pub-key from this */
0103     const PKCS7_CTX *ctx;
0104 } PKCS7_RECIP_INFO;
0105 SKM_DEFINE_STACK_OF_INTERNAL(PKCS7_RECIP_INFO, PKCS7_RECIP_INFO, PKCS7_RECIP_INFO)
0106 #define sk_PKCS7_RECIP_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk))
0107 #define sk_PKCS7_RECIP_INFO_value(sk, idx) ((PKCS7_RECIP_INFO *)OPENSSL_sk_value(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk), (idx)))
0108 #define sk_PKCS7_RECIP_INFO_new(cmp) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new(ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp)))
0109 #define sk_PKCS7_RECIP_INFO_new_null() ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new_null())
0110 #define sk_PKCS7_RECIP_INFO_new_reserve(cmp, n) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp), (n)))
0111 #define sk_PKCS7_RECIP_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (n))
0112 #define sk_PKCS7_RECIP_INFO_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_RECIP_INFO_sk_type(sk))
0113 #define sk_PKCS7_RECIP_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_RECIP_INFO_sk_type(sk))
0114 #define sk_PKCS7_RECIP_INFO_delete(sk, i) ((PKCS7_RECIP_INFO *)OPENSSL_sk_delete(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (i)))
0115 #define sk_PKCS7_RECIP_INFO_delete_ptr(sk, ptr) ((PKCS7_RECIP_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr)))
0116 #define sk_PKCS7_RECIP_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr))
0117 #define sk_PKCS7_RECIP_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr))
0118 #define sk_PKCS7_RECIP_INFO_pop(sk) ((PKCS7_RECIP_INFO *)OPENSSL_sk_pop(ossl_check_PKCS7_RECIP_INFO_sk_type(sk)))
0119 #define sk_PKCS7_RECIP_INFO_shift(sk) ((PKCS7_RECIP_INFO *)OPENSSL_sk_shift(ossl_check_PKCS7_RECIP_INFO_sk_type(sk)))
0120 #define sk_PKCS7_RECIP_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_RECIP_INFO_sk_type(sk),ossl_check_PKCS7_RECIP_INFO_freefunc_type(freefunc))
0121 #define sk_PKCS7_RECIP_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr), (idx))
0122 #define sk_PKCS7_RECIP_INFO_set(sk, idx, ptr) ((PKCS7_RECIP_INFO *)OPENSSL_sk_set(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), (idx), ossl_check_PKCS7_RECIP_INFO_type(ptr)))
0123 #define sk_PKCS7_RECIP_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr))
0124 #define sk_PKCS7_RECIP_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr))
0125 #define sk_PKCS7_RECIP_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_type(ptr), pnum)
0126 #define sk_PKCS7_RECIP_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_RECIP_INFO_sk_type(sk))
0127 #define sk_PKCS7_RECIP_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk))
0128 #define sk_PKCS7_RECIP_INFO_dup(sk) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk)))
0129 #define sk_PKCS7_RECIP_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7_RECIP_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_copyfunc_type(copyfunc), ossl_check_PKCS7_RECIP_INFO_freefunc_type(freefunc)))
0130 #define sk_PKCS7_RECIP_INFO_set_cmp_func(sk, cmp) ((sk_PKCS7_RECIP_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_RECIP_INFO_sk_type(sk), ossl_check_PKCS7_RECIP_INFO_compfunc_type(cmp)))
0131 
0132 
0133 
0134 typedef struct pkcs7_signed_st {
0135     ASN1_INTEGER *version;      /* version 1 */
0136     STACK_OF(X509_ALGOR) *md_algs; /* md used */
0137     STACK_OF(X509) *cert;       /* [ 0 ] */ /* name should be 'certificates' */
0138     STACK_OF(X509_CRL) *crl;    /* [ 1 ] */ /* name should be 'crls' */
0139     STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
0140     struct pkcs7_st *contents;
0141 } PKCS7_SIGNED;
0142 /*
0143  * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about
0144  * merging the two
0145  */
0146 
0147 typedef struct pkcs7_enc_content_st {
0148     ASN1_OBJECT *content_type;
0149     X509_ALGOR *algorithm;
0150     ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
0151     const EVP_CIPHER *cipher;
0152     const PKCS7_CTX *ctx;
0153 } PKCS7_ENC_CONTENT;
0154 
0155 typedef struct pkcs7_enveloped_st {
0156     ASN1_INTEGER *version;      /* version 0 */
0157     STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
0158     PKCS7_ENC_CONTENT *enc_data;
0159 } PKCS7_ENVELOPE;
0160 
0161 typedef struct pkcs7_signedandenveloped_st {
0162     ASN1_INTEGER *version;      /* version 1 */
0163     STACK_OF(X509_ALGOR) *md_algs; /* md used */
0164     STACK_OF(X509) *cert;       /* [ 0 ] */ /* name should be 'certificates' */
0165     STACK_OF(X509_CRL) *crl;    /* [ 1 ] */ /* name should be 'crls' */
0166     STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
0167     PKCS7_ENC_CONTENT *enc_data;
0168     STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
0169 } PKCS7_SIGN_ENVELOPE;
0170 
0171 typedef struct pkcs7_digest_st {
0172     ASN1_INTEGER *version;      /* version 0 */
0173     X509_ALGOR *md;             /* md used */
0174     struct pkcs7_st *contents;
0175     ASN1_OCTET_STRING *digest;
0176 } PKCS7_DIGEST;
0177 
0178 typedef struct pkcs7_encrypted_st {
0179     ASN1_INTEGER *version;      /* version 0 */
0180     PKCS7_ENC_CONTENT *enc_data;
0181 } PKCS7_ENCRYPT;
0182 
0183 typedef struct pkcs7_st {
0184     /*
0185      * The following is non NULL if it contains ASN1 encoding of this
0186      * structure
0187      */
0188     unsigned char *asn1;
0189     long length;
0190 # define PKCS7_S_HEADER  0
0191 # define PKCS7_S_BODY    1
0192 # define PKCS7_S_TAIL    2
0193     int state;                  /* used during processing */
0194     int detached;
0195     ASN1_OBJECT *type;
0196     /* content as defined by the type */
0197     /*
0198      * all encryption/message digests are applied to the 'contents', leaving
0199      * out the 'type' field.
0200      */
0201     union {
0202         char *ptr;
0203         /* NID_pkcs7_data */
0204         ASN1_OCTET_STRING *data;
0205         /* NID_pkcs7_signed */
0206         PKCS7_SIGNED *sign; /* field name 'signed' would clash with C keyword */
0207         /* NID_pkcs7_enveloped */
0208         PKCS7_ENVELOPE *enveloped;
0209         /* NID_pkcs7_signedAndEnveloped */
0210         PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
0211         /* NID_pkcs7_digest */
0212         PKCS7_DIGEST *digest;
0213         /* NID_pkcs7_encrypted */
0214         PKCS7_ENCRYPT *encrypted;
0215         /* Anything else */
0216         ASN1_TYPE *other;
0217     } d;
0218     PKCS7_CTX ctx;
0219 } PKCS7;
0220 SKM_DEFINE_STACK_OF_INTERNAL(PKCS7, PKCS7, PKCS7)
0221 #define sk_PKCS7_num(sk) OPENSSL_sk_num(ossl_check_const_PKCS7_sk_type(sk))
0222 #define sk_PKCS7_value(sk, idx) ((PKCS7 *)OPENSSL_sk_value(ossl_check_const_PKCS7_sk_type(sk), (idx)))
0223 #define sk_PKCS7_new(cmp) ((STACK_OF(PKCS7) *)OPENSSL_sk_new(ossl_check_PKCS7_compfunc_type(cmp)))
0224 #define sk_PKCS7_new_null() ((STACK_OF(PKCS7) *)OPENSSL_sk_new_null())
0225 #define sk_PKCS7_new_reserve(cmp, n) ((STACK_OF(PKCS7) *)OPENSSL_sk_new_reserve(ossl_check_PKCS7_compfunc_type(cmp), (n)))
0226 #define sk_PKCS7_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PKCS7_sk_type(sk), (n))
0227 #define sk_PKCS7_free(sk) OPENSSL_sk_free(ossl_check_PKCS7_sk_type(sk))
0228 #define sk_PKCS7_zero(sk) OPENSSL_sk_zero(ossl_check_PKCS7_sk_type(sk))
0229 #define sk_PKCS7_delete(sk, i) ((PKCS7 *)OPENSSL_sk_delete(ossl_check_PKCS7_sk_type(sk), (i)))
0230 #define sk_PKCS7_delete_ptr(sk, ptr) ((PKCS7 *)OPENSSL_sk_delete_ptr(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr)))
0231 #define sk_PKCS7_push(sk, ptr) OPENSSL_sk_push(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr))
0232 #define sk_PKCS7_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr))
0233 #define sk_PKCS7_pop(sk) ((PKCS7 *)OPENSSL_sk_pop(ossl_check_PKCS7_sk_type(sk)))
0234 #define sk_PKCS7_shift(sk) ((PKCS7 *)OPENSSL_sk_shift(ossl_check_PKCS7_sk_type(sk)))
0235 #define sk_PKCS7_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PKCS7_sk_type(sk),ossl_check_PKCS7_freefunc_type(freefunc))
0236 #define sk_PKCS7_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr), (idx))
0237 #define sk_PKCS7_set(sk, idx, ptr) ((PKCS7 *)OPENSSL_sk_set(ossl_check_PKCS7_sk_type(sk), (idx), ossl_check_PKCS7_type(ptr)))
0238 #define sk_PKCS7_find(sk, ptr) OPENSSL_sk_find(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr))
0239 #define sk_PKCS7_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr))
0240 #define sk_PKCS7_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_type(ptr), pnum)
0241 #define sk_PKCS7_sort(sk) OPENSSL_sk_sort(ossl_check_PKCS7_sk_type(sk))
0242 #define sk_PKCS7_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PKCS7_sk_type(sk))
0243 #define sk_PKCS7_dup(sk) ((STACK_OF(PKCS7) *)OPENSSL_sk_dup(ossl_check_const_PKCS7_sk_type(sk)))
0244 #define sk_PKCS7_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PKCS7) *)OPENSSL_sk_deep_copy(ossl_check_const_PKCS7_sk_type(sk), ossl_check_PKCS7_copyfunc_type(copyfunc), ossl_check_PKCS7_freefunc_type(freefunc)))
0245 #define sk_PKCS7_set_cmp_func(sk, cmp) ((sk_PKCS7_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PKCS7_sk_type(sk), ossl_check_PKCS7_compfunc_type(cmp)))
0246 
0247 
0248 
0249 # define PKCS7_OP_SET_DETACHED_SIGNATURE 1
0250 # define PKCS7_OP_GET_DETACHED_SIGNATURE 2
0251 
0252 # define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
0253 # define PKCS7_get_attributes(si)        ((si)->unauth_attr)
0254 
0255 # define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
0256 # define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
0257 # define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
0258 # define PKCS7_type_is_signedAndEnveloped(a) \
0259                 (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
0260 # define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
0261 # define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
0262 
0263 # define PKCS7_set_detached(p,v) \
0264                 PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
0265 # define PKCS7_get_detached(p) \
0266                 PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
0267 
0268 # define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
0269 
0270 /* S/MIME related flags */
0271 
0272 # define PKCS7_TEXT              0x1
0273 # define PKCS7_NOCERTS           0x2
0274 # define PKCS7_NOSIGS            0x4
0275 # define PKCS7_NOCHAIN           0x8
0276 # define PKCS7_NOINTERN          0x10
0277 # define PKCS7_NOVERIFY          0x20
0278 # define PKCS7_DETACHED          0x40
0279 # define PKCS7_BINARY            0x80
0280 # define PKCS7_NOATTR            0x100
0281 # define PKCS7_NOSMIMECAP        0x200
0282 # define PKCS7_NOOLDMIMETYPE     0x400
0283 # define PKCS7_CRLFEOL           0x800
0284 # define PKCS7_STREAM            0x1000
0285 # define PKCS7_NOCRL             0x2000
0286 # define PKCS7_PARTIAL           0x4000
0287 # define PKCS7_REUSE_DIGEST      0x8000
0288 # define PKCS7_NO_DUAL_CONTENT   0x10000
0289 
0290 /* Flags: for compatibility with older code */
0291 
0292 # define SMIME_TEXT      PKCS7_TEXT
0293 # define SMIME_NOCERTS   PKCS7_NOCERTS
0294 # define SMIME_NOSIGS    PKCS7_NOSIGS
0295 # define SMIME_NOCHAIN   PKCS7_NOCHAIN
0296 # define SMIME_NOINTERN  PKCS7_NOINTERN
0297 # define SMIME_NOVERIFY  PKCS7_NOVERIFY
0298 # define SMIME_DETACHED  PKCS7_DETACHED
0299 # define SMIME_BINARY    PKCS7_BINARY
0300 # define SMIME_NOATTR    PKCS7_NOATTR
0301 
0302 /* CRLF ASCII canonicalisation */
0303 # define SMIME_ASCIICRLF         0x80000
0304 
0305 DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
0306 
0307 int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,
0308                                    const EVP_MD *type, unsigned char *md,
0309                                    unsigned int *len);
0310 # ifndef OPENSSL_NO_STDIO
0311 PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7);
0312 int i2d_PKCS7_fp(FILE *fp, const PKCS7 *p7);
0313 # endif
0314 DECLARE_ASN1_DUP_FUNCTION(PKCS7)
0315 PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7);
0316 int i2d_PKCS7_bio(BIO *bp, const PKCS7 *p7);
0317 int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
0318 int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
0319 
0320 DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
0321 DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
0322 DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)
0323 DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)
0324 DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
0325 DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)
0326 DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)
0327 DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)
0328 DECLARE_ASN1_FUNCTIONS(PKCS7)
0329 PKCS7 *PKCS7_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
0330 
0331 DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
0332 DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
0333 
0334 DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
0335 DECLARE_ASN1_PRINT_FUNCTION(PKCS7)
0336 
0337 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
0338 
0339 int PKCS7_type_is_other(PKCS7 *p7);
0340 int PKCS7_set_type(PKCS7 *p7, int type);
0341 int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
0342 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
0343 int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
0344                           const EVP_MD *dgst);
0345 int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);
0346 int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
0347 int PKCS7_add_certificate(PKCS7 *p7, X509 *cert);
0348 int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl);
0349 int PKCS7_content_new(PKCS7 *p7, int nid);
0350 int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
0351                      BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
0352 int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
0353                           X509 *signer);
0354 
0355 BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
0356 int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
0357 BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
0358 
0359 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
0360                                        EVP_PKEY *pkey, const EVP_MD *dgst);
0361 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
0362 int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
0363 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
0364 
0365 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
0366 void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
0367                                  X509_ALGOR **pdig, X509_ALGOR **psig);
0368 void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);
0369 int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
0370 int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
0371 int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
0372 int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);
0373 
0374 PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
0375 ASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7);
0376 ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
0377 int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type,
0378                                void *data);
0379 int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
0380                         void *value);
0381 ASN1_TYPE *PKCS7_get_attribute(const PKCS7_SIGNER_INFO *si, int nid);
0382 ASN1_TYPE *PKCS7_get_signed_attribute(const PKCS7_SIGNER_INFO *si, int nid);
0383 int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
0384                                 STACK_OF(X509_ATTRIBUTE) *sk);
0385 int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,
0386                          STACK_OF(X509_ATTRIBUTE) *sk);
0387 
0388 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
0389                   BIO *data, int flags);
0390 PKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
0391                      BIO *data, int flags, OSSL_LIB_CTX *libctx,
0392                      const char *propq);
0393 
0394 PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,
0395                                          X509 *signcert, EVP_PKEY *pkey,
0396                                          const EVP_MD *md, int flags);
0397 
0398 int PKCS7_final(PKCS7 *p7, BIO *data, int flags);
0399 int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
0400                  BIO *indata, BIO *out, int flags);
0401 STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs,
0402                                    int flags);
0403 PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
0404                      int flags);
0405 PKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in,
0406                         const EVP_CIPHER *cipher, int flags,
0407                         OSSL_LIB_CTX *libctx, const char *propq);
0408 int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
0409                   int flags);
0410 
0411 int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
0412                               STACK_OF(X509_ALGOR) *cap);
0413 STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
0414 int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
0415 
0416 int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid);
0417 int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);
0418 int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
0419                              const unsigned char *md, int mdlen);
0420 
0421 int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
0422 PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7);
0423 PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
0424 
0425 BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);
0426 
0427 # ifdef  __cplusplus
0428 }
0429 # endif
0430 #endif