Skip to content

Commit

Permalink
FIX: occasional HTTPS read fails when server used ECDHE_ECDSA key method
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jan 5, 2022
1 parent d4bb59c commit 734edab
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/mezz/prot-tls.reb
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ TLS-init-cipher-suite: func [
]
]

pad-bin: function[
"Left binary padding"
bin [binary!]
len [integer!]
][
if len > n: length? bin [
; using copy, because binary may not be at its head!
insert/dup copy bin 0 len - n
]
bin
]

make-TLS-error: func [
"Make an error for the TLS protocol"
message [string! block!]
Expand Down Expand Up @@ -1599,8 +1611,10 @@ TLS-parse-handshake-message: function [
rsa_fixed_dh [
log-more "Checking signature using RSA_fixed_DH"
der: decode 'der signature
;@@ Review: der codec skips null char, which is needed here (reason for `head` calls)!
signature: join head der/2/2 head der/2/4
n: select [secp256r1 32 secp384r1 48 secp521r1 66] ctx/pub-exp
x: pad-bin der/2/2 n
y: pad-bin der/2/4 n
signature: join x y
;? ctx/pub-key
;? signature
;? ctx/pub-key
Expand Down

0 comments on commit 734edab

Please sign in to comment.