Skip to content

Commit 734edab

Browse files
committed
FIX: occasional HTTPS read fails when server used ECDHE_ECDSA key method
1 parent d4bb59c commit 734edab

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/mezz/prot-tls.reb

+16-2
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,18 @@ TLS-init-cipher-suite: func [
413413
]
414414
]
415415

416+
pad-bin: function[
417+
"Left binary padding"
418+
bin [binary!]
419+
len [integer!]
420+
][
421+
if len > n: length? bin [
422+
; using copy, because binary may not be at its head!
423+
insert/dup copy bin 0 len - n
424+
]
425+
bin
426+
]
427+
416428
make-TLS-error: func [
417429
"Make an error for the TLS protocol"
418430
message [string! block!]
@@ -1599,8 +1611,10 @@ TLS-parse-handshake-message: function [
15991611
rsa_fixed_dh [
16001612
log-more "Checking signature using RSA_fixed_DH"
16011613
der: decode 'der signature
1602-
;@@ Review: der codec skips null char, which is needed here (reason for `head` calls)!
1603-
signature: join head der/2/2 head der/2/4
1614+
n: select [secp256r1 32 secp384r1 48 secp521r1 66] ctx/pub-exp
1615+
x: pad-bin der/2/2 n
1616+
y: pad-bin der/2/4 n
1617+
signature: join x y
16041618
;? ctx/pub-key
16051619
;? signature
16061620
;? ctx/pub-key

0 commit comments

Comments
 (0)