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