2015-01-22 03:40:55 +00:00
|
|
|
/*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2000-12-13 18:21:51 +00:00
|
|
|
*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2000-12-13 18:21:51 +00:00
|
|
|
*/
|
2016-05-17 18:52:22 +00:00
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
#include <openssl/asn1.h>
|
|
|
|
#include <openssl/asn1t.h>
|
|
|
|
#include <openssl/ocsp.h>
|
2015-03-05 13:41:11 +00:00
|
|
|
#include "ocsp_lcl.h"
|
2000-12-13 18:21:51 +00:00
|
|
|
|
|
|
|
ASN1_SEQUENCE(OCSP_SIGNATURE) = {
|
2015-10-06 22:04:08 +00:00
|
|
|
ASN1_EMBED(OCSP_SIGNATURE, signatureAlgorithm, X509_ALGOR),
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_SIGNATURE, signature, ASN1_BIT_STRING),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_SIGNATURE, certs, X509, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_SIGNATURE)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_SIGNATURE)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_CERTID) = {
|
2015-10-06 22:04:08 +00:00
|
|
|
ASN1_EMBED(OCSP_CERTID, hashAlgorithm, X509_ALGOR),
|
2015-10-07 13:42:34 +00:00
|
|
|
ASN1_EMBED(OCSP_CERTID, issuerNameHash, ASN1_OCTET_STRING),
|
|
|
|
ASN1_EMBED(OCSP_CERTID, issuerKeyHash, ASN1_OCTET_STRING),
|
|
|
|
ASN1_EMBED(OCSP_CERTID, serialNumber, ASN1_INTEGER)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_CERTID)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_CERTID)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_ONEREQ) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_ONEREQ, reqCert, OCSP_CERTID),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_ONEREQ, singleRequestExtensions, X509_EXTENSION, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_ONEREQ)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_ONEREQ)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_REQINFO) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_EXP_OPT(OCSP_REQINFO, version, ASN1_INTEGER, 0),
|
|
|
|
ASN1_EXP_OPT(OCSP_REQINFO, requestorName, GENERAL_NAME, 1),
|
|
|
|
ASN1_SEQUENCE_OF(OCSP_REQINFO, requestList, OCSP_ONEREQ),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_REQINFO, requestExtensions, X509_EXTENSION, 2)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_REQINFO)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_REQINFO)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_REQUEST) = {
|
2015-10-06 22:04:08 +00:00
|
|
|
ASN1_EMBED(OCSP_REQUEST, tbsRequest, OCSP_REQINFO),
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_EXP_OPT(OCSP_REQUEST, optionalSignature, OCSP_SIGNATURE, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_REQUEST)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_REQUEST)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
|
|
|
/* OCSP_RESPONSE templates */
|
|
|
|
|
|
|
|
ASN1_SEQUENCE(OCSP_RESPBYTES) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_RESPBYTES, responseType, ASN1_OBJECT),
|
|
|
|
ASN1_SIMPLE(OCSP_RESPBYTES, response, ASN1_OCTET_STRING)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_RESPBYTES)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPBYTES)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_RESPONSE) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_RESPONSE, responseStatus, ASN1_ENUMERATED),
|
|
|
|
ASN1_EXP_OPT(OCSP_RESPONSE, responseBytes, OCSP_RESPBYTES, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_RESPONSE)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPONSE)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_CHOICE(OCSP_RESPID) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_EXP(OCSP_RESPID, value.byName, X509_NAME, 1),
|
|
|
|
ASN1_EXP(OCSP_RESPID, value.byKey, ASN1_OCTET_STRING, 2)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_CHOICE_END(OCSP_RESPID)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-21 01:38:55 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPID)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_REVOKEDINFO) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_REVOKEDINFO, revocationTime, ASN1_GENERALIZEDTIME),
|
|
|
|
ASN1_EXP_OPT(OCSP_REVOKEDINFO, revocationReason, ASN1_ENUMERATED, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_REVOKEDINFO)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_CHOICE(OCSP_CERTSTATUS) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_IMP(OCSP_CERTSTATUS, value.good, ASN1_NULL, 0),
|
|
|
|
ASN1_IMP(OCSP_CERTSTATUS, value.revoked, OCSP_REVOKEDINFO, 1),
|
|
|
|
ASN1_IMP(OCSP_CERTSTATUS, value.unknown, ASN1_NULL, 2)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_CHOICE_END(OCSP_CERTSTATUS)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_SINGLERESP) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_SINGLERESP, certId, OCSP_CERTID),
|
|
|
|
ASN1_SIMPLE(OCSP_SINGLERESP, certStatus, OCSP_CERTSTATUS),
|
|
|
|
ASN1_SIMPLE(OCSP_SINGLERESP, thisUpdate, ASN1_GENERALIZEDTIME),
|
|
|
|
ASN1_EXP_OPT(OCSP_SINGLERESP, nextUpdate, ASN1_GENERALIZEDTIME, 0),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_SINGLERESP, singleExtensions, X509_EXTENSION, 1)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_SINGLERESP)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_SINGLERESP)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_RESPDATA) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_EXP_OPT(OCSP_RESPDATA, version, ASN1_INTEGER, 0),
|
2015-10-06 22:04:08 +00:00
|
|
|
ASN1_EMBED(OCSP_RESPDATA, responderId, OCSP_RESPID),
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_RESPDATA, producedAt, ASN1_GENERALIZEDTIME),
|
|
|
|
ASN1_SEQUENCE_OF(OCSP_RESPDATA, responses, OCSP_SINGLERESP),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_RESPDATA, responseExtensions, X509_EXTENSION, 1)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_RESPDATA)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_RESPDATA)
|
|
|
|
|
2000-12-13 18:21:51 +00:00
|
|
|
ASN1_SEQUENCE(OCSP_BASICRESP) = {
|
2015-10-06 22:04:08 +00:00
|
|
|
ASN1_EMBED(OCSP_BASICRESP, tbsResponseData, OCSP_RESPDATA),
|
|
|
|
ASN1_EMBED(OCSP_BASICRESP, signatureAlgorithm, X509_ALGOR),
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_BASICRESP, signature, ASN1_BIT_STRING),
|
|
|
|
ASN1_EXP_SEQUENCE_OF_OPT(OCSP_BASICRESP, certs, X509, 0)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_BASICRESP)
|
2000-12-13 18:21:51 +00:00
|
|
|
|
2000-12-14 18:42:28 +00:00
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_BASICRESP)
|
|
|
|
|
|
|
|
ASN1_SEQUENCE(OCSP_CRLID) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_EXP_OPT(OCSP_CRLID, crlUrl, ASN1_IA5STRING, 0),
|
|
|
|
ASN1_EXP_OPT(OCSP_CRLID, crlNum, ASN1_INTEGER, 1),
|
|
|
|
ASN1_EXP_OPT(OCSP_CRLID, crlTime, ASN1_GENERALIZEDTIME, 2)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_CRLID)
|
2000-12-14 18:42:28 +00:00
|
|
|
|
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_CRLID)
|
|
|
|
|
|
|
|
ASN1_SEQUENCE(OCSP_SERVICELOC) = {
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_SIMPLE(OCSP_SERVICELOC, issuer, X509_NAME),
|
|
|
|
ASN1_SEQUENCE_OF_OPT(OCSP_SERVICELOC, locator, ACCESS_DESCRIPTION)
|
2001-02-23 12:47:06 +00:00
|
|
|
} ASN1_SEQUENCE_END(OCSP_SERVICELOC)
|
2000-12-14 18:42:28 +00:00
|
|
|
|
|
|
|
IMPLEMENT_ASN1_FUNCTIONS(OCSP_SERVICELOC)
|