summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <>2022-08-21 19:32:38 +0000
committerjsing <>2022-08-21 19:32:38 +0000
commit3c351e711595523526ff652c526430c9865244a9 (patch)
treef5484c592e752999edfb43ac5fd4dba1a5e88914 /src/lib/libssl/ssl_lib.c
parent14c1d07ebeba51e7c5d52a7a218214dcd39548d4 (diff)
downloadopenbsd-3c351e711595523526ff652c526430c9865244a9.tar.gz
openbsd-3c351e711595523526ff652c526430c9865244a9.tar.bz2
openbsd-3c351e711595523526ff652c526430c9865244a9.zip
Provide SSL_QUIC_METHOD.
This provides SSL_QUIC_METHOD (aka ssl_quic_method_st), which allows for QUIC callback hooks to be passed to an SSL_CTX or SSL. This is largely ported/adapted from BoringSSL. It is worth noting that this struct is not opaque and the original interface exposed by BoringSSL differs to the one they now use. The original interface was copied by quictls and it appears that this API will not be updated to match BoringSSL. To make things even more challenging, at least one consumer does not use named initialisers, making code completely dependent on the order in which the function pointers are defined as struct members. In order to try to support both variants, the set_read_secret/set_write_secret functions are included, however they have to go at the end. ok tb@
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 515065de6c..f0f0150d19 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.302 2022/08/21 18:17:11 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.303 2022/08/21 19:32:38 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -339,6 +339,7 @@ SSL_new(SSL_CTX *ctx)
339 s->verify_result = X509_V_OK; 339 s->verify_result = X509_V_OK;
340 340
341 s->method = ctx->method; 341 s->method = ctx->method;
342 s->quic_method = ctx->quic_method;
342 343
343 if (!s->method->ssl_new(s)) 344 if (!s->method->ssl_new(s))
344 goto err; 345 goto err;
@@ -2585,6 +2586,28 @@ SSL_get_error(const SSL *s, int i)
2585} 2586}
2586 2587
2587int 2588int
2589SSL_CTX_set_quic_method(SSL_CTX *ctx, const SSL_QUIC_METHOD *quic_method)
2590{
2591 if (ctx->method->dtls)
2592 return 0;
2593
2594 ctx->quic_method = quic_method;
2595
2596 return 1;
2597}
2598
2599int
2600SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method)
2601{
2602 if (ssl->method->dtls)
2603 return 0;
2604
2605 ssl->quic_method = quic_method;
2606
2607 return 1;
2608}
2609
2610int
2588SSL_do_handshake(SSL *s) 2611SSL_do_handshake(SSL *s)
2589{ 2612{
2590 if (s->internal->handshake_func == NULL) { 2613 if (s->internal->handshake_func == NULL) {