summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
authorjsing <>2021-03-21 18:36:34 +0000
committerjsing <>2021-03-21 18:36:34 +0000
commitb4267956efe26acca04e81248b224852ab3b48df (patch)
tree04368005066ac217cbc5ba4c6633356e81eb6d00 /src/lib/libssl/ssl_locl.h
parent25064bbd608cffa42b7bf46d3ea7eeb88d693de4 (diff)
downloadopenbsd-b4267956efe26acca04e81248b224852ab3b48df.tar.gz
openbsd-b4267956efe26acca04e81248b224852ab3b48df.tar.bz2
openbsd-b4267956efe26acca04e81248b224852ab3b48df.zip
Move the TLSv1.3 handshake struct inside the shared handshake struct.
There are currently three different handshake structs that are in use - the SSL_HANDSHAKE struct (as S3I(s)->hs), the SSL_HANDSHAKE_TLS13 struct (as S3I(s)->hs_tls13 or ctx->hs in the TLSv1.3 code) and the infamous 'tmp' embedded in SSL3_STATE_INTERNAL (as S3I(s)->tmp)). This is the first step towards cleaning up the handshake structs so that shared data is in the SSL_HANDSHAKE struct, with sub-structs for TLSv1.2 and TLSv1.3 specific information. Place SSL_HANDSHAKE_TLS13 inside SSL_HANDSHAKE and change ctx->hs to refer to the SSL_HANDSHAKE struct instead of the SSL_HANDSHAKE_TLS13 struct. This allows the TLSv1.3 code to access the shared handshake data without needing the SSL struct. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r--src/lib/libssl/ssl_locl.h81
1 files changed, 41 insertions, 40 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 99b72cc65e..33eb3bba7d 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.327 2021/03/17 17:42:53 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.328 2021/03/21 18:36:34 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -410,6 +410,44 @@ typedef struct ssl_session_internal_st {
410} SSL_SESSION_INTERNAL; 410} SSL_SESSION_INTERNAL;
411#define SSI(s) (s->session->internal) 411#define SSI(s) (s->session->internal)
412 412
413typedef struct cert_pkey_st {
414 X509 *x509;
415 EVP_PKEY *privatekey;
416 STACK_OF(X509) *chain;
417} CERT_PKEY;
418
419typedef struct ssl_handshake_tls13_st {
420 int use_legacy;
421 int hrr;
422
423 /* Certificate and sigalg selected for use (static pointers). */
424 const CERT_PKEY *cpk;
425 const struct ssl_sigalg *sigalg;
426
427 /* Version proposed by peer server. */
428 uint16_t server_version;
429
430 uint16_t server_group;
431 struct tls13_key_share *key_share;
432 struct tls13_secrets *secrets;
433
434 uint8_t *cookie;
435 size_t cookie_len;
436
437 /* Preserved transcript hash. */
438 uint8_t transcript_hash[EVP_MAX_MD_SIZE];
439 size_t transcript_hash_len;
440
441 /* Legacy session ID. */
442 uint8_t legacy_session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
443 size_t legacy_session_id_len;
444
445 /* ClientHello hash, used to validate following HelloRetryRequest */
446 EVP_MD_CTX *clienthello_md_ctx;
447 unsigned char *clienthello_hash;
448 unsigned int clienthello_hash_len;
449} SSL_HANDSHAKE_TLS13;
450
413typedef struct ssl_handshake_st { 451typedef struct ssl_handshake_st {
414 /* 452 /*
415 * Minimum and maximum versions supported for this handshake. These are 453 * Minimum and maximum versions supported for this handshake. These are
@@ -428,6 +466,8 @@ typedef struct ssl_handshake_st {
428 */ 466 */
429 uint16_t negotiated_tls_version; 467 uint16_t negotiated_tls_version;
430 468
469 SSL_HANDSHAKE_TLS13 tls13;
470
431 /* state contains one of the SSL3_ST_* values. */ 471 /* state contains one of the SSL3_ST_* values. */
432 int state; 472 int state;
433 473
@@ -449,44 +489,6 @@ typedef struct ssl_handshake_st {
449 uint8_t *sigalgs; 489 uint8_t *sigalgs;
450} SSL_HANDSHAKE; 490} SSL_HANDSHAKE;
451 491
452typedef struct cert_pkey_st {
453 X509 *x509;
454 EVP_PKEY *privatekey;
455 STACK_OF(X509) *chain;
456} CERT_PKEY;
457
458typedef struct ssl_handshake_tls13_st {
459 int use_legacy;
460 int hrr;
461
462 /* Certificate and sigalg selected for use (static pointers). */
463 const CERT_PKEY *cpk;
464 const struct ssl_sigalg *sigalg;
465
466 /* Version proposed by peer server. */
467 uint16_t server_version;
468
469 uint16_t server_group;
470 struct tls13_key_share *key_share;
471 struct tls13_secrets *secrets;
472
473 uint8_t *cookie;
474 size_t cookie_len;
475
476 /* Preserved transcript hash. */
477 uint8_t transcript_hash[EVP_MAX_MD_SIZE];
478 size_t transcript_hash_len;
479
480 /* Legacy session ID. */
481 uint8_t legacy_session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];
482 size_t legacy_session_id_len;
483
484 /* ClientHello hash, used to validate following HelloRetryRequest */
485 EVP_MD_CTX *clienthello_md_ctx;
486 unsigned char *clienthello_hash;
487 unsigned int clienthello_hash_len;
488} SSL_HANDSHAKE_TLS13;
489
490struct tls12_record_layer; 492struct tls12_record_layer;
491 493
492struct tls12_record_layer *tls12_record_layer_new(void); 494struct tls12_record_layer *tls12_record_layer_new(void);
@@ -907,7 +909,6 @@ typedef struct ssl3_state_internal_st {
907 int in_read_app_data; 909 int in_read_app_data;
908 910
909 SSL_HANDSHAKE hs; 911 SSL_HANDSHAKE hs;
910 SSL_HANDSHAKE_TLS13 hs_tls13;
911 912
912 struct { 913 struct {
913 unsigned char cert_verify_md[EVP_MAX_MD_SIZE]; 914 unsigned char cert_verify_md[EVP_MAX_MD_SIZE];