OS X build fixes

This commit is contained in:
Jack Andersen 2015-09-02 08:53:24 -10:00
parent 960ba8e462
commit ceb4d3bb9b
5 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,7 @@
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.0)
project(NODLib)
endif()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

@ -1 +1 @@
Subproject commit 317e75c22e31746947bd1b3700cd72d53c97c837
Subproject commit 7be764c387951cabfc86d52f48bd3dab54127aeb

View File

@ -12,8 +12,8 @@ class IAES
{
public:
virtual ~IAES() {}
virtual void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len)=0;
virtual void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len)=0;
virtual void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len)=0;
virtual void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len)=0;
virtual void setKey(const uint8_t* key)=0;
};

View File

@ -1,6 +1,7 @@
#include "NOD/DiscBase.hpp"
#include "NOD/IFileIO.hpp"
#include <errno.h>
#ifndef _WIN32
#include <unistd.h>
#endif

View File

@ -185,8 +185,8 @@ protected:
void _decrypt(uint8_t* buff);
public:
void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len);
void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len);
void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len);
void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len);
void setKey(const uint8_t* key);
};
@ -430,7 +430,7 @@ void SoftwareAES::decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outb
}
// CBC mode encryption
void SoftwareAES::encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len)
void SoftwareAES::encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len)
{
uint8_t block[16];
uint8_t feedback[16];
@ -477,7 +477,7 @@ class NiAES : public IAES
__m128i m_ekey[11];
__m128i m_dkey[11];
public:
void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len)
void encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len)
{
__m128i feedback,data;
uint64_t i,j;
@ -497,7 +497,7 @@ public:
_mm_storeu_si128(&((__m128i*)outbuf)[i], feedback);
}
}
void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, uint64_t len)
void decrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outbuf, size_t len)
{
__m128i data,feedback,last_in;
uint64_t i,j;