From d7ad9528319596298b80e450e5a2eb87610d2fcf Mon Sep 17 00:00:00 2001 From: Andres Erbsen Date: Sun, 2 Jul 2017 17:09:09 -0400 Subject: automate P256 integration --- liblow/cmovznz.c | 10 ++++++++++ liblow/liblow.h | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 liblow/cmovznz.c create mode 100644 liblow/liblow.h (limited to 'liblow') diff --git a/liblow/cmovznz.c b/liblow/cmovznz.c new file mode 100644 index 000000000..8533ade99 --- /dev/null +++ b/liblow/cmovznz.c @@ -0,0 +1,10 @@ +#include +#include "liblow.h" +uint64_t cmovznz(uint64_t t, uint64_t z, uint64_t nz) { + asm ("testq %1, %1;" "\n" + "\t" "cmovnzq %3, %0;" + :"=r"(z) + :"r"(t), "0"(z), "r"(nz) + ); + return z; +} diff --git a/liblow/liblow.h b/liblow/liblow.h new file mode 100644 index 000000000..a8af0f52f --- /dev/null +++ b/liblow/liblow.h @@ -0,0 +1,2 @@ +#include +uint64_t cmovznz(uint64_t t, uint64_t z, uint64_t nz); -- cgit v1.2.3