openssl/0141-print-pq-group.patch
2025-02-12 14:59:33 +01:00

33 lines
1.1 KiB
Diff

diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c
index 3b3c0dd0b38f5..026315406e298 100644
--- a/apps/lib/s_cb.c
+++ b/apps/lib/s_cb.c
@@ -418,8 +418,13 @@ int ssl_print_tmp_key(BIO *out, SSL *s)
{
EVP_PKEY *key;
- if (!SSL_get_peer_tmp_key(s, &key))
+ if (!SSL_get_peer_tmp_key(s, &key)) {
+ if (SSL_version(s) == TLS1_3_VERSION)
+ BIO_printf(out, "Negotiated TLS1.3 group: %s\n",
+ SSL_group_to_name(s, SSL_get_negotiated_group(s)));
return 1;
+ }
+
BIO_puts(out, "Server Temp Key: ");
switch (EVP_PKEY_get_id(key)) {
case EVP_PKEY_RSA:
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index b98464256e..eb3d7e24f6 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3734,7 +3734,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
if (SSL_CONNECTION_IS_TLS13(sc) && sc->s3.did_kex)
id = sc->s3.group_id;
else
- id = sc->session->kex_group;
+ id = (sc->session != NULL) ? sc->session->kex_group : NID_undef;
ret = tls1_group_id2nid(id, 1);
break;
}