mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
Refactor Crypto/Utils lib to make it Linux compatible
This commit is contained in:
parent
22402766af
commit
b6b0a57232
@ -1,4 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "IHashFunction.h"
|
||||
#include "IStreamCipher.h"
|
||||
#include "IPublicKeyAlgorithm.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class IHashFunction
|
||||
{
|
||||
public:
|
||||
@ -9,4 +11,4 @@ public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Process(const void* input, size_t inputSize) = 0;
|
||||
virtual void Finish(void* hashBuffer) = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
class IPublicKeyAlgorithm
|
||||
{
|
||||
@ -18,4 +19,4 @@ public:
|
||||
// If needed add a signing method
|
||||
|
||||
virtual bool Verify(const uint8_t* signedData, size_t signedDataSize, const uint8_t* signature, size_t signatureSize) = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
class IStreamCipher
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "AlgorithmSalsa20.h"
|
||||
#include "salsa20.h"
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
|
||||
class AlgorithmSalsa20::AlgorithmSalsa20Impl
|
||||
{
|
||||
@ -27,7 +27,7 @@ public:
|
||||
|
||||
if(ivSize != 8)
|
||||
{
|
||||
throw std::exception("Salsa20 IV size must be 8");
|
||||
throw std::invalid_argument("Salsa20 IV size must be 8");
|
||||
}
|
||||
|
||||
Salsa20_IVSetup(&m_context, iv);
|
||||
@ -84,4 +84,4 @@ void AlgorithmSalsa20::SetIV(const uint8_t* iv, const size_t ivSize)
|
||||
void AlgorithmSalsa20::Process(const void* plainText, void* cipherText, const size_t amount)
|
||||
{
|
||||
m_impl->Process(plainText, cipherText, amount);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "CommandLineOption.h"
|
||||
#include <Windows.h>
|
||||
|
||||
CommandLineOption::CommandLineOption()
|
||||
{
|
||||
@ -57,4 +56,4 @@ CommandLineOption* CommandLineOption::Builder::Build() const
|
||||
delete this;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user