From 08f75368824e95baf7e097581e7229b6fc289619 Mon Sep 17 00:00:00 2001 From: Wiktor Kwapisiewicz Date: Tue, 5 Sep 2023 14:19:55 +0200 Subject: openpgp: Provide better error messages on curve25519 clamp failures. --- openpgp/src/crypto/ecdh.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openpgp/src/crypto/ecdh.rs b/openpgp/src/crypto/ecdh.rs index 3f47e0a6..14e1ac1b 100644 --- a/openpgp/src/crypto/ecdh.rs +++ b/openpgp/src/crypto/ecdh.rs @@ -566,8 +566,10 @@ mod tests { const LAST: usize = 0; let s = s.as_ref(); - assert_eq!(s[FIRST] & ! 0b1111_1000, 0); - assert_eq!(s[LAST] & 0b1100_0000, 0b0100_0000); + assert_eq!(s[FIRST] & ! 0b1111_1000, 0, + "bits 0, 1 and 2 of the first byte should be cleared"); + assert_eq!(s[LAST] & 0b1100_0000, 0b0100_0000, + "bits 7 should be cleared and bit 6 should be set in the last byte"); } for _ in 0..5 { -- cgit v1.2.3