HomePhabricator

Constant-time behaviour test using valgrind memtest.

Description

Constant-time behaviour test using valgrind memtest.

Summary:

  • Constant-time behaviour test using valgrind memtest.

Valgrind does bit-level tracking of the "uninitialized" status of memory,
property tracks memory which is tainted by any uninitialized memory, and
warns if any branch or array access depends on an uninitialized bit.

That is exactly the verification we need on secret data to test for
constant-time behaviour. All we need to do is tell valgrind our
secret key is actually uninitialized memory.

This adds a valgrind_ctime_test which is compiled if valgrind is installed:

Run it with libtool --mode=execute:
$ libtool --mode=execute valgrind ./valgrind_ctime_test

  • Run valgrind_ctime_test in travis

This is a backport of secp256k1 PR708

Test Plan:

make check

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5580