mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
commit
59984df603
@ -223,7 +223,7 @@ void LoadNativeFirmKeysOld3DS() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto rsa = RSA::GetSlot(0);
|
const auto rsa = RSA::GetSlot(0);
|
||||||
if (!rsa) {
|
if (!rsa) {
|
||||||
LOG_ERROR(HW_AES, "RSA slot is missing");
|
LOG_ERROR(HW_AES, "RSA slot is missing");
|
||||||
return;
|
return;
|
||||||
|
@ -31,7 +31,7 @@ std::vector<u8> HexToBytes(const std::string& hex) {
|
|||||||
constexpr std::size_t SlotSize = 4;
|
constexpr std::size_t SlotSize = 4;
|
||||||
std::array<RsaSlot, SlotSize> rsa_slots;
|
std::array<RsaSlot, SlotSize> rsa_slots;
|
||||||
|
|
||||||
std::vector<u8> RsaSlot::GetSignature(const std::vector<u8>& message) {
|
std::vector<u8> RsaSlot::GetSignature(const std::vector<u8>& message) const {
|
||||||
CryptoPP::Integer sig =
|
CryptoPP::Integer sig =
|
||||||
CryptoPP::ModularExponentiation(CryptoPP::Integer(message.data(), message.size()),
|
CryptoPP::ModularExponentiation(CryptoPP::Integer(message.data(), message.size()),
|
||||||
CryptoPP::Integer(exponent.data(), exponent.size()),
|
CryptoPP::Integer(exponent.data(), exponent.size()),
|
||||||
@ -74,7 +74,7 @@ void InitSlots() {
|
|||||||
std::vector<u8> exponent(256);
|
std::vector<u8> exponent(256);
|
||||||
file.ReadArray(exponent.data(), exponent.size());
|
file.ReadArray(exponent.data(), exponent.size());
|
||||||
|
|
||||||
rsa_slots[0] = RsaSlot(exponent, modulus);
|
rsa_slots[0] = RsaSlot(std::move(exponent), std::move(modulus));
|
||||||
// TODO(B3N30): Initalize the other slots. But since they aren't used at all, we can skip them
|
// TODO(B3N30): Initalize the other slots. But since they aren't used at all, we can skip them
|
||||||
// for now
|
// for now
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,18 @@ namespace HW::RSA {
|
|||||||
|
|
||||||
class RsaSlot {
|
class RsaSlot {
|
||||||
public:
|
public:
|
||||||
RsaSlot() : init(false) {}
|
RsaSlot() = default;
|
||||||
RsaSlot(const std::vector<u8>& exponent, const std::vector<u8>& modulus)
|
RsaSlot(std::vector<u8> exponent, std::vector<u8> modulus)
|
||||||
: init(true), exponent(exponent), modulus(modulus) {}
|
: init(true), exponent(std::move(exponent)), modulus(std::move(modulus)) {}
|
||||||
std::vector<u8> GetSignature(const std::vector<u8>& message);
|
std::vector<u8> GetSignature(const std::vector<u8>& message) const;
|
||||||
|
|
||||||
operator bool() const {
|
explicit operator bool() const {
|
||||||
// TODO(B3N30): Maybe check if exponent and modulus are vailid
|
// TODO(B3N30): Maybe check if exponent and modulus are vailid
|
||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool init;
|
bool init = false;
|
||||||
std::vector<u8> exponent;
|
std::vector<u8> exponent;
|
||||||
std::vector<u8> modulus;
|
std::vector<u8> modulus;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user