hkdf: when HMAC key is all zeros, still set a valid key length
[openssl.git] / doc / man3 / OCSP_sendreq_new.pod
1 =pod
2
3 =head1 NAME
4
5 OCSP_REQ_CTX,
6 OCSP_sendreq_new,
7 OCSP_sendreq_nbio,
8 OCSP_sendreq_bio,
9 OCSP_REQ_CTX_i2d,
10 OCSP_REQ_CTX_add1_header,
11 OCSP_REQ_CTX_free,
12 OCSP_set_max_response_length,
13 OCSP_REQ_CTX_set1_req
14 - OCSP responder query functions
15
16 =head1 SYNOPSIS
17
18  #include <openssl/ocsp.h>
19
20  OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
21                                      const OCSP_REQUEST *req, int buf_size);
22  OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
23
24 The following functions have been deprecated since OpenSSL 3.0, and can be
25 hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
26 see L<openssl_user_macros(7)>:
27
28  typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;
29  int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);
30  int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);
31  int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,
32                               const char *name, const char *value);
33  void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
34  void OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len);
35  int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);
36
37 =head1 DESCRIPTION
38
39 These functions perform an OCSP POST request / response transfer over HTTP,
40 using the HTTP request functions described in L<OSSL_HTTP_REQ_CTX(3)>.
41
42 The function OCSP_sendreq_new() builds a complete B<OSSL_HTTP_REQ_CTX> structure
43 with the B<BIO> I<io> to be used for requests and response, the URL path I<path>,
44 optionally the OCSP request I<req>, and a response header maximum line length
45 of I<buf_size>. If I<buf_size> is zero a default value of 4KiB is used.
46 The I<req> may be set to NULL and provided later using OCSP_REQ_CTX_set1_req()
47 or L<OSSL_HTTP_REQ_CTX_set1_req(3)>.
48 The I<io> and I<path> arguments to OCSP_sendreq_new() correspond to the
49 components of the URL.
50 For example if the responder URL is C<http://example.com/ocspreq> the BIO
51 I<io> should haven been connected to host C<example.com> on port 80 and I<path>
52 should be set to C</ocspreq>.
53
54 OCSP_sendreq_nbio() attempts to send the request prepared in I<rctx>
55 and to gather the response via HTTP, using the BIO I<io> and I<path>
56 that were given when calling OCSP_sendreq_new().
57 If the operation gets completed it assigns the response,
58 a pointer to a B<OCSP_RESPONSE> structure, in I<*presp>.
59 The function may need to be called again if its result is -1, which indicates
60 L<BIO_should_retry(3)>.  In such a case it is advisable to sleep a little in
61 between, using L<BIO_wait(3)> on the read BIO to prevent a busy loop.
62
63 OCSP_sendreq_bio() combines OCSP_sendreq_new() with as many calls of
64 OCSP_sendreq_nbio() as needed and then OCSP_REQ_CTX_free(), with a
65 response header maximum line length 4k. It waits indefinitely on a response.
66 It does not support setting a timeout or adding headers and is retained
67 for compatibility; use L<OSSL_HTTP_transfer(3)> instead.
68
69 OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:
70
71   OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request", it, req)
72
73 OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
74
75  OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request",
76                             ASN1_ITEM_rptr(OCSP_REQUEST),
77                             (const ASN1_VALUE *)req)
78
79 The deprecated type and the remaining deprecated functions
80 have been superseded by the following equivalents:
81 B<OCSP_REQ_CTX> by L<OSSL_HTTP_REQ_CTX(3)>,
82 OCSP_REQ_CTX_add1_header() by L<OSSL_HTTP_REQ_CTX_add1_header(3)>,
83 OCSP_REQ_CTX_free() by L<OSSL_HTTP_REQ_CTX_free(3)>, and
84 OCSP_set_max_response_length() by
85 L<OSSL_HTTP_REQ_CTX_set_max_response_length(3)>.
86
87 =head1 RETURN VALUES
88
89 OCSP_sendreq_new() returns a valid B<OSSL_HTTP_REQ_CTX> structure or NULL
90 if an error occurred.
91
92 OCSP_sendreq_nbio() returns 1 for success, 0 on error, -1 if retry is needed.
93
94 OCSP_sendreq_bio() returns the B<OCSP_RESPONSE> structure sent by the
95 responder or NULL if an error occurred.
96
97 =head1 SEE ALSO
98
99 L<OSSL_HTTP_REQ_CTX(3)>, L<OSSL_HTTP_transfer(3)>,
100 L<OCSP_cert_to_id(3)>,
101 L<OCSP_request_add1_nonce(3)>,
102 L<OCSP_REQUEST_new(3)>,
103 L<OCSP_resp_find_status(3)>,
104 L<OCSP_response_status(3)>
105
106 =head1 HISTORY
107
108 B<OCSP_REQ_CTX>,
109 OCSP_REQ_CTX_i2d(),
110 OCSP_REQ_CTX_add1_header(),
111 OCSP_REQ_CTX_free(),
112 OCSP_set_max_response_length(),
113 and OCSP_REQ_CTX_set1_req()
114 were deprecated in OpenSSL 3.0.
115
116 =head1 COPYRIGHT
117
118 Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
119
120 Licensed under the Apache License 2.0 (the "License").  You may not use
121 this file except in compliance with the License.  You can obtain a copy
122 in the file LICENSE in the source distribution or at
123 L<https://www.openssl.org/source/license.html>.
124
125 =cut