core/hw/rsa: Make GetSignature() a const member function

This doesn't directly modify instance state, so it can be made const.
This commit is contained in:
Lioncash 2020-05-01 10:17:01 -04:00
parent c55e81b946
commit 3ab0701192
3 changed files with 3 additions and 3 deletions

View file

@ -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;

View file

@ -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()),

View file

@ -14,7 +14,7 @@ public:
RsaSlot() = default; RsaSlot() = default;
RsaSlot(std::vector<u8> exponent, std::vector<u8> modulus) RsaSlot(std::vector<u8> exponent, std::vector<u8> modulus)
: init(true), exponent(std::move(exponent)), modulus(std::move(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;
explicit 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