summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_lib.c
diff options
context:
space:
mode:
authorjsing <>2022-11-11 17:15:27 +0000
committerjsing <>2022-11-11 17:15:27 +0000
commit167103faa44f8407455f11f6599e9919e2b22653 (patch)
treea8f8e94c51cf1dc74d90e267faf0ad4720537e35 /src/lib/libssl/s3_lib.c
parentf8749b129444d560b9e645a68ec7b045800243ed (diff)
downloadopenbsd-167103faa44f8407455f11f6599e9919e2b22653.tar.gz
openbsd-167103faa44f8407455f11f6599e9919e2b22653.tar.bz2
openbsd-167103faa44f8407455f11f6599e9919e2b22653.zip
Convert the legacy TLS stack to tls_content.
This converts the legacy TLS stack to tls_content - records are now opened into a tls_content structure, rather than being written back into the same buffer that the sealed record was read into. This will allow for further clean up of the legacy record layer. ok tb@
Diffstat (limited to 'src/lib/libssl/s3_lib.c')
-rw-r--r--src/lib/libssl/s3_lib.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 68c6fc6324..87092069df 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.240 2022/11/10 18:06:37 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.241 2022/11/11 17:15:26 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 *
@@ -163,6 +163,7 @@
163#include "ssl_locl.h" 163#include "ssl_locl.h"
164#include "ssl_sigalgs.h" 164#include "ssl_sigalgs.h"
165#include "ssl_tlsext.h" 165#include "ssl_tlsext.h"
166#include "tls_content.h"
166 167
167#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER)) 168#define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers) / sizeof(SSL_CIPHER))
168 169
@@ -1441,11 +1442,12 @@ ssl3_cipher_get_value(const SSL_CIPHER *c)
1441int 1442int
1442ssl3_pending(const SSL *s) 1443ssl3_pending(const SSL *s)
1443{ 1444{
1444 if (s->rstate == SSL_ST_READ_BODY) 1445 if (s->s3->rcontent == NULL)
1446 return 0;
1447 if (tls_content_type(s->s3->rcontent) != SSL3_RT_APPLICATION_DATA)
1445 return 0; 1448 return 0;
1446 1449
1447 return (s->s3->rrec.type == SSL3_RT_APPLICATION_DATA) ? 1450 return tls_content_remaining(s->s3->rcontent);
1448 s->s3->rrec.length : 0;
1449} 1451}
1450 1452
1451int 1453int
@@ -1560,6 +1562,8 @@ ssl3_free(SSL *s)
1560 ssl3_release_read_buffer(s); 1562 ssl3_release_read_buffer(s);
1561 ssl3_release_write_buffer(s); 1563 ssl3_release_write_buffer(s);
1562 1564
1565 tls_content_free(s->s3->rcontent);
1566
1563 tls_buffer_free(s->s3->alert_fragment); 1567 tls_buffer_free(s->s3->alert_fragment);
1564 tls_buffer_free(s->s3->handshake_fragment); 1568 tls_buffer_free(s->s3->handshake_fragment);
1565 1569
@@ -1637,6 +1641,9 @@ ssl3_clear(SSL *s)
1637 rlen = s->s3->rbuf.len; 1641 rlen = s->s3->rbuf.len;
1638 wlen = s->s3->wbuf.len; 1642 wlen = s->s3->wbuf.len;
1639 1643
1644 tls_content_free(s->s3->rcontent);
1645 s->s3->rcontent = NULL;
1646
1640 tls1_transcript_free(s); 1647 tls1_transcript_free(s);
1641 tls1_transcript_hash_free(s); 1648 tls1_transcript_hash_free(s);
1642 1649