Skip to content

Commit 3ae9c47

Browse files
committed
Elaborate on "k*G has a large x-coordinate" case for secp256k1
1 parent 59fd2d8 commit 3ae9c47

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/crypto/tests/wycheproof_secp256k1.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ fn ecdsa_secp256k1_sha256() {
103103
let valid = secp256k1_verify(&message_hash, &signature, &public_key).unwrap();
104104
assert!(valid);
105105
if tc.comment == "k*G has a large x-coordinate" {
106-
// this case is currently not supported for historic reasons
106+
// This case (recovery ID 2 and 3) was never supported in the implementation of
107+
// secp256k1_recover_pubkey because the library we used at that time did not support it.
108+
// If needed, we could enable it now in a consensus breaking change.
107109
} else {
108110
test_recover_pubkey(&message_hash, &signature, &public_key, [0, 1]);
109111
}
@@ -153,7 +155,9 @@ fn ecdsa_secp256k1_sha512() {
153155
let valid = secp256k1_verify(&message_hash, &signature, &public_key).unwrap();
154156
assert!(valid);
155157
if tc.comment == "k*G has a large x-coordinate" {
156-
// this case is currently not supported for historic reasons
158+
// This case (recovery ID 2 and 3) was never supported in the implementation of
159+
// secp256k1_recover_pubkey because the library we used at that time did not support it.
160+
// If needed, we could enable it now in a consensus breaking change.
157161
} else {
158162
test_recover_pubkey(&message_hash, &signature, &public_key, [0, 1]);
159163
}
@@ -203,7 +207,9 @@ fn ecdsa_secp256k1_sha3_256() {
203207
let valid = secp256k1_verify(&message_hash, &signature, &public_key).unwrap();
204208
assert!(valid);
205209
if tc.comment == "k*G has a large x-coordinate" {
206-
// this case is currently not supported for historic reasons
210+
// This case (recovery ID 2 and 3) was never supported in the implementation of
211+
// secp256k1_recover_pubkey because the library we used at that time did not support it.
212+
// If needed, we could enable it now in a consensus breaking change.
207213
} else {
208214
test_recover_pubkey(&message_hash, &signature, &public_key, [0, 1]);
209215
}
@@ -253,7 +259,9 @@ fn ecdsa_secp256k1_sha3_512() {
253259
let valid = secp256k1_verify(&message_hash, &signature, &public_key).unwrap();
254260
assert!(valid);
255261
if tc.comment == "k*G has a large x-coordinate" {
256-
// this case is currently not supported for historic reasons
262+
// This case (recovery ID 2 and 3) was never supported in the implementation of
263+
// secp256k1_recover_pubkey because the library we used at that time did not support it.
264+
// If needed, we could enable it now in a consensus breaking change.
257265
} else {
258266
test_recover_pubkey(&message_hash, &signature, &public_key, [0, 1]);
259267
}

0 commit comments

Comments
 (0)