Skip to content

Commit ffbf2da

Browse files
add support for X509_CRL_http_nbio (aws#1596)
### Issues: Resolves `CryptoAlg-1648` ### Description of changes: `X509_CRL_http_nbio` is the last API needed to support the AzureSDK after implementation of aws@7ef93cb. It's a simple wrapper around an existing API, so might as well add support so we can resolve the ticket. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 7572352 commit ffbf2da

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

crypto/ocsp/internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)
258258
// Try exchanging request and response via HTTP on (non-)blocking BIO in rctx.
259259
OPENSSL_EXPORT int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx);
260260

261-
// Tries to exchange the request and response with OCSP_REQ_CTX_nbio(), but on
261+
// Tries to exchange the request and response with |OCSP_REQ_CTX_nbio|, but on
262262
// success, it additionally parses the response, which must be a
263263
// DER-encoded ASN.1 structure.
264264
int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval,

crypto/x509/x_all.c

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include <openssl/stack.h>
6868

6969
#include "../asn1/internal.h"
70+
#include "../ocsp/internal.h"
7071
#include "internal.h"
7172

7273

@@ -120,6 +121,11 @@ int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) {
120121
x->sig_alg, x->signature, x->crl, ctx);
121122
}
122123

124+
int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl) {
125+
return OCSP_REQ_CTX_nbio_d2i(rctx, (ASN1_VALUE **)pcrl,
126+
ASN1_ITEM_rptr(X509_CRL));
127+
}
128+
123129
int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md) {
124130
return (ASN1_item_sign(ASN1_ITEM_rptr(NETSCAPE_SPKAC), x->sig_algor, NULL,
125131
x->signature, x->spkac, pkey, md));

include/openssl/base.h

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ typedef struct evp_pkey_st EVP_PKEY;
347347
typedef struct hmac_ctx_st HMAC_CTX;
348348
typedef struct md4_state_st MD4_CTX;
349349
typedef struct md5_state_st MD5_CTX;
350+
typedef struct ocsp_req_ctx_st OCSP_REQ_CTX;
350351
typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS;
351352
typedef struct pkcs12_st PKCS12;
352353
typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;

include/openssl/ocsp.h

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ extern "C" {
5050
typedef struct ocsp_cert_id_st OCSP_CERTID;
5151
typedef struct ocsp_one_request_st OCSP_ONEREQ;
5252
typedef struct ocsp_req_info_st OCSP_REQINFO;
53-
typedef struct ocsp_req_ctx_st OCSP_REQ_CTX;
5453
typedef struct ocsp_signature_st OCSP_SIGNATURE;
5554
typedef struct ocsp_request_st OCSP_REQUEST;
5655
typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES;

include/openssl/x509.h

+5
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,11 @@ OPENSSL_EXPORT int X509_CRL_set1_signature_value(X509_CRL *crl,
966966
const uint8_t *sig,
967967
size_t sig_len);
968968

969+
// X509_CRL_http_nbio calls |OCSP_REQ_CTX_nbio_d2i| to exchange the request
970+
// via http. On success, it parses the response as a DER-encoded |X509_CRL|
971+
// ASN.1 structure.
972+
OPENSSL_EXPORT int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl);
973+
969974

970975
// CRL entries.
971976
//

0 commit comments

Comments
 (0)