From 5e4fc533393e01e16739f450d46f739ca4b24fe8 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 18 Jun 2015 14:55:51 -0400 Subject: Refactor CRT code into public API. --- tests/test-rsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test-rsa.c b/tests/test-rsa.c index 08d22c5..799f1fa 100644 --- a/tests/test-rsa.c +++ b/tests/test-rsa.c @@ -82,7 +82,7 @@ static int test_modexp(const char * const kind, * Run one RSA CRT test. */ -static int test_crt(const char * const kind, const rsa_tc_t * const tc) +static int test_decrypt(const char * const kind, const rsa_tc_t * const tc) { printf("%s test for %lu-bit RSA key\n", kind, (unsigned long) tc->size); @@ -106,7 +106,7 @@ static int test_crt(const char * const kind, const rsa_tc_t * const tc) uint8_t result[tc->n.len]; - if ((err = hal_rsa_crt(key, tc->m.val, tc->m.len, result, sizeof(result))) != HAL_OK) + if ((err = hal_rsa_decrypt(key, tc->m.val, tc->m.len, result, sizeof(result))) != HAL_OK) printf("RSA CRT failed: %s\n", hal_error_string(err)); const int mismatch = (err == HAL_OK && memcmp(result, tc->s.val, tc->s.len) != 0); @@ -172,7 +172,7 @@ static int test_gen(const char * const kind, const rsa_tc_t * const tc) uint8_t result[tc->n.len]; - if ((err = hal_rsa_crt(key, tc->m.val, tc->m.len, result, sizeof(result))) != HAL_OK) + if ((err = hal_rsa_decrypt(key, tc->m.val, tc->m.len, result, sizeof(result))) != HAL_OK) printf("RSA CRT failed: %s\n", hal_error_string(err)); snprintf(fn, sizeof(fn), "test-rsa-sig-%04lu.der", (unsigned long) tc->size); @@ -244,7 +244,7 @@ static int test_rsa(const rsa_tc_t * const tc) time_check(test_modexp("Signature (ModExp)", tc, &tc->m, &tc->d, &tc->s)); /* RSA decyrption using CRT */ - time_check(test_crt("Signature (CRT)", tc)); + time_check(test_decrypt("Signature (CRT)", tc)); /* Key generation and CRT -- not test vector, so writes key and sig to file */ time_check(test_gen("Generation and CRT", tc)); -- cgit v1.2.3