mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
port to GCC 4
This commit is contained in:
parent
946eb7f0f4
commit
09bb1aab64
@ -278,4 +278,8 @@ protected:
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||
#include "algebra.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
2
base32.h
2
base32.h
@ -30,7 +30,7 @@ public:
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||
|
||||
private:
|
||||
static const int *GetDefaultDecodingLookupArray();
|
||||
static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
2
base64.h
2
base64.h
@ -28,7 +28,7 @@ public:
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters) {}
|
||||
|
||||
private:
|
||||
static const int *GetDecodingLookupArray();
|
||||
static const int * CRYPTOPP_API GetDecodingLookupArray();
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
|
||||
|
||||
static void InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);
|
||||
static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);
|
||||
|
||||
private:
|
||||
const int *m_lookup;
|
||||
|
20
config.h
20
config.h
@ -284,20 +284,28 @@ NAMESPACE_END
|
||||
|
||||
#endif // CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||
#elif defined(__MWERKS__)
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
|
||||
#elif defined(__MWERKS__)
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern class
|
||||
#else
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern template class
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
2
dh.h
2
dh.h
@ -76,7 +76,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static std::string StaticAlgorithmName()
|
||||
static std::string CRYPTOPP_API StaticAlgorithmName()
|
||||
{return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
|
||||
std::string AlgorithmName() const {return StaticAlgorithmName();}
|
||||
|
||||
|
25
dll.cpp
25
dll.cpp
@ -6,37 +6,14 @@
|
||||
#include "dll.h"
|
||||
#pragma warning(default: 4660)
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
#if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "iterhash.cpp"
|
||||
#include "strciphr.cpp"
|
||||
#include "algebra.cpp"
|
||||
#include "eprecomp.cpp"
|
||||
#include "eccrypto.cpp"
|
||||
|
||||
#ifndef CRYPTOPP_IMPORTS
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#ifdef __MWERKS__
|
||||
// CodeWarrior 8 workaround: explicit instantiations have to appear after member function definitions
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain<Integer>;
|
||||
#endif
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if 0
|
||||
static void ECDSA_TestInstantiations()
|
||||
{
|
||||
ECDSA<EC2N>::Signer t1;
|
||||
|
52
eccrypto.h
52
eccrypto.h
@ -93,7 +93,7 @@ public:
|
||||
Integer GetMaxExponent() const {return GetSubgroupOrder()-1;}
|
||||
bool IsIdentity(const Element &element) const {return element.identity;}
|
||||
void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const;
|
||||
static std::string StaticAlgorithmNamePrefix() {return "EC";}
|
||||
static std::string CRYPTOPP_API StaticAlgorithmNamePrefix() {return "EC";}
|
||||
|
||||
// ASN1Key
|
||||
OID GetAlgorithmID() const;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
// non-inherited
|
||||
|
||||
// enumerate OIDs for recommended parameters, use OID() to get first one
|
||||
static OID GetNextRecommendedParametersOID(const OID &oid);
|
||||
static OID CRYPTOPP_API GetNextRecommendedParametersOID(const OID &oid);
|
||||
|
||||
void BERDecode(BufferedTransformation &bt);
|
||||
void DEREncode(BufferedTransformation &bt) const;
|
||||
@ -137,11 +137,6 @@ protected:
|
||||
mutable Integer m_k; // cofactor
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<EC2N> >;
|
||||
|
||||
//! EC public key
|
||||
template <class EC>
|
||||
class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
|
||||
@ -159,11 +154,6 @@ public:
|
||||
void DEREncodeKey(BufferedTransformation &bt) const;
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<EC2N> >;
|
||||
|
||||
//! EC private key
|
||||
template <class EC>
|
||||
class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
|
||||
@ -185,9 +175,6 @@ public:
|
||||
void DEREncodeKey(BufferedTransformation &bt) const;
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<EC2N>;
|
||||
|
||||
//! Elliptic Curve Diffie-Hellman, AKA <a href="http://www.weidai.com/scan-mirror/ka.html#ECDH">ECDH</a>
|
||||
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption>
|
||||
struct ECDH
|
||||
@ -221,15 +208,12 @@ struct DL_Keys_ECDSA
|
||||
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC>, ECDSA<EC> > PrivateKey;
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<ECP::Point>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<EC2N::Point>;
|
||||
|
||||
//! ECDSA algorithm
|
||||
template <class EC>
|
||||
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
|
||||
{
|
||||
public:
|
||||
static const char * StaticAlgorithmName() {return "ECDSA";}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
|
||||
};
|
||||
|
||||
//! ECNR algorithm
|
||||
@ -237,7 +221,7 @@ template <class EC>
|
||||
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
|
||||
{
|
||||
public:
|
||||
static const char * StaticAlgorithmName() {return "ECNR";}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECNR";}
|
||||
};
|
||||
|
||||
//! <a href="http://www.weidai.com/scan-mirror/sig.html#ECDSA">ECDSA</a>
|
||||
@ -246,9 +230,6 @@ struct ECDSA : public DL_SS<DL_Keys_ECDSA<EC>, DL_Algorithm_ECDSA<EC>, DL_Signat
|
||||
{
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<ECP>, ECDSA<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC2N>, ECDSA<EC2N> >;
|
||||
|
||||
//! ECNR
|
||||
template <class EC, class H = SHA>
|
||||
struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H>
|
||||
@ -268,9 +249,32 @@ struct ECIES
|
||||
DL_EncryptionAlgorithm_Xor<HMAC<SHA1>, DHAES_MODE>,
|
||||
ECIES<EC> >
|
||||
{
|
||||
static std::string StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized
|
||||
static std::string CRYPTOPP_API StaticAlgorithmName() {return "ECIES";} // TODO: fix this after name is standardized
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||
#include "eccrypto.cpp"
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<EC2N> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<EC2N> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<ECP>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_EC<EC2N>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<ECP::Point>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<EC2N::Point>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<ECP>, ECDSA<ECP> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC2N>, ECDSA<EC2N> >;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
@ -66,4 +66,8 @@ private:
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||
#include "eprecomp.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
16
gf2n.h
16
gf2n.h
@ -56,18 +56,18 @@ public:
|
||||
{Randomize(rng, bitcount);}
|
||||
|
||||
//! return x^i
|
||||
static PolynomialMod2 Monomial(size_t i);
|
||||
static PolynomialMod2 CRYPTOPP_API Monomial(size_t i);
|
||||
//! return x^t0 + x^t1 + x^t2
|
||||
static PolynomialMod2 Trinomial(size_t t0, size_t t1, size_t t2);
|
||||
static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2);
|
||||
//! return x^t0 + x^t1 + x^t2 + x^t3 + x^t4
|
||||
static PolynomialMod2 Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4);
|
||||
static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4);
|
||||
//! return x^(n-1) + ... + x + 1
|
||||
static PolynomialMod2 AllOnes(size_t n);
|
||||
static PolynomialMod2 CRYPTOPP_API AllOnes(size_t n);
|
||||
|
||||
//!
|
||||
static const PolynomialMod2 &Zero();
|
||||
static const PolynomialMod2 & CRYPTOPP_API Zero();
|
||||
//!
|
||||
static const PolynomialMod2 &One();
|
||||
static const PolynomialMod2 & CRYPTOPP_API One();
|
||||
//@}
|
||||
|
||||
//! \name ENCODE/DECODE
|
||||
@ -216,12 +216,12 @@ public:
|
||||
PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();}
|
||||
|
||||
//! greatest common divisor
|
||||
static PolynomialMod2 Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n);
|
||||
static PolynomialMod2 CRYPTOPP_API Gcd(const PolynomialMod2 &a, const PolynomialMod2 &n);
|
||||
//! calculate multiplicative inverse of *this mod n
|
||||
PolynomialMod2 InverseMod(const PolynomialMod2 &) const;
|
||||
|
||||
//! calculate r and q such that (a == d*q + r) && (deg(r) < deg(d))
|
||||
static void Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d);
|
||||
static void CRYPTOPP_API Divide(PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d);
|
||||
//@}
|
||||
|
||||
//! \name INPUT/OUTPUT
|
||||
|
2
hex.h
2
hex.h
@ -28,7 +28,7 @@ public:
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||
|
||||
private:
|
||||
static const int *GetDefaultDecodingLookupArray();
|
||||
static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
@ -108,6 +108,8 @@ void AlignedAllocator<T>::deallocate(void *p, size_type n)
|
||||
else
|
||||
delete [] (T *)p;
|
||||
}
|
||||
|
||||
template class CRYPTOPP_DLL AlignedAllocator<word>;
|
||||
#endif
|
||||
|
||||
static int Compare(const word *A, const word *B, size_t N)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#endif
|
||||
|
||||
// SSE2 intrinsics work in GCC 3.3 or later
|
||||
#if defined(__SSE2__) && (__GNUC_MAJOR__ > 3 || __GNUC_MINOR__ > 2)
|
||||
#if defined(__SSE2__) && (__GNUC__ > 3 || __GNUC_MINOR__ > 2)
|
||||
#define SSE2_INTRINSICS_AVAILABLE
|
||||
#endif
|
||||
|
||||
@ -56,7 +56,10 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
#endif
|
||||
};
|
||||
|
||||
template class CRYPTOPP_DLL AlignedAllocator<word>;
|
||||
#ifdef CRYPTOPP_IMPORTS
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator<word>;
|
||||
#endif
|
||||
|
||||
typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
|
||||
#else
|
||||
typedef SecWordBlock SecAlignedWordBlock;
|
||||
|
24
iterhash.h
24
iterhash.h
@ -54,14 +54,6 @@ private:
|
||||
T m_countLo, m_countHi;
|
||||
};
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>;
|
||||
#endif
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
|
||||
|
||||
//! _
|
||||
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, class T_Base = HashTransformation>
|
||||
class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase<T_HashWordType, T_Base>
|
||||
@ -105,4 +97,20 @@ protected:
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||
#include "iterhash.cpp"
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#ifdef WORD64_AVAILABLE
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>;
|
||||
#endif
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
|
||||
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
@ -126,8 +126,8 @@ void BlockingRng::GenerateBlock(byte *output, size_t size)
|
||||
{
|
||||
// on some systems /dev/random will block until all bytes
|
||||
// are available, on others it will returns immediately
|
||||
int len = read(m_fd, output, STDMIN(size, (unsigned int)INT_MAX));
|
||||
if (len == -1)
|
||||
ssize_t len = read(m_fd, output, size);
|
||||
if (len < 0)
|
||||
throw OS_RNG_Err("read /dev/random");
|
||||
size -= len;
|
||||
output += len;
|
||||
|
4
osrng.h
4
osrng.h
@ -112,8 +112,6 @@ private:
|
||||
unsigned int m_counter;
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
|
||||
|
||||
template <class BLOCK_CIPHER>
|
||||
void AutoSeededX917RNG<BLOCK_CIPHER>::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector)
|
||||
{
|
||||
@ -161,6 +159,8 @@ byte AutoSeededX917RNG<BLOCK_CIPHER>::GenerateByte()
|
||||
return b;
|
||||
}
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
20
sha.h
20
sha.h
@ -9,8 +9,8 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
|
||||
{
|
||||
public:
|
||||
static void InitState(HashWordType *state);
|
||||
static void Transform(word32 *digest, const word32 *data);
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
|
||||
};
|
||||
|
||||
@ -20,8 +20,8 @@ typedef SHA1 SHA; // for backwards compatibility
|
||||
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256>
|
||||
{
|
||||
public:
|
||||
static void InitState(HashWordType *state);
|
||||
static void Transform(word32 *digest, const word32 *data);
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
|
||||
|
||||
protected:
|
||||
@ -32,8 +32,8 @@ protected:
|
||||
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28>
|
||||
{
|
||||
public:
|
||||
static void InitState(HashWordType *state);
|
||||
static void Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
|
||||
};
|
||||
|
||||
@ -43,8 +43,8 @@ public:
|
||||
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512>
|
||||
{
|
||||
public:
|
||||
static void InitState(HashWordType *state);
|
||||
static void Transform(word64 *digest, const word64 *data);
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
|
||||
|
||||
protected:
|
||||
@ -55,8 +55,8 @@ protected:
|
||||
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
|
||||
{
|
||||
public:
|
||||
static void InitState(HashWordType *state);
|
||||
static void Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
//! _
|
||||
struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
|
||||
{
|
||||
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "SKIPJACK";}
|
||||
CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return "SKIPJACK";}
|
||||
};
|
||||
|
||||
/// <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
|
||||
|
22
strciphr.h
22
strciphr.h
@ -146,10 +146,6 @@ protected:
|
||||
size_t m_leftOver;
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases<SymmetricCipher, RandomNumberGenerator>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
|
||||
|
||||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_CipherAbstractPolicy
|
||||
{
|
||||
public:
|
||||
@ -263,11 +259,6 @@ public:
|
||||
unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();}
|
||||
};
|
||||
|
||||
// for Darwin
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;
|
||||
|
||||
//! _
|
||||
template <class BASE, class INFO = BASE>
|
||||
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
|
||||
@ -316,4 +307,17 @@ void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs ¶ms, con
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||
#include "strciphr.cpp"
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases<SymmetricCipher, RandomNumberGenerator>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder<AdditiveCipherAbstractPolicy, TwoBases<SymmetricCipher, RandomNumberGenerator> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, SymmetricCipher> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user