summaryrefslogtreecommitdiffstats
path: root/ssl/s3_lib.c
diff options
context:
space:
mode:
authorAlex Bozarth <ajbozart@us.ibm.com>2023-05-19 14:08:41 -0500
committerTomas Mraz <tomas@openssl.org>2023-06-06 17:03:41 +0200
commit68668243b176cd2bc53a83c6768d4f39930ba8ed (patch)
tree61cddf3545b28d1f276a92eb8e8736fcc5cb932b /ssl/s3_lib.c
parent8229874476cc2955e6947cf6d3fee09e13b8c160 (diff)
Add SSL_get0_group_name() to get name of the group used for KEX
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20866)
Diffstat (limited to 'ssl/s3_lib.c')
-rw-r--r--ssl/s3_lib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 835af33fea..10cff08eae 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -5022,6 +5022,22 @@ int ssl_encapsulate(SSL_CONNECTION *s, EVP_PKEY *pubkey,
return rv;
}
+const char *SSL_get0_group_name(SSL *s)
+{
+ SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
+ unsigned int id;
+
+ if (sc == NULL)
+ return NULL;
+
+ if (SSL_CONNECTION_IS_TLS13(sc) && sc->s3.did_kex)
+ id = sc->s3.group_id;
+ else
+ id = sc->session->kex_group;
+
+ return tls1_group_id2name(s->ctx, id);
+}
+
const char *SSL_group_to_name(SSL *s, int nid) {
int group_id = 0;
const TLS_GROUP_INFO *cinf = NULL;