diff options
author | Matt Caswell <matt@openssl.org> | 2022-08-12 09:51:51 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2022-09-23 14:39:46 +0100 |
commit | a566864b607317fc95cbe190bbf0b8b928fcfa77 (patch) | |
tree | 1373e90728e2af0e052a869edd8a8b9b1728ccbc /ssl/s3_msg.c | |
parent | c5d061290baa9466182b6d1a5b88aa9e5a4b2386 (diff) |
Move initial TLS write record layer code into new structure
The new write record layer architecture splits record writing into
a "write_records" call and a "retry_write_records" call - where multiple
records can be sent to "write_records" in one go. We restructure the code
into that format in order that future commits can move these functions into
the new record layer more easily.
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19198)
Diffstat (limited to 'ssl/s3_msg.c')
-rw-r--r-- | ssl/s3_msg.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ssl/s3_msg.c b/ssl/s3_msg.c index 01524fd6fd..749c93e16d 100644 --- a/ssl/s3_msg.c +++ b/ssl/s3_msg.c @@ -78,18 +78,24 @@ int ssl3_send_alert(SSL_CONNECTION *s, int level, int desc) int ssl3_dispatch_alert(SSL *s) { int i, j; - size_t alertlen; void (*cb) (const SSL *ssl, int type, int val) = NULL; - size_t written; SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s); + OSSL_RECORD_TEMPLATE templ; if (sc == NULL) return -1; sc->s3.alert_dispatch = 0; - alertlen = 2; - i = do_ssl3_write(sc, SSL3_RT_ALERT, &sc->s3.send_alert[0], &alertlen, 1, 0, - &written); + + templ.type = SSL3_RT_ALERT; + templ.buf = &sc->s3.send_alert[0]; + templ.buflen = 2; + + /* TODO(RECLAYER): What happens if there is already a write pending? */ + if (RECORD_LAYER_write_pending(&sc->rlayer)) + return -1; + + i = tls_write_records(sc, &templ, 1); if (i <= 0) { sc->s3.alert_dispatch = 1; } else { |