Skip to content

Commit 9759860

Browse files
committed
[ocsp] Allow OCSP checks to be disabled
Some CAs provide non-functional OCSP servers, and some clients are forced to operate on networks without access to the OCSP servers. Allow the user to explicitly disable the use of OCSP checks by undefining OCSP_CHECK in config/crypto.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
1 parent a0021a3 commit 9759860

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/config/crypto.h

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5858
*/
5959
#define CROSSCERT "http://ca.ipxe.org/auto"
6060

61+
/** Perform OCSP checks when applicable
62+
*
63+
* Some CAs provide non-functional OCSP servers, and some clients are
64+
* forced to operate on networks without access to the OCSP servers.
65+
* Allow the user to explicitly disable the use of OCSP checks.
66+
*/
67+
#define OCSP_CHECK
68+
6169
#include <config/named.h>
6270
#include NAMED_CONFIG(crypto.h)
6371
#include <config/local/crypto.h>

src/include/ipxe/ocsp.h

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
1414
#include <ipxe/asn1.h>
1515
#include <ipxe/x509.h>
1616
#include <ipxe/refcnt.h>
17+
#include <config/crypto.h>
18+
19+
/* Allow OCSP to be disabled completely */
20+
#ifdef OCSP_CHECK
21+
#define OCSP_ENABLED 1
22+
#else
23+
#define OCSP_ENABLED 0
24+
#endif
1725

1826
/** OCSP algorithm identifier */
1927
#define OCSP_ALGORITHM_IDENTIFIER( ... ) \
@@ -119,6 +127,10 @@ ocsp_put ( struct ocsp_check *ocsp ) {
119127
*/
120128
static inline int ocsp_required ( struct x509_certificate *cert ) {
121129

130+
/* An OCSP check is never required if OCSP checks are disabled */
131+
if ( ! OCSP_ENABLED )
132+
return 0;
133+
122134
/* An OCSP check is required if an OCSP URI exists but the
123135
* OCSP status is not (yet) good.
124136
*/

0 commit comments

Comments
 (0)