From 240a14e5618a90a3a85318f7b9e0738952f696be Mon Sep 17 00:00:00 2001 From: weidai Date: Fri, 4 May 2007 15:25:08 +0000 Subject: [PATCH] add word128 --- config.h | 10 ++++++++++ validat1.cpp | 27 +++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index 05d77fff..6d7a31cb 100644 --- a/config.h +++ b/config.h @@ -135,6 +135,8 @@ typedef unsigned int word32; typedef word32 hword; typedef word64 word; typedef __uint128_t dword; + typedef __uint128_t word128; + #define CRYPTOPP_WORD128_AVAILABLE #else // if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results typedef word16 hword; @@ -277,6 +279,14 @@ NAMESPACE_END #endif #endif +#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64) + #define CRYPTOPP_X64_MASM_AVAILABLE +#endif + +#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__) + #define CRYPTOPP_X64_ASM_AVAILABLE +#endif + #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 #else diff --git a/validat1.cpp b/validat1.cpp index c68adadb..3134cbf3 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -2,7 +2,7 @@ #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "files.h" #include "hex.h" #include "base32.h" @@ -92,6 +92,7 @@ bool ValidateAll(bool thorough) pass=ValidateCamellia() && pass; pass=ValidateSalsa() && pass; pass=ValidateSosemanuk() && pass; + pass=ValidateVMAC() && pass; pass=ValidateBBS() && pass; pass=ValidateDH() && pass; @@ -199,6 +200,17 @@ bool TestSettings() cout << "passed: word64 not available" << endl; #endif +#ifdef CRYPTOPP_WORD128_AVAILABLE + if (sizeof(word128) == 16) + cout << "passed: "; + else + { + cout << "FAILED: "; + pass = false; + } + cout << "sizeof(word128) == " << sizeof(word128) << endl; +#endif + if (sizeof(word) == 2*sizeof(hword) #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE && sizeof(dword) == 2*sizeof(word) @@ -501,15 +513,13 @@ bool ValidateDES() bool TestModeIV(SymmetricCipher &e, SymmetricCipher &d) { - SecByteBlock lastIV; + SecByteBlock lastIV, iv(e.IVSize()); StreamTransformationFilter filter(e, new StreamTransformationFilter(d)); byte plaintext[20480]; for (unsigned int i=1; i