1/*
2 * Copyright 2019 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/ess.h>
13#include <openssl/x509v3.h>
14#include "crypto/ess.h"
15
16/* ASN1 stuff for ESS Structure */
17
18ASN1_SEQUENCE(ESS_ISSUER_SERIAL) = {
19 ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
20 ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
21} static_ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
22
23IMPLEMENT_ASN1_FUNCTIONS(ESS_ISSUER_SERIAL)
24IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
25
26ASN1_SEQUENCE(ESS_CERT_ID) = {
27 ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
28 ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
29} static_ASN1_SEQUENCE_END(ESS_CERT_ID)
30
31IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID)
32IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
33
34ASN1_SEQUENCE(ESS_SIGNING_CERT) = {
35 ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
36 ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
37} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
38
39IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT)
40IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
41
42ASN1_SEQUENCE(ESS_CERT_ID_V2) = {
43 ASN1_OPT(ESS_CERT_ID_V2, hash_alg, X509_ALGOR),
44 ASN1_SIMPLE(ESS_CERT_ID_V2, hash, ASN1_OCTET_STRING),
45 ASN1_OPT(ESS_CERT_ID_V2, issuer_serial, ESS_ISSUER_SERIAL)
46} static_ASN1_SEQUENCE_END(ESS_CERT_ID_V2)
47
48IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID_V2)
49IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2)
50
51ASN1_SEQUENCE(ESS_SIGNING_CERT_V2) = {
52 ASN1_SEQUENCE_OF(ESS_SIGNING_CERT_V2, cert_ids, ESS_CERT_ID_V2),
53 ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT_V2, policy_info, POLICYINFO)
54} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2)
55
56IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT_V2)
57IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2)
58