mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
fix compile on Turbo C++ 2006
This commit is contained in:
parent
31b3f6c3a8
commit
f018ac354a
@ -14,7 +14,7 @@
|
||||
</Source>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="active" value="1"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
@ -235,11 +235,11 @@
|
||||
<Debugging Name="DebugSourceDirs"></Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams">v 50</Parameters>
|
||||
<Parameters Name="RunParams">v 66</Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">True</Parameters>
|
||||
<Parameters Name="DebugCWD">.</Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="HostApplication">D:\cvs\c5\Debug_Build\cryptest_bds.exe</Parameters>
|
||||
<Parameters Name="RemoteHost"></Parameters>
|
||||
<Parameters Name="RemotePath"></Parameters>
|
||||
<Parameters Name="RemoteParams"></Parameters>
|
||||
|
@ -14,7 +14,7 @@
|
||||
</Source>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="active" value="1"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
@ -45,14 +45,19 @@
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.wccc.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.wrch.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
|
||||
@ -70,6 +75,10 @@
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.A.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.AK.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.AU.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
@ -86,10 +95,14 @@
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Op.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Ov.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Oz.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.k.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.vi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.wccc.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.wrch.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
|
||||
@ -227,7 +240,6 @@
|
||||
<FILE FILENAME="gfpcrypt.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="gfpcrypt" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="gost.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="gost" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="gzip.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="gzip" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="haval.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="haval" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="hex.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="hex" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="hmac.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="hmac" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="hrtimer.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="hrtimer" FORMNAME="" DESIGNCLASS=""/>
|
||||
@ -241,7 +253,6 @@
|
||||
<FILE FILENAME="md2.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="md2" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="md4.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="md4" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="md5.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="md5" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="md5mac.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="md5mac" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="misc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="misc" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="modes.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="modes" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="mqueue.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="mqueue" FORMNAME="" DESIGNCLASS=""/>
|
||||
@ -267,7 +278,6 @@
|
||||
<FILE FILENAME="rsa.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="rsa" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="rw.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="rw" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="safer.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="safer" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="salsa.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="salsa" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="seal.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="seal" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="serpent.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="serpent" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="sha.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="sha" FORMNAME="" DESIGNCLASS=""/>
|
||||
@ -296,6 +306,10 @@
|
||||
<FILE FILENAME="zdeflate.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="zdeflate" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="zinflate.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="zinflate" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="randpool.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="randpool" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="cpu.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="cpu" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="salsa.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="salsa" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="sosemanuk.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="sosemanuk" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="vmac.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="vmac" FORMNAME="" DESIGNCLASS=""/>
|
||||
</FILELIST>
|
||||
<IDEOPTIONS>
|
||||
<VersionInfo>
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "hrtimer.h"
|
||||
#include "misc.h"
|
||||
#include <stddef.h> // for NULL
|
||||
#include <time.h>
|
||||
|
||||
#if defined(CRYPTOPP_WIN32_AVAILABLE)
|
||||
#include <windows.h>
|
||||
|
@ -359,15 +359,16 @@ void Panama<B>::Iterate(size_t count, const word32 *p, word32 *z, const word32 *
|
||||
m_state[17] = bstart;
|
||||
}
|
||||
|
||||
namespace Weak {
|
||||
template <class B>
|
||||
size_t Weak::PanamaHash<B>::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
size_t PanamaHash<B>::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
this->Iterate(length / this->BLOCKSIZE, input);
|
||||
return length % this->BLOCKSIZE;
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void Weak::PanamaHash<B>::TruncatedFinal(byte *hash, size_t size)
|
||||
void PanamaHash<B>::TruncatedFinal(byte *hash, size_t size)
|
||||
{
|
||||
this->ThrowIfInvalidTruncatedSize(size);
|
||||
|
||||
@ -384,6 +385,7 @@ void Weak::PanamaHash<B>::TruncatedFinal(byte *hash, size_t size)
|
||||
|
||||
this->Restart(); // reinit for next use
|
||||
}
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void PanamaCipherPolicy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
|
||||
|
24
secblock.h
24
secblock.h
@ -116,17 +116,9 @@ public:
|
||||
CallNewHandler();
|
||||
|
||||
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
assert(IsAlignedOn(p, 8));
|
||||
if (IsAlignedOn(p, 16))
|
||||
{
|
||||
p += 16/sizeof(T);
|
||||
((int *)p)[-1] = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
p += 8/sizeof(T);
|
||||
((int *)p)[-1] = 8;
|
||||
}
|
||||
size_t adjustment = 16-((size_t)p%16);
|
||||
p += adjustment;
|
||||
p[-1] = (byte)adjustment;
|
||||
#endif
|
||||
|
||||
assert(IsAlignedOn(p, 16));
|
||||
@ -148,7 +140,7 @@ public:
|
||||
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
_mm_free(p);
|
||||
#elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
|
||||
p = ((byte *)p) - ((int *)p)[-1]/sizeof(T);
|
||||
p = (byte *)p - ((byte *)p)[-1];
|
||||
free(p);
|
||||
#else
|
||||
free(p);
|
||||
@ -269,9 +261,13 @@ public:
|
||||
size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);}
|
||||
|
||||
private:
|
||||
#ifdef __BORLANDC__
|
||||
T* GetAlignedArray() {return m_array;}
|
||||
T m_array[S];
|
||||
#else
|
||||
T* GetAlignedArray() {return T_Align16 ? (T*)(((byte *)m_array) + (0-(size_t)m_array)%16) : m_array;}
|
||||
|
||||
CRYPTOPP_ALIGN_DATA(8) T m_array[T_Align16 ? S+8/sizeof(T) : S];
|
||||
#endif
|
||||
A m_fallbackAllocator;
|
||||
bool m_allocated;
|
||||
};
|
||||
@ -286,7 +282,7 @@ public:
|
||||
typedef typename A::const_pointer const_iterator;
|
||||
typedef typename A::size_type size_type;
|
||||
|
||||
explicit SecBlock(size_type size=0)
|
||||
explicit SecBlock(size_type size=0)
|
||||
: m_size(size) {m_ptr = m_alloc.allocate(size, NULL);}
|
||||
SecBlock(const SecBlock<T, A> &t)
|
||||
: m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));}
|
||||
|
16
vmac.cpp
16
vmac.cpp
@ -13,12 +13,17 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
#endif
|
||||
|
||||
#define VMAC_BOOL_WORD128 (defined(CRYPTOPP_WORD128_AVAILABLE) && !defined(CRYPTOPP_X64_ASM_AVAILABLE))
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#define const // Turbo C++ 2006 workaround
|
||||
#endif
|
||||
static const word64 p64 = W64LIT(0xfffffffffffffeff); /* 2^64 - 257 prime */
|
||||
static const word64 m62 = W64LIT(0x3fffffffffffffff); /* 62-bit mask */
|
||||
static const word64 m63 = W64LIT(0x7fffffffffffffff); /* 63-bit mask */
|
||||
static const word64 m64 = W64LIT(0xffffffffffffffff); /* 64-bit mask */
|
||||
static const word64 mpoly = W64LIT(0x1fffffff1fffffff); /* Poly key mask */
|
||||
#ifdef __BORLANDC__
|
||||
#undef const
|
||||
#endif
|
||||
#if VMAC_BOOL_WORD128
|
||||
static const word128 m126 = (word128(m62)<<64)|m64; /* 126-bit mask */
|
||||
#endif
|
||||
@ -55,7 +60,7 @@ void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
||||
}
|
||||
|
||||
/* Fill poly key */
|
||||
in[0] = 0xC0;
|
||||
in[0] = 0xC0;
|
||||
in[15] = 0;
|
||||
for (i = 0; i <= (size_t)m_is128; i++)
|
||||
{
|
||||
@ -68,14 +73,15 @@ void VMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
||||
/* Fill ip key */
|
||||
in[0] = 0xE0;
|
||||
in[15] = 0;
|
||||
word64 *l3Key = m_l3Key();
|
||||
for (i = 0; i <= (size_t)m_is128; i++)
|
||||
do
|
||||
{
|
||||
cipher.ProcessBlock(in, out.BytePtr());
|
||||
m_l3Key()[i*2+0] = GetWord<word64>(true, BIG_ENDIAN_ORDER, out.BytePtr());
|
||||
m_l3Key()[i*2+1] = GetWord<word64>(true, BIG_ENDIAN_ORDER, out.BytePtr()+8);
|
||||
l3Key[i*2+0] = GetWord<word64>(true, BIG_ENDIAN_ORDER, out.BytePtr());
|
||||
l3Key[i*2+1] = GetWord<word64>(true, BIG_ENDIAN_ORDER, out.BytePtr()+8);
|
||||
in[15]++;
|
||||
} while ((m_l3Key()[0] >= p64) || (m_l3Key()[1] >= p64));
|
||||
} while ((l3Key[i*2+0] >= p64) || (l3Key[i*2+1] >= p64));
|
||||
|
||||
m_padCached = false;
|
||||
Resynchronize(GetIVAndThrowIfInvalid(params));
|
||||
|
Loading…
Reference in New Issue
Block a user