6 * Cryptographic Message Syntax (PKCS #7)
10 FILE_LICENCE ( GPL2_OR_LATER );
13 #include <ipxe/asn1.h>
14 #include <ipxe/crypto.h>
15 #include <ipxe/x509.h>
16 #include <ipxe/refcnt.h>
17 #include <ipxe/uaccess.h>
19 /** CMS signer information */
20 struct cms_signer_info {
21 /** List of signer information blocks */
22 struct list_head list;
24 /** Certificate chain */
25 struct x509_chain *chain;
27 /** Digest algorithm */
28 struct digest_algorithm *digest;
29 /** Public-key algorithm */
30 struct pubkey_algorithm *pubkey;
34 /** Length of signature */
38 /** A CMS signature */
39 struct cms_signature {
40 /** Reference count */
42 /** List of all certificates */
43 struct x509_chain *certificates;
44 /** List of signer information blocks */
45 struct list_head info;
49 * Get reference to CMS signature
51 * @v sig CMS signature
52 * @ret sig CMS signature
54 static inline __attribute__ (( always_inline )) struct cms_signature *
55 cms_get ( struct cms_signature *sig ) {
56 ref_get ( &sig->refcnt );
61 * Drop reference to CMS signature
63 * @v sig CMS signature
65 static inline __attribute__ (( always_inline )) void
66 cms_put ( struct cms_signature *sig ) {
67 ref_put ( &sig->refcnt );
70 extern int cms_signature ( const void *data, size_t len,
71 struct cms_signature **sig );
72 extern int cms_verify ( struct cms_signature *sig, userptr_t data, size_t len,
73 const char *name, time_t time, struct x509_chain *store,
74 struct x509_root *root );
76 #endif /* _IPXE_CMS_H */