ocsp_resp_parse.h
Go to the documentation of this file.
1 /**
2  * @file ocsp_resp_parse.h
3  * @brief OCSP response parsing
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _OCSP_RESP_PARSE_H
32 #define _OCSP_RESP_PARSE_H
33 
34 //Dependencies
35 #include "ocsp/ocsp_common.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //OCSP related functions
43 error_t ocspParseResponse(const uint8_t *data, size_t length,
44  OcspResponse *response);
45 
46 error_t ocspParseResponseStatus(const uint8_t *data, size_t length,
47  size_t *totalLength, OcspResponseStatus *status);
48 
49 error_t ocspParseResponseBytes(const uint8_t *data, size_t length,
50  OcspResponse *response);
51 
52 error_t ocspParseBasicResponse(const uint8_t *data, size_t length,
53  OcspBasicResponse *basicResponse);
54 
55 error_t ocspParseTbsResponseData(const uint8_t *data, size_t length,
56  size_t *totalLength, OcspTbsResponseData *tbsResponseData);
57 
58 error_t ocspParseVersion(const uint8_t *data, size_t length,
59  size_t *totalLength, OcspVersion *version);
60 
61 error_t ocspParseResponderId(const uint8_t *data, size_t length,
62  size_t *totalLength, OcspResponderId *responderId);
63 
64 error_t ocspParseResponses(const uint8_t *data, size_t length,
65  size_t *totalLength, OcspTbsResponseData *tbsResponseData);
66 
67 error_t ocspParseSingleResponse(const uint8_t *data, size_t length,
68  size_t *totalLength, OcspSingleResponse *singleResponse);
69 
70 error_t ocspParseCertId(const uint8_t *data, size_t length,
71  size_t *totalLength, OcspCertId *certId);
72 
73 error_t ocspParseHashAlgo(const uint8_t *data, size_t length,
74  size_t *totalLength, OcspCertId *certId);
75 
76 error_t ocspParseCertStatus(const uint8_t *data, size_t length,
77  size_t *totalLength, OcspSingleResponse *singleResponse);
78 
79 error_t ocspParseRevokedInfo(const uint8_t *data, size_t length,
80  OcspRevokedInfo *revokedInfo);
81 
82 error_t ocspParseRevocationReason(const uint8_t *data, size_t length,
83  X509CrlReasons *revocationReason);
84 
85 error_t ocspParseCerts(const uint8_t *data, size_t length,
86  OcspCerts *certs);
87 
88 error_t ocspParseResponseExtensions(const uint8_t *data, size_t length,
89  OcspExtensions *responseExtensions);
90 
91 error_t ocspParseSingleExtensions(const uint8_t *data, size_t length,
92  OcspSingleExtensions *singleExtensions);
93 
95  size_t length, X509OctetString *nonce);
96 
97 //C++ guard
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif
int bool_t
Definition: compiler_port.h:53
OCSP common definitions.
OcspResponseStatus
OCSP response status.
Definition: ocsp_common.h:115
TbsResponseData structure.
Definition: ocsp_common.h:249
uint8_t data[]
Definition: ethernet.h:222
error_t ocspParseCertId(const uint8_t *data, size_t length, size_t *totalLength, OcspCertId *certId)
Parse CertID structure.
error_t ocspParseCerts(const uint8_t *data, size_t length, OcspCerts *certs)
Parse Certs structure.
OcspCerts structure.
Definition: ocsp_common.h:265
uint16_t totalLength
Definition: ipv4.h:322
error_t ocspParseResponses(const uint8_t *data, size_t length, size_t *totalLength, OcspTbsResponseData *tbsResponseData)
Parse Responses structure.
error_t ocspParseNonceExtension(bool_t critical, const uint8_t *data, size_t length, X509OctetString *nonce)
Parse Nonce extension.
uint8_t version
Definition: coap_common.h:177
error_t ocspParseCertStatus(const uint8_t *data, size_t length, size_t *totalLength, OcspSingleResponse *singleResponse)
Parse CertStatus structure.
BasicOCSPResponse structure.
Definition: ocsp_common.h:275
error_t ocspParseResponse(const uint8_t *data, size_t length, OcspResponse *response)
Parse OCSPResponse structure.
error_t ocspParseResponderId(const uint8_t *data, size_t length, size_t *totalLength, OcspResponderId *responderId)
Parse ResponderID structure.
error_t ocspParseVersion(const uint8_t *data, size_t length, size_t *totalLength, OcspVersion *version)
Parse Version field.
X509CrlReasons
CRL reasons.
Definition: x509_common.h:566
error_t
Error codes.
Definition: error.h:43
error_t ocspParseRevocationReason(const uint8_t *data, size_t length, X509CrlReasons *revocationReason)
Parse RevocationReason field.
RevokedInfo structure.
Definition: ocsp_common.h:212
error_t ocspParseBasicResponse(const uint8_t *data, size_t length, OcspBasicResponse *basicResponse)
Parse BasicOCSPResponse structure.
error_t ocspParseRevokedInfo(const uint8_t *data, size_t length, OcspRevokedInfo *revokedInfo)
Parse RevokedInfo structure.
error_t ocspParseResponseBytes(const uint8_t *data, size_t length, OcspResponse *response)
Parse ResponseBytes structure.
error_t ocspParseResponseExtensions(const uint8_t *data, size_t length, OcspExtensions *responseExtensions)
Parse ResponseExtensions structure.
uint8_t length
Definition: tcp.h:368
OCSP extensions.
Definition: ocsp_common.h:176
ResponderID structure.
Definition: ocsp_common.h:238
CertID structure.
Definition: ocsp_common.h:142
error_t ocspParseResponseStatus(const uint8_t *data, size_t length, size_t *totalLength, OcspResponseStatus *status)
Parse ResponseStatus field.
uint8_t critical
Definition: ike.h:1281
error_t ocspParseHashAlgo(const uint8_t *data, size_t length, size_t *totalLength, OcspCertId *certId)
Parse HashAlgorithm structure.
SingleResponse structure.
Definition: ocsp_common.h:223
Single request/response extensions.
Definition: ocsp_common.h:155
Octet string.
Definition: x509_common.h:653
error_t ocspParseTbsResponseData(const uint8_t *data, size_t length, size_t *totalLength, OcspTbsResponseData *tbsResponseData)
Parse TbsResponseData structure.
error_t ocspParseSingleResponse(const uint8_t *data, size_t length, size_t *totalLength, OcspSingleResponse *singleResponse)
Parse SingleResponse structure.
OCSPResponse structure.
Definition: ocsp_common.h:288
error_t ocspParseSingleExtensions(const uint8_t *data, size_t length, OcspSingleExtensions *singleExtensions)
Parse SingleExtensions structure.
uint8_t nonce[]
Definition: ntp_common.h:233
OcspVersion
OCSP versions.
Definition: ocsp_common.h:105