]>
git.proxmox.com Git - efi-boot-shim.git/blob - Cryptlib/Include/openssl/ocsp.h
3 * Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
8 * History: This file was transfered to Richard Levitte from CertCo by Kathy
9 * Weinhold in mid-spring 2000 to be included in OpenSSL or released as a
13 /* ====================================================================
14 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in
25 * the documentation and/or other materials provided with the
28 * 3. All advertising materials mentioning features or use of this
29 * software must display the following acknowledgment:
30 * "This product includes software developed by the OpenSSL Project
31 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
33 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
34 * endorse or promote products derived from this software without
35 * prior written permission. For written permission, please contact
36 * openssl-core@openssl.org.
38 * 5. Products derived from this software may not be called "OpenSSL"
39 * nor may "OpenSSL" appear in their names without prior written
40 * permission of the OpenSSL Project.
42 * 6. Redistributions of any form whatsoever must retain the following
44 * "This product includes software developed by the OpenSSL Project
45 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
47 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
48 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
50 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
51 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
56 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
58 * OF THE POSSIBILITY OF SUCH DAMAGE.
59 * ====================================================================
61 * This product includes cryptographic software written by Eric Young
62 * (eay@cryptsoft.com). This product includes software written by Tim
63 * Hudson (tjh@cryptsoft.com).
68 # define HEADER_OCSP_H
70 # include <openssl/ossl_typ.h>
71 # include <openssl/x509.h>
72 # include <openssl/x509v3.h>
73 # include <openssl/safestack.h>
79 /* Various flags and values */
81 # define OCSP_DEFAULT_NONCE_LENGTH 16
83 # define OCSP_NOCERTS 0x1
84 # define OCSP_NOINTERN 0x2
85 # define OCSP_NOSIGS 0x4
86 # define OCSP_NOCHAIN 0x8
87 # define OCSP_NOVERIFY 0x10
88 # define OCSP_NOEXPLICIT 0x20
89 # define OCSP_NOCASIGN 0x40
90 # define OCSP_NODELEGATED 0x80
91 # define OCSP_NOCHECKS 0x100
92 # define OCSP_TRUSTOTHER 0x200
93 # define OCSP_RESPID_KEY 0x400
94 # define OCSP_NOTIME 0x800
96 /*- CertID ::= SEQUENCE {
97 * hashAlgorithm AlgorithmIdentifier,
98 * issuerNameHash OCTET STRING, -- Hash of Issuer's DN
99 * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
100 * serialNumber CertificateSerialNumber }
102 typedef struct ocsp_cert_id_st
{
103 X509_ALGOR
*hashAlgorithm
;
104 ASN1_OCTET_STRING
*issuerNameHash
;
105 ASN1_OCTET_STRING
*issuerKeyHash
;
106 ASN1_INTEGER
*serialNumber
;
109 DECLARE_STACK_OF(OCSP_CERTID
)
111 /*- Request ::= SEQUENCE {
113 * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
115 typedef struct ocsp_one_request_st
{
116 OCSP_CERTID
*reqCert
;
117 STACK_OF(X509_EXTENSION
) *singleRequestExtensions
;
120 DECLARE_STACK_OF(OCSP_ONEREQ
)
121 DECLARE_ASN1_SET_OF(OCSP_ONEREQ
)
123 /*- TBSRequest ::= SEQUENCE {
124 * version [0] EXPLICIT Version DEFAULT v1,
125 * requestorName [1] EXPLICIT GeneralName OPTIONAL,
126 * requestList SEQUENCE OF Request,
127 * requestExtensions [2] EXPLICIT Extensions OPTIONAL }
129 typedef struct ocsp_req_info_st
{
130 ASN1_INTEGER
*version
;
131 GENERAL_NAME
*requestorName
;
132 STACK_OF(OCSP_ONEREQ
) *requestList
;
133 STACK_OF(X509_EXTENSION
) *requestExtensions
;
136 /*- Signature ::= SEQUENCE {
137 * signatureAlgorithm AlgorithmIdentifier,
138 * signature BIT STRING,
139 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
141 typedef struct ocsp_signature_st
{
142 X509_ALGOR
*signatureAlgorithm
;
143 ASN1_BIT_STRING
*signature
;
144 STACK_OF(X509
) *certs
;
147 /*- OCSPRequest ::= SEQUENCE {
148 * tbsRequest TBSRequest,
149 * optionalSignature [0] EXPLICIT Signature OPTIONAL }
151 typedef struct ocsp_request_st
{
152 OCSP_REQINFO
*tbsRequest
;
153 OCSP_SIGNATURE
*optionalSignature
; /* OPTIONAL */
156 /*- OCSPResponseStatus ::= ENUMERATED {
157 * successful (0), --Response has valid confirmations
158 * malformedRequest (1), --Illegal confirmation request
159 * internalError (2), --Internal error in issuer
160 * tryLater (3), --Try again later
162 * sigRequired (5), --Must sign the request
163 * unauthorized (6) --Request unauthorized
166 # define OCSP_RESPONSE_STATUS_SUCCESSFUL 0
167 # define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
168 # define OCSP_RESPONSE_STATUS_INTERNALERROR 2
169 # define OCSP_RESPONSE_STATUS_TRYLATER 3
170 # define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
171 # define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
173 /*- ResponseBytes ::= SEQUENCE {
174 * responseType OBJECT IDENTIFIER,
175 * response OCTET STRING }
177 typedef struct ocsp_resp_bytes_st
{
178 ASN1_OBJECT
*responseType
;
179 ASN1_OCTET_STRING
*response
;
182 /*- OCSPResponse ::= SEQUENCE {
183 * responseStatus OCSPResponseStatus,
184 * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
186 struct ocsp_response_st
{
187 ASN1_ENUMERATED
*responseStatus
;
188 OCSP_RESPBYTES
*responseBytes
;
191 /*- ResponderID ::= CHOICE {
193 * byKey [2] KeyHash }
195 # define V_OCSP_RESPID_NAME 0
196 # define V_OCSP_RESPID_KEY 1
197 struct ocsp_responder_id_st
{
201 ASN1_OCTET_STRING
*byKey
;
205 DECLARE_STACK_OF(OCSP_RESPID
)
206 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID
)
208 /*- KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
209 * --(excluding the tag and length fields)
212 /*- RevokedInfo ::= SEQUENCE {
213 * revocationTime GeneralizedTime,
214 * revocationReason [0] EXPLICIT CRLReason OPTIONAL }
216 typedef struct ocsp_revoked_info_st
{
217 ASN1_GENERALIZEDTIME
*revocationTime
;
218 ASN1_ENUMERATED
*revocationReason
;
221 /*- CertStatus ::= CHOICE {
222 * good [0] IMPLICIT NULL,
223 * revoked [1] IMPLICIT RevokedInfo,
224 * unknown [2] IMPLICIT UnknownInfo }
226 # define V_OCSP_CERTSTATUS_GOOD 0
227 # define V_OCSP_CERTSTATUS_REVOKED 1
228 # define V_OCSP_CERTSTATUS_UNKNOWN 2
229 typedef struct ocsp_cert_status_st
{
233 OCSP_REVOKEDINFO
*revoked
;
238 /*- SingleResponse ::= SEQUENCE {
240 * certStatus CertStatus,
241 * thisUpdate GeneralizedTime,
242 * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
243 * singleExtensions [1] EXPLICIT Extensions OPTIONAL }
245 typedef struct ocsp_single_response_st
{
247 OCSP_CERTSTATUS
*certStatus
;
248 ASN1_GENERALIZEDTIME
*thisUpdate
;
249 ASN1_GENERALIZEDTIME
*nextUpdate
;
250 STACK_OF(X509_EXTENSION
) *singleExtensions
;
253 DECLARE_STACK_OF(OCSP_SINGLERESP
)
254 DECLARE_ASN1_SET_OF(OCSP_SINGLERESP
)
256 /*- ResponseData ::= SEQUENCE {
257 * version [0] EXPLICIT Version DEFAULT v1,
258 * responderID ResponderID,
259 * producedAt GeneralizedTime,
260 * responses SEQUENCE OF SingleResponse,
261 * responseExtensions [1] EXPLICIT Extensions OPTIONAL }
263 typedef struct ocsp_response_data_st
{
264 ASN1_INTEGER
*version
;
265 OCSP_RESPID
*responderId
;
266 ASN1_GENERALIZEDTIME
*producedAt
;
267 STACK_OF(OCSP_SINGLERESP
) *responses
;
268 STACK_OF(X509_EXTENSION
) *responseExtensions
;
271 /*- BasicOCSPResponse ::= SEQUENCE {
272 * tbsResponseData ResponseData,
273 * signatureAlgorithm AlgorithmIdentifier,
274 * signature BIT STRING,
275 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
278 * Note 1: The value for "signature" is specified in the OCSP rfc2560 as
279 * follows: "The value for the signature SHALL be computed on the hash of
280 * the DER encoding ResponseData." This means that you must hash the
281 * DER-encoded tbsResponseData, and then run it through a crypto-signing
282 * function, which will (at least w/RSA) do a hash-'n'-private-encrypt
283 * operation. This seems a bit odd, but that's the spec. Also note that
284 * the data structures do not leave anywhere to independently specify the
285 * algorithm used for the initial hash. So, we look at the
286 * signature-specification algorithm, and try to do something intelligent.
287 * -- Kathy Weinhold, CertCo
290 * Note 2: It seems that the mentioned passage from RFC 2560 (section
291 * 4.2.1) is open for interpretation. I've done tests against another
292 * responder, and found that it doesn't do the double hashing that the RFC
293 * seems to say one should. Therefore, all relevant functions take a flag
294 * saying which variant should be used. -- Richard Levitte, OpenSSL team
297 typedef struct ocsp_basic_response_st
{
298 OCSP_RESPDATA
*tbsResponseData
;
299 X509_ALGOR
*signatureAlgorithm
;
300 ASN1_BIT_STRING
*signature
;
301 STACK_OF(X509
) *certs
;
305 * CRLReason ::= ENUMERATED {
309 * affiliationChanged (3),
311 * cessationOfOperation (5),
312 * certificateHold (6),
313 * removeFromCRL (8) }
315 # define OCSP_REVOKED_STATUS_NOSTATUS -1
316 # define OCSP_REVOKED_STATUS_UNSPECIFIED 0
317 # define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
318 # define OCSP_REVOKED_STATUS_CACOMPROMISE 2
319 # define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
320 # define OCSP_REVOKED_STATUS_SUPERSEDED 4
321 # define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
322 # define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
323 # define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
326 * CrlID ::= SEQUENCE {
327 * crlUrl [0] EXPLICIT IA5String OPTIONAL,
328 * crlNum [1] EXPLICIT INTEGER OPTIONAL,
329 * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
331 typedef struct ocsp_crl_id_st
{
332 ASN1_IA5STRING
*crlUrl
;
333 ASN1_INTEGER
*crlNum
;
334 ASN1_GENERALIZEDTIME
*crlTime
;
338 * ServiceLocator ::= SEQUENCE {
340 * locator AuthorityInfoAccessSyntax OPTIONAL }
342 typedef struct ocsp_service_locator_st
{
344 STACK_OF(ACCESS_DESCRIPTION
) *locator
;
347 # define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
348 # define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
350 # define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
352 # define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
354 # define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
355 (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
357 # define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
358 (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
360 # define PEM_write_bio_OCSP_REQUEST(bp,o) \
361 PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
362 bp,(char *)o, NULL,NULL,0,NULL,NULL)
364 # define PEM_write_bio_OCSP_RESPONSE(bp,o) \
365 PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
366 bp,(char *)o, NULL,NULL,0,NULL,NULL)
368 # define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
370 # define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
372 # define OCSP_REQUEST_sign(o,pkey,md) \
373 ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
374 o->optionalSignature->signatureAlgorithm,NULL,\
375 o->optionalSignature->signature,o->tbsRequest,pkey,md)
377 # define OCSP_BASICRESP_sign(o,pkey,md,d) \
378 ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\
379 o->signature,o->tbsResponseData,pkey,md)
381 # define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\
382 a->optionalSignature->signatureAlgorithm,\
383 a->optionalSignature->signature,a->tbsRequest,r)
385 # define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\
386 a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
388 # define ASN1_BIT_STRING_digest(data,type,md,len) \
389 ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
391 # define OCSP_CERTSTATUS_dup(cs)\
392 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
393 (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
395 OCSP_CERTID
*OCSP_CERTID_dup(OCSP_CERTID
*id
);
397 OCSP_RESPONSE
*OCSP_sendreq_bio(BIO
*b
, const char *path
, OCSP_REQUEST
*req
);
398 OCSP_REQ_CTX
*OCSP_sendreq_new(BIO
*io
, const char *path
, OCSP_REQUEST
*req
,
400 int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX
*rctx
);
401 int OCSP_sendreq_nbio(OCSP_RESPONSE
**presp
, OCSP_REQ_CTX
*rctx
);
402 OCSP_REQ_CTX
*OCSP_REQ_CTX_new(BIO
*io
, int maxline
);
403 void OCSP_REQ_CTX_free(OCSP_REQ_CTX
*rctx
);
404 void OCSP_set_max_response_length(OCSP_REQ_CTX
*rctx
, unsigned long len
);
405 int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX
*rctx
, const ASN1_ITEM
*it
,
407 int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX
*rctx
, ASN1_VALUE
**pval
,
408 const ASN1_ITEM
*it
);
409 BIO
*OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX
*rctx
);
410 int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX
*rctx
, const ASN1_ITEM
*it
,
412 int OCSP_REQ_CTX_http(OCSP_REQ_CTX
*rctx
, const char *op
, const char *path
);
413 int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX
*rctx
, OCSP_REQUEST
*req
);
414 int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX
*rctx
,
415 const char *name
, const char *value
);
417 OCSP_CERTID
*OCSP_cert_to_id(const EVP_MD
*dgst
, X509
*subject
, X509
*issuer
);
419 OCSP_CERTID
*OCSP_cert_id_new(const EVP_MD
*dgst
,
420 X509_NAME
*issuerName
,
421 ASN1_BIT_STRING
*issuerKey
,
422 ASN1_INTEGER
*serialNumber
);
424 OCSP_ONEREQ
*OCSP_request_add0_id(OCSP_REQUEST
*req
, OCSP_CERTID
*cid
);
426 int OCSP_request_add1_nonce(OCSP_REQUEST
*req
, unsigned char *val
, int len
);
427 int OCSP_basic_add1_nonce(OCSP_BASICRESP
*resp
, unsigned char *val
, int len
);
428 int OCSP_check_nonce(OCSP_REQUEST
*req
, OCSP_BASICRESP
*bs
);
429 int OCSP_copy_nonce(OCSP_BASICRESP
*resp
, OCSP_REQUEST
*req
);
431 int OCSP_request_set1_name(OCSP_REQUEST
*req
, X509_NAME
*nm
);
432 int OCSP_request_add1_cert(OCSP_REQUEST
*req
, X509
*cert
);
434 int OCSP_request_sign(OCSP_REQUEST
*req
,
438 STACK_OF(X509
) *certs
, unsigned long flags
);
440 int OCSP_response_status(OCSP_RESPONSE
*resp
);
441 OCSP_BASICRESP
*OCSP_response_get1_basic(OCSP_RESPONSE
*resp
);
443 int OCSP_resp_count(OCSP_BASICRESP
*bs
);
444 OCSP_SINGLERESP
*OCSP_resp_get0(OCSP_BASICRESP
*bs
, int idx
);
445 int OCSP_resp_find(OCSP_BASICRESP
*bs
, OCSP_CERTID
*id
, int last
);
446 int OCSP_single_get0_status(OCSP_SINGLERESP
*single
, int *reason
,
447 ASN1_GENERALIZEDTIME
**revtime
,
448 ASN1_GENERALIZEDTIME
**thisupd
,
449 ASN1_GENERALIZEDTIME
**nextupd
);
450 int OCSP_resp_find_status(OCSP_BASICRESP
*bs
, OCSP_CERTID
*id
, int *status
,
452 ASN1_GENERALIZEDTIME
**revtime
,
453 ASN1_GENERALIZEDTIME
**thisupd
,
454 ASN1_GENERALIZEDTIME
**nextupd
);
455 int OCSP_check_validity(ASN1_GENERALIZEDTIME
*thisupd
,
456 ASN1_GENERALIZEDTIME
*nextupd
, long sec
, long maxsec
);
458 int OCSP_request_verify(OCSP_REQUEST
*req
, STACK_OF(X509
) *certs
,
459 X509_STORE
*store
, unsigned long flags
);
461 int OCSP_parse_url(const char *url
, char **phost
, char **pport
, char **ppath
,
464 int OCSP_id_issuer_cmp(OCSP_CERTID
*a
, OCSP_CERTID
*b
);
465 int OCSP_id_cmp(OCSP_CERTID
*a
, OCSP_CERTID
*b
);
467 int OCSP_request_onereq_count(OCSP_REQUEST
*req
);
468 OCSP_ONEREQ
*OCSP_request_onereq_get0(OCSP_REQUEST
*req
, int i
);
469 OCSP_CERTID
*OCSP_onereq_get0_id(OCSP_ONEREQ
*one
);
470 int OCSP_id_get0_info(ASN1_OCTET_STRING
**piNameHash
, ASN1_OBJECT
**pmd
,
471 ASN1_OCTET_STRING
**pikeyHash
,
472 ASN1_INTEGER
**pserial
, OCSP_CERTID
*cid
);
473 int OCSP_request_is_signed(OCSP_REQUEST
*req
);
474 OCSP_RESPONSE
*OCSP_response_create(int status
, OCSP_BASICRESP
*bs
);
475 OCSP_SINGLERESP
*OCSP_basic_add1_status(OCSP_BASICRESP
*rsp
,
477 int status
, int reason
,
481 int OCSP_basic_add1_cert(OCSP_BASICRESP
*resp
, X509
*cert
);
482 int OCSP_basic_sign(OCSP_BASICRESP
*brsp
,
483 X509
*signer
, EVP_PKEY
*key
, const EVP_MD
*dgst
,
484 STACK_OF(X509
) *certs
, unsigned long flags
);
486 X509_EXTENSION
*OCSP_crlID_new(char *url
, long *n
, char *tim
);
488 X509_EXTENSION
*OCSP_accept_responses_new(char **oids
);
490 X509_EXTENSION
*OCSP_archive_cutoff_new(char *tim
);
492 X509_EXTENSION
*OCSP_url_svcloc_new(X509_NAME
*issuer
, char **urls
);
494 int OCSP_REQUEST_get_ext_count(OCSP_REQUEST
*x
);
495 int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST
*x
, int nid
, int lastpos
);
496 int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST
*x
, ASN1_OBJECT
*obj
,
498 int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST
*x
, int crit
, int lastpos
);
499 X509_EXTENSION
*OCSP_REQUEST_get_ext(OCSP_REQUEST
*x
, int loc
);
500 X509_EXTENSION
*OCSP_REQUEST_delete_ext(OCSP_REQUEST
*x
, int loc
);
501 void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST
*x
, int nid
, int *crit
,
503 int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST
*x
, int nid
, void *value
, int crit
,
504 unsigned long flags
);
505 int OCSP_REQUEST_add_ext(OCSP_REQUEST
*x
, X509_EXTENSION
*ex
, int loc
);
507 int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ
*x
);
508 int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ
*x
, int nid
, int lastpos
);
509 int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ
*x
, ASN1_OBJECT
*obj
, int lastpos
);
510 int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ
*x
, int crit
, int lastpos
);
511 X509_EXTENSION
*OCSP_ONEREQ_get_ext(OCSP_ONEREQ
*x
, int loc
);
512 X509_EXTENSION
*OCSP_ONEREQ_delete_ext(OCSP_ONEREQ
*x
, int loc
);
513 void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ
*x
, int nid
, int *crit
, int *idx
);
514 int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ
*x
, int nid
, void *value
, int crit
,
515 unsigned long flags
);
516 int OCSP_ONEREQ_add_ext(OCSP_ONEREQ
*x
, X509_EXTENSION
*ex
, int loc
);
518 int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP
*x
);
519 int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP
*x
, int nid
, int lastpos
);
520 int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP
*x
, ASN1_OBJECT
*obj
,
522 int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP
*x
, int crit
,
524 X509_EXTENSION
*OCSP_BASICRESP_get_ext(OCSP_BASICRESP
*x
, int loc
);
525 X509_EXTENSION
*OCSP_BASICRESP_delete_ext(OCSP_BASICRESP
*x
, int loc
);
526 void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP
*x
, int nid
, int *crit
,
528 int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP
*x
, int nid
, void *value
,
529 int crit
, unsigned long flags
);
530 int OCSP_BASICRESP_add_ext(OCSP_BASICRESP
*x
, X509_EXTENSION
*ex
, int loc
);
532 int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP
*x
);
533 int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP
*x
, int nid
, int lastpos
);
534 int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP
*x
, ASN1_OBJECT
*obj
,
536 int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP
*x
, int crit
,
538 X509_EXTENSION
*OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP
*x
, int loc
);
539 X509_EXTENSION
*OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP
*x
, int loc
);
540 void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP
*x
, int nid
, int *crit
,
542 int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP
*x
, int nid
, void *value
,
543 int crit
, unsigned long flags
);
544 int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP
*x
, X509_EXTENSION
*ex
, int loc
);
546 DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP
)
547 DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS
)
548 DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO
)
549 DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP
)
550 DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA
)
551 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID
)
552 DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE
)
553 DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES
)
554 DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ
)
555 DECLARE_ASN1_FUNCTIONS(OCSP_CERTID
)
556 DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST
)
557 DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE
)
558 DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO
)
559 DECLARE_ASN1_FUNCTIONS(OCSP_CRLID
)
560 DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC
)
562 const char *OCSP_response_status_str(long s
);
563 const char *OCSP_cert_status_str(long s
);
564 const char *OCSP_crl_reason_str(long s
);
566 int OCSP_REQUEST_print(BIO
*bp
, OCSP_REQUEST
*a
, unsigned long flags
);
567 int OCSP_RESPONSE_print(BIO
*bp
, OCSP_RESPONSE
*o
, unsigned long flags
);
569 int OCSP_basic_verify(OCSP_BASICRESP
*bs
, STACK_OF(X509
) *certs
,
570 X509_STORE
*st
, unsigned long flags
);
572 /* BEGIN ERROR CODES */
574 * The following lines are auto generated by the script mkerr.pl. Any changes
575 * made after this point may be overwritten when the script is next run.
577 void ERR_load_OCSP_strings(void);
579 /* Error codes for the OCSP functions. */
581 /* Function codes. */
582 # define OCSP_F_ASN1_STRING_ENCODE 100
583 # define OCSP_F_D2I_OCSP_NONCE 102
584 # define OCSP_F_OCSP_BASIC_ADD1_STATUS 103
585 # define OCSP_F_OCSP_BASIC_SIGN 104
586 # define OCSP_F_OCSP_BASIC_VERIFY 105
587 # define OCSP_F_OCSP_CERT_ID_NEW 101
588 # define OCSP_F_OCSP_CHECK_DELEGATED 106
589 # define OCSP_F_OCSP_CHECK_IDS 107
590 # define OCSP_F_OCSP_CHECK_ISSUER 108
591 # define OCSP_F_OCSP_CHECK_VALIDITY 115
592 # define OCSP_F_OCSP_MATCH_ISSUERID 109
593 # define OCSP_F_OCSP_PARSE_URL 114
594 # define OCSP_F_OCSP_REQUEST_SIGN 110
595 # define OCSP_F_OCSP_REQUEST_VERIFY 116
596 # define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
597 # define OCSP_F_OCSP_SENDREQ_BIO 112
598 # define OCSP_F_OCSP_SENDREQ_NBIO 117
599 # define OCSP_F_PARSE_HTTP_LINE1 118
600 # define OCSP_F_REQUEST_VERIFY 113
603 # define OCSP_R_BAD_DATA 100
604 # define OCSP_R_CERTIFICATE_VERIFY_ERROR 101
605 # define OCSP_R_DIGEST_ERR 102
606 # define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122
607 # define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123
608 # define OCSP_R_ERROR_PARSING_URL 121
609 # define OCSP_R_MISSING_OCSPSIGNING_USAGE 103
610 # define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124
611 # define OCSP_R_NOT_BASIC_RESPONSE 104
612 # define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105
613 # define OCSP_R_NO_CONTENT 106
614 # define OCSP_R_NO_PUBLIC_KEY 107
615 # define OCSP_R_NO_RESPONSE_DATA 108
616 # define OCSP_R_NO_REVOKED_TIME 109
617 # define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110
618 # define OCSP_R_REQUEST_NOT_SIGNED 128
619 # define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111
620 # define OCSP_R_ROOT_CA_NOT_TRUSTED 112
621 # define OCSP_R_SERVER_READ_ERROR 113
622 # define OCSP_R_SERVER_RESPONSE_ERROR 114
623 # define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115
624 # define OCSP_R_SERVER_WRITE_ERROR 116
625 # define OCSP_R_SIGNATURE_FAILURE 117
626 # define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118
627 # define OCSP_R_STATUS_EXPIRED 125
628 # define OCSP_R_STATUS_NOT_YET_VALID 126
629 # define OCSP_R_STATUS_TOO_OLD 127
630 # define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119
631 # define OCSP_R_UNKNOWN_NID 120
632 # define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129