Add in-place encryption test

This commit is contained in:
Frank Denis
2025-12-30 00:58:26 +01:00
parent 7a58f66b43
commit 864e1b27b3
2 changed files with 19 additions and 0 deletions
+16
View File
@@ -181,6 +181,22 @@ main(void)
}
printf("OK: Deterministic encryption verified\n");
printf("\nTest 7: In-place encryption and decryption\n");
crypto_ipcrypt_encrypt(output, input, key);
memcpy(decrypted, input, sizeof input);
crypto_ipcrypt_encrypt(decrypted, decrypted, key);
if (memcmp(output, decrypted, sizeof output) != 0) {
printf("FAILED: In-place encryption differs from out-of-place\n");
return 1;
}
crypto_ipcrypt_decrypt(decrypted, decrypted, key);
if (memcmp(input, decrypted, sizeof input) != 0) {
printf("FAILED: In-place decryption does not match original\n");
return 1;
}
printf("OK: In-place round-trip successful\n");
printf("\nAll tests passed!\n");
return 0;
+3
View File
@@ -46,4 +46,7 @@ Input[3]: 00000000000000000000ffff00000003
Test 6: Verify deterministic encryption
OK: Deterministic encryption verified
Test 7: In-place encryption and decryption
OK: In-place round-trip successful
All tests passed!