4874561f8fb353d52e2983c196d82ff7ec431b63
[openssl.git] / crypto / ocsp / ocsp.h
1 /* ocsp.h */
2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
3  * project. */
4
5 /* History:
6    This file was transfered to Richard Levitte from CertCo by Kathy
7    Weinhold in mid-spring 2000 to be included in OpenSSL or released
8    as a patch kit. */
9
10 /* ====================================================================
11  * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  *
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer. 
19  *
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in
22  *    the documentation and/or other materials provided with the
23  *    distribution.
24  *
25  * 3. All advertising materials mentioning features or use of this
26  *    software must display the following acknowledgment:
27  *    "This product includes software developed by the OpenSSL Project
28  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
29  *
30  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
31  *    endorse or promote products derived from this software without
32  *    prior written permission. For written permission, please contact
33  *    openssl-core@openssl.org.
34  *
35  * 5. Products derived from this software may not be called "OpenSSL"
36  *    nor may "OpenSSL" appear in their names without prior written
37  *    permission of the OpenSSL Project.
38  *
39  * 6. Redistributions of any form whatsoever must retain the following
40  *    acknowledgment:
41  *    "This product includes software developed by the OpenSSL Project
42  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
43  *
44  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
45  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
48  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55  * OF THE POSSIBILITY OF SUCH DAMAGE.
56  * ====================================================================
57  *
58  * This product includes cryptographic software written by Eric Young
59  * (eay@cryptsoft.com).  This product includes software written by Tim
60  * Hudson (tjh@cryptsoft.com).
61  *
62  */
63
64 #ifndef HEADER_OCSP_H
65 #define HEADER_OCSP_H
66
67 #include <openssl/x509.h>
68 #include <openssl/x509v3.h>
69 #include <openssl/safestack.h>
70
71 #ifdef  __cplusplus
72 extern "C" {
73 #endif
74
75 /* Various flags and values */
76
77 #define OCSP_DEFAULT_NONCE_LENGTH       16
78
79 #define OCSP_NOCERTS                    0x1
80
81 /*   CertID ::= SEQUENCE {
82  *       hashAlgorithm            AlgorithmIdentifier,
83  *       issuerNameHash     OCTET STRING, -- Hash of Issuer's DN
84  *       issuerKeyHash      OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
85  *       serialNumber       CertificateSerialNumber }
86  */
87 typedef struct ocsp_cert_id_st
88         {
89         X509_ALGOR *hashAlgorithm;
90         ASN1_OCTET_STRING *issuerNameHash;
91         ASN1_OCTET_STRING *issuerKeyHash;
92         ASN1_INTEGER *serialNumber;
93         } OCSP_CERTID;
94
95 /*   Request ::=     SEQUENCE {
96  *       reqCert                    CertID,
97  *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }
98  */
99 typedef struct ocsp_one_request_st
100         {
101         OCSP_CERTID *reqCert;
102         STACK_OF(X509_EXTENSION) *singleRequestExtensions;
103         } OCSP_ONEREQ;
104
105 DECLARE_STACK_OF(OCSP_ONEREQ)
106 DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
107
108
109 /*   TBSRequest      ::=     SEQUENCE {
110  *       version             [0] EXPLICIT Version DEFAULT v1,
111  *       requestorName       [1] EXPLICIT GeneralName OPTIONAL,
112  *       requestList             SEQUENCE OF Request,
113  *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }
114  */
115 typedef struct ocsp_req_info_st
116         {
117         ASN1_INTEGER *version;
118         GENERAL_NAME *requestorName;
119         STACK_OF(OCSP_ONEREQ) *requestList;
120         STACK_OF(X509_EXTENSION) *requestExtensions;
121         } OCSP_REQINFO;
122
123 /*   Signature       ::=     SEQUENCE {
124  *       signatureAlgorithm   AlgorithmIdentifier,
125  *       signature            BIT STRING,
126  *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
127  */
128 typedef struct ocsp_signature_st
129         {
130         X509_ALGOR *signatureAlgorithm;
131         ASN1_BIT_STRING *signature;
132         STACK_OF(X509) *certs;
133         } OCSP_SIGNATURE;
134
135 /*   OCSPRequest     ::=     SEQUENCE {
136  *       tbsRequest                  TBSRequest,
137  *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
138  */
139 typedef struct ocsp_request_st
140         {
141         OCSP_REQINFO *tbsRequest;
142         OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
143         } OCSP_REQUEST;
144
145 /*   OCSPResponseStatus ::= ENUMERATED {
146  *       successful            (0),      --Response has valid confirmations
147  *       malformedRequest      (1),      --Illegal confirmation request
148  *       internalError         (2),      --Internal error in issuer
149  *       tryLater              (3),      --Try again later
150  *                                       --(4) is not used
151  *       sigRequired           (5),      --Must sign the request
152  *       unauthorized          (6)       --Request unauthorized
153  *   }
154  */
155 #define OCSP_RESPONSE_STATUS_SUCCESSFUL          0
156 #define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST     1
157 #define OCSP_RESPONSE_STATUS_INTERNALERROR        2
158 #define OCSP_RESPONSE_STATUS_TRYLATER             3
159 #define OCSP_RESPONSE_STATUS_SIGREQUIRED          5
160 #define OCSP_RESPONSE_STATUS_UNAUTHORIZED         6
161
162 /*   ResponseBytes ::=       SEQUENCE {
163  *       responseType   OBJECT IDENTIFIER,
164  *       response       OCTET STRING }
165  */
166 typedef struct ocsp_resp_bytes_st
167         {
168         ASN1_OBJECT *responseType;
169         ASN1_OCTET_STRING *response;
170         } OCSP_RESPBYTES;
171
172 /*   OCSPResponse ::= SEQUENCE {
173  *      responseStatus         OCSPResponseStatus,
174  *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
175  */
176 typedef struct ocsp_response_st
177         {
178         ASN1_ENUMERATED *responseStatus;
179         OCSP_RESPBYTES  *responseBytes;
180         } OCSP_RESPONSE;
181
182 /*   ResponderID ::= CHOICE {
183  *      byName   [1] Name,
184  *      byKey    [2] KeyHash }
185  */
186 #define V_OCSP_RESPID_NAME 0
187 #define V_OCSP_RESPID_KEY  1
188 typedef struct ocsp_responder_id_st
189         {
190         int type;
191         union   {
192                 X509_NAME* byName;
193                 ASN1_OCTET_STRING *byKey;
194                 } value;
195         } OCSP_RESPID;
196 /*   KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
197  *                            --(excluding the tag and length fields)
198  */
199
200 /*   RevokedInfo ::= SEQUENCE {
201  *       revocationTime              GeneralizedTime,
202  *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
203  */
204 typedef struct ocsp_revoked_info_st
205         {
206         ASN1_GENERALIZEDTIME *revocationTime;
207         ASN1_ENUMERATED *revocationReason;
208         } OCSP_REVOKEDINFO;
209
210 /*   CertStatus ::= CHOICE {
211  *       good                [0]     IMPLICIT NULL,
212  *       revoked             [1]     IMPLICIT RevokedInfo,
213  *       unknown             [2]     IMPLICIT UnknownInfo }
214  */
215 #define V_OCSP_CERTSTATUS_GOOD    0
216 #define V_OCSP_CERTSTATUS_REVOKED 1
217 #define V_OCSP_CERTSTATUS_UNKNOWN 2
218 typedef struct ocsp_cert_status_st
219         {
220         int type;
221         union   {
222                 ASN1_NULL *good;
223                 OCSP_REVOKEDINFO *revoked;
224                 ASN1_NULL *unknown;
225                 } value;
226         } OCSP_CERTSTATUS;
227
228 /*   SingleResponse ::= SEQUENCE {
229  *      certID                       CertID,
230  *      certStatus                   CertStatus,
231  *      thisUpdate                   GeneralizedTime,
232  *      nextUpdate           [0]     EXPLICIT GeneralizedTime OPTIONAL,
233  *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }
234  */
235 typedef struct ocsp_single_response_st
236         {
237         OCSP_CERTID *certId;
238         OCSP_CERTSTATUS *certStatus;
239         ASN1_GENERALIZEDTIME *thisUpdate;
240         ASN1_GENERALIZEDTIME *nextUpdate;
241         STACK_OF(X509_EXTENSION) *singleExtensions;
242         } OCSP_SINGLERESP;
243
244 DECLARE_STACK_OF(OCSP_SINGLERESP)
245 DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
246
247 /*   ResponseData ::= SEQUENCE {
248  *      version              [0] EXPLICIT Version DEFAULT v1,
249  *      responderID              ResponderID,
250  *      producedAt               GeneralizedTime,
251  *      responses                SEQUENCE OF SingleResponse,
252  *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
253  */
254 typedef struct ocsp_response_data_st
255         {
256         ASN1_INTEGER *version;
257         OCSP_RESPID  *responderId;
258         ASN1_GENERALIZEDTIME *producedAt;
259         STACK_OF(OCSP_SINGLERESP) *responses;
260         STACK_OF(X509_EXTENSION) *responseExtensions;
261         } OCSP_RESPDATA;
262
263 /*   BasicOCSPResponse       ::= SEQUENCE {
264  *      tbsResponseData      ResponseData,
265  *      signatureAlgorithm   AlgorithmIdentifier,
266  *      signature            BIT STRING,
267  *      certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
268  */
269   /* Note 1:
270      The value for "signature" is specified in the OCSP rfc2560 as follows:
271      "The value for the signature SHALL be computed on the hash of the DER
272      encoding ResponseData."  This means that you must hash the DER-encoded
273      tbsResponseData, and then run it through a crypto-signing function, which
274      will (at least w/RSA) do a hash-'n'-private-encrypt operation.  This seems
275      a bit odd, but that's the spec.  Also note that the data structures do not
276      leave anywhere to independently specify the algorithm used for the initial
277      hash. So, we look at the signature-specification algorithm, and try to do
278      something intelligent.     -- Kathy Weinhold, CertCo */
279   /* Note 2:
280      It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
281      for interpretation.  I've done tests against another responder, and found
282      that it doesn't do the double hashing that the RFC seems to say one
283      should.  Therefore, all relevant functions take a flag saying which
284      variant should be used.    -- Richard Levitte, OpenSSL team and CeloCom */
285 typedef struct ocsp_basic_response_st
286         {
287         OCSP_RESPDATA *tbsResponseData;
288         X509_ALGOR *signatureAlgorithm;
289         ASN1_BIT_STRING *signature;
290         STACK_OF(X509) *certs;
291         } OCSP_BASICRESP;
292
293 /*
294  *   CRLReason ::= ENUMERATED {
295  *        unspecified             (0),
296  *        keyCompromise           (1),
297  *        cACompromise            (2),
298  *        affiliationChanged      (3),
299  *        superseded              (4),
300  *        cessationOfOperation    (5),
301  *        certificateHold         (6),
302  *        removeFromCRL           (8) }
303  */
304 #define OCSP_REVOKED_STATUS_NOSTATUS               -1
305 #define OCSP_REVOKED_STATUS_UNSPECIFIED             0
306 #define OCSP_REVOKED_STATUS_KEYCOMPROMISE           1
307 #define OCSP_REVOKED_STATUS_CACOMPROMISE            2
308 #define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED      3
309 #define OCSP_REVOKED_STATUS_SUPERSEDED              4
310 #define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION    5
311 #define OCSP_REVOKED_STATUS_CERTIFICATEHOLD         6
312 #define OCSP_REVOKED_STATUS_REMOVEFROMCRL           8
313
314 /* CrlID ::= SEQUENCE {
315  *     crlUrl               [0]     EXPLICIT IA5String OPTIONAL,
316  *     crlNum               [1]     EXPLICIT INTEGER OPTIONAL,
317  *     crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }
318  */
319 typedef struct ocsp_crl_id_st
320         {
321         ASN1_IA5STRING *crlUrl;
322         ASN1_INTEGER *crlNum;
323         ASN1_GENERALIZEDTIME *crlTime;
324         } OCSP_CRLID;
325
326 /* ServiceLocator ::= SEQUENCE {
327  *      issuer    Name,
328  *      locator   AuthorityInfoAccessSyntax OPTIONAL }
329  */
330 typedef struct ocsp_service_locator_st
331         {
332         X509_NAME* issuer;
333         STACK_OF(ACCESS_DESCRIPTION) *locator;
334         } OCSP_SERVICELOC;
335  
336 #define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
337 #define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
338
339 #define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
340                 OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
341                 (unsigned char **)(p))
342
343 #define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
344                 OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
345                 (unsigned char **)(p))
346
347 #define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
348      (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
349
350 #define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
351      (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
352
353 #define PEM_write_bio_OCSP_REQUEST(bp,o) \
354     PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
355                         bp,(char *)o, NULL,NULL,0,NULL,NULL)
356
357 #define PEM_write_bio_OCSP_RESPONSE(bp,o) \
358     PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
359                         bp,(char *)o, NULL,NULL,0,NULL,NULL)
360
361 #define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
362                 (unsigned char *)o)
363
364 #define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
365                 (unsigned char *)o)
366
367 #define OCSP_REQUEST_sign(o,pkey,md) \
368         ASN1_item_sign(&OCSP_REQINFO_it,\
369                 o->optionalSignature->signatureAlgorithm,NULL,\
370                 o->optionalSignature->signature,o->tbsRequest,pkey,md)
371
372 #define OCSP_BASICRESP_sign(o,pkey,md,d) \
373         ASN1_item_sign(&OCSP_RESPDATA_it,o->signatureAlgorithm,NULL,\
374                 o->signature,o->tbsResponseData,pkey,md)
375
376 #define OCSP_REQUEST_verify(a,r) ASN1_item_verify(&OCSP_REQINFO_it,\
377         a->optionalSignature->signatureAlgorithm,\
378         a->optionalSignature->signature,a->tbsRequest,r)
379
380 #define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(&OCSP_RESPDATA_it,\
381         a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
382
383 #define ASN1_BIT_STRING_digest(data,type,md,len) \
384         ASN1_item_digest(&ASN1_BIT_STRING_it,type,data,md,len)
385
386 #define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
387                 (char *(*)())d2i_OCSP_CERTID,(char *)(cid))
388
389 #define OCSP_CERTSTATUS_dup(cs)\
390                 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
391                 (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
392
393 OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
394
395 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
396
397 OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, 
398                               X509_NAME *issuerName, 
399                               ASN1_BIT_STRING* issuerKey, 
400                               ASN1_INTEGER *serialNumber);
401
402 OCSP_CERTSTATUS *OCSP_cert_status_new(int status, int reason, char *tim);
403
404 OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
405 int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
406 int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);
407 int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
408 int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
409
410 int OCSP_request_sign(OCSP_REQUEST   *req,
411                       X509           *signer,
412                       EVP_PKEY       *key,
413                       const EVP_MD   *dgst,
414                       STACK_OF(X509) *certs,
415                       unsigned long flags);
416
417 int OCSP_response_status(OCSP_RESPONSE *resp);
418 OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
419
420 int OCSP_resp_count(OCSP_BASICRESP *bs);
421 OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
422 int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
423 int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
424                                 ASN1_GENERALIZEDTIME **revtime,
425                                 ASN1_GENERALIZEDTIME **thisupd,
426                                 ASN1_GENERALIZEDTIME **nextupd);
427 int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
428                                 int *reason,
429                                 ASN1_GENERALIZEDTIME **revtime,
430                                 ASN1_GENERALIZEDTIME **thisupd,
431                                 ASN1_GENERALIZEDTIME **nextupd);
432
433 int OCSP_request_verify(OCSP_REQUEST *req, EVP_PKEY *pkey);
434
435 int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
436
437 OCSP_BASICRESP *OCSP_basic_response_new(int tag,
438                                         X509* cert);
439
440 int OCSP_basic_response_add(OCSP_BASICRESP           *rsp,
441                             OCSP_CERTID              *cid,
442                             OCSP_CERTSTATUS          *cst,
443                             char                     *thisUpdate,
444                             char                     *nextUpdate);
445
446 int OCSP_basic_response_sign(OCSP_BASICRESP *brsp, 
447                              EVP_PKEY       *key,
448                              const EVP_MD   *dgst,
449                              STACK_OF(X509) *certs);
450
451 int OCSP_response_verify(OCSP_RESPONSE *rsp, EVP_PKEY *pkey);
452
453 int OCSP_basic_response_verify(OCSP_BASICRESP *rsp, EVP_PKEY *pkey);
454
455
456 OCSP_RESPONSE *OCSP_response_new(int status,
457                                  int nid,
458                                  int (*i2d)(),
459                                  char *data);
460
461 ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(), 
462                                 char *data, STACK_OF(ASN1_OBJECT) *sk);
463
464 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
465
466 X509_EXTENSION *OCSP_accept_responses_new(char **oids);
467
468 X509_EXTENSION *OCSP_archive_cutoff_new(char* tim);
469
470 X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);
471
472 int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
473 int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
474 int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos);
475 int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);
476 X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
477 X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
478 void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);
479 int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
480                                                         unsigned long flags);
481 int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
482
483 int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
484 int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
485 int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);
486 int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
487 X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
488 X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
489 void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
490 int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
491                                                         unsigned long flags);
492 int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
493
494 int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
495 int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
496 int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos);
497 int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos);
498 X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
499 X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
500 void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);
501 int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,
502                                                         unsigned long flags);
503 int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
504
505 int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
506 int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);
507 int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos);
508 int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos);
509 X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
510 X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
511 void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);
512 int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,
513                                                         unsigned long flags);
514 int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
515
516 DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
517 DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
518 DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
519 DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)
520 DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)
521 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
522 DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)
523 DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)
524 DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)
525 DECLARE_ASN1_FUNCTIONS(OCSP_CERTID)
526 DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)
527 DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)
528 DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
529 DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
530 DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
531
532 int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
533
534
535 void ERR_load_OCSP_strings(void);
536
537 /* BEGIN ERROR CODES */
538 /* The following lines are auto generated by the script mkerr.pl. Any changes
539  * made after this point may be overwritten when the script is next run.
540  */
541
542 /* Error codes for the OCSP functions. */
543
544 /* Function codes. */
545 #define OCSP_F_ASN1_STRING_ENCODE                        106
546 #define OCSP_F_BASIC_RESPONSE_NEW                        100
547 #define OCSP_F_BASIC_RESPONSE_VERIFY                     101
548 #define OCSP_F_CERT_ID_NEW                               102
549 #define OCSP_F_CERT_STATUS_NEW                           103
550 #define OCSP_F_D2I_OCSP_NONCE                            109
551 #define OCSP_F_OCSP_CHECK_NONCE                          112
552 #define OCSP_F_OCSP_RESPONSE_GET1_BASIC                  111
553 #define OCSP_F_OCSP_SENDREQ_BIO                          110
554 #define OCSP_F_REQUEST_VERIFY                            104
555 #define OCSP_F_RESPONSE_VERIFY                           105
556 #define OCSP_F_S2I_OCSP_NONCE                            107
557 #define OCSP_F_V2I_OCSP_CRLID                            108
558
559 /* Reason codes. */
560 #define OCSP_R_BAD_DATA                                  108
561 #define OCSP_R_BAD_TAG                                   100
562 #define OCSP_R_DIGEST_ERR                                101
563 #define OCSP_R_FAILED_TO_OPEN                            109
564 #define OCSP_R_FAILED_TO_READ                            110
565 #define OCSP_R_FAILED_TO_STAT                            111
566 #define OCSP_R_MISSING_VALUE                             112
567 #define OCSP_R_NONCE_MISSING_IN_RESPONSE                 121
568 #define OCSP_R_NONCE_VALUE_MISMATCH                      122
569 #define OCSP_R_NOT_BASIC_RESPONSE                        120
570 #define OCSP_R_NO_CERTIFICATE                            102
571 #define OCSP_R_NO_CONTENT                                115
572 #define OCSP_R_NO_PUBLIC_KEY                             103
573 #define OCSP_R_NO_RESPONSE_DATA                          104
574 #define OCSP_R_NO_SIGNATURE                              105
575 #define OCSP_R_REVOKED_NO_TIME                           106
576 #define OCSP_R_SERVER_READ_ERROR                         116
577 #define OCSP_R_SERVER_RESPONSE_ERROR                     117
578 #define OCSP_R_SERVER_RESPONSE_PARSE_ERROR               118
579 #define OCSP_R_SERVER_WRITE_ERROR                        119
580 #define OCSP_R_UNEXPECTED_NONCE_IN_RESPONSE              123
581 #define OCSP_R_UNKNOWN_NID                               107
582 #define OCSP_R_UNSUPPORTED_OPTION                        113
583 #define OCSP_R_VALUE_ALREADY                             114
584
585 #ifdef  __cplusplus
586 }
587 #endif
588 #endif
589