Beispiel #1
0
/**
 * Run all test cases
 */
int main(){
  test_shift_rows();
  test_mul_in_gf();
  test_mix_columns();
  test_key_schedule_128bitkey();
  test_encryption();
// TODO: test add round key, sub bytes
  printf("\nAll tests passed!\n");
  return 0;
}
Beispiel #2
0
int
test_kuzn()
{
	struct kuzn_ctx ctx;

	kuzn_context_init(&ctx);

	if (test_S() != 0) {
		printf("[-] S function test failed\n");
		return 1;
	} else {
		printf("[+] S test OK!\n");
	}
	
	if (test_R(&ctx) != 0) {
		printf("[-] R function test failed\n");
		return 1;
	} else {
		printf("[+] R test OK!\n");
	}

	if (test_L(&ctx) != 0) {
		printf("[-] L function test failed\n");
		return 1;
	} else {
		printf("[+] L test OK!\n");
	}

	if (test_keygen(&ctx) != 0) {
		printf("[-] expand key test failed\n");
		return 1;
	} else {
		printf("[+] expand key test OK!\n");
	}

	if (test_encryption(&ctx) != 0) {
		printf("[-] Encrypt/decrypt test failed\n");
		return 1;
	} else {
		printf("[+] Encrypt/decrypt test OK!\n");
	}

	return 0;
}