From 3f4e3ee0148ea15470f3d239a1c4f3d34044f347 Mon Sep 17 00:00:00 2001 From: patchzyy <64382339+patchzyy@users.noreply.github.com> Date: Tue, 29 Sep 2026 08:47:55 +0200 Subject: [PATCH] Fix Wii certificates --- runtime/include/wii_es_crypto.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/include/wii_es_crypto.h b/runtime/include/wii_es_crypto.h index d1fb78c..0c515b5 100644 --- a/runtime/include/wii_es_crypto.h +++ b/runtime/include/wii_es_crypto.h @@ -132,8 +132,9 @@ using CryptoEcdsa = CryptoPP::ECDSA; inline CryptoEcdsa::PrivateKey MakePrivateKey(const uint8_t* key) { CryptoPP::DL_GroupParameters_EC 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"); }