summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_locl.h
diff options
context:
space:
mode:
authorjsing <>2020-08-30 15:40:20 +0000
committerjsing <>2020-08-30 15:40:20 +0000
commit09997f3d41692022beb138f1e238f51af93a8024 (patch)
tree18ad8015f1e0ba01f043e52b0e4feb24b04656f8 /src/lib/libssl/ssl_locl.h
parent3a0362608e329661831d8a0de2005821d2cc1fe0 (diff)
downloadopenbsd-09997f3d41692022beb138f1e238f51af93a8024.tar.gz
openbsd-09997f3d41692022beb138f1e238f51af93a8024.tar.bz2
openbsd-09997f3d41692022beb138f1e238f51af93a8024.zip
Start replacing the existing TLSv1.2 record layer.
This takes the same design/approach used in TLSv1.3 and provides an opaque struct that is self contained and cannot reach back into other layers. For now this just implements/replaces the writing of records for DTLSv1/TLSv1.0/TLSv1.1/TLSv1.2. In doing so we stop copying the plaintext into the same buffer that is used to transmit to the wire. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r--src/lib/libssl/ssl_locl.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 676f404352..e41465419a 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.283 2020/08/11 18:40:24 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.284 2020/08/30 15:40:20 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 *
@@ -475,6 +475,34 @@ typedef struct ssl_handshake_tls13_st {
475 475
476} SSL_HANDSHAKE_TLS13; 476} SSL_HANDSHAKE_TLS13;
477 477
478struct tls12_record_layer;
479
480struct tls12_record_layer *tls12_record_layer_new(void);
481void tls12_record_layer_free(struct tls12_record_layer *rl);
482void tls12_record_layer_set_version(struct tls12_record_layer *rl,
483 uint16_t version);
484void tls12_record_layer_set_read_epoch(struct tls12_record_layer *rl,
485 uint16_t epoch);
486void tls12_record_layer_set_write_epoch(struct tls12_record_layer *rl,
487 uint16_t epoch);
488void tls12_record_layer_clear_read_state(struct tls12_record_layer *rl);
489void tls12_record_layer_clear_write_state(struct tls12_record_layer *rl);
490void tls12_record_layer_set_read_seq_num(struct tls12_record_layer *rl,
491 uint8_t *seq_num);
492void tls12_record_layer_set_write_seq_num(struct tls12_record_layer *rl,
493 uint8_t *seq_num);
494int tls12_record_layer_set_read_aead(struct tls12_record_layer *rl,
495 SSL_AEAD_CTX *aead_ctx);
496int tls12_record_layer_set_write_aead(struct tls12_record_layer *rl,
497 SSL_AEAD_CTX *aead_ctx);
498int tls12_record_layer_set_read_cipher_hash(struct tls12_record_layer *rl,
499 EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *hash_ctx, int stream_mac);
500int tls12_record_layer_set_write_cipher_hash(struct tls12_record_layer *rl,
501 EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *hash_ctx, int stream_mac);
502int tls12_record_layer_seal_record(struct tls12_record_layer *rl,
503 uint8_t content_type, const uint8_t *content, size_t content_len,
504 CBB *out);
505
478typedef struct ssl_ctx_internal_st { 506typedef struct ssl_ctx_internal_st {
479 uint16_t min_version; 507 uint16_t min_version;
480 uint16_t max_version; 508 uint16_t max_version;
@@ -736,6 +764,8 @@ typedef struct ssl_internal_st {
736 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 764 EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
737 EVP_MD_CTX *write_hash; /* used for mac generation */ 765 EVP_MD_CTX *write_hash; /* used for mac generation */
738 766
767 struct tls12_record_layer *rl;
768
739 /* session info */ 769 /* session info */
740 770
741 /* extra application data */ 771 /* extra application data */
@@ -826,7 +856,6 @@ typedef struct ssl3_state_internal_st {
826 int empty_fragment_done; 856 int empty_fragment_done;
827 857
828 SSL3_RECORD_INTERNAL rrec; /* each decoded record goes in here */ 858 SSL3_RECORD_INTERNAL rrec; /* each decoded record goes in here */
829 SSL3_RECORD_INTERNAL wrec; /* goes out from here */
830 859
831 /* storage for Alert/Handshake protocol data received but not 860 /* storage for Alert/Handshake protocol data received but not
832 * yet processed by ssl3_read_bytes: */ 861 * yet processed by ssl3_read_bytes: */