int _tmain(int argc, _TCHAR* argv[])
{
	Crypto crypto;
	BYTE salt[CRYPTO_KDF_SALT_LEN];
	BYTE master_key[16], db_key[16];
	int pass= 0;
	int tests= 4;

	pass+= test_result(
		test_salt(&crypto, (PBYTE) salt)
	);

	pass+= test_result(
		test_db_key(&crypto, db_key)
	);
	
	pass+= test_result(
		test_kdf(&crypto, (PBYTE) PASSPHRASE, sizeof(PASSPHRASE), salt, master_key)
	);

	pass+= test_result(
		test_key_encryption(&crypto, db_key, master_key)
	);

	if ( tests == pass ) {
		wprintf(L"\n===> ALL TESTS PASSED <===\n\n");
		Exit(0);
	}

	wprintf(L"%d OF %d TESTS PASSING\n\n", pass, tests);
	Exit(1);
}
Пример #2
0
int main()
{
	if (test_salt_int(6)==0 && test_salt_max(31)==0 && test_salt(12)==0 && test_hash()==0 && test_international_chars(12)==0) {
		std::cout << "Success" << std::endl;
		return EXIT_SUCCESS;
	} else {
		std::cerr << "Fail " << std::endl;
		return EXIT_FAILURE;
	}
}