From 33cb3c2b1fc3f3fe46c6d0eab118248ea86c1f06 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sat, 19 Dec 2020 10:56:51 +0200 Subject: [PATCH] Add secret key extraction from keypair to constant time tests --- src/valgrind_ctime_test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/valgrind_ctime_test.c b/src/valgrind_ctime_test.c index 3169e3651c404..bf8dfa9ce3428 100644 --- a/src/valgrind_ctime_test.c +++ b/src/valgrind_ctime_test.c @@ -140,6 +140,12 @@ int main(void) { ret = secp256k1_keypair_xonly_tweak_add(ctx, &keypair, msg); VALGRIND_MAKE_MEM_DEFINED(&ret, sizeof(ret)); CHECK(ret == 1); + + VALGRIND_MAKE_MEM_UNDEFINED(key, 32); + VALGRIND_MAKE_MEM_UNDEFINED(&keypair, sizeof(keypair)); + ret = secp256k1_keypair_sec(ctx, key, &keypair); + VALGRIND_MAKE_MEM_DEFINED(&ret, sizeof(ret)); + CHECK(ret == 1); #endif #ifdef ENABLE_MODULE_SCHNORRSIG