aboutsummaryrefslogtreecommitdiff
path: root/tests/test-rsa.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-06-18 14:55:51 -0400
committerRob Austein <sra@hactrn.net>2015-06-18 14:55:51 -0400
commit5e4fc533393e01e16739f450d46f739ca4b24fe8 (patch)
treeb1ded623fb65555921a75ca3966817e6e5f8a56b /tests/test-rsa.c
parent35733aaf5f384f26a3a736f2ab54f638646bc086 (diff)
Refactor CRT code into public API.
Diffstat (limited to 'tests/test-rsa.c')
-rw-r--r--tests/test-rsa.c8
1 files changed, 4 insertions, 4 deletions
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));