Skip to content

Commit 3cdba9b

Browse files
committed
CHANGE: minor TLS code rearrangement
1 parent b2059c2 commit 3cdba9b

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/mezz/prot-tls.reb

+14-21
Original file line numberDiff line numberDiff line change
@@ -738,25 +738,22 @@ client-key-exchange: function [
738738
;?? iv-size
739739

740740
unless is-aead? [
741-
local-mac: take/part key-expansion mac-size
741+
local-mac: take/part key-expansion mac-size
742742
remote-mac: take/part key-expansion mac-size
743743
]
744744

745-
local-key: take/part key-expansion crypt-size
745+
local-key: take/part key-expansion crypt-size
746746
remote-key: take/part key-expansion crypt-size
747747

748-
log-more ["Client-mac: ^[[32m" local-mac ]
749-
log-more ["Server-mac: ^[[32m" remote-mac ]
750-
log-more ["Client-key: ^[[32m" local-key]
751-
log-more ["Server-key: ^[[32m" remote-key]
752-
753-
local-IV: take/part key-expansion iv-size
748+
local-IV: take/part key-expansion iv-size
754749
remote-IV: take/part key-expansion iv-size
755-
756-
log-more ["Client-IV: ^[[32m" local-IV]
757-
log-more ["Server-IV: ^[[32m" remote-IV]
758750

759-
key-expansion: none
751+
log-more ["Local-IV: ^[[32m" local-IV]
752+
log-more ["Local-mac: ^[[32m" local-mac]
753+
log-more ["Local-key: ^[[32m" local-key]
754+
log-more ["Remote-IV: ^[[32m" remote-IV]
755+
log-more ["Remote-mac: ^[[32m" remote-mac]
756+
log-more ["Remote-key: ^[[32m" remote-key]
760757

761758
encrypt-port: open [
762759
scheme: 'crypt
@@ -773,8 +770,7 @@ client-key-exchange: function [
773770
]
774771

775772
; not needed anymore...
776-
local-key: none
777-
remote-key: none
773+
key-expansion: local-key: remote-key: none
778774

779775
TLS-update-messages-hash ctx (at head out/buffer pos-record) length-record
780776
]
@@ -973,9 +969,9 @@ encrypt-data: function [
973969
modify encrypt-port 'init-vector local-IV
974970

975971
;?? ctx/seq-write
976-
log-more ["Client-IV: ^[[32m" local-IV]
977-
log-more ["Client-mac: ^[[32m" local-mac]
978-
log-more ["Hash-method: ^[[32m" hash-method]
972+
log-more ["Local-IV: ^[[32m" local-IV]
973+
log-more ["Local-mac: ^[[32m" local-mac]
974+
log-more ["Hash-method:^[[32m" hash-method]
979975

980976
; Message Authentication Code
981977
; https://tools.ietf.org/html/rfc5246#section-6.2.3.1
@@ -1515,10 +1511,7 @@ TLS-parse-handshake-message: function [
15151511
if ends > pos: index? msg/buffer [
15161512
len: ends - pos
15171513
binary/read msg [extra: BYTES :len]
1518-
log-error [
1519-
"Extra" len "bytes at the end of message:"
1520-
mold extra
1521-
]
1514+
log-error ["Extra" len "bytes at the end of message:" ellipsize form extra 40]
15221515
return *Alert/Decode_error
15231516
]
15241517

0 commit comments

Comments
 (0)