Hello,
NIIBE Yutaka <[email protected]> wrote:
> I can test with Clang 17. I'll test.
The particular tests (using valgrind) do not fail with Clang 17. I
checked the assembler output, and confirmed no issues.
With artifically modified source (so that it can replicate cnd_copy problem):
==========================
diff --git a/cnd-memcpy.c b/cnd-memcpy.c
index 4aaee78b..1a7bbcf6 100644
--- a/cnd-memcpy.c
+++ b/cnd-memcpy.c
@@ -41,10 +41,10 @@ cnd_memcpy(int cnd, volatile void *dst, const volatile void
*src, size_t n)
const volatile unsigned char *sp = src;
volatile unsigned char *dp = dst;
volatile unsigned char c;
- volatile unsigned char m;
+ unsigned char m;
size_t i;
- m = -(unsigned char) cnd;
+ m = -(unsigned char) (cnd != 0);
for (i = 0; i < n; i++)
{
==========================
Build of Clang 17 with -O3, it correctly detects the problem.
==========================
==71789== Conditional jump or move depends on uninitialised value(s)
==71789== at 0x48C6BBB: nettle_cnd_memcpy (../cnd-memcpy.c:51)
==71789== by 0x10C946: cnd_memcpy_for_test
(../../testsuite/cnd-memcpy-test.c:14)
==71789== by 0x10C946: test_main (???:36)
==71789== by 0x10CFC4: main (../../testsuite/testutils.c:173)
==71789==
==71789==
==71789== Exit program on first error (--exit-on-first-error=yes)
FAIL: sc-cnd-memcpy
[...]
==71811== Conditional jump or move depends on uninitialised value(s)
==71811== at 0x48C6BBB: nettle_cnd_memcpy (../cnd-memcpy.c:51)
==71811== by 0x485EB68: _nettle_pkcs1_sec_decrypt (../pkcs1-sec-decrypt.c:82)
==71811== by 0x10C94E: pkcs1_decrypt_for_test
(../../testsuite/pkcs1-sec-decrypt-test.c:14)
==71811== by 0x10C94E: test_main (???:41)
==71811== by 0x10D524: main (../../testsuite/testutils.c:173)
==71811==
==71811==
==71811== Exit program on first error (--exit-on-first-error=yes)
FAIL: sc-pkcs1-sec-decrypt
==========================
So, I think that the tests itself work well.
--
_______________________________________________
nettle-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]