1 | /*
|
---|
2 | * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the OpenSSL license (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/asn1.h>
|
---|
11 | #include <openssl/asn1t.h>
|
---|
12 | #include <openssl/ocsp.h>
|
---|
13 | #include "ocsp_local.h"
|
---|
14 |
|
---|
15 | ASN1_SEQUENCE(OCSP_SIGNATURE) = {
|
---|
16 | ASN1_EMBED(OCSP_SIGNATURE, signatureAlgorithm, X509_ALGOR),
|
---|
17 | ASN1_SIMPLE(OCSP_SIGNATURE, signature, ASN1_BIT_STRING),
|
---|
18 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_SIGNATURE, certs, X509, 0)
|
---|
19 | } ASN1_SEQUENCE_END(OCSP_SIGNATURE)
|
---|
20 |
|
---|
21 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_SIGNATURE)
|
---|
22 |
|
---|
23 | ASN1_SEQUENCE(OCSP_CERTID) = {
|
---|
24 | ASN1_EMBED(OCSP_CERTID, hashAlgorithm, X509_ALGOR),
|
---|
25 | ASN1_EMBED(OCSP_CERTID, issuerNameHash, ASN1_OCTET_STRING),
|
---|
26 | ASN1_EMBED(OCSP_CERTID, issuerKeyHash, ASN1_OCTET_STRING),
|
---|
27 | ASN1_EMBED(OCSP_CERTID, serialNumber, ASN1_INTEGER)
|
---|
28 | } ASN1_SEQUENCE_END(OCSP_CERTID)
|
---|
29 |
|
---|
30 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_CERTID)
|
---|
31 |
|
---|
32 | ASN1_SEQUENCE(OCSP_ONEREQ) = {
|
---|
33 | ASN1_SIMPLE(OCSP_ONEREQ, reqCert, OCSP_CERTID),
|
---|
34 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_ONEREQ, singleRequestExtensions, X509_EXTENSION, 0)
|
---|
35 | } ASN1_SEQUENCE_END(OCSP_ONEREQ)
|
---|
36 |
|
---|
37 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_ONEREQ)
|
---|
38 |
|
---|
39 | ASN1_SEQUENCE(OCSP_REQINFO) = {
|
---|
40 | ASN1_EXP_OPT(OCSP_REQINFO, version, ASN1_INTEGER, 0),
|
---|
41 | ASN1_EXP_OPT(OCSP_REQINFO, requestorName, GENERAL_NAME, 1),
|
---|
42 | ASN1_SEQUENCE_OF(OCSP_REQINFO, requestList, OCSP_ONEREQ),
|
---|
43 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_REQINFO, requestExtensions, X509_EXTENSION, 2)
|
---|
44 | } ASN1_SEQUENCE_END(OCSP_REQINFO)
|
---|
45 |
|
---|
46 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_REQINFO)
|
---|
47 |
|
---|
48 | ASN1_SEQUENCE(OCSP_REQUEST) = {
|
---|
49 | ASN1_EMBED(OCSP_REQUEST, tbsRequest, OCSP_REQINFO),
|
---|
50 | ASN1_EXP_OPT(OCSP_REQUEST, optionalSignature, OCSP_SIGNATURE, 0)
|
---|
51 | } ASN1_SEQUENCE_END(OCSP_REQUEST)
|
---|
52 |
|
---|
53 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_REQUEST)
|
---|
54 |
|
---|
55 | /* OCSP_RESPONSE templates */
|
---|
56 |
|
---|
57 | ASN1_SEQUENCE(OCSP_RESPBYTES) = {
|
---|
58 | ASN1_SIMPLE(OCSP_RESPBYTES, responseType, ASN1_OBJECT),
|
---|
59 | ASN1_SIMPLE(OCSP_RESPBYTES, response, ASN1_OCTET_STRING)
|
---|
60 | } ASN1_SEQUENCE_END(OCSP_RESPBYTES)
|
---|
61 |
|
---|
62 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPBYTES)
|
---|
63 |
|
---|
64 | ASN1_SEQUENCE(OCSP_RESPONSE) = {
|
---|
65 | ASN1_SIMPLE(OCSP_RESPONSE, responseStatus, ASN1_ENUMERATED),
|
---|
66 | ASN1_EXP_OPT(OCSP_RESPONSE, responseBytes, OCSP_RESPBYTES, 0)
|
---|
67 | } ASN1_SEQUENCE_END(OCSP_RESPONSE)
|
---|
68 |
|
---|
69 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPONSE)
|
---|
70 |
|
---|
71 | ASN1_CHOICE(OCSP_RESPID) = {
|
---|
72 | ASN1_EXP(OCSP_RESPID, value.byName, X509_NAME, 1),
|
---|
73 | ASN1_EXP(OCSP_RESPID, value.byKey, ASN1_OCTET_STRING, 2)
|
---|
74 | } ASN1_CHOICE_END(OCSP_RESPID)
|
---|
75 |
|
---|
76 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPID)
|
---|
77 |
|
---|
78 | ASN1_SEQUENCE(OCSP_REVOKEDINFO) = {
|
---|
79 | ASN1_SIMPLE(OCSP_REVOKEDINFO, revocationTime, ASN1_GENERALIZEDTIME),
|
---|
80 | ASN1_EXP_OPT(OCSP_REVOKEDINFO, revocationReason, ASN1_ENUMERATED, 0)
|
---|
81 | } ASN1_SEQUENCE_END(OCSP_REVOKEDINFO)
|
---|
82 |
|
---|
83 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
|
---|
84 |
|
---|
85 | ASN1_CHOICE(OCSP_CERTSTATUS) = {
|
---|
86 | ASN1_IMP(OCSP_CERTSTATUS, value.good, ASN1_NULL, 0),
|
---|
87 | ASN1_IMP(OCSP_CERTSTATUS, value.revoked, OCSP_REVOKEDINFO, 1),
|
---|
88 | ASN1_IMP(OCSP_CERTSTATUS, value.unknown, ASN1_NULL, 2)
|
---|
89 | } ASN1_CHOICE_END(OCSP_CERTSTATUS)
|
---|
90 |
|
---|
91 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
|
---|
92 |
|
---|
93 | ASN1_SEQUENCE(OCSP_SINGLERESP) = {
|
---|
94 | ASN1_SIMPLE(OCSP_SINGLERESP, certId, OCSP_CERTID),
|
---|
95 | ASN1_SIMPLE(OCSP_SINGLERESP, certStatus, OCSP_CERTSTATUS),
|
---|
96 | ASN1_SIMPLE(OCSP_SINGLERESP, thisUpdate, ASN1_GENERALIZEDTIME),
|
---|
97 | ASN1_EXP_OPT(OCSP_SINGLERESP, nextUpdate, ASN1_GENERALIZEDTIME, 0),
|
---|
98 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_SINGLERESP, singleExtensions, X509_EXTENSION, 1)
|
---|
99 | } ASN1_SEQUENCE_END(OCSP_SINGLERESP)
|
---|
100 |
|
---|
101 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_SINGLERESP)
|
---|
102 |
|
---|
103 | ASN1_SEQUENCE(OCSP_RESPDATA) = {
|
---|
104 | ASN1_EXP_OPT(OCSP_RESPDATA, version, ASN1_INTEGER, 0),
|
---|
105 | ASN1_EMBED(OCSP_RESPDATA, responderId, OCSP_RESPID),
|
---|
106 | ASN1_SIMPLE(OCSP_RESPDATA, producedAt, ASN1_GENERALIZEDTIME),
|
---|
107 | ASN1_SEQUENCE_OF(OCSP_RESPDATA, responses, OCSP_SINGLERESP),
|
---|
108 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_RESPDATA, responseExtensions, X509_EXTENSION, 1)
|
---|
109 | } ASN1_SEQUENCE_END(OCSP_RESPDATA)
|
---|
110 |
|
---|
111 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPDATA)
|
---|
112 |
|
---|
113 | ASN1_SEQUENCE(OCSP_BASICRESP) = {
|
---|
114 | ASN1_EMBED(OCSP_BASICRESP, tbsResponseData, OCSP_RESPDATA),
|
---|
115 | ASN1_EMBED(OCSP_BASICRESP, signatureAlgorithm, X509_ALGOR),
|
---|
116 | ASN1_SIMPLE(OCSP_BASICRESP, signature, ASN1_BIT_STRING),
|
---|
117 | ASN1_EXP_SEQUENCE_OF_OPT(OCSP_BASICRESP, certs, X509, 0)
|
---|
118 | } ASN1_SEQUENCE_END(OCSP_BASICRESP)
|
---|
119 |
|
---|
120 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_BASICRESP)
|
---|
121 |
|
---|
122 | ASN1_SEQUENCE(OCSP_CRLID) = {
|
---|
123 | ASN1_EXP_OPT(OCSP_CRLID, crlUrl, ASN1_IA5STRING, 0),
|
---|
124 | ASN1_EXP_OPT(OCSP_CRLID, crlNum, ASN1_INTEGER, 1),
|
---|
125 | ASN1_EXP_OPT(OCSP_CRLID, crlTime, ASN1_GENERALIZEDTIME, 2)
|
---|
126 | } ASN1_SEQUENCE_END(OCSP_CRLID)
|
---|
127 |
|
---|
128 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_CRLID)
|
---|
129 |
|
---|
130 | ASN1_SEQUENCE(OCSP_SERVICELOC) = {
|
---|
131 | ASN1_SIMPLE(OCSP_SERVICELOC, issuer, X509_NAME),
|
---|
132 | ASN1_SEQUENCE_OF_OPT(OCSP_SERVICELOC, locator, ACCESS_DESCRIPTION)
|
---|
133 | } ASN1_SEQUENCE_END(OCSP_SERVICELOC)
|
---|
134 |
|
---|
135 | IMPLEMENT_ASN1_FUNCTIONS(OCSP_SERVICELOC)
|
---|