mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Improve test based on code review feedback
Co-authored-by: michaelsproul <4452260+michaelsproul@users.noreply.github.com>
This commit is contained in:
@@ -317,8 +317,8 @@ fn aes_ctr_endianness_verification() {
|
|||||||
// Password: "testpassword" (from the simplified test in the spec)
|
// Password: "testpassword" (from the simplified test in the spec)
|
||||||
let password = b"testpassword";
|
let password = b"testpassword";
|
||||||
|
|
||||||
// Expected secret key after decryption
|
// Expected BLS secret key after decryption
|
||||||
let expected_secret =
|
let expected_secret_key =
|
||||||
hex::decode("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")
|
hex::decode("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")
|
||||||
.expect("valid hex");
|
.expect("valid hex");
|
||||||
|
|
||||||
@@ -363,19 +363,14 @@ fn aes_ctr_endianness_verification() {
|
|||||||
.decrypt_keypair(password)
|
.decrypt_keypair(password)
|
||||||
.expect("should decrypt with correct password");
|
.expect("should decrypt with correct password");
|
||||||
|
|
||||||
// Verify the decrypted secret matches the expected value
|
// Verify the decrypted secret key matches the expected value.
|
||||||
// This proves the AES-CTR counter is being incremented in big-endian format
|
// This proves the AES-CTR counter is being incremented in big-endian format
|
||||||
|
// as required by NIST SP 800-38A and RFC 3686.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
keypair.sk.serialize().as_ref(),
|
keypair.sk.serialize().as_ref(),
|
||||||
&expected_secret[..],
|
&expected_secret_key[..],
|
||||||
"Decrypted secret key should match expected value. \
|
"Decrypted secret key must match expected value. \
|
||||||
If this fails, the AES-CTR counter increment endianness may be incorrect."
|
Failure indicates non-compliance with NIST SP 800-38A and RFC 3686 \
|
||||||
);
|
big-endian counter increment requirement."
|
||||||
|
|
||||||
// Also verify the public key matches
|
|
||||||
assert_eq!(
|
|
||||||
format!("0x{}", keystore.pubkey()),
|
|
||||||
format!("{:?}", keystore.public_key().unwrap()),
|
|
||||||
"Public key should match"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user