3
3
name: 'tls
4
4
type: 'module
5
5
author: rights: ["Richard 'Cyphre' Smolak" "Oldes" "Brian Dickens (Hostilefork)" ]
6
- version: 0.7.3
6
+ version: 0.7.4
7
7
history: [
8
8
0.6.1 "Cyphre" "Initial implementation used in old R3-alpha"
9
9
0.7.0 "Oldes" {
@@ -21,6 +21,7 @@ REBOL [
21
21
* Added support for Chacha20-Poly1305 cipher suite
22
22
}
23
23
0.7.3 "Oldes" "Fixed RSA memory leak"
24
+ 0.7.4 "Oldes" "Pass data to parent handler even when ALERT message is not decoded"
24
25
]
25
26
todo: {
26
27
* cached sessions
@@ -860,7 +861,7 @@ decrypt-msg: function [
860
861
binary/init bin 0 ;clear the temp bin buffer
861
862
]
862
863
unless data [
863
- critical-error: *Alert/Bad_record_MAC
864
+ ; critical-error: *Alert/Bad_record_MAC
864
865
]
865
866
data
866
867
]
@@ -1285,11 +1286,19 @@ TLS-read-data: function [
1285
1286
ctx/critical-error: TLS-parse-handshake-message ctx data
1286
1287
]
1287
1288
ALERT [
1289
+ log-debug ["ALERT len:" :len "ctx/cipher-spec-set:" ctx/cipher-spec-set ]
1288
1290
binary/read inp [data: BYTES :len ]
1289
1291
if ctx/cipher-spec-set > 1 [
1292
+ log-debug ["Decrypting ALERT message:" mold data]
1290
1293
data: decrypt-msg ctx data
1291
- ;print "DECRYPTED ALERT"
1292
- ;?? data
1294
+ unless data [
1295
+ log-error "Failed to decode ALERT message!"
1296
+ ;@@ TODO: inspect how it's possible that decrypt failes
1297
+ ;@@ problem is when CHACHA20_POLY1305 is used.
1298
+ ctx/critical-error: none
1299
+ ctx/protocol: 'APPLICATION ; content is reported to higher level
1300
+ continue
1301
+ ]
1293
1302
]
1294
1303
level: data/1
1295
1304
id: data/2
@@ -1785,6 +1794,7 @@ TLS-awake: function [event [event!]][
1785
1794
]
1786
1795
TLS-port/data: TLS-port/state/port-data
1787
1796
binary/init TLS-port/state/in none ; resets input buffer
1797
+ ?? TLS-port/state/protocol
1788
1798
either 'APPLICATION = TLS-port/state/protocol [
1789
1799
;print "------------------"
1790
1800
;- report that we have data to higher layer
0 commit comments