Load RSA slot_0 data from bootrom; load and decrypt data from native firm for NCCHSecure2 keyslot

This commit is contained in:
B3n30
2020-02-26 16:43:53 +01:00
parent 5b54a99f96
commit ebeea43fb8
4 changed files with 204 additions and 4 deletions

36
src/core/hw/rsa/rsa.h Normal file
View File

@ -0,0 +1,36 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <vector>
#include "common/common_types.h"
namespace HW::RSA {
class RsaSlot {
public:
RsaSlot() : init(false) {}
RsaSlot(const std::vector<u8>& exponent, const std::vector<u8>& modulus)
: init(true), exponent(exponent), modulus(modulus) {}
std::vector<u8> GetSignature(const std::vector<u8>& message);
operator bool() const {
// TODO(B3N30): Maybe check if exponent and modulus are vailid
return init;
}
private:
bool init;
std::vector<u8> exponent;
std::vector<u8> modulus;
};
void InitSlots();
RsaSlot GetSlot(std::size_t slot_id);
std::vector<u8> CreateASN1Message(const std::vector<u8>& data);
} // namespace HW::RSA