xref: /openssl/crypto/ess/ess_asn1.c (revision 4189dc37)
1 /*
2  * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #include <openssl/err.h>
11 #include <openssl/asn1t.h>
12 #include <openssl/cms.h>
13 #include <openssl/ess.h>
14 #include <openssl/x509v3.h>
15 #include "crypto/ess.h"
16 
17 /* ASN1 stuff for ESS Structure */
18 
19 ASN1_SEQUENCE(ESS_ISSUER_SERIAL) = {
20         ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
21         ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
22 } static_ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
23 
24 IMPLEMENT_ASN1_FUNCTIONS(ESS_ISSUER_SERIAL)
25 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
26 
27 ASN1_SEQUENCE(ESS_CERT_ID) = {
28         ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
29         ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
30 } static_ASN1_SEQUENCE_END(ESS_CERT_ID)
31 
32 IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID)
33 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
34 
35 ASN1_SEQUENCE(ESS_SIGNING_CERT) = {
36         ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
37         ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
38 } ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
39 
40 IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT)
41 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
42 
43 ASN1_SEQUENCE(ESS_CERT_ID_V2) = {
44         ASN1_OPT(ESS_CERT_ID_V2, hash_alg, X509_ALGOR),
45         ASN1_SIMPLE(ESS_CERT_ID_V2, hash, ASN1_OCTET_STRING),
46         ASN1_OPT(ESS_CERT_ID_V2, issuer_serial, ESS_ISSUER_SERIAL)
47 } static_ASN1_SEQUENCE_END(ESS_CERT_ID_V2)
48 
49 IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID_V2)
50 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2)
51 
52 ASN1_SEQUENCE(ESS_SIGNING_CERT_V2) = {
53         ASN1_SEQUENCE_OF(ESS_SIGNING_CERT_V2, cert_ids, ESS_CERT_ID_V2),
54         ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT_V2, policy_info, POLICYINFO)
55 } ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2)
56 
57 IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT_V2)
58 IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2)
59