From 1f07a6fc3b3b9d44b731e6cf17fd00b540758db8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 30 Jan 2020 16:25:09 +0000 Subject: Factor out/rewrite the ECDHE EC point key exchange code. This reduces replication between the existing TLS client/server and allows the code to soon be reused for TLSv1.3. With feedback from inoguchi@ and tb@ ok inoguchi@ tb@ --- src/lib/libssl/ssl_locl.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib/libssl/ssl_locl.h') diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index 6c33ec9743..5ff6f39b45 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_locl.h,v 1.257 2020/01/29 17:08:49 jsing Exp $ */ +/* $OpenBSD: ssl_locl.h,v 1.258 2020/01/30 16:25:09 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -872,6 +872,7 @@ typedef struct ssl3_state_internal_st { DH *dh; EC_KEY *ecdh; /* holds short lived ECDH key */ + int ecdh_nid; uint8_t *x25519; @@ -1017,6 +1018,7 @@ typedef struct sess_cert_st { /* Obviously we don't have the private keys of these, * so maybe we shouldn't even use the CERT_PKEY type here. */ + int peer_nid; DH *peer_dh_tmp; EC_KEY *peer_ecdh_tmp; uint8_t *peer_x25519_tmp; @@ -1278,6 +1280,12 @@ int ssl3_get_client_certificate(SSL *s); int ssl3_get_client_key_exchange(SSL *s); int ssl3_get_cert_verify(SSL *s); +int ssl_kex_generate_ecdhe_ecp(EC_KEY *ecdh, int nid); +int ssl_kex_public_ecdhe_ecp(EC_KEY *ecdh, CBB *cbb); +int ssl_kex_peer_public_ecdhe_ecp(EC_KEY *ecdh, int nid, CBS *cbs); +int ssl_kex_derive_ecdhe_ecp(EC_KEY *ecdh, EC_KEY *ecdh_peer, + uint8_t **shared_key, size_t *shared_key_len); + int tls1_new(SSL *s); void tls1_free(SSL *s); void tls1_clear(SSL *s); -- cgit v1.2.3-55-g6feb