mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Removed "typedef SHA1 SHA" (Issue 369)
This should have happened when we removed most of MAINTAIN_BACKWARDS_COMPATIBILITY artifacts. Its not practical move SHA1 into Weak:: namespace or "typedef SHA256 SHA" because SHA1 is too intertwined at the moment. In the interim, maybe we can place SHA1 in both CryptoPP:: and Weak:: namespaces. This will allow us to transition into Weak::SHA1 over time, and signal to users SHA1 should be avoided.
This commit is contained in:
parent
64f1b50b7f
commit
2297dd000a
58
bench2.cpp
58
bench2.cpp
@ -246,40 +246,40 @@ void Benchmark3(double t, double hertz)
|
||||
|
||||
std::cout << "\n<TBODY style=\"background: white;\">";
|
||||
{
|
||||
BenchMarkCrypto<RSAES<OAEP<SHA> > >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
|
||||
BenchMarkCrypto<LUCES<OAEP<SHA> > >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
|
||||
BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
|
||||
BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
|
||||
BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie1024.dat", "DLIES 1024", t);
|
||||
BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc512.dat", "LUCELG 512", t);
|
||||
}
|
||||
|
||||
std::cout << "\n<TBODY style=\"background: yellow;\">";
|
||||
{
|
||||
BenchMarkCrypto<RSAES<OAEP<SHA> > >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
|
||||
BenchMarkCrypto<LUCES<OAEP<SHA> > >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
|
||||
BenchMarkCrypto<RSAES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
|
||||
BenchMarkCrypto<LUCES<OAEP<SHA1> > >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
|
||||
BenchMarkCrypto<DLIES<> >(CRYPTOPP_DATA_DIR "TestData/dlie2048.dat", "DLIES 2048", t);
|
||||
BenchMarkCrypto<LUC_IES<> >(CRYPTOPP_DATA_DIR "TestData/lucc1024.dat", "LUCELG 1024", t);
|
||||
}
|
||||
|
||||
std::cout << "\n<TBODY style=\"background: white;\">";
|
||||
{
|
||||
BenchMarkSignature<RSASS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
|
||||
BenchMarkSignature<RWSS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/rw1024.dat", "RW 1024", t);
|
||||
BenchMarkSignature<LUCSS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
|
||||
BenchMarkSignature<NR<SHA> >(CRYPTOPP_DATA_DIR "TestData/nr1024.dat", "NR 1024", t);
|
||||
BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
|
||||
BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw1024.dat", "RW 1024", t);
|
||||
BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
|
||||
BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr1024.dat", "NR 1024", t);
|
||||
BenchMarkSignature<DSA>(CRYPTOPP_DATA_DIR "TestData/dsa1024.dat", "DSA 1024", t);
|
||||
BenchMarkSignature<LUC_HMP<SHA> >(CRYPTOPP_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t);
|
||||
BenchMarkSignature<ESIGN<SHA> >(CRYPTOPP_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t);
|
||||
BenchMarkSignature<ESIGN<SHA> >(CRYPTOPP_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t);
|
||||
BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t);
|
||||
BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t);
|
||||
BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t);
|
||||
}
|
||||
|
||||
std::cout << "\n<TBODY style=\"background: yellow;\">";
|
||||
{
|
||||
BenchMarkSignature<RSASS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
|
||||
BenchMarkSignature<RWSS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/rw2048.dat", "RW 2048", t);
|
||||
BenchMarkSignature<LUCSS<PSSR, SHA> >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
|
||||
BenchMarkSignature<NR<SHA> >(CRYPTOPP_DATA_DIR "TestData/nr2048.dat", "NR 2048", t);
|
||||
BenchMarkSignature<LUC_HMP<SHA> >(CRYPTOPP_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t);
|
||||
BenchMarkSignature<ESIGN<SHA> >(CRYPTOPP_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t);
|
||||
BenchMarkSignature<RSASS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
|
||||
BenchMarkSignature<RWSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/rw2048.dat", "RW 2048", t);
|
||||
BenchMarkSignature<LUCSS<PSSR, SHA1> >(CRYPTOPP_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
|
||||
BenchMarkSignature<NR<SHA1> >(CRYPTOPP_DATA_DIR "TestData/nr2048.dat", "NR 2048", t);
|
||||
BenchMarkSignature<LUC_HMP<SHA1> >(CRYPTOPP_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t);
|
||||
BenchMarkSignature<ESIGN<SHA1> >(CRYPTOPP_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t);
|
||||
}
|
||||
|
||||
std::cout << "\n<TBODY style=\"background: white;\">";
|
||||
@ -310,12 +310,12 @@ void Benchmark3(double t, double hertz)
|
||||
{
|
||||
ECIES<ECP>::Decryptor cpriv(Test::GlobalRNG(), ASN1::secp256k1());
|
||||
ECIES<ECP>::Encryptor cpub(cpriv);
|
||||
ECDSA<ECP, SHA>::Signer spriv(cpriv);
|
||||
ECDSA<ECP, SHA>::Verifier spub(spriv);
|
||||
ECDSA_RFC6979<ECP, SHA>::Signer spriv2(cpriv);
|
||||
ECDSA_RFC6979<ECP, SHA>::Verifier spub2(spriv);
|
||||
ECGDSA<ECP, SHA>::Signer spriv3(Test::GlobalRNG(), ASN1::secp256k1());
|
||||
ECGDSA<ECP, SHA>::Verifier spub3(spriv3);
|
||||
ECDSA<ECP, SHA1>::Signer spriv(cpriv);
|
||||
ECDSA<ECP, SHA1>::Verifier spub(spriv);
|
||||
ECDSA_RFC6979<ECP, SHA1>::Signer spriv2(cpriv);
|
||||
ECDSA_RFC6979<ECP, SHA1>::Verifier spub2(spriv);
|
||||
ECGDSA<ECP, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::secp256k1());
|
||||
ECGDSA<ECP, SHA1>::Verifier spub3(spriv3);
|
||||
ECDH<ECP>::Domain ecdhc(ASN1::secp256k1());
|
||||
ECMQV<ECP>::Domain ecmqvc(ASN1::secp256k1());
|
||||
|
||||
@ -337,12 +337,12 @@ void Benchmark3(double t, double hertz)
|
||||
{
|
||||
ECIES<EC2N>::Decryptor cpriv(Test::GlobalRNG(), ASN1::sect233r1());
|
||||
ECIES<EC2N>::Encryptor cpub(cpriv);
|
||||
ECDSA<EC2N, SHA>::Signer spriv(cpriv);
|
||||
ECDSA<EC2N, SHA>::Verifier spub(spriv);
|
||||
ECDSA_RFC6979<EC2N, SHA>::Signer spriv2(cpriv);
|
||||
ECDSA_RFC6979<EC2N, SHA>::Verifier spub2(spriv);
|
||||
ECGDSA<EC2N, SHA>::Signer spriv3(Test::GlobalRNG(), ASN1::sect233r1());
|
||||
ECGDSA<EC2N, SHA>::Verifier spub3(spriv3);
|
||||
ECDSA<EC2N, SHA1>::Signer spriv(cpriv);
|
||||
ECDSA<EC2N, SHA1>::Verifier spub(spriv);
|
||||
ECDSA_RFC6979<EC2N, SHA1>::Signer spriv2(cpriv);
|
||||
ECDSA_RFC6979<EC2N, SHA1>::Verifier spub2(spriv);
|
||||
ECGDSA<EC2N, SHA1>::Signer spriv3(Test::GlobalRNG(), ASN1::sect233r1());
|
||||
ECGDSA<EC2N, SHA1>::Verifier spub3(spriv3);
|
||||
ECDH<EC2N>::Domain ecdhc(ASN1::sect233r1());
|
||||
ECMQV<EC2N>::Domain ecmqvc(ASN1::sect233r1());
|
||||
|
||||
|
@ -19,7 +19,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
//! \brief Legacy block cipher for LegacyEncryptor, LegacyDecryptor, LegacyEncryptorWithMAC and LegacyDecryptorWithMAC
|
||||
typedef DES_EDE2 LegacyBlockCipher;
|
||||
//! \brief Legacy hash for use with LegacyEncryptorWithMAC and LegacyDecryptorWithMAC
|
||||
typedef SHA LegacyHashModule;
|
||||
typedef SHA1 LegacyHashModule;
|
||||
//! \brief Legacy HMAC for use withLegacyEncryptorWithMAC and LegacyDecryptorWithMAC
|
||||
typedef HMAC<LegacyHashModule> LegacyMAC;
|
||||
|
||||
|
@ -398,7 +398,7 @@ struct ECDSA_RFC6979 : public DL_SS<
|
||||
//! \brief Elliptic Curve NR (ECNR) signature scheme
|
||||
//! \tparam EC elliptic curve field
|
||||
//! \tparam H HashTransformation derived class
|
||||
template <class EC, class H = SHA>
|
||||
template <class EC, class H = SHA1>
|
||||
struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMessageEncodingMethod_NR, H>
|
||||
{
|
||||
};
|
||||
|
14
esign.cpp
14
esign.cpp
@ -21,15 +21,15 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
void ESIGN_TestInstantiations()
|
||||
{
|
||||
ESIGN<SHA>::Verifier x1(1, 1);
|
||||
ESIGN<SHA>::Signer x2(NullRNG(), 1);
|
||||
ESIGN<SHA>::Verifier x3(x2);
|
||||
ESIGN<SHA>::Verifier x4(x2.GetKey());
|
||||
ESIGN<SHA>::Verifier x5(x3);
|
||||
ESIGN<SHA>::Signer x6 = x2;
|
||||
ESIGN<SHA1>::Verifier x1(1, 1);
|
||||
ESIGN<SHA1>::Signer x2(NullRNG(), 1);
|
||||
ESIGN<SHA1>::Verifier x3(x2);
|
||||
ESIGN<SHA1>::Verifier x4(x2.GetKey());
|
||||
ESIGN<SHA1>::Verifier x5(x3);
|
||||
ESIGN<SHA1>::Signer x6 = x2;
|
||||
|
||||
x6 = x2;
|
||||
x3 = ESIGN<SHA>::Verifier(x2);
|
||||
x3 = ESIGN<SHA1>::Verifier(x2);
|
||||
x4 = x2.GetKey();
|
||||
}
|
||||
#endif
|
||||
|
@ -457,7 +457,7 @@ protected:
|
||||
Integer p, q, h, g;
|
||||
int counter;
|
||||
|
||||
SecByteBlock seed(SHA::DIGESTSIZE);
|
||||
SecByteBlock seed(SHA1::DIGESTSIZE);
|
||||
do
|
||||
{
|
||||
m_rng.GenerateBlock(seed, seed.size());
|
||||
|
@ -23,12 +23,12 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
void TestInstantiations_gfpcrypt()
|
||||
{
|
||||
GDSA<SHA>::Signer test;
|
||||
GDSA<SHA>::Verifier test1;
|
||||
GDSA<SHA1>::Signer test;
|
||||
GDSA<SHA1>::Verifier test1;
|
||||
DSA::Signer test5(NullRNG(), 100);
|
||||
DSA::Signer test2(test5);
|
||||
NR<SHA>::Signer test3;
|
||||
NR<SHA>::Verifier test4;
|
||||
NR<SHA1>::Signer test3;
|
||||
NR<SHA1>::Verifier test4;
|
||||
DLIES<>::Encryptor test6;
|
||||
DLIES<>::Decryptor test7;
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ class DSA2;
|
||||
struct DL_Keys_DSA
|
||||
{
|
||||
typedef DL_PublicKey_GFP<DL_GroupParameters_DSA> PublicKey;
|
||||
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA> > PrivateKey;
|
||||
typedef DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA1> > PrivateKey;
|
||||
};
|
||||
|
||||
//! \class DSA2
|
||||
@ -779,7 +779,7 @@ typedef DSA2<SHA1> DSA;
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_GFP<DL_GroupParameters_DSA>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP<DL_GroupParameters_DSA>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA> >;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA2<SHA1> >;
|
||||
|
||||
//! \class DL_EncryptionAlgorithm_Xor
|
||||
//! \brief P1363 based XOR Encryption Method
|
||||
|
2
luc.cpp
2
luc.cpp
@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
void LUC_TestInstantiations()
|
||||
{
|
||||
LUC_HMP<SHA>::Signer t1;
|
||||
LUC_HMP<SHA1>::Signer t1;
|
||||
LUCFunction t2;
|
||||
InvertibleLUCFunction t3;
|
||||
}
|
||||
|
8
luc.h
8
luc.h
@ -152,11 +152,11 @@ struct LUCSS : public TF_SS<LUC, STANDARD, H>
|
||||
};
|
||||
|
||||
// analogous to the RSA schemes defined in PKCS #1 v2.0
|
||||
typedef LUCES<OAEP<SHA> >::Decryptor LUCES_OAEP_SHA_Decryptor;
|
||||
typedef LUCES<OAEP<SHA> >::Encryptor LUCES_OAEP_SHA_Encryptor;
|
||||
typedef LUCES<OAEP<SHA1> >::Decryptor LUCES_OAEP_SHA_Decryptor;
|
||||
typedef LUCES<OAEP<SHA1> >::Encryptor LUCES_OAEP_SHA_Encryptor;
|
||||
|
||||
typedef LUCSS<PKCS1v15, SHA>::Signer LUCSSA_PKCS1v15_SHA_Signer;
|
||||
typedef LUCSS<PKCS1v15, SHA>::Verifier LUCSSA_PKCS1v15_SHA_Verifier;
|
||||
typedef LUCSS<PKCS1v15, SHA1>::Signer LUCSSA_PKCS1v15_SHA_Signer;
|
||||
typedef LUCSS<PKCS1v15, SHA1>::Verifier LUCSSA_PKCS1v15_SHA_Verifier;
|
||||
|
||||
// ********************************************************
|
||||
|
||||
|
2
oaep.h
2
oaep.h
@ -37,7 +37,7 @@ protected:
|
||||
MaskGeneratingFunction * NewMGF() const {return new MGF;}
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS OAEP<SHA>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS OAEP<SHA1>;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
//! # Go back one more
|
||||
//! git checkout HEAD~1
|
||||
//!
|
||||
//! $ grep 'MDC<SHA>' *.h *.cpp
|
||||
//! randpool.cpp:typedef MDC<SHA> RandomPoolCipher;
|
||||
//! $ grep 'MDC<SHA1>' *.h *.cpp
|
||||
//! randpool.cpp:typedef MDC<SHA1> RandomPoolCipher;
|
||||
//! </pre>
|
||||
//! \since Crypto++ 4.0 (PGP 2.6.x style), Crypto++ 5.5 (AES-256 based)
|
||||
|
||||
|
22
rsa.cpp
22
rsa.cpp
@ -15,13 +15,13 @@
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
void RSA_TestInstantiations()
|
||||
{
|
||||
RSASS<PKCS1v15, SHA>::Verifier x1(1, 1);
|
||||
RSASS<PKCS1v15, SHA>::Signer x2(NullRNG(), 1);
|
||||
RSASS<PKCS1v15, SHA>::Verifier x3(x2);
|
||||
RSASS<PKCS1v15, SHA>::Verifier x4(x2.GetKey());
|
||||
RSASS<PSS, SHA>::Verifier x5(x3);
|
||||
RSASS<PKCS1v15, SHA1>::Verifier x1(1, 1);
|
||||
RSASS<PKCS1v15, SHA1>::Signer x2(NullRNG(), 1);
|
||||
RSASS<PKCS1v15, SHA1>::Verifier x3(x2);
|
||||
RSASS<PKCS1v15, SHA1>::Verifier x4(x2.GetKey());
|
||||
RSASS<PSS, SHA1>::Verifier x5(x3);
|
||||
#ifndef __MWERKS__
|
||||
RSASS<PSSR, SHA>::Signer x6 = x2;
|
||||
RSASS<PSSR, SHA1>::Signer x6 = x2;
|
||||
x3 = x2;
|
||||
x6 = x2;
|
||||
#endif
|
||||
@ -29,7 +29,7 @@ void RSA_TestInstantiations()
|
||||
#ifndef __GNUC__
|
||||
RSAES<PKCS1v15>::Encryptor x8(x3);
|
||||
#endif
|
||||
RSAES<OAEP<SHA> >::Encryptor x9(x2);
|
||||
RSAES<OAEP<SHA1> >::Encryptor x9(x2);
|
||||
|
||||
x4 = x2.GetKey();
|
||||
}
|
||||
@ -136,12 +136,12 @@ void InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const Nam
|
||||
|
||||
if (FIPS_140_2_ComplianceEnabled())
|
||||
{
|
||||
RSASS<PKCS1v15, SHA>::Signer signer(*this);
|
||||
RSASS<PKCS1v15, SHA>::Verifier verifier(signer);
|
||||
RSASS<PKCS1v15, SHA1>::Signer signer(*this);
|
||||
RSASS<PKCS1v15, SHA1>::Verifier verifier(signer);
|
||||
SignaturePairwiseConsistencyTest_FIPS_140_Only(signer, verifier);
|
||||
|
||||
RSAES<OAEP<SHA> >::Decryptor decryptor(*this);
|
||||
RSAES<OAEP<SHA> >::Encryptor encryptor(decryptor);
|
||||
RSAES<OAEP<SHA1> >::Decryptor decryptor(*this);
|
||||
RSAES<OAEP<SHA1> >::Encryptor encryptor(decryptor);
|
||||
EncryptionPairwiseConsistencyTest_FIPS_140_Only(encryptor, decryptor);
|
||||
}
|
||||
}
|
||||
|
20
rsa.h
20
rsa.h
@ -217,22 +217,22 @@ DOCUMENTED_TYPEDEF(RSAES<PKCS1v15>::Decryptor, RSAES_PKCS1v15_Decryptor);
|
||||
//! \details RSA encryption scheme defined in PKCS #1 v2.0
|
||||
DOCUMENTED_TYPEDEF(RSAES<PKCS1v15>::Encryptor, RSAES_PKCS1v15_Encryptor);
|
||||
|
||||
//! \brief \ref RSAES<STANDARD> "RSAES<OAEP<SHA>>::Decryptor" typedef
|
||||
//! \brief \ref RSAES<STANDARD> "RSAES<OAEP<SHA1>>::Decryptor" typedef
|
||||
//! \details RSA encryption scheme defined in PKCS #1 v2.0
|
||||
DOCUMENTED_TYPEDEF(RSAES<OAEP<SHA> >::Decryptor, RSAES_OAEP_SHA_Decryptor);
|
||||
//! \brief \ref RSAES<STANDARD> "RSAES<OAEP<SHA>>::Encryptor" typedef
|
||||
DOCUMENTED_TYPEDEF(RSAES<OAEP<SHA1> >::Decryptor, RSAES_OAEP_SHA_Decryptor);
|
||||
//! \brief \ref RSAES<STANDARD> "RSAES<OAEP<SHA1>>::Encryptor" typedef
|
||||
//! \details RSA encryption scheme defined in PKCS #1 v2.0
|
||||
DOCUMENTED_TYPEDEF(RSAES<OAEP<SHA> >::Encryptor, RSAES_OAEP_SHA_Encryptor);
|
||||
DOCUMENTED_TYPEDEF(RSAES<OAEP<SHA1> >::Encryptor, RSAES_OAEP_SHA_Encryptor);
|
||||
|
||||
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
|
||||
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Signer" typedef
|
||||
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA1>::Signer" typedef
|
||||
//! \details RSA signature schemes defined in PKCS #1 v2.0
|
||||
//! \since Crypto++ 1.0
|
||||
class RSASSA_PKCS1v15_SHA_Signer : public RSASS<PKCS1v15,SHA>::Signer {};
|
||||
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA>::Verifier" typedef
|
||||
class RSASSA_PKCS1v15_SHA_Signer : public RSASS<PKCS1v15,SHA1>::Signer {};
|
||||
//! \brief \ref RSASS<STANDARD,HASH> "RSASS<PKCS1v15,SHA1>::Verifier" typedef
|
||||
//! \details RSA signature schemes defined in PKCS #1 v2.0
|
||||
//! \since Crypto++ 1.0
|
||||
class RSASSA_PKCS1v15_SHA_Verifier : public RSASS<PKCS1v15,SHA>::Verifier {};
|
||||
class RSASSA_PKCS1v15_SHA_Verifier : public RSASS<PKCS1v15,SHA1>::Verifier {};
|
||||
|
||||
namespace Weak {
|
||||
|
||||
@ -256,8 +256,8 @@ class RSASSA_PKCS1v15_MD5_Verifier : public RSASS<PKCS1v15, Weak1::MD5>::Verifie
|
||||
}
|
||||
|
||||
#else
|
||||
typedef RSASS<PKCS1v15,SHA>::Signer RSASSA_PKCS1v15_SHA_Signer;
|
||||
typedef RSASS<PKCS1v15,SHA>::Verifier RSASSA_PKCS1v15_SHA_Verifier;
|
||||
typedef RSASS<PKCS1v15,SHA1>::Signer RSASSA_PKCS1v15_SHA_Signer;
|
||||
typedef RSASS<PKCS1v15,SHA1>::Verifier RSASSA_PKCS1v15_SHA_Verifier;
|
||||
|
||||
namespace Weak {
|
||||
typedef RSASS<PKCS1v15, Weak1::MD2>::Signer RSASSA_PKCS1v15_MD2_Signer;
|
||||
|
2
seal.cpp
2
seal.cpp
@ -39,7 +39,7 @@ word32 SEAL_Gamma::Apply(word32 i)
|
||||
{
|
||||
memcpy(Z, H, 20);
|
||||
D[0] = shaIndex;
|
||||
SHA::Transform(Z, D);
|
||||
SHA1::Transform(Z, D);
|
||||
lastIndex = shaIndex;
|
||||
}
|
||||
return Z[i%5];
|
||||
|
2
sha.h
2
sha.h
@ -30,8 +30,6 @@ public:
|
||||
CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
|
||||
};
|
||||
|
||||
typedef SHA1 SHA; // for backwards compatibility
|
||||
|
||||
//! \class SHA256
|
||||
//! \brief SHA-256 message digest
|
||||
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-256">SHA-256</a>
|
||||
|
4
test.cpp
4
test.cpp
@ -543,14 +543,14 @@ std::string RSADecryptString(const char *privFilename, const char *ciphertext)
|
||||
void RSASignFile(const char *privFilename, const char *messageFilename, const char *signatureFilename)
|
||||
{
|
||||
FileSource privFile(privFilename, true, new HexDecoder);
|
||||
RSASS<PKCS1v15, SHA>::Signer priv(privFile);
|
||||
RSASS<PKCS1v15, SHA1>::Signer priv(privFile);
|
||||
FileSource f(messageFilename, true, new SignerFilter(Test::GlobalRNG(), priv, new HexEncoder(new FileSink(signatureFilename))));
|
||||
}
|
||||
|
||||
bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const char *signatureFilename)
|
||||
{
|
||||
FileSource pubFile(pubFilename, true, new HexDecoder);
|
||||
RSASS<PKCS1v15, SHA>::Verifier pub(pubFile);
|
||||
RSASS<PKCS1v15, SHA1>::Verifier pub(pubFile);
|
||||
|
||||
FileSource signatureFile(signatureFilename, true, new HexDecoder);
|
||||
if (signatureFile.MaxRetrievable() != pub.SignatureLength())
|
||||
|
44
validat2.cpp
44
validat2.cpp
@ -322,8 +322,8 @@ bool ValidateRSA()
|
||||
pass = CryptoSystemValidate(rsaPriv, rsaPub) && pass;
|
||||
}
|
||||
{
|
||||
RSAES<OAEP<SHA> >::Decryptor rsaPriv(GlobalRNG(), 512);
|
||||
RSAES<OAEP<SHA> >::Encryptor rsaPub(rsaPriv);
|
||||
RSAES<OAEP<SHA1> >::Decryptor rsaPriv(GlobalRNG(), 512);
|
||||
RSAES<OAEP<SHA1> >::Encryptor rsaPub(rsaPriv);
|
||||
|
||||
pass = CryptoSystemValidate(rsaPriv, rsaPub) && pass;
|
||||
}
|
||||
@ -679,16 +679,16 @@ bool ValidateNR()
|
||||
bool pass = true;
|
||||
{
|
||||
FileSource f(CRYPTOPP_DATA_DIR "TestData/nr2048.dat", true, new HexDecoder);
|
||||
NR<SHA>::Signer privS(f);
|
||||
NR<SHA1>::Signer privS(f);
|
||||
privS.AccessKey().Precompute();
|
||||
NR<SHA>::Verifier pubS(privS);
|
||||
NR<SHA1>::Verifier pubS(privS);
|
||||
|
||||
pass = SignatureValidate(privS, pubS) && pass;
|
||||
}
|
||||
{
|
||||
std::cout << "Generating new signature key..." << std::endl;
|
||||
NR<SHA>::Signer privS(GlobalRNG(), 256);
|
||||
NR<SHA>::Verifier pubS(privS);
|
||||
NR<SHA1>::Signer privS(GlobalRNG(), 256);
|
||||
NR<SHA1>::Verifier pubS(privS);
|
||||
|
||||
pass = SignatureValidate(privS, pubS) && pass;
|
||||
}
|
||||
@ -736,8 +736,8 @@ bool ValidateLUC_DL()
|
||||
std::cout << "\nLUC-HMP validation suite running...\n\n";
|
||||
|
||||
FileSource f(CRYPTOPP_DATA_DIR "TestData/lucs512.dat", true, new HexDecoder);
|
||||
LUC_HMP<SHA>::Signer privS(f);
|
||||
LUC_HMP<SHA>::Verifier pubS(privS);
|
||||
LUC_HMP<SHA1>::Signer privS(f);
|
||||
LUC_HMP<SHA1>::Verifier pubS(privS);
|
||||
bool pass = SignatureValidate(privS, pubS);
|
||||
|
||||
std::cout << "\nLUC-IES validation suite running...\n\n";
|
||||
@ -757,13 +757,13 @@ bool ValidateRabin()
|
||||
|
||||
{
|
||||
FileSource f(CRYPTOPP_DATA_DIR "TestData/rabi1024.dat", true, new HexDecoder);
|
||||
RabinSS<PSSR, SHA>::Signer priv(f);
|
||||
RabinSS<PSSR, SHA>::Verifier pub(priv);
|
||||
RabinSS<PSSR, SHA1>::Signer priv(f);
|
||||
RabinSS<PSSR, SHA1>::Verifier pub(priv);
|
||||
pass = SignatureValidate(priv, pub) && pass;
|
||||
}
|
||||
{
|
||||
RabinES<OAEP<SHA> >::Decryptor priv(GlobalRNG(), 512);
|
||||
RabinES<OAEP<SHA> >::Encryptor pub(priv);
|
||||
RabinES<OAEP<SHA1> >::Decryptor priv(GlobalRNG(), 512);
|
||||
RabinES<OAEP<SHA1> >::Encryptor pub(priv);
|
||||
pass = CryptoSystemValidate(priv, pub) && pass;
|
||||
}
|
||||
return pass;
|
||||
@ -774,8 +774,8 @@ bool ValidateRW()
|
||||
std::cout << "\nRW validation suite running...\n\n";
|
||||
|
||||
FileSource f(CRYPTOPP_DATA_DIR "TestData/rw1024.dat", true, new HexDecoder);
|
||||
RWSS<PSSR, SHA>::Signer priv(f);
|
||||
RWSS<PSSR, SHA>::Verifier pub(priv);
|
||||
RWSS<PSSR, SHA1>::Signer priv(f);
|
||||
RWSS<PSSR, SHA1>::Verifier pub(priv);
|
||||
|
||||
return SignatureValidate(priv, pub);
|
||||
}
|
||||
@ -917,8 +917,8 @@ bool ValidateECP()
|
||||
cpriv.GetKey().DEREncode(bq);
|
||||
cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
|
||||
cpub.GetKey().DEREncode(bq);
|
||||
ECDSA<ECP, SHA>::Signer spriv(bq);
|
||||
ECDSA<ECP, SHA>::Verifier spub(bq);
|
||||
ECDSA<ECP, SHA1>::Signer spriv(bq);
|
||||
ECDSA<ECP, SHA1>::Verifier spub(bq);
|
||||
ECDH<ECP>::Domain ecdhc(ASN1::secp192r1());
|
||||
ECMQV<ECP>::Domain ecmqvc(ASN1::secp192r1());
|
||||
|
||||
@ -966,8 +966,8 @@ bool ValidateEC2N()
|
||||
cpriv.DEREncode(bq);
|
||||
cpub.AccessKey().AccessGroupParameters().SetEncodeAsOID(true);
|
||||
cpub.DEREncode(bq);
|
||||
ECDSA<EC2N, SHA>::Signer spriv(bq);
|
||||
ECDSA<EC2N, SHA>::Verifier spub(bq);
|
||||
ECDSA<EC2N, SHA1>::Signer spriv(bq);
|
||||
ECDSA<EC2N, SHA1>::Verifier spub(bq);
|
||||
ECDH<EC2N>::Domain ecdhc(ASN1::sect193r1());
|
||||
ECMQV<EC2N>::Domain ecmqvc(ASN1::sect193r1());
|
||||
|
||||
@ -1023,8 +1023,8 @@ bool ValidateECDSA()
|
||||
Integer n("40000000000000000000000004a20e90c39067c893bbb9a5H");
|
||||
Integer d("340562e1dda332f9d2aec168249b5696ee39d0ed4d03760fH");
|
||||
EC2N::Point Q(ec.Multiply(d, P));
|
||||
ECDSA<EC2N, SHA>::Signer priv(ec, P, n, d);
|
||||
ECDSA<EC2N, SHA>::Verifier pub(priv);
|
||||
ECDSA<EC2N, SHA1>::Signer priv(ec, P, n, d);
|
||||
ECDSA<EC2N, SHA1>::Verifier pub(priv);
|
||||
|
||||
Integer h("A9993E364706816ABA3E25717850C26C9CD0D89DH");
|
||||
Integer k("3eeace72b4919d991738d521879f787cb590aff8189d2b69H");
|
||||
@ -1416,8 +1416,8 @@ bool ValidateESIGN()
|
||||
"\x79\xA2\xE5\x52\x20\x5D\x97\x5E\xFE\x39\xAE\x21\x10\xFB\x35\xF4\x80\x81\x41\x13\xDD\xE8\x5F\xCA\x1E\x4F\xF8\x9B\xB2\x68\xFB\x28";
|
||||
|
||||
FileSource keys(CRYPTOPP_DATA_DIR "TestData/esig1536.dat", true, new HexDecoder);
|
||||
ESIGN<SHA>::Signer signer(keys);
|
||||
ESIGN<SHA>::Verifier verifier(signer);
|
||||
ESIGN<SHA1>::Signer signer(keys);
|
||||
ESIGN<SHA1>::Verifier verifier(signer);
|
||||
|
||||
fail = !SignatureValidate(signer, verifier);
|
||||
pass = pass && !fail;
|
||||
|
Loading…
Reference in New Issue
Block a user