void showP7zipInfo(CStdOutStream *so) { if (!so) return; AString cpu_name; GetCpuName(cpu_name); cpu_name.Trim(); int bits = int(sizeof(void *)) * 8; *so << "p7zip Version " << P7ZIP_VERSION << " (locale=" << my_getlocale() <<",Utf16="; if (global_use_utf16_conversion) *so << "on"; else *so << "off"; *so << ",HugeFiles="; if (sizeof(off_t) >= 8) *so << "on,"; else *so << "off,"; *so << bits << " bits,"; int nbcpu = NWindows::NSystem::GetNumberOfProcessors(); if (nbcpu > 1) *so << nbcpu << " CPUs "; else *so << nbcpu << " CPU "; *so << cpu_name; #ifdef _7ZIP_ASM { const char * txt =",ASM"; #ifdef MY_CPU_X86_OR_AMD64 if (CPU_Is_Aes_Supported()) { txt =",ASM,AES-NI"; } #endif *so << txt; } #endif *so << ")\n\n"; }
void AesGenTables(void) { unsigned i; for (i = 0; i < 256; i++) InvS[Sbox[i]] = (Byte)i; for (i = 0; i < 256; i++) { { UInt32 a1 = Sbox[i]; UInt32 a2 = xtime(a1); UInt32 a3 = a2 ^ a1; T[ i] = Ui32(a2, a1, a1, a3); T[0x100 + i] = Ui32(a3, a2, a1, a1); T[0x200 + i] = Ui32(a1, a3, a2, a1); T[0x300 + i] = Ui32(a1, a1, a3, a2); } { UInt32 a1 = InvS[i]; UInt32 a2 = xtime(a1); UInt32 a4 = xtime(a2); UInt32 a8 = xtime(a4); UInt32 a9 = a8 ^ a1; UInt32 aB = a8 ^ a2 ^ a1; UInt32 aD = a8 ^ a4 ^ a1; UInt32 aE = a8 ^ a4 ^ a2; D[ i] = Ui32(aE, a9, aD, aB); D[0x100 + i] = Ui32(aB, aE, a9, aD); D[0x200 + i] = Ui32(aD, aB, aE, a9); D[0x300 + i] = Ui32(a9, aD, aB, aE); } } g_AesCbc_Encode = AesCbc_Encode; g_AesCbc_Decode = AesCbc_Decode; g_AesCtr_Code = AesCtr_Code; #ifdef MY_CPU_X86_OR_AMD64 #ifdef P7ZIP_USE_ASM if (CPU_Is_Aes_Supported()) { g_AesCbc_Encode = AesCbc_Encode_Intel; g_AesCbc_Decode = AesCbc_Decode_Intel; g_AesCtr_Code = AesCtr_Code_Intel; } #endif #endif }