For keys greater than the order, secp256k1_scalar_negate
returns strange results (understandable!).
But, as a result, secp256k1_ec_privkey_negate
, when called with an invalid private key, returns 1
(OK), and a ?private key?.
Tripped me up for a bit when generating some test fixtures for secp256k1_ec_privkey_negate
.
00000000000000000000000000000000000000000000000000000000000000000 becomes 0000000000000000000000000000000000000000000000000000000000000000
1ff00000000000000000000000000000000000000000000000000000000000000 becomes 00fffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
2ffff000000000000000000000000000000000000000000000000000000000000 becomes 0000fffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
3ffffff0000000000000000000000000000000000000000000000000000000000 becomes 000000fffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
4ffffffff00000000000000000000000000000000000000000000000000000000 becomes 00000000fffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
5ffffffffff000000000000000000000000000000000000000000000000000000 becomes 0000000000fffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
6ffffffffffff0000000000000000000000000000000000000000000000000000 becomes 000000000000fffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
7ffffffffffffff00000000000000000000000000000000000000000000000000 becomes 00000000000000fffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
8ffffffffffffffff000000000000000000000000000000000000000000000000 becomes 0000000000000000fffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
9ffffffffffffffffff0000000000000000000000000000000000000000000000 becomes 000000000000000000fffffffffffffebaaedce6af48a03bbfd25e8cd0364141
10ffffffffffffffffffff00000000000000000000000000000000000000000000 becomes 00000000000000000000fffffffffffebaaedce6af48a03bbfd25e8cd0364141
11ffffffffffffffffffffff000000000000000000000000000000000000000000 becomes 0000000000000000000000fffffffffebaaedce6af48a03bbfd25e8cd0364141
12ffffffffffffffffffffffff0000000000000000000000000000000000000000 becomes 000000000000000000000000fffffffebaaedce6af48a03bbfd25e8cd0364141
13ffffffffffffffffffffffffff00000000000000000000000000000000000000 becomes 00000000000000000000000000fffffebaaedce6af48a03bbfd25e8cd0364141
14ffffffffffffffffffffffffffff000000000000000000000000000000000000 becomes 0000000000000000000000000000fffebaaedce6af48a03bbfd25e8cd0364141
15ffffffffffffffffffffffffffffff0000000000000000000000000000000000 becomes 000000000000000000000000000000febaaedce6af48a03bbfd25e8cd0364141
16ffffffffffffffffffffffffffffffff00000000000000000000000000000000 becomes fffffffffffffffffffffffffffffffe755db9cd5e9140777fa4bd19a06c8282
17ffffffffffffffffffffffffffffffffff000000000000000000000000000000 becomes fffffffffffffffffffffffffffffffd765db9cd5e9140777fa4bd19a06c8282
18ffffffffffffffffffffffffffffffffffff0000000000000000000000000000 becomes fffffffffffffffffffffffffffffffd755eb9cd5e9140777fa4bd19a06c8282
19ffffffffffffffffffffffffffffffffffffff00000000000000000000000000 becomes fffffffffffffffffffffffffffffffd755dbacd5e9140777fa4bd19a06c8282
20ffffffffffffffffffffffffffffffffffffffff000000000000000000000000 becomes fffffffffffffffffffffffffffffffd755db9ce5e9140777fa4bd19a06c8282
21ffffffffffffffffffffffffffffffffffffffffff0000000000000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5f9140777fa4bd19a06c8282
22ffffffffffffffffffffffffffffffffffffffffffff00000000000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9240777fa4bd19a06c8282
23ffffffffffffffffffffffffffffffffffffffffffffff000000000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9141777fa4bd19a06c8282
24ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140787fa4bd19a06c8282
25ffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e91407780a4bd19a06c8282
26ffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa5bd19a06c8282
27ffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa4be19a06c8282
28ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa4bd1aa06c8282
29ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa4bd19a16c8282
30ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa4bd19a06d8282
31ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 becomes fffffffffffffffffffffffffffffffd755db9cd5e9140777fa4bd19a06c8382