Does the code that handles a secret run in time independent of it?memcheck already follows undefined bytes through arithmetic and reports themoment one of them decides a branch or an address. That is the same question,so each driver here declares its secret undefined and runs under valgrind:every report names a place where a secret reached a branch or an index. Thetechnique is Adam Langley's ctgrind.ct_canary.c is the calibration. It branches on a secret and indexes a tablewith one, so it must report; if it does not, the marking is not reaching thecode and the silence of every other driver in that run means nothing. Roundfive learned this the hard way with ThreadSanitizer, which saw nothing throughGHC's runtime including a deliberate race.What is marked secret in each driver is the thing the caller would call aprivate key, and nothing else. A modulus, a peer's public key, a nonce and amessage are public and stay defined; so does each answer, which is declaredpublic again before anything looks at it. canary a branch and a table index on a secret -- must report powm crypton_powm_sec, the exponent being an RSA private key p256 both scalar multiplications and the scalar inversion x25519 the scalar ed25519 the private key, through signing decaf Ed448 signing and X448, both private scalars chapoly the ChaCha20 key, the plaintext, and the Poly1305 key aes the AES key and the plaintext, through ECB and GCM aes_armv8 the same driver again, on AArch64, against the instructions aes_x86ni the same driver again, on x86-64, against AES-NIOne driver, built three times, against the portable C and against each ofthe two instruction sets. All three must report nothing at all -- not"nothing outside known.txt", nothing. The portable AES and GHASH arebitsliced and table-free; AESE, AESMC, PMULL, AESENC and PCLMULQDQ looknothing up. None of the three has anywhere for a secret to decide a branchor an address.This entry used to read the other way round. The portable implementationwas table-driven -- an S-box indexed by a byte of the state, and Shoup's4-bit table for the GHASH -- so the aes driver was *required* to report, andknown.txt carried four entries saying so. That requirement was also whatkept the pair honest: if the portable build had quietly taken an acceleratedpath it would have fallen silent, and the silence would have failed it.With the tables gone that check goes too, so the question is now askedoutright rather than read off a leak. Each build of the driver prints whichimplementation its dispatch took, and run.sh requires the answer it expectsbefore it looks at anything else. A build that takes the wrong path failson that line rather than passing by saying nothing.The x86-64 build is new with the rewrite. Before it, AES-NI and PCLMULQDQhad never been put to this harness at all: their being constant time was aninference from the instruction specifications rather than a measurement ofcrypton's code. The AArch64 build came earlier, when the GHASH wasrewritten and it was noticed that the harness had only ever run on x86-64.What round eight found----------------------Of the eight drivers, five were silent: the RSA exponentiation, X25519,Ed25519, ChaCha20 and Poly1305 never let a private key decide a branch or anaddress. The AES driver reported from the tables, as it was built to.The other two reported, five places between them, and every one of them anassert(): crypton_p256_modmul assert(top <= 1), assert(top == 0) crypton_gf_448_strong_reduce two asserts on a carry and a borrow crypton_gf_invert assert(ret), that what was inverted had an inverseThe first four check an invariant of a reduction rather than anything aboutthe data, so they hold whatever the input is. The fifth holds because the twocallers that ask for it are inverting a projective z, which is never zero fora point on the curve. Either way the branch goes the same way every time andno timing follows from it. They are reported at all becausecrypton's C is compiled without NDEBUG, so assert() is live in a releasedlibrary. Twenty-eight assertions ship that way, none of them with a sideeffect, and defining NDEBUG measured no faster on P-256, so whether to keepthem is a question about what a library should do when an internal invariantfails -- abort the process, or carry on -- rather than one about speed. Theyare listed in known.txt and the job passes with them.The decision was to keep them: an internal invariant that fails in acryptographic library is better met with an abort than with a wrong answercarried onwards. So this is settled rather than open, and the five entries inknown.txt are permanent. What is not permanent is anything else appearingbeside them.