common: Move all cryptographic function to common/crypto

This commit is contained in:
MerryMage 2018-07-29 08:48:28 +01:00
parent 5dc23e49d7
commit f9c6d5e1a0
10 changed files with 36 additions and 34 deletions

View file

@ -6,10 +6,10 @@
#include <array>
#include "common/aes.h"
#include "common/common_types.h"
#include "common/crypto/aes.h"
namespace Dynarmic::Common::AES {
namespace Dynarmic::Common::Crypto::AES {
using SubstitutionTable = std::array<u8, 256>;
@ -179,4 +179,4 @@ void InverseMixColumns(State& out_state, const State& state) {
}
}
} // namespace Dynarmic::Common::AES
} // namespace Dynarmic::Common::Crypto::AES

View file

@ -9,7 +9,7 @@
#include <array>
#include "common/common_types.h"
namespace Dynarmic::Common::AES {
namespace Dynarmic::Common::Crypto::AES {
using State = std::array<u8, 16>;
@ -20,4 +20,4 @@ void EncryptSingleRound(State& out_state, const State& state);
void MixColumns(State& out_state, const State& state);
void InverseMixColumns(State& out_state, const State& state);
} // namespace Dynarmic::Common::AES
} // namespace Dynarmic::Common::Crypto::AES

View file

@ -7,9 +7,9 @@
#include <array>
#include "common/common_types.h"
#include "common/crc32.h"
#include "common/crypto/crc32.h"
namespace Dynarmic::Common {
namespace Dynarmic::Common::Crypto::CRC32 {
using CRC32Table = std::array<u32, 256>;
@ -167,4 +167,4 @@ u32 ComputeCRC32ISO(u32 crc, u64 value, int length) {
return ComputeCRC32(iso_table, crc, value, length);
}
} // namespace Dynarmic::Common
} // namespace Dynarmic::Common::Crypto::CRC32

View file

@ -8,7 +8,7 @@
#include "common/common_types.h"
namespace Dynarmic::Common {
namespace Dynarmic::Common::Crypto::CRC32 {
/**
* Computes a CRC32 value using Castagnoli polynomial (0x1EDC6F41).
@ -38,4 +38,4 @@ u32 ComputeCRC32Castagnoli(u32 crc, u64 value, int length);
*/
u32 ComputeCRC32ISO(u32 crc, u64 value, int length);
} // namespace Dynarmic::Common
} // namespace Dynarmic::Common::Crypto::CRC32

View file

@ -6,10 +6,10 @@
#include <array>
#include "common/sm4.h"
#include "common/common_types.h"
#include "common/crypto/sm4.h"
namespace Dynarmic::Common::SM4 {
namespace Dynarmic::Common::Crypto::SM4 {
using SubstitutionTable = std::array<u8, 256>;
@ -52,4 +52,4 @@ u8 AccessSubstitutionBox(u8 index) {
return substitution_box[index];
}
} // namespace Dynarmic::Common::SM4
} // namespace Dynarmic::Common::Crypto::SM4

View file

@ -8,8 +8,8 @@
#include "common/common_types.h"
namespace Dynarmic::Common::SM4 {
namespace Dynarmic::Common::Crypto::SM4 {
u8 AccessSubstitutionBox(u8 index);
} // namespace Dynarmic::Common::SM4
} // namespace Dynarmic::Common::Crypto::SM4