Refactor Crypto/Utils lib to make it Linux compatible

This commit is contained in:
Jan 2021-03-01 08:17:18 -08:00
parent 22402766af
commit b6b0a57232
6 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,7 @@
#pragma once
#include <cstddef>
#include "IHashFunction.h"
#include "IStreamCipher.h"
#include "IPublicKeyAlgorithm.h"

View File

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

View File

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

View File

@ -1,5 +1,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
class IStreamCipher
{

View File

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

View File

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