mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-29 07:30:32 -04:00
Compare commits
1 Commits
main
...
wii-cert-fix
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f4e3ee014 |
@@ -132,8 +132,9 @@ using CryptoEcdsa = CryptoPP::ECDSA<CryptoPP::EC2N, CryptoPP::SHA1>;
|
||||
|
||||
inline CryptoEcdsa::PrivateKey MakePrivateKey(const uint8_t* key) {
|
||||
CryptoPP::DL_GroupParameters_EC<CryptoPP::EC2N> parameters(CryptoPP::ASN1::sect233r1());
|
||||
const CryptoPP::Integer exponent(key, 30);
|
||||
if (exponent <= CryptoPP::Integer::Zero() || exponent >= parameters.GetSubgroupOrder()) {
|
||||
// Wii keys need not be canonical scalars; reduction preserves their public key.
|
||||
const CryptoPP::Integer exponent = CryptoPP::Integer(key, 30) % parameters.GetSubgroupOrder();
|
||||
if (exponent == CryptoPP::Integer::Zero()) {
|
||||
throw std::invalid_argument("Wii ES private key is outside the sect233r1 subgroup");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user