From 38d3ac1b44eb37ead2a96d2fc31c6df49fdaf455 Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Mon, 19 Jul 2021 22:14:27 +0200 Subject: [PATCH] Reduce chance that tamper change is same as original value in tests --- .../kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt index fdc5929..c3722cd 100644 --- a/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt +++ b/multiplatform-crypto-libsodium-bindings/src/commonTest/kotlin/com/ionspin/kotlin/crypto/box/BoxTest.kt @@ -44,6 +44,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openEasy(tampered, messageNonce, senderKeypair.publicKey, recipientKeypair.secretKey) } } @@ -71,6 +73,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.ciphertext.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openDetached( tampered, encrypted.tag, @@ -104,6 +108,8 @@ class BoxTest { assertFailsWith() { val tampered = encrypted.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.openEasyAfterNM(tampered, messageNonce, recipientComputedSessionKey) } } @@ -124,6 +130,8 @@ class BoxTest { assertFailsWith() { val tampered = sealed.copyOf() tampered[1] = 0U + tampered[2] = 0U + tampered[3] = 0U Box.sealOpen(tampered, recipientKeypair.publicKey, recipientKeypair.secretKey) } }