/* ================= Sys_GetProcessorFeatures ================= */ int Sys_GetProcessorFeatures( void ) { int features = 0; //cpuFeatures_t features = (cpuFeatures_t)0; CPUINFO cpuinfo; GetCPUInfo( &cpuinfo, CI_FALSE ); if( HasCPUID() ) features |= CF_RDTSC; if( HasMMX( &cpuinfo ) ) features |= CF_MMX; if( HasMMXExt( &cpuinfo ) ) features |= CF_MMX_EXT; if( Has3DNow( &cpuinfo ) ) features |= CF_3DNOW; if( Has3DNowExt( &cpuinfo ) ) features |= CF_3DNOW_EXT; if( HasSSE( &cpuinfo ) ) features |= CF_SSE; if( HasSSE2( &cpuinfo ) ) features |= CF_SSE2; if( HasSSE3( &cpuinfo ) ) features |= CF_SSE3; if( HasSSSE3( &cpuinfo ) ) features |= CF_SSSE3; if( HasSSE4_1( &cpuinfo ) ) features |= CF_SSE4_1; if( HasSSE4_2( &cpuinfo ) ) features |= CF_SSE4_2; if( HasHTT( &cpuinfo ) ) features |= CF_HasHTT; if( HasSerial( &cpuinfo ) ) features |= CF_HasSerial; if( Is64Bit( &cpuinfo ) ) features |= CF_Is64Bit; return features; }
void Panama<B>::Reset() { memset(m_state, 0, m_state.SizeInBytes()); #if CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE m_state[17] = HasSSSE3(); #endif }
bool TestSettings() { bool pass = true; cout << "\nTesting Settings...\n\n"; if (*(word32 *)"\x01\x02\x03\x04" == 0x04030201L) { #ifdef IS_LITTLE_ENDIAN cout << "passed: "; #else cout << "FAILED: "; pass = false; #endif cout << "Your machine is little endian.\n"; } else if (*(word32 *)"\x01\x02\x03\x04" == 0x01020304L) { #ifndef IS_LITTLE_ENDIAN cout << "passed: "; #else cout << "FAILED: "; pass = false; #endif cout << "Your machine is big endian.\n"; } else { cout << "FAILED: Your machine is neither big endian nor little endian.\n"; pass = false; } if (sizeof(byte) == 1) cout << "passed: "; else { cout << "FAILED: "; pass = false; } cout << "sizeof(byte) == " << sizeof(byte) << endl; if (sizeof(word16) == 2) cout << "passed: "; else { cout << "FAILED: "; pass = false; } cout << "sizeof(word16) == " << sizeof(word16) << endl; if (sizeof(word32) == 4) cout << "passed: "; else { cout << "FAILED: "; pass = false; } cout << "sizeof(word32) == " << sizeof(word32) << endl; #ifdef WORD64_AVAILABLE if (sizeof(word64) == 8) cout << "passed: "; else { cout << "FAILED: "; pass = false; } cout << "sizeof(word64) == " << sizeof(word64) << endl; #elif defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) if (sizeof(dword) >= 8) { cout << "FAILED: sizeof(dword) >= 8, but WORD64_AVAILABLE not defined" << endl; pass = false; } else 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) #endif ) cout << "passed: "; else { cout << "FAILED: "; pass = false; } cout << "sizeof(hword) == " << sizeof(hword) << ", sizeof(word) == " << sizeof(word); #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE cout << ", sizeof(dword) == " << sizeof(dword); #endif cout << endl; bool hasMMX = HasMMX(); bool hasISSE = HasISSE(); bool hasSSE2 = HasSSE2(); bool hasSSSE3 = HasSSSE3(); bool isP4 = IsP4(); int cacheLineSize = GetCacheLineSize(); if ((isP4 && (!hasMMX || !hasSSE2)) || (hasSSE2 && !hasMMX) || (cacheLineSize < 16 || cacheLineSize > 256 || !IsPowerOf2(cacheLineSize))) { cout << "FAILED: "; pass = false; } else cout << "passed: "; cout << "hasMMX == " << hasMMX << ", hasISSE == " << hasISSE << ", hasSSE2 == " << hasSSE2 << ", hasSSSE3 == " << hasSSSE3 << ", isP4 == " << isP4 << ", cacheLineSize == " << cacheLineSize; if (!pass) { cout << "Some critical setting in config.h is in error. Please fix it and recompile." << endl; abort(); } return pass; }