From 3ab070119293e6edbff74162df78eae8fdf6cbb2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 1 May 2020 10:17:01 -0400 Subject: [PATCH] core/hw/rsa: Make GetSignature() a const member function This doesn't directly modify instance state, so it can be made const. --- src/core/hw/aes/key.cpp | 2 +- src/core/hw/rsa/rsa.cpp | 2 +- src/core/hw/rsa/rsa.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hw/aes/key.cpp b/src/core/hw/aes/key.cpp index 2148ab04c..e406aed71 100644 --- a/src/core/hw/aes/key.cpp +++ b/src/core/hw/aes/key.cpp @@ -223,7 +223,7 @@ void LoadNativeFirmKeysOld3DS() { return; } - auto rsa = RSA::GetSlot(0); + const auto rsa = RSA::GetSlot(0); if (!rsa) { LOG_ERROR(HW_AES, "RSA slot is missing"); return; diff --git a/src/core/hw/rsa/rsa.cpp b/src/core/hw/rsa/rsa.cpp index a349cbf37..b4179fd69 100644 --- a/src/core/hw/rsa/rsa.cpp +++ b/src/core/hw/rsa/rsa.cpp @@ -31,7 +31,7 @@ std::vector HexToBytes(const std::string& hex) { constexpr std::size_t SlotSize = 4; std::array rsa_slots; -std::vector RsaSlot::GetSignature(const std::vector& message) { +std::vector RsaSlot::GetSignature(const std::vector& message) const { CryptoPP::Integer sig = CryptoPP::ModularExponentiation(CryptoPP::Integer(message.data(), message.size()), CryptoPP::Integer(exponent.data(), exponent.size()), diff --git a/src/core/hw/rsa/rsa.h b/src/core/hw/rsa/rsa.h index 51288f41f..26dc84cb1 100644 --- a/src/core/hw/rsa/rsa.h +++ b/src/core/hw/rsa/rsa.h @@ -14,7 +14,7 @@ public: RsaSlot() = default; RsaSlot(std::vector exponent, std::vector modulus) : init(true), exponent(std::move(exponent)), modulus(std::move(modulus)) {} - std::vector GetSignature(const std::vector& message); + std::vector GetSignature(const std::vector& message) const; explicit operator bool() const { // TODO(B3N30): Maybe check if exponent and modulus are vailid