28 Commits

Author SHA1 Message Date
Brian Smith
5aa224c4bc Import constant_time_conditional_memcpy from BoringSSL.
Previously we didn't need it. Now we do.
2023-10-06 09:54:59 -07:00
Brian Smith
7bd536e9df Replicate BoringSSL's test for constant_time_conditional_memxor. 2023-09-30 13:40:06 -07:00
Brian Smith
2270dc6943 Rename crypto_word back to crypto_word_t.
Originally I was trying to be pedantic and avoid any use of `_t`-
suffixed names. However, this hasn't really accomplished anything
except annoying me, so just do what BoringSSL does.
2023-09-28 18:11:05 -07:00
Brian Smith
1194b80cb4 Simplify constant_time_test & remove its stdlib.h dependency.
Remove the trivial stdlib.h dependency from the test. Now the test
works more like other tests, so it's a double win.
2019-02-02 16:08:12 -10:00
Brian Smith
bd96baa7e4 Remove <stdio.h> dependency from tests.
SGX targets don't necessarily have file I/O and some embedded targets
don't either.

Do this in a minimal-effort way since this test file should get
replaced soon anyway.
2019-02-02 16:08:12 -10:00
Brian Smith
cda9d33d31 Use Rust for RSA exponentiation. 2018-11-29 16:01:00 -10:00
Brian Smith
7d34afc5f0 Fix formatting nit in constant_time_test.c. 2018-05-18 13:32:50 -10:00
Brian Smith
0027633cc9 Rename crypto_word_t to crypto_word.
Avoid using the `_t` suffix since that's undefined behavior in C.
2018-05-18 13:32:49 -10:00
Brian Smith
fe3cedd82a Fix build breakage in constant_time_test.c from a7b44dee79af4d5cf639fd1e28fc838e12e2667e. 2018-04-27 16:37:41 -10:00
Brian Smith
a7b44dee79 Merge BoringSSL 518ba07: Switch constant-time functions to using |crypto_word_t|.
This was a simple but non-trivial merge.
2018-04-26 16:49:26 -10:00
Brian Smith
3b34c230c9 Merge BoringSSL d1c0de6: Add size_t variants of constant-time functions.
*ring* had already created its own versions of these functions. Switch
to the BoringSSL definitions since the *ring* definitions were no better
and in some cases worse.

Note in particular the replacement of shift of the sign bit, which is
undefined behavior, with well-defined behavior.

Remove the `_unsigned()` variants which are no longer needed.
2017-12-28 20:06:39 -10:00
Brian Smith
2c56be7e2c Rename size_t constant-time utilities to match BoringSSL's.
Make it easier to keep the code in sync by using the same names.
2017-12-28 19:19:46 -10:00
Brian Smith
db972916c0 Reformat test cases in constant_time_test.c.
Make it easier to compare this code with BoringSSL's and adding
new teset cases cleaner.
2017-12-28 19:11:58 -10:00
Brian Smith
7e47e190cc Fix typos in constant_time_test.c.
It seems some of these tests were probably not running due to these
typos. However, it seems to have not hid any actual problems.
2017-12-28 19:09:10 -10:00
David Benjamin
c96a888194 Convert constant_time_test and refcount_test to C++.
No source changes, just a rename.

Change-Id: Iaef406d2a04dc8c68c94eb2a98eec6378eaeab66
Reviewed-on: https://boringssl-review.googlesource.com/12975
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2017-01-04 01:36:49 +00:00
Brian Smith
c2ee5d3a52 Remove unused constant_time_lt_size_t.
The code that used it was rewritten a while ago.
2016-08-17 15:04:22 -10:00
Brian Smith
f3c1e41698 Name unsigned variants of constant-time utilities _unsigned.
It's too easy to accidentally use the `unsigned` variants instead of the
`size_t` variants. This fixes that.
2016-07-09 10:30:44 -10:00
Brian Smith
735e611ce7 Add constant_time_is_nonzero_size_t. 2016-07-09 10:30:43 -10:00
Brian Smith
71c5a42e38 Fix constant_time_test testing of size_t variants.
It was using the `unsigned int` test vectors instead of the `size_t`
test vectors. Besides being totally wrong, it also broke the Mac build.
2016-06-30 16:37:34 -10:00
Brian Smith
9bfb6d3cff Add new constant-time utilities for field elements & scalars.
The changes to crypto/internal.h and crypto/constant_time_test.c were
copied from the analogous tests for the |unsigned int| variants from
BoringSSL.
2016-06-30 15:26:37 -10:00
Brian Smith
4165289b36 Use one process for all tests.
Instead of building the test suites inherited from BoringSSL as
seperate executables, link them all together into one executable,
giving all their `main` functions unique names.

This allows all the tests to be run, even on platforms that don't have
traditional process spawning, and avoids the need to keep track of
directory names even on platforms that do support process spawning.

This also makes it easier to integrate new BoringSSL test suites on
Windows, because we don't need to create a new `vcxproj` file for each
one.

Having one test executable may also make code coverage easier.
2016-04-16 18:55:05 -10:00
Ms2ger
02f39ead8a Remove now-unused constant-time math functions.
I agree to license my contributions to each file under the
same terms given at the top of each file I changed.
2016-04-14 17:28:58 -10:00
Brian Smith
d80d3c09fc Remove even more unused stuff in constant_time_test.c. 2016-03-17 12:29:45 -10:00
Brian Smith
081890e9e5 Remove more now-unused code in constant_time_test.c. 2016-03-17 08:50:57 -10:00
Brian Smith
7c8e9fe403 Remove unused constant-time utilities. 2016-03-16 23:11:58 -10:00
Brian Smith
8435da899b Remove unused parameters in tests. 2016-02-14 13:55:47 -10:00
Brian Smith
28f1ea5ae3 Make more tests silent when they succeed. 2015-10-26 18:32:31 -10:00
Adam Langley
9ed9dae18e Update constant-time operations.
(Based on upstream's 42af669ff2754dfbe1dd55a0ab56664f82284dc4)

Change-Id: I4d3954fea7471e274c626483a0dfb9d7b3250b74
2014-11-10 13:48:30 -08:00