diff options
author | jsing <jsing@openbsd.org> | 2018-11-08 22:28:52 +0000 |
---|---|---|
committer | jsing <jsing@openbsd.org> | 2018-11-08 22:28:52 +0000 |
commit | cef855dc927554ea6cd8f8b5125b409ddf3d5bf6 (patch) | |
tree | bb455d9d7adf43bda78d9743ebaf3c63cec89e12 /lib/libssl/t1_enc.c | |
parent | Add missing NULL checks on allocation, style(9) and consistently use (diff) | |
download | wireguard-openbsd-cef855dc927554ea6cd8f8b5125b409ddf3d5bf6.tar.xz wireguard-openbsd-cef855dc927554ea6cd8f8b5125b409ddf3d5bf6.zip |
Clean up and simplify the handshake transcript code.
This provides a cleaner, simpler and more readable API, with code that uses
a BUF_MEM instead of a BIO.
ok beck@ ("hurry up") and tb@.
Diffstat (limited to 'lib/libssl/t1_enc.c')
-rw-r--r-- | lib/libssl/t1_enc.c | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/lib/libssl/t1_enc.c b/lib/libssl/t1_enc.c index 2a38d8de6a2..33158e160ea 100644 --- a/lib/libssl/t1_enc.c +++ b/lib/libssl/t1_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_enc.c,v 1.115 2018/10/24 18:04:50 jsing Exp $ */ +/* $OpenBSD: t1_enc.c,v 1.116 2018/11/08 22:28:52 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -157,61 +157,6 @@ tls1_cleanup_key_block(SSL *s) S3I(s)->hs.key_block_len = 0; } -int -tls1_init_finished_mac(SSL *s) -{ - BIO_free(S3I(s)->handshake_buffer); - - S3I(s)->handshake_buffer = BIO_new(BIO_s_mem()); - if (S3I(s)->handshake_buffer == NULL) - return (0); - - (void)BIO_set_close(S3I(s)->handshake_buffer, BIO_CLOSE); - - return (1); -} - -int -tls1_finish_mac(SSL *s, const unsigned char *buf, int len) -{ - if (len < 0) - return 0; - - if (!tls1_handshake_hash_update(s, buf, len)) - return 0; - - if (S3I(s)->handshake_buffer && - !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) { - BIO_write(S3I(s)->handshake_buffer, (void *)buf, len); - return 1; - } - - return 1; -} - -int -tls1_digest_cached_records(SSL *s) -{ - long hdatalen; - void *hdata; - - hdatalen = BIO_get_mem_data(S3I(s)->handshake_buffer, &hdata); - if (hdatalen <= 0) { - SSLerror(s, SSL_R_BAD_HANDSHAKE_LENGTH); - goto err; - } - - if (!(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) { - BIO_free(S3I(s)->handshake_buffer); - S3I(s)->handshake_buffer = NULL; - } - - return 1; - - err: - return 0; -} - void tls1_record_sequence_increment(unsigned char *seq) { |