From d5e787e3c6d25e1e646b502b039277c16228549c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niels=20M=C3=B6ller?= Date: Tue, 10 Mar 2015 22:54:56 +0100 Subject: [PATCH] Changed return type for curve25519_mul to void. --- ChangeLog | 7 +++++++ curve25519-mul.c | 3 +-- curve25519.h | 3 +-- examples/hogweed-benchmark.c | 3 +-- testsuite/curve25519-dh-test.c | 10 +--------- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd47079f..02e69496 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-03-10 Niels Möller + + * curve25519-mul.c (curve25519_mul): Changed return type to void. + * examples/hogweed-benchmark.c (bench_curve25519_mul): Drop check + of curve25519_mul return value. + * testsuite/curve25519-dh-test.c (test_a): Likewise. + 2015-02-26 Niels Möller * nettle.texinfo: Document curve25519 and eddsa. diff --git a/curve25519-mul.c b/curve25519-mul.c index 0e280244..3dbb3dde 100644 --- a/curve25519-mul.c +++ b/curve25519-mul.c @@ -41,7 +41,7 @@ #include "ecc-internal.h" /* Intended to be compatible with NaCl's crypto_scalarmult. */ -int +void curve25519_mul (uint8_t *q, const uint8_t *n, const uint8_t *p) { const struct ecc_curve *ecc = &nettle_curve25519; @@ -139,5 +139,4 @@ curve25519_mul (uint8_t *q, const uint8_t *n, const uint8_t *p) mpn_get_base256_le (q, CURVE25519_SIZE, x2, ecc->p.size); gmp_free_limbs (scratch, itch); - return 1; } diff --git a/curve25519.h b/curve25519.h index d9bcb0d5..b47200b9 100644 --- a/curve25519.h +++ b/curve25519.h @@ -47,8 +47,7 @@ extern "C" { void curve25519_mul_g (uint8_t *q, const uint8_t *n); -/* FIXME: Switch to void return type? */ -int +void curve25519_mul (uint8_t *q, const uint8_t *n, const uint8_t *p); #ifdef __cplusplus diff --git a/examples/hogweed-benchmark.c b/examples/hogweed-benchmark.c index 3d7b5855..444d7aab 100644 --- a/examples/hogweed-benchmark.c +++ b/examples/hogweed-benchmark.c @@ -669,8 +669,7 @@ bench_curve25519_mul (void *p) { struct curve25519_ctx *ctx = p; char q[CURVE25519_SIZE]; - if (!curve25519_mul (q, ctx->s, ctx->x)) - die ("Internal error, curve25519_mul failed.\n"); + curve25519_mul (q, ctx->s, ctx->x); } static void diff --git a/testsuite/curve25519-dh-test.c b/testsuite/curve25519-dh-test.c index cd075d99..11b42632 100644 --- a/testsuite/curve25519-dh-test.c +++ b/testsuite/curve25519-dh-test.c @@ -55,15 +55,7 @@ static void test_a (const uint8_t *s, const uint8_t *b, const uint8_t *r) { uint8_t p[CURVE25519_SIZE]; - if (!curve25519_mul (p, s, b)) - { - printf ("curve25519_mul returned 0:\ns = "); - print_hex (CURVE25519_SIZE, s); - printf ("\nb = "); - print_hex (CURVE25519_SIZE, b); - printf ("\n"); - abort (); - } + curve25519_mul (p, s, b); if (!MEMEQ (CURVE25519_SIZE, p, r)) { -- 2.47.2