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