diff --git a/cryptopp-5.6.1-autotools.patch b/cryptopp-5.6.1-autotools.patch index ed8815b..4900aac 100644 --- a/cryptopp-5.6.1-autotools.patch +++ b/cryptopp-5.6.1-autotools.patch @@ -1,7 +1,7 @@ ---- cryptopp-5.6.1/configure.ac 1969-12-31 19:00:00.000000000 -0500 -+++ cryptopp-5.6.1/configure.ac 2005-08-02 14:02:30.000000000 -0400 +--- cryptopp-5.6.1/configure.ac 1970-01-01 03:00:00.000000000 +0300 ++++ cryptopp-5.6.1/configure.ac 2010-10-21 15:20:14.000000000 +0300 @@ -0,0 +1,13 @@ -+AC_INIT([cryptopp], [5.5.2], [cryptopp-users@googlegroups.com]) ++AC_INIT([cryptopp], [5.6.1], [cryptopp-users@googlegroups.com]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR(configure.ac) +AC_CONFIG_HEADER([local.h]) @@ -14,9 +14,9 @@ +AC_C_BIGENDIAN + +AC_OUTPUT(Makefile) ---- cryptopp-5.6.1/Makefile.am 1969-12-31 19:00:00.000000000 -0500 -+++ cryptopp-5.6.1/Makefile.am 2005-08-02 14:02:30.000000000 -0400 -@@ -0,0 +1,290 @@ +--- cryptopp-5.6.1/Makefile.am 1970-01-01 03:00:00.000000000 +0300 ++++ cryptopp-5.6.1/Makefile.am 2010-10-21 15:32:36.000000000 +0300 +@@ -0,0 +1,305 @@ +AUTOMAKE_OPTIONS = foreign +lib_LTLIBRARIES = libcryptopp.la +libcryptopp_la_LIBADD = -lpthread @@ -284,7 +284,8 @@ + serpentp.h + validate.h + -+bin_PROGRAMS = cryptest ++bin_PROGRAMS = cryptest cryptestcwd ++cryptest_CXXFLAGS = $(CXXFLAGS) -DPACKAGE_DATA_DIR='"/usr/share/cryptopp/"' +cryptest_SOURCES = \ + bench.cpp \ + bench2.cpp \ @@ -296,10 +297,24 @@ + regtest.cpp \ + fipsalgt.cpp \ + dlltest.cpp -+ +nodist_cryptest_SOURCES = adhoc.cpp +CLEANFILES = adhoc.cpp +cryptest_LDADD = $(lib_LTLIBRARIES) ++cryptestcwd_CXXFLAGS = $(CXXFLAGS) -DPACKAGE_DATA_DIR='""' ++cryptestcwd_SOURCES = \ ++ bench.cpp \ ++ bench2.cpp \ ++ test.cpp \ ++ validat1.cpp \ ++ validat2.cpp \ ++ validat3.cpp \ ++ datatest.cpp \ ++ regtest.cpp \ ++ fipsalgt.cpp \ ++ dlltest.cpp ++nodist_cryptestcwd_SOURCES = adhoc.cpp ++CLEANFILES = adhoc.cpp ++cryptestcwd_LDADD = $(lib_LTLIBRARIES) + +adhoc.cpp: Makefile + if test -f adhoc.cpp; then \ diff --git a/cryptopp-data-files-location.patch b/cryptopp-data-files-location.patch new file mode 100644 index 0000000..e41d983 --- /dev/null +++ b/cryptopp-data-files-location.patch @@ -0,0 +1,572 @@ +## cryptest-data-files-location.diff by Jens Peter Secher +## +## Prefix data file names by PACKAGE_DATA_DIR which is set during build. + +Index: libcrypto++/bench2.cpp +=================================================================== +--- libcrypto++.orig/bench2.cpp 2010-08-11 17:25:57.000000000 +0200 ++++ libcrypto++/bench2.cpp 2010-08-11 17:26:03.000000000 +0200 +@@ -237,44 +237,44 @@ + cout << "OperationMilliseconds/Operation" << (g_hertz ? "Megacycles/Operation" : "") << endl; + + cout << "\n"; +- BenchMarkCrypto > >("TestData/rsa1024.dat", "RSA 1024", t); +- BenchMarkCrypto > >("TestData/luc1024.dat", "LUC 1024", t); +- BenchMarkCrypto >("TestData/dlie1024.dat", "DLIES 1024", t); +- BenchMarkCrypto >("TestData/lucc512.dat", "LUCELG 512", t); ++ BenchMarkCrypto > >(PACKAGE_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t); ++ BenchMarkCrypto > >(PACKAGE_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t); ++ BenchMarkCrypto >(PACKAGE_DATA_DIR "TestData/dlie1024.dat", "DLIES 1024", t); ++ BenchMarkCrypto >(PACKAGE_DATA_DIR "TestData/lucc512.dat", "LUCELG 512", t); + + cout << "\n"; +- BenchMarkCrypto > >("TestData/rsa2048.dat", "RSA 2048", t); +- BenchMarkCrypto > >("TestData/luc2048.dat", "LUC 2048", t); +- BenchMarkCrypto >("TestData/dlie2048.dat", "DLIES 2048", t); +- BenchMarkCrypto >("TestData/lucc1024.dat", "LUCELG 1024", t); ++ BenchMarkCrypto > >(PACKAGE_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t); ++ BenchMarkCrypto > >(PACKAGE_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t); ++ BenchMarkCrypto >(PACKAGE_DATA_DIR "TestData/dlie2048.dat", "DLIES 2048", t); ++ BenchMarkCrypto >(PACKAGE_DATA_DIR "TestData/lucc1024.dat", "LUCELG 1024", t); + + cout << "\n"; +- BenchMarkSignature >("TestData/rsa1024.dat", "RSA 1024", t); +- BenchMarkSignature >("TestData/rw1024.dat", "RW 1024", t); +- BenchMarkSignature >("TestData/luc1024.dat", "LUC 1024", t); +- BenchMarkSignature >("TestData/nr1024.dat", "NR 1024", t); +- BenchMarkSignature("TestData/dsa1024.dat", "DSA 1024", t); +- BenchMarkSignature >("TestData/lucs512.dat", "LUC-HMP 512", t); +- BenchMarkSignature >("TestData/esig1023.dat", "ESIGN 1023", t); +- BenchMarkSignature >("TestData/esig1536.dat", "ESIGN 1536", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/rw1024.dat", "RW 1024", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/nr1024.dat", "NR 1024", t); ++ BenchMarkSignature(PACKAGE_DATA_DIR "TestData/dsa1024.dat", "DSA 1024", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t); + + cout << "\n"; +- BenchMarkSignature >("TestData/rsa2048.dat", "RSA 2048", t); +- BenchMarkSignature >("TestData/rw2048.dat", "RW 2048", t); +- BenchMarkSignature >("TestData/luc2048.dat", "LUC 2048", t); +- BenchMarkSignature >("TestData/nr2048.dat", "NR 2048", t); +- BenchMarkSignature >("TestData/lucs1024.dat", "LUC-HMP 1024", t); +- BenchMarkSignature >("TestData/esig2046.dat", "ESIGN 2046", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/rw2048.dat", "RW 2048", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/nr2048.dat", "NR 2048", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t); ++ BenchMarkSignature >(PACKAGE_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t); + + cout << "\n"; +- BenchMarkKeyAgreement("TestData/xtrdh171.dat", "XTR-DH 171", t); +- BenchMarkKeyAgreement("TestData/xtrdh342.dat", "XTR-DH 342", t); +- BenchMarkKeyAgreement("TestData/dh1024.dat", "DH 1024", t); +- BenchMarkKeyAgreement("TestData/dh2048.dat", "DH 2048", t); +- BenchMarkKeyAgreement("TestData/lucd512.dat", "LUCDIF 512", t); +- BenchMarkKeyAgreement("TestData/lucd1024.dat", "LUCDIF 1024", t); +- BenchMarkKeyAgreement("TestData/mqv1024.dat", "MQV 1024", t); +- BenchMarkKeyAgreement("TestData/mqv2048.dat", "MQV 2048", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/xtrdh171.dat", "XTR-DH 171", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/xtrdh342.dat", "XTR-DH 342", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/dh1024.dat", "DH 1024", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/dh2048.dat", "DH 2048", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/lucd512.dat", "LUCDIF 512", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/lucd1024.dat", "LUCDIF 1024", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/mqv1024.dat", "MQV 1024", t); ++ BenchMarkKeyAgreement(PACKAGE_DATA_DIR "TestData/mqv2048.dat", "MQV 2048", t); + #endif + cout << "\n"; + { +Index: libcrypto++/test.cpp +=================================================================== +--- libcrypto++.orig/test.cpp 2010-08-11 17:25:57.000000000 +0200 ++++ libcrypto++/test.cpp 2010-08-11 17:26:20.000000000 +0200 +@@ -251,7 +251,7 @@ + { + std::string fname = argv[2]; + if (fname.find(".txt") == std::string::npos) +- fname = "TestVectors/" + fname + ".txt"; ++ fname = PACKAGE_DATA_DIR "TestVectors/" + fname + ".txt"; + return !RunTestDataFile(fname.c_str()); + } + else if (command == "t") +@@ -337,7 +337,7 @@ + AES_CTR_Encrypt(argv[2], argv[3], argv[4], argv[5]); + else if (command == "h") + { +- FileSource usage("TestData/usage.dat", true, new FileSink(cout)); ++ FileSource usage(PACKAGE_DATA_DIR "TestData/usage.dat", true, new FileSink(cout)); + return 1; + } + else if (command == "V") +Index: libcrypto++/validat1.cpp +=================================================================== +--- libcrypto++.orig/validat1.cpp 2010-08-11 17:25:57.000000000 +0200 ++++ libcrypto++/validat1.cpp 2010-08-11 17:26:03.000000000 +0200 +@@ -93,8 +93,8 @@ + pass=ValidateCCM() && pass; + pass=ValidateGCM() && pass; + pass=ValidateCMAC() && pass; +- pass=RunTestDataFile("TestVectors/eax.txt") && pass; +- pass=RunTestDataFile("TestVectors/seed.txt") && pass; ++ pass=RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/eax.txt") && pass; ++ pass=RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/seed.txt") && pass; + + pass=ValidateBBS() && pass; + pass=ValidateDH() && pass; +@@ -511,12 +511,12 @@ + { + cout << "\nDES validation suite running...\n\n"; + +- FileSource valdata("TestData/descert.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/descert.dat", true, new HexDecoder); + bool pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + + cout << "\nTesting EDE2, EDE3, and XEX3 variants...\n\n"; + +- FileSource valdata1("TestData/3desval.dat", true, new HexDecoder); ++ FileSource valdata1(PACKAGE_DATA_DIR "TestData/3desval.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(), valdata1, 1) && pass; +@@ -858,7 +858,7 @@ + { + cout << "\nIDEA validation suite running...\n\n"; + +- FileSource valdata("TestData/ideaval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/ideaval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -866,7 +866,7 @@ + { + cout << "\nSAFER validation suite running...\n\n"; + +- FileSource valdata("TestData/saferval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/saferval.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(VariableRoundsCipherFactory(8,6), valdata, 4) && pass; + pass = BlockTransformationTest(VariableRoundsCipherFactory(16,12), valdata, 4) && pass; +@@ -879,7 +879,7 @@ + { + cout << "\nRC2 validation suite running...\n\n"; + +- FileSource valdata("TestData/rc2val.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/rc2val.dat", true, new HexDecoder); + HexEncoder output(new FileSink(cout)); + SecByteBlock plain(RC2Encryption::BLOCKSIZE), cipher(RC2Encryption::BLOCKSIZE), out(RC2Encryption::BLOCKSIZE), outplain(RC2Encryption::BLOCKSIZE); + SecByteBlock key(128); +@@ -1089,7 +1089,7 @@ + { + cout << "\nRC5 validation suite running...\n\n"; + +- FileSource valdata("TestData/rc5val.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/rc5val.dat", true, new HexDecoder); + return BlockTransformationTest(VariableRoundsCipherFactory(16, 12), valdata); + } + +@@ -1097,7 +1097,7 @@ + { + cout << "\nRC6 validation suite running...\n\n"; + +- FileSource valdata("TestData/rc6val.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/rc6val.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 2) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 2) && pass; +@@ -1109,7 +1109,7 @@ + { + cout << "\nMARS validation suite running...\n\n"; + +- FileSource valdata("TestData/marsval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/marsval.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; +@@ -1121,12 +1121,12 @@ + { + cout << "\nRijndael (AES) validation suite running...\n\n"; + +- FileSource valdata("TestData/rijndael.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/rijndael.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 2) && pass; +- pass = RunTestDataFile("TestVectors/aes.txt") && pass; ++ pass = RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/aes.txt") && pass; + return pass; + } + +@@ -1134,7 +1134,7 @@ + { + cout << "\nTwofish validation suite running...\n\n"; + +- FileSource valdata("TestData/twofishv.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/twofishv.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; +@@ -1146,7 +1146,7 @@ + { + cout << "\nSerpent validation suite running...\n\n"; + +- FileSource valdata("TestData/serpentv.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/serpentv.dat", true, new HexDecoder); + bool pass = true; + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 3) && pass; +@@ -1192,7 +1192,7 @@ + { + cout << "\n3-WAY validation suite running...\n\n"; + +- FileSource valdata("TestData/3wayval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/3wayval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -1200,7 +1200,7 @@ + { + cout << "\nGOST validation suite running...\n\n"; + +- FileSource valdata("TestData/gostval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/gostval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -1208,7 +1208,7 @@ + { + cout << "\nSHARK validation suite running...\n\n"; + +- FileSource valdata("TestData/sharkval.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/sharkval.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -1218,14 +1218,14 @@ + + cout << "\nCAST-128 validation suite running...\n\n"; + +- FileSource val128("TestData/cast128v.dat", true, new HexDecoder); ++ FileSource val128(PACKAGE_DATA_DIR "TestData/cast128v.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), val128, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(10), val128, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(5), val128, 1) && pass; + + cout << "\nCAST-256 validation suite running...\n\n"; + +- FileSource val256("TestData/cast256v.dat", true, new HexDecoder); ++ FileSource val256(PACKAGE_DATA_DIR "TestData/cast256v.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), val256, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), val256, 1) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), val256, 1) && pass; +@@ -1237,7 +1237,7 @@ + { + cout << "\nSquare validation suite running...\n\n"; + +- FileSource valdata("TestData/squareva.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/squareva.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -1245,7 +1245,7 @@ + { + cout << "\nSKIPJACK validation suite running...\n\n"; + +- FileSource valdata("TestData/skipjack.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/skipjack.dat", true, new HexDecoder); + return BlockTransformationTest(FixedRoundsCipherFactory(), valdata); + } + +@@ -1349,7 +1349,7 @@ + cout << "\nSHACAL-2 validation suite running...\n\n"; + + bool pass = true; +- FileSource valdata("TestData/shacal2v.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/shacal2v.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(64), valdata, 10) && pass; + return pass; +@@ -1360,7 +1360,7 @@ + cout << "\nCamellia validation suite running...\n\n"; + + bool pass = true; +- FileSource valdata("TestData/camellia.dat", true, new HexDecoder); ++ FileSource valdata(PACKAGE_DATA_DIR "TestData/camellia.dat", true, new HexDecoder); + pass = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 15) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(24), valdata, 15) && pass; + pass = BlockTransformationTest(FixedRoundsCipherFactory(32), valdata, 15) && pass; +@@ -1371,38 +1371,38 @@ + { + cout << "\nSalsa validation suite running...\n"; + +- return RunTestDataFile("TestVectors/salsa.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/salsa.txt"); + } + + bool ValidateSosemanuk() + { + cout << "\nSosemanuk validation suite running...\n"; +- return RunTestDataFile("TestVectors/sosemanuk.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/sosemanuk.txt"); + } + + bool ValidateVMAC() + { + cout << "\nVMAC validation suite running...\n"; +- return RunTestDataFile("TestVectors/vmac.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/vmac.txt"); + } + + bool ValidateCCM() + { + cout << "\nAES/CCM validation suite running...\n"; +- return RunTestDataFile("TestVectors/ccm.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/ccm.txt"); + } + + bool ValidateGCM() + { + cout << "\nAES/GCM validation suite running...\n"; + cout << "\n2K tables:"; +- bool pass = RunTestDataFile("TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)2048)); ++ bool pass = RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)2048)); + cout << "\n64K tables:"; +- return RunTestDataFile("TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)64*1024)) && pass; ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/gcm.txt", MakeParameters(Name::TableSize(), (int)64*1024)) && pass; + } + + bool ValidateCMAC() + { + cout << "\nCMAC validation suite running...\n"; +- return RunTestDataFile("TestVectors/cmac.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/cmac.txt"); + } +Index: libcrypto++/validat2.cpp +=================================================================== +--- libcrypto++.orig/validat2.cpp 2010-08-11 17:25:57.000000000 +0200 ++++ libcrypto++/validat2.cpp 2010-08-11 17:26:03.000000000 +0200 +@@ -268,7 +268,7 @@ + "\x69\x94\xac\x04\xf3\x41\xb5\x7d\x05\x20\x2d\x42\x8f\xb2\xa2\x7b" + "\x5c\x77\xdf\xd9\xb1\x5b\xfc\x3d\x55\x93\x53\x50\x34\x10\xc1\xe1"; + +- FileSource keys("TestData/rsa512a.dat", true, new HexDecoder); ++ FileSource keys(PACKAGE_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder); + Weak::RSASSA_PKCS1v15_MD2_Signer rsaPriv(keys); + Weak::RSASSA_PKCS1v15_MD2_Verifier rsaPub(rsaPriv); + +@@ -293,7 +293,7 @@ + cout << "invalid signature verification\n"; + } + { +- FileSource keys("TestData/rsa1024.dat", true, new HexDecoder); ++ FileSource keys(PACKAGE_DATA_DIR "TestData/rsa1024.dat", true, new HexDecoder); + RSAES_PKCS1v15_Decryptor rsaPriv(keys); + RSAES_PKCS1v15_Encryptor rsaPub(rsaPriv); + +@@ -320,8 +320,8 @@ + bq.Put(oaepSeed, 20); + FixedRNG rng(bq); + +- FileSource privFile("TestData/rsa400pv.dat", true, new HexDecoder); +- FileSource pubFile("TestData/rsa400pb.dat", true, new HexDecoder); ++ FileSource privFile(PACKAGE_DATA_DIR "TestData/rsa400pv.dat", true, new HexDecoder); ++ FileSource pubFile(PACKAGE_DATA_DIR "TestData/rsa400pb.dat", true, new HexDecoder); + RSAES_OAEP_SHA_Decryptor rsaPriv; + rsaPriv.AccessKey().BERDecodePrivateKey(privFile, false, 0); + RSAES_OAEP_SHA_Encryptor rsaPub(pubFile); +@@ -344,7 +344,7 @@ + { + cout << "\nDH validation suite running...\n\n"; + +- FileSource f("TestData/dh1024.dat", true, new HexDecoder()); ++ FileSource f(PACKAGE_DATA_DIR "TestData/dh1024.dat", true, new HexDecoder()); + DH dh(f); + return SimpleKeyAgreementValidate(dh); + } +@@ -353,7 +353,7 @@ + { + cout << "\nMQV validation suite running...\n\n"; + +- FileSource f("TestData/mqv1024.dat", true, new HexDecoder()); ++ FileSource f(PACKAGE_DATA_DIR "TestData/mqv1024.dat", true, new HexDecoder()); + MQV mqv(f); + return AuthenticatedKeyAgreementValidate(mqv); + } +@@ -362,7 +362,7 @@ + { + cout << "\nLUC-DH validation suite running...\n\n"; + +- FileSource f("TestData/lucd512.dat", true, new HexDecoder()); ++ FileSource f(PACKAGE_DATA_DIR "TestData/lucd512.dat", true, new HexDecoder()); + LUC_DH dh(f); + return SimpleKeyAgreementValidate(dh); + } +@@ -371,7 +371,7 @@ + { + cout << "\nXTR-DH validation suite running...\n\n"; + +- FileSource f("TestData/xtrdh171.dat", true, new HexDecoder()); ++ FileSource f(PACKAGE_DATA_DIR "TestData/xtrdh171.dat", true, new HexDecoder()); + XTR_DH dh(f); + return SimpleKeyAgreementValidate(dh); + } +@@ -381,7 +381,7 @@ + cout << "\nElGamal validation suite running...\n\n"; + bool pass = true; + { +- FileSource fc("TestData/elgc1024.dat", true, new HexDecoder); ++ FileSource fc(PACKAGE_DATA_DIR "TestData/elgc1024.dat", true, new HexDecoder); + ElGamalDecryptor privC(fc); + ElGamalEncryptor pubC(privC); + privC.AccessKey().Precompute(); +@@ -399,7 +399,7 @@ + cout << "\nDLIES validation suite running...\n\n"; + bool pass = true; + { +- FileSource fc("TestData/dlie1024.dat", true, new HexDecoder); ++ FileSource fc(PACKAGE_DATA_DIR "TestData/dlie1024.dat", true, new HexDecoder); + DLIES<>::Decryptor privC(fc); + DLIES<>::Encryptor pubC(privC); + pass = CryptoSystemValidate(privC, pubC) && pass; +@@ -422,7 +422,7 @@ + cout << "\nNR validation suite running...\n\n"; + bool pass = true; + { +- FileSource f("TestData/nr2048.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/nr2048.dat", true, new HexDecoder); + NR::Signer privS(f); + privS.AccessKey().Precompute(); + NR::Verifier pubS(privS); +@@ -445,7 +445,7 @@ + + bool pass = true, fail; + { +- FileSource fs("TestData/dsa512.dat", true, new HexDecoder()); ++ FileSource fs(PACKAGE_DATA_DIR "TestData/dsa512.dat", true, new HexDecoder()); + GDSA::Signer priv(fs); + priv.AccessKey().Precompute(16); + GDSA::Verifier pub(priv); +@@ -487,10 +487,10 @@ + fail = pub.VerifyMessage((byte *)"xyz", 3, sig, sizeof(sig)); + pass = pass && !fail; + } +- FileSource fs1("TestData/dsa1024.dat", true, new HexDecoder()); ++ FileSource fs1(PACKAGE_DATA_DIR "TestData/dsa1024.dat", true, new HexDecoder()); + DSA::Signer priv(fs1); + DSA::Verifier pub(priv); +- FileSource fs2("TestData/dsa1024b.dat", true, new HexDecoder()); ++ FileSource fs2(PACKAGE_DATA_DIR "TestData/dsa1024b.dat", true, new HexDecoder()); + DSA::Verifier pub1(fs2); + assert(pub.GetKey() == pub1.GetKey()); + pass = SignatureValidate(priv, pub, thorough) && pass; +@@ -503,7 +503,7 @@ + bool pass=true; + + { +- FileSource f("TestData/luc1024.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/luc1024.dat", true, new HexDecoder); + LUCSSA_PKCS1v15_SHA_Signer priv(f); + LUCSSA_PKCS1v15_SHA_Verifier pub(priv); + pass = SignatureValidate(priv, pub) && pass; +@@ -520,14 +520,14 @@ + { + cout << "\nLUC-HMP validation suite running...\n\n"; + +- FileSource f("TestData/lucs512.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/lucs512.dat", true, new HexDecoder); + LUC_HMP::Signer privS(f); + LUC_HMP::Verifier pubS(privS); + bool pass = SignatureValidate(privS, pubS); + + cout << "\nLUC-IES validation suite running...\n\n"; + +- FileSource fc("TestData/lucc512.dat", true, new HexDecoder); ++ FileSource fc(PACKAGE_DATA_DIR "TestData/lucc512.dat", true, new HexDecoder); + LUC_IES<>::Decryptor privC(fc); + LUC_IES<>::Encryptor pubC(privC); + pass = CryptoSystemValidate(privC, pubC) && pass; +@@ -541,7 +541,7 @@ + bool pass=true; + + { +- FileSource f("TestData/rabi1024.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/rabi1024.dat", true, new HexDecoder); + RabinSS::Signer priv(f); + RabinSS::Verifier pub(priv); + pass = SignatureValidate(priv, pub) && pass; +@@ -558,7 +558,7 @@ + { + cout << "\nRW validation suite running...\n\n"; + +- FileSource f("TestData/rw1024.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/rw1024.dat", true, new HexDecoder); + RWSS::Signer priv(f); + RWSS::Verifier pub(priv); + +@@ -570,7 +570,7 @@ + { + cout << "\nBlumGoldwasser validation suite running...\n\n"; + +- FileSource f("TestData/blum512.dat", true, new HexDecoder); ++ FileSource f(PACKAGE_DATA_DIR "TestData/blum512.dat", true, new HexDecoder); + BlumGoldwasserPrivateKey priv(f); + BlumGoldwasserPublicKey pub(priv); + +@@ -740,7 +740,7 @@ + "\x74\x02\x37\x0E\xED\x0A\x06\xAD\xF4\x15\x65\xB8\xE1\xD1\x45\xAE\x39\x19\xB4\xFF\x5D\xF1\x45\x7B\xE0\xFE\x72\xED\x11\x92\x8F\x61\x41\x4F\x02\x00\xF2\x76\x6F\x7C" + "\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("TestData/esig1536.dat", true, new HexDecoder); ++ FileSource keys(PACKAGE_DATA_DIR "TestData/esig1536.dat", true, new HexDecoder); + ESIGN::Signer signer(keys); + ESIGN::Verifier verifier(signer); + +Index: libcrypto++/validat3.cpp +=================================================================== +--- libcrypto++.orig/validat3.cpp 2010-08-11 17:25:57.000000000 +0200 ++++ libcrypto++/validat3.cpp 2010-08-11 17:26:20.000000000 +0200 +@@ -168,13 +168,13 @@ + bool ValidateSHA() + { + cout << "\nSHA validation suite running...\n\n"; +- return RunTestDataFile("TestVectors/sha.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/sha.txt"); + } + + bool ValidateSHA2() + { + cout << "\nSHA validation suite running...\n\n"; +- return RunTestDataFile("TestVectors/sha.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/sha.txt"); + } + + bool ValidateTiger() +@@ -321,12 +321,12 @@ + + bool ValidatePanama() + { +- return RunTestDataFile("TestVectors/panama.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/panama.txt"); + } + + bool ValidateWhirlpool() + { +- return RunTestDataFile("TestVectors/whrlpool.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/whrlpool.txt"); + } + + #ifdef CRYPTOPP_REMOVED +@@ -393,7 +393,7 @@ + + bool ValidateHMAC() + { +- return RunTestDataFile("TestVectors/hmac.txt"); ++ return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/hmac.txt"); + } + + #ifdef CRYPTOPP_REMOVED diff --git a/cryptopp.spec b/cryptopp.spec index 142d84d..06d4f90 100644 --- a/cryptopp.spec +++ b/cryptopp.spec @@ -1,6 +1,6 @@ Name: cryptopp Version: 5.6.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Public domain C++ class library of cryptographic schemes License: Public Domain Group: System Environment/Libraries @@ -9,6 +9,9 @@ Source0: http://www.cryptopp.com/cryptopp561.zip Source1: cryptopp.pc Patch0: cryptopp-5.6.1-autotools.patch Patch1: cryptopp-5.6.1-s390.patch +# Debian patch installs TestVectors and TestData in /usr/share/cryptopp/ +# http://groups.google.com/group/cryptopp-users/browse_thread/thread/6fe2192340f07e5d +Patch2: cryptopp-data-files-location.patch BuildRequires: doxygen, autoconf, libtool BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -57,16 +60,19 @@ This package contains programs for manipulating %{name} routines. rm -f GNUmakefile %patch0 -p1 %patch1 -p1 -b .s390 +%patch2 -p1 autoreconf --verbose --force --install perl -pi -e 's/\r$//g' License.txt Readme.txt %build -%configure --disable-static %ifnarch x86_64 # Does not build with PIC by default on x86, see # http://groups.google.com/group/cryptopp-users/browse_thread/thread/d639907b0b1816b9 -sed -i -e '1 i #define CRYPTOPP_DISABLE_SSE2' config.h +export CXXFLAGS="$RPM_OPT_FLAGS -DCRYPTOPP_DISABLE_SSE2" %endif + +%configure --disable-static + make %{?_smp_mflags} doxygen @@ -83,9 +89,15 @@ sed -i "s|@PREFIX@|%{_prefix}|g" $RPM_BUILD_ROOT%{_libdir}/pkgconfig/cryptopp.pc sed -i "s|@LIBDIR@|%{_libdir}|g" $RPM_BUILD_ROOT%{_libdir}/pkgconfig/cryptopp.pc sed -i "s|@INCLUDEDIR@|%{_includedir}|g" $RPM_BUILD_ROOT%{_libdir}/pkgconfig/cryptopp.pc +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/TestVectors +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/TestData +install -m644 TestVectors/* $RPM_BUILD_ROOT%{_datadir}/%{name}/TestVectors +install -m644 TestData/* $RPM_BUILD_ROOT%{_datadir}/%{name}/TestData + +rm -f $RPM_BUILD_ROOT%{_bindir}/cryptestcwd + %check -./cryptest v 2>&1 | tee cryptest.log -grep -qs '^FAILED' cryptest.log && exit 1 || : +./cryptestcwd v %clean rm -rf $RPM_BUILD_ROOT @@ -114,9 +126,17 @@ rm -rf $RPM_BUILD_ROOT %files progs %defattr(0644,root,root,0755) %attr(0755,root,root) %{_bindir}/cryptest +%{_datadir}/%{name} %changelog +* Thu Oct 21 2010 Alexey Kurov - 5.6.1-2 +- add -DCRYPTOPP_DISABLE_SSE2 to CXXFLAGS instead of config.h for non-x86_64 (rhbz#645169) +- install TestVectors and TestData in cryptopp-progs +- patch cryptest for using data files in /usr/share/cryptopp +- build cryptestcwd for build time test only +- fix check section + * Wed Sep 1 2010 Alexey Kurov - 5.6.1-1 - Crypto++ 5.6.1 - fixed pkgconfig file installation