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
|
NAMESPACE_END
|
||||||
|
|
||||||
|
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||||
|
#include "algebra.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2
base32.h
2
base32.h
@ -30,7 +30,7 @@ public:
|
|||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int *GetDefaultDecodingLookupArray();
|
static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
2
base64.h
2
base64.h
@ -28,7 +28,7 @@ public:
|
|||||||
void IsolatedInitialize(const NameValuePairs ¶meters) {}
|
void IsolatedInitialize(const NameValuePairs ¶meters) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int *GetDecodingLookupArray();
|
static const int * CRYPTOPP_API GetDecodingLookupArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);
|
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:
|
private:
|
||||||
const int *m_lookup;
|
const int *m_lookup;
|
||||||
|
20
config.h
20
config.h
@ -284,20 +284,28 @@ NAMESPACE_END
|
|||||||
|
|
||||||
#endif // CRYPTOPP_WIN32_AVAILABLE
|
#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)
|
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
|
||||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||||
#elif defined(__MWERKS__)
|
|
||||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
|
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
|
||||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
|
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
|
||||||
#elif defined(__MWERKS__)
|
|
||||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern class
|
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern template class
|
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#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();}
|
{return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
|
||||||
std::string AlgorithmName() const {return StaticAlgorithmName();}
|
std::string AlgorithmName() const {return StaticAlgorithmName();}
|
||||||
|
|
||||||
|
25
dll.cpp
25
dll.cpp
@ -6,37 +6,14 @@
|
|||||||
#include "dll.h"
|
#include "dll.h"
|
||||||
#pragma warning(default: 4660)
|
#pragma warning(default: 4660)
|
||||||
|
|
||||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
#if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "iterhash.cpp"
|
|
||||||
#include "strciphr.cpp"
|
|
||||||
#include "algebra.cpp"
|
|
||||||
#include "eprecomp.cpp"
|
|
||||||
#include "eccrypto.cpp"
|
|
||||||
|
|
||||||
#ifndef CRYPTOPP_IMPORTS
|
#ifndef CRYPTOPP_IMPORTS
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
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 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);
|
template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if 0
|
||||||
static void ECDSA_TestInstantiations()
|
static void ECDSA_TestInstantiations()
|
||||||
{
|
{
|
||||||
ECDSA<EC2N>::Signer t1;
|
ECDSA<EC2N>::Signer t1;
|
||||||
|
52
eccrypto.h
52
eccrypto.h
@ -93,7 +93,7 @@ public:
|
|||||||
Integer GetMaxExponent() const {return GetSubgroupOrder()-1;}
|
Integer GetMaxExponent() const {return GetSubgroupOrder()-1;}
|
||||||
bool IsIdentity(const Element &element) const {return element.identity;}
|
bool IsIdentity(const Element &element) const {return element.identity;}
|
||||||
void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const;
|
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
|
// ASN1Key
|
||||||
OID GetAlgorithmID() const;
|
OID GetAlgorithmID() const;
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
// non-inherited
|
// non-inherited
|
||||||
|
|
||||||
// enumerate OIDs for recommended parameters, use OID() to get first one
|
// 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 BERDecode(BufferedTransformation &bt);
|
||||||
void DEREncode(BufferedTransformation &bt) const;
|
void DEREncode(BufferedTransformation &bt) const;
|
||||||
@ -137,11 +137,6 @@ protected:
|
|||||||
mutable Integer m_k; // cofactor
|
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
|
//! EC public key
|
||||||
template <class EC>
|
template <class EC>
|
||||||
class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
|
class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
|
||||||
@ -159,11 +154,6 @@ public:
|
|||||||
void DEREncodeKey(BufferedTransformation &bt) const;
|
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
|
//! EC private key
|
||||||
template <class EC>
|
template <class EC>
|
||||||
class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
|
class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
|
||||||
@ -185,9 +175,6 @@ public:
|
|||||||
void DEREncodeKey(BufferedTransformation &bt) const;
|
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>
|
//! 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>
|
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption>
|
||||||
struct ECDH
|
struct ECDH
|
||||||
@ -221,15 +208,12 @@ struct DL_Keys_ECDSA
|
|||||||
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_EC<EC>, ECDSA<EC> > PrivateKey;
|
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
|
//! ECDSA algorithm
|
||||||
template <class EC>
|
template <class EC>
|
||||||
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
|
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const char * StaticAlgorithmName() {return "ECDSA";}
|
static const char * CRYPTOPP_API StaticAlgorithmName() {return "ECDSA";}
|
||||||
};
|
};
|
||||||
|
|
||||||
//! ECNR algorithm
|
//! ECNR algorithm
|
||||||
@ -237,7 +221,7 @@ template <class EC>
|
|||||||
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
|
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
|
||||||
{
|
{
|
||||||
public:
|
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>
|
//! <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
|
//! ECNR
|
||||||
template <class EC, class H = SHA>
|
template <class EC, class H = SHA>
|
||||||
struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H>
|
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>,
|
DL_EncryptionAlgorithm_Xor<HMAC<SHA1>, DHAES_MODE>,
|
||||||
ECIES<EC> >
|
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
|
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
|
#endif
|
||||||
|
@ -66,4 +66,8 @@ private:
|
|||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
|
#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
|
||||||
|
#include "eprecomp.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
16
gf2n.h
16
gf2n.h
@ -56,18 +56,18 @@ public:
|
|||||||
{Randomize(rng, bitcount);}
|
{Randomize(rng, bitcount);}
|
||||||
|
|
||||||
//! return x^i
|
//! return x^i
|
||||||
static PolynomialMod2 Monomial(size_t i);
|
static PolynomialMod2 CRYPTOPP_API Monomial(size_t i);
|
||||||
//! return x^t0 + x^t1 + x^t2
|
//! 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
|
//! 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
|
//! 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
|
//! \name ENCODE/DECODE
|
||||||
@ -216,12 +216,12 @@ public:
|
|||||||
PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();}
|
PolynomialMod2 MultiplicativeInverse() const {return IsUnit() ? One() : Zero();}
|
||||||
|
|
||||||
//! greatest common divisor
|
//! 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
|
//! calculate multiplicative inverse of *this mod n
|
||||||
PolynomialMod2 InverseMod(const PolynomialMod2 &) const;
|
PolynomialMod2 InverseMod(const PolynomialMod2 &) const;
|
||||||
|
|
||||||
//! calculate r and q such that (a == d*q + r) && (deg(r) < deg(d))
|
//! 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
|
//! \name INPUT/OUTPUT
|
||||||
|
2
hex.h
2
hex.h
@ -28,7 +28,7 @@ public:
|
|||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int *GetDefaultDecodingLookupArray();
|
static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
@ -108,6 +108,8 @@ void AlignedAllocator<T>::deallocate(void *p, size_type n)
|
|||||||
else
|
else
|
||||||
delete [] (T *)p;
|
delete [] (T *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class CRYPTOPP_DLL AlignedAllocator<word>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int Compare(const word *A, const word *B, size_t N)
|
static int Compare(const word *A, const word *B, size_t N)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SSE2 intrinsics work in GCC 3.3 or later
|
// 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
|
#define SSE2_INTRINSICS_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,7 +56,10 @@ NAMESPACE_BEGIN(CryptoPP)
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template class CRYPTOPP_DLL AlignedAllocator<word>;
|
#ifdef CRYPTOPP_IMPORTS
|
||||||
|
CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator<word>;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
|
typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
|
||||||
#else
|
#else
|
||||||
typedef SecWordBlock SecAlignedWordBlock;
|
typedef SecWordBlock SecAlignedWordBlock;
|
||||||
|
24
iterhash.h
24
iterhash.h
@ -54,14 +54,6 @@ private:
|
|||||||
T m_countLo, m_countHi;
|
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>
|
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>
|
class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase<T_HashWordType, T_Base>
|
||||||
@ -105,4 +97,20 @@ protected:
|
|||||||
|
|
||||||
NAMESPACE_END
|
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
|
#endif
|
||||||
|
@ -126,8 +126,8 @@ void BlockingRng::GenerateBlock(byte *output, size_t size)
|
|||||||
{
|
{
|
||||||
// on some systems /dev/random will block until all bytes
|
// on some systems /dev/random will block until all bytes
|
||||||
// are available, on others it will returns immediately
|
// are available, on others it will returns immediately
|
||||||
int len = read(m_fd, output, STDMIN(size, (unsigned int)INT_MAX));
|
ssize_t len = read(m_fd, output, size);
|
||||||
if (len == -1)
|
if (len < 0)
|
||||||
throw OS_RNG_Err("read /dev/random");
|
throw OS_RNG_Err("read /dev/random");
|
||||||
size -= len;
|
size -= len;
|
||||||
output += len;
|
output += len;
|
||||||
|
4
osrng.h
4
osrng.h
@ -112,8 +112,6 @@ private:
|
|||||||
unsigned int m_counter;
|
unsigned int m_counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
|
|
||||||
|
|
||||||
template <class BLOCK_CIPHER>
|
template <class BLOCK_CIPHER>
|
||||||
void AutoSeededX917RNG<BLOCK_CIPHER>::Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector)
|
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;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CRYPTOPP_DLL_TEMPLATE_CLASS AutoSeededX917RNG<DES_EDE3>;
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
#endif
|
#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>
|
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitState(HashWordType *state);
|
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||||
static void Transform(word32 *digest, const word32 *data);
|
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
|
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>
|
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitState(HashWordType *state);
|
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||||
static void Transform(word32 *digest, const word32 *data);
|
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
|
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -32,8 +32,8 @@ protected:
|
|||||||
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28>
|
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitState(HashWordType *state);
|
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||||
static void Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
|
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>
|
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitState(HashWordType *state);
|
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||||
static void Transform(word64 *digest, const word64 *data);
|
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
|
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -55,8 +55,8 @@ protected:
|
|||||||
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
|
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void InitState(HashWordType *state);
|
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||||
static void Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
|
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>
|
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>
|
/// <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;
|
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
|
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_CipherAbstractPolicy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -263,11 +259,6 @@ public:
|
|||||||
unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();}
|
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>
|
template <class BASE, class INFO = BASE>
|
||||||
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
|
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
|
||||||
@ -316,4 +307,17 @@ void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs ¶ms, con
|
|||||||
|
|
||||||
NAMESPACE_END
|
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
|
#endif
|
||||||
|
2
test.cpp
2
test.cpp
@ -85,7 +85,7 @@ int (*AdhocTest)(int argc, char *argv[]) = NULL;
|
|||||||
#ifdef __BCPLUSPLUS__
|
#ifdef __BCPLUSPLUS__
|
||||||
int cmain(int argc, char *argv[])
|
int cmain(int argc, char *argv[])
|
||||||
#else
|
#else
|
||||||
int main(int argc, char *argv[])
|
int __cdecl main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _CRTDBG_LEAK_CHECK_DF
|
#ifdef _CRTDBG_LEAK_CHECK_DF
|
||||||
|
Loading…
Reference in New Issue
Block a user