1
0
forked from QPQ-AG/enoise

Handle failed decrypts in handshake

This commit is contained in:
Hans Svensson
2018-04-25 09:37:26 +02:00
parent a484d14c41
commit a024fc4dc9
2 changed files with 12 additions and 5 deletions
+6 -3
View File
@@ -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.