Skip to content

Commit 1e589b2

Browse files
committed
Update
Signed-off-by: Vlad Gheorghiu <[email protected]>
1 parent 622f6dd commit 1e589b2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_kem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ def check_wrong_ciphertext(alg_name):
3636
public_key = kem.generate_keypair()
3737
ciphertext, shared_secret_server = kem.encap_secret(public_key)
3838
wrong_ciphertext = bytes(random.getrandbits(8) for _ in range(len(ciphertext)))
39-
shared_secret_client = kem.decap_secret(wrong_ciphertext)
40-
assert shared_secret_client != shared_secret_server
39+
try:
40+
shared_secret_client = kem.decap_secret(wrong_ciphertext)
41+
assert shared_secret_client != shared_secret_server
42+
except RuntimeError:
43+
pass
44+
except Exception as ex:
45+
raise AssertionError("An unexpected exception was raised. " + ex)
4146

4247

4348
def test_not_supported():

0 commit comments

Comments
 (0)