////////// // // Top level for running test cases against the current system. // Attempts to load each plugin in turn, vvmt_core.dll first, then all other DLLs. // ////// void ivvm_runTestPlugins(void) { u64 lnHandle; ////////// // Prepare the test results file ////// lnHandle = oss_sharedAsciiOpenFile((s8*)cgcVvmTestLogFile, true, false, true, true, false, true, false, false); if (!lnHandle) { // The log file is an essential, integral component of testing. We cannot leave it out. oss_messageBox(NULL, "Unable to open log file for test results. Terminating.", "Test Failure", false, false, false, false, true); return; } ////////// // Run the tests, core first, then all other tests ////// // vvmt_core.dll -- the core test must be run first and must pass, or the other tests cannot run if (ivvm_loadTestsByName(lnHandle, _csu8p(cgcVvmTestsDirectory)/*.\tests\*/, _csu8p(cgcVvmTestCoreDll)/*vvmt_core.dll*/, _csu8p_NULL())) { // *.dll -- all other tests, but don't run vvmt_core.dll again ivvm_loadTestsByName(lnHandle, _csu8p(cgcVvmTestsDirectory)/*.\tests\*/, _csu8p(cgcVvmTestFilePattern)/**.dll*/, _csu8p(cgcVvmTestCoreDll)/*exclude this test*/); } }
bool iivvmt_testSha1_1(u64 lnHandleLog) { // Used for test #3 u32 lnI; u8 context[96]; ////////// // Tell them which test we're running ////// vvm_resourcePrintf(IDS_VVM_TEST_SHA1_FIPS_PUB_180_1); ////////// // "abc" // A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D ////// vvm_resourcePrintf(IDS_VVM_1DOTDOTDOT); vvm_sha1ComputeSha1AsHex((s8*)cgc_Test_Sha1_1_1, sizeof(cgc_Test_Sha1_1_1) - 1, cgc_Test_Sha1_1_3, true);; if (vvm_memicmp(_csu8p(cgc_Test_Sha1_1_2), _csu8p(cgc_Test_Sha1_1_3), sizeof(cgc_Test_Sha1_1_2) - 1) != 0) { failure: // Error vvm_resourcePrintf(IDS_VVM_TEST_FAIL); // Indicate we failed return false; } ////////// // "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" // 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 ////// vvm_resourcePrintf(IDS_VVM_2DOTDOTDOT); vvm_sha1ComputeSha1AsHex((s8*)cgc_Test_Sha1_2_1, sizeof(cgc_Test_Sha1_2_1) - 1, cgc_Test_Sha1_2_3, true);; if (vvm_memicmp(_csu8p(cgc_Test_Sha1_2_2), _csu8p(cgc_Test_Sha1_2_3), sizeof(cgc_Test_Sha1_2_2) - 1) != 0) goto failure; // Failure ////////// // A million repetitions of "a" // 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F ////// vvm_resourcePrintf(IDS_VVM_3DOTDOTDOT); // Initialize vvm_sha1ComputeSha1_Start(context); // Process one million lower-case "a" characters in succession, one at a time for (lnI = 0; lnI < 1000000; lnI++) vvm_sha1ComputeSha1_ProcessThisData(context, (s8*)cgc_Test_Sha1_3_1, sizeof(cgc_Test_Sha1_3_1) - 1); // Finalize and compute the value a hex vvm_sha1ComputeSha1_FinishAsHex(context, cgc_Test_Sha1_3_3, true, true); if (vvm_memicmp(_csu8p(cgc_Test_Sha1_3_2), _csu8p(cgc_Test_Sha1_3_3), sizeof(cgc_Test_Sha1_3_2) - 1) != 0) goto failure; // Failure // If we get here, we're good vvm_resourcePrintf(IDS_VVM_TEST_PASS); return(true); }