2023-11-15 Niels Möller <nisse@lysator.liu.se>
+ * ecc-mod-arith.c (ecc_mod_addmul_1): Use assert_maybe.
+ * ecc-curve448.c (ecc_curve448_modp): Likewise.
+
* testsuite/curve25519-dh-test.c (test_g): Add calls to
mark_bytes_undefined and mark_bytes_defined.
(test_a): Likewise.
(test_main): Skip side-channel tests in builds with mini-gmp or
extra asserts enabled.
-
- * ecc-mod-arith.c (ecc_mod_addmul_1): Use assert_maybe.
+ * testsuite/curve448-dh-test.c: Analogous changes.
* testsuite/Makefile.in (TS_SC_HOGWEED): New make variable. Added
- sc-curve25519-dh-test to list.
-
+ sc-curve25519-dh-test and sc-curve448-dh-test to list.
* testsuite/sc-curve25519-dh-test: New testcase.
+ * testsuite/sc-curve448-dh-test: New testcase.
2023-11-14 Niels Möller <nisse@lysator.liu.se>
tp[5] = tp[6] = 0;
c7 = mpn_add_n (rp, xp, tp, 7);
c7 = mpn_cnd_add_n (c7, rp, rp, m->B, 7);
- assert (c7 == 0);
+ assert_maybe (c7 == 0);
}
#else
#define ecc_curve448_modp ecc_mod
TS_CXX = @IF_CXX@ $(CXX_SOURCES:.cxx=$(EXEEXT))
TARGETS = $(TS_C) $(TS_CXX)
TS_SC_HOGWEED = sc-pkcs1-sec-decrypt-test sc-rsa-sec-decrypt-test \
- sc-ecdsa-sign-test sc-curve25519-dh-test
+ sc-ecdsa-sign-test sc-curve25519-dh-test sc-curve448-dh-test
TS_SC = sc-cnd-memcpy-test sc-gcm-test sc-memeql-test \
@IF_HOGWEED@ $(TS_SC_HOGWEED)
test_g (const uint8_t *s, const uint8_t *r)
{
uint8_t p[CURVE448_SIZE];
+ mark_bytes_undefined (CURVE448_SIZE, s);
curve448_mul_g (p, s);
+ mark_bytes_defined (CURVE448_SIZE, p);
+
if (!MEMEQ (CURVE448_SIZE, p, r))
{
printf ("curve448_mul_g failure:\ns = ");
test_a (const uint8_t *s, const uint8_t *b, const uint8_t *r)
{
uint8_t p[CURVE448_SIZE];
+ mark_bytes_undefined (CURVE448_SIZE, s);
+ mark_bytes_undefined (CURVE448_SIZE, b);
curve448_mul (p, s, b);
+ mark_bytes_defined (CURVE448_SIZE, p);
+
if (!MEMEQ (CURVE448_SIZE, p, r))
{
printf ("curve448_mul failure:\ns = ");
void
test_main (void)
{
+#if NETTLE_USE_MINI_GMP || WITH_EXTRA_ASSERTS
+ if (test_side_channel)
+ SKIP();
+#endif
/* From RFC 7748. */
test_g (H("9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28d"
"d9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b"),
--- /dev/null
+#! /bin/sh
+
+srcdir=`dirname $0`
+. "${srcdir}/sc-valgrind.sh"
+
+with_valgrind ./curve448-dh-test