Handle failed decrypts in handshake
This commit is contained in:
parent
a484d14c41
commit
a024fc4dc9
@ -181,8 +181,12 @@ do_handshake(HState, ComState, Timeout) ->
|
||||
in ->
|
||||
case hs_recv_msg(ComState, Timeout) of
|
||||
{ok, Data, ComState1} ->
|
||||
{ok, HState1, _Msg} = enoise_hs_state:read_message(HState, Data),
|
||||
do_handshake(HState1, ComState1, Timeout);
|
||||
case enoise_hs_state:read_message(HState, Data) of
|
||||
{ok, HState1, _Msg} ->
|
||||
do_handshake(HState1, ComState1, Timeout);
|
||||
Err = {error, _} ->
|
||||
Err
|
||||
end;
|
||||
Err = {error, _} ->
|
||||
Err
|
||||
end;
|
||||
|
@ -160,8 +160,11 @@ encrypt_and_hash(HS = #noise_hs{ ss = SS0 }, PlainText) ->
|
||||
{ok, HS#noise_hs{ ss = SS1 }, CipherText}.
|
||||
|
||||
decrypt_and_hash(HS = #noise_hs{ ss = SS0 }, CipherText) ->
|
||||
{ok, SS1, PlainText} = enoise_sym_state:decrypt_and_hash(SS0, CipherText),
|
||||
{ok, HS#noise_hs{ ss = SS1 }, PlainText}.
|
||||
|
||||
case enoise_sym_state:decrypt_and_hash(SS0, CipherText) of
|
||||
{ok, SS1, PlainText} ->
|
||||
{ok, HS#noise_hs{ ss = SS1 }, PlainText};
|
||||
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
end.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user