diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-08-09 17:46:33 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-09-01 10:45:35 +0100 |
commit | b96e5cc60b6c9b4985eab829fd7b1161481da428 (patch) | |
tree | 76ea3e0f2dc45aed2d5b9337d36706c86f64988a | |
parent | 37f12107ee98670bae4b967110370a2bdb171c16 (diff) |
QUIC DDD: ddd-01-conn-blocking: Unplanned changes
- QUIC_client_method() renamed due to namespacing
- QUIC mandates use of ALPN
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21715)
-rw-r--r-- | doc/designs/ddd/ddd-01-conn-blocking.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/designs/ddd/ddd-01-conn-blocking.c b/doc/designs/ddd/ddd-01-conn-blocking.c index 11c3585a18..ab5cbf673d 100644 --- a/doc/designs/ddd/ddd-01-conn-blocking.c +++ b/doc/designs/ddd/ddd-01-conn-blocking.c @@ -21,7 +21,7 @@ SSL_CTX *create_ssl_ctx(void) SSL_CTX *ctx; #ifdef USE_QUIC - ctx = SSL_CTX_new(QUIC_client_method()); + ctx = SSL_CTX_new(OSSL_QUIC_client_method()); #else ctx = SSL_CTX_new(TLS_client_method()); #endif @@ -51,6 +51,9 @@ BIO *new_conn(SSL_CTX *ctx, const char *hostname) BIO *out; SSL *ssl = NULL; const char *bare_hostname; +#ifdef USE_QUIC + static const unsigned char alpn[] = {5, 'd', 'u', 'm', 'm', 'y'}; +#endif out = BIO_new_ssl_connect(ctx); if (out == NULL) @@ -79,6 +82,15 @@ BIO *new_conn(SSL_CTX *ctx, const char *hostname) return NULL; } +#ifdef USE_QUIC + /* Configure ALPN, which is required for QUIC. */ + if (SSL_set_alpn_protos(ssl, alpn, sizeof(alpn))) { + /* Note: SSL_set_alpn_protos returns 1 for failure. */ + BIO_free_all(out); + return NULL; + } +#endif + return out; } |