summaryrefslogtreecommitdiff
path: root/ssl
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:55 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:47:11 +0100
commit19cb0887722b66e5db7ec0d339526608444a11ef (patch)
tree8a7f8eb3a2215a319b009199d6680484a0f62900 /ssl
parent1bca3f1b2d139c2306fd65d23583e4d16bdc11f9 (diff)
downloadopenssl-new-19cb0887722b66e5db7ec0d339526608444a11ef.tar.gz
QUIC DISPATCH/APL: Implement SSL_get_stream_id
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/quic/quic_impl.c14
-rw-r--r--ssl/ssl_lib.c12
2 files changed, 26 insertions, 0 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index 2f97f7c6b5..6a28c00c75 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -1868,6 +1868,20 @@ int ossl_quic_get_stream_type(SSL *s)
}
/*
+ * SSL_get_stream_id
+ * -----------------
+ */
+uint64_t ossl_quic_get_stream_id(SSL *s)
+{
+ QCTX ctx;
+
+ if (!expect_quic_with_stream(s, /*remote_init=*/-1, &ctx))
+ return UINT64_MAX;
+
+ return ctx.xso->stream->id;
+}
+
+/*
* QUIC Front-End I/O API: SSL_CTX Management
* ==========================================
*/
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 5a226312da..a7e3682291 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -7340,6 +7340,18 @@ int SSL_get_stream_type(SSL *s)
#endif
}
+uint64_t SSL_get_stream_id(SSL *s)
+{
+#ifndef OPENSSL_NO_QUIC
+ if (!IS_QUIC(s))
+ return UINT64_MAX;
+
+ return ossl_quic_get_stream_id(s);
+#else
+ return UINT64_MAX;
+#endif
+}
+
int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk)
{
unsigned char *data = NULL;