diff options
author | jsing <> | 2020-08-30 15:40:20 +0000 |
---|---|---|
committer | jsing <> | 2020-08-30 15:40:20 +0000 |
commit | 09997f3d41692022beb138f1e238f51af93a8024 (patch) | |
tree | 18ad8015f1e0ba01f043e52b0e4feb24b04656f8 /src/lib/libssl/ssl_lib.c | |
parent | 3a0362608e329661831d8a0de2005821d2cc1fe0 (diff) | |
download | openbsd-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_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index bd3188cdf6..bf10cea685 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.220 2020/08/11 18:39:40 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.221 2020/08/30 15:40:19 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 | * |
@@ -344,6 +344,9 @@ SSL_new(SSL_CTX *ctx) | |||
344 | if (!s->method->internal->ssl_new(s)) | 344 | if (!s->method->internal->ssl_new(s)) |
345 | goto err; | 345 | goto err; |
346 | 346 | ||
347 | if ((s->internal->rl = tls12_record_layer_new()) == NULL) | ||
348 | goto err; | ||
349 | |||
347 | s->references = 1; | 350 | s->references = 1; |
348 | s->server = (ctx->method->internal->ssl_accept == ssl_undefined_function) ? 0 : 1; | 351 | s->server = (ctx->method->internal->ssl_accept == ssl_undefined_function) ? 0 : 1; |
349 | 352 | ||
@@ -564,6 +567,8 @@ SSL_free(SSL *s) | |||
564 | sk_SRTP_PROTECTION_PROFILE_free(s->internal->srtp_profiles); | 567 | sk_SRTP_PROTECTION_PROFILE_free(s->internal->srtp_profiles); |
565 | #endif | 568 | #endif |
566 | 569 | ||
570 | tls12_record_layer_free(s->internal->rl); | ||
571 | |||
567 | free(s->internal); | 572 | free(s->internal); |
568 | free(s); | 573 | free(s); |
569 | } | 574 | } |
@@ -2535,6 +2540,10 @@ ssl_clear_cipher_read_state(SSL *s) | |||
2535 | EVP_MD_CTX_free(s->read_hash); | 2540 | EVP_MD_CTX_free(s->read_hash); |
2536 | s->read_hash = NULL; | 2541 | s->read_hash = NULL; |
2537 | 2542 | ||
2543 | tls12_record_layer_clear_read_state(s->internal->rl); | ||
2544 | tls12_record_layer_set_read_seq_num(s->internal->rl, | ||
2545 | S3I(s)->read_sequence); | ||
2546 | |||
2538 | if (s->internal->aead_read_ctx != NULL) { | 2547 | if (s->internal->aead_read_ctx != NULL) { |
2539 | EVP_AEAD_CTX_cleanup(&s->internal->aead_read_ctx->ctx); | 2548 | EVP_AEAD_CTX_cleanup(&s->internal->aead_read_ctx->ctx); |
2540 | free(s->internal->aead_read_ctx); | 2549 | free(s->internal->aead_read_ctx); |
@@ -2550,6 +2559,10 @@ ssl_clear_cipher_write_state(SSL *s) | |||
2550 | EVP_MD_CTX_free(s->internal->write_hash); | 2559 | EVP_MD_CTX_free(s->internal->write_hash); |
2551 | s->internal->write_hash = NULL; | 2560 | s->internal->write_hash = NULL; |
2552 | 2561 | ||
2562 | tls12_record_layer_clear_write_state(s->internal->rl); | ||
2563 | tls12_record_layer_set_write_seq_num(s->internal->rl, | ||
2564 | S3I(s)->write_sequence); | ||
2565 | |||
2553 | if (s->internal->aead_write_ctx != NULL) { | 2566 | if (s->internal->aead_write_ctx != NULL) { |
2554 | EVP_AEAD_CTX_cleanup(&s->internal->aead_write_ctx->ctx); | 2567 | EVP_AEAD_CTX_cleanup(&s->internal->aead_write_ctx->ctx); |
2555 | free(s->internal->aead_write_ctx); | 2568 | free(s->internal->aead_write_ctx); |