diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2023-09-05 14:19:55 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2023-09-05 14:19:55 +0200 |
commit | 08f75368824e95baf7e097581e7229b6fc289619 (patch) | |
tree | 5d261bedbc3ace97e62070d152079dc1b77de895 | |
parent | a8127384578bb815e07258f6ad1dc65c5e55a187 (diff) |
openpgp: Provide better error messages on curve25519 clamp failures.
-rw-r--r-- | openpgp/src/crypto/ecdh.rs | 6 |
1 files 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 { |