summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorraja-ashok <rashok.svks@gmail.com>2019-07-08 14:50:59 +0530
committerMatt Caswell <matt@openssl.org>2019-08-06 12:04:52 +0100
commit84d4b9e31d5fd63408a0a43e02ec0780673362cf (patch)
tree677c3cf0f8287710d9b4ceac34a483cc1ef9cd4d /ssl
parentbbda79976b5c5095c5e6557311c86c623ba335f1 (diff)
API to get negotiated key exchange algorithm in TLS1.3
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9323)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_lib.c10
-rw-r--r--ssl/ssl_locl.h1
-rw-r--r--ssl/t1_lib.c7
3 files changed, 13 insertions, 5 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 8a22d01325..d23f932ce9 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3617,13 +3617,13 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
{
uint16_t id = tls1_shared_group(s, larg);
- if (larg != -1) {
- const TLS_GROUP_INFO *ginf = tls1_group_id_lookup(id);
-
- return ginf == NULL ? 0 : ginf->nid;
- }
+ if (larg != -1)
+ return tls1_group_id2nid(id);
return id;
}
+ case SSL_CTRL_GET_NEGOTIATED_GROUP:
+ ret = tls1_group_id2nid(s->s3.group_id);
+ break;
#endif /* !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH) */
case SSL_CTRL_SET_SIGALGS:
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index 49c45109a8..b66979b4da 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -2530,6 +2530,7 @@ __owur int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s);
SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n);
__owur const TLS_GROUP_INFO *tls1_group_id_lookup(uint16_t curve_id);
+__owur int tls1_group_id2nid(uint16_t group_id);
__owur int tls1_check_group_id(SSL *s, uint16_t group_id, int check_own_curves);
__owur uint16_t tls1_shared_group(SSL *s, int nmatch);
__owur int tls1_set_groups(uint16_t **pext, size_t *pextlen,
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 93b14b80a2..24702704db 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -226,6 +226,13 @@ const TLS_GROUP_INFO *tls1_group_id_lookup(uint16_t group_id)
}
#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_EC)
+int tls1_group_id2nid(uint16_t group_id)
+{
+ const TLS_GROUP_INFO *ginf = tls1_group_id_lookup(group_id);
+
+ return ginf == NULL ? NID_undef : ginf->nid;
+}
+
static uint16_t tls1_nid2group_id(int nid)
{
size_t i;