4886 Commits

Author SHA1 Message Date
Brian Smith
d25ceb61a5 Make RAND_bytes test-only.
It is only used in the tests, and it is one of the things that
creates linkage conflicts when people try to link OpenSSL forks with
*ring*.
2016-08-22 10:01:41 -10:00
David Judd
f96d6403ec Make BN_rand test-only.
It was already only used in tests, so only compile it in tests,
and remove now-unused modes.

I agree to license my contributions to each file under the terms
given at the top of each file I changed.
2016-08-22 10:01:40 -10:00
Brian Smith
0a8efedb51 Use Limb::max_value() instead of defining MAX_LIMB. 2016-08-22 10:01:39 -10:00
Brian Smith
ef7a07cdf3 Describe limb ordering in just one place. 2016-08-22 10:01:39 -10:00
David Judd
7cbe5d76fb Replace BN_rand_range C implementation with call to Rust.
The random key generation code is adapted from that used for EC,
but temporarily duplicated, with the following changes:
- A Range struct wrapping Limb slices used as ranges
- Instead of converting bytes to limbs, generate random bytes directly
  into the Limb slice, temporarily casting it to u8
- Add support for ranges with zero bits in the most significant limb
  by masking those bits in the generated random bytes

Also remove the `min_inclusive` parameter from BN_rand_range_ex,
since in practice it is always 1.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-08-22 10:01:38 -10:00
Brian Smith
7d7ac56929 Remove pub from extern declarations in src/rand.rs. 2016-08-21 11:15:02 -10:00
Peter Reid
e7cd8ee766 Fix HKDF test; it was not comparing actual to expected output.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-08-18 12:25:37 -10:00
Brian Smith
c56690d356 Fix indention of Fn/FnOnce/FnMut where clauses. 2016-08-18 12:19:57 -10:00
Brian Smith
a7b02de2dc Avoid storing unused/redundant copies of {n, p, q} in RSA.
|d| is only used in rsa_check_key. |n|, |p|, and |q| are already stored
in |mont_n|, |mont_p|, |mont_q|.
2016-08-18 12:19:57 -10:00
Brian Smith
82b40be68d Require non-NULL BN_MONT_CTX for |BN_mod_exp_mont_consttime|.
Since |BN_MONT_CTX_set| is not protected against side channels,
encourage callers to call it explicitly, once, and reuse the
|BN_MONT_CTX|, instead of relying on |BN_mod_exp_mont_consttime|
to recreate it each time. All the existing callers already passed a
non-NULL |BN_MONT_CTX_set|, so this is just deleting dead (test-only)
code.
2016-08-17 18:19:04 -10: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
cef7e4cf7a Remove ring::digest::Algorithm::nid.
This is a leftover thing from when `ring::digest` was primarily written
in terms of the OpenSSL digest API.
2016-08-17 15:02:16 -10:00
Thomas Bahn
bd76a799c7 Add fmt::Debug impl for Algorithm and Digest
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-08-17 15:02:15 -10:00
Brian Smith
d288a43ba3 Wrap lines at 80 characters in src/digest.rs. 2016-08-17 12:51:52 -10:00
Corey Farwell
9154bc5fd5 Fix incorrect compilation flag in doc example.
I agree to license my contributions to each file under the terms
given at the top of each file I changed.
2016-08-17 10:21:42 -10:00
Brian Smith
1da33f1f6f Prohibit extern implementations of ring::signature::VerificationAlgorithm.
Thanks to Gläb Hörl for the tip on how to do this.
2016-08-16 14:17:29 -10:00
Brian Smith
69c6e504a6 Ignore *.orig in .gitignore. 2016-08-16 14:16:56 -10:00
Brian Smith
94d9d791de Linux: Actually enable Clang 3.8.
The previous commit only updated mk/update-travis-yml.py.
2016-08-16 14:16:46 -10:00
Brian Smith
4c4ea47e26 Linux: Re-enable clang builds on Travis CI.
This reverts commit b6331570d081c820ded86f4fa2423a53beb75c56. It isn't
a pure revert because of merge conflicts.
2016-08-16 10:22:33 -10:00
Brian Smith
68ad8a4f47 Improve crates.io description. 2016-08-15 15:50:02 -10:00
Brian Smith
8fcfeb315e Windows: Copy pregenerated asm lib to lib dir.
Cargo/rustc wasn't resolving "pregenerated" to an absolute path, so
while the previous scheme for finding the pregenerated libraries worked
for "sh mk/package.sh", it didn't work when building other libraries,
when the current working directory isn't the *ring* source directory.
2016-08-15 15:24:09 -10:00
Brian Smith
086227aba4 Remove pregenerated/ from .gitignore.
Putting it in .gitignore resulted in "cargo package" excluding its
contents from the package.
2016-08-15 15:14:41 -10:00
Brian Smith
d59b70cec3 Windows: Don't require msbuild.exe to be in %PATH%. 2016-08-15 13:27:43 -10:00
Brian Smith
caa4df6e68 Prepare for publishing on crates.io. 2016-08-15 12:38:08 -10:00
Brian Smith
f8bb8677e9 Windows: Split assembly language components into seperate static lib. 2016-08-14 20:24:43 -10:00
Brian Smith
078d3c2bae Windows: Compute linker inputs from PerlAsm output automatically. 2016-08-14 20:14:43 -10:00
Brian Smith
6440d1cdad Windows: Fix dependencies on PerlAsm scripts in build system.
Wildcards are not allowed in this part of MSBuild files. When doing a
/verbosity:d build using MSBuild here, MSBuild outputs a warning/error.
2016-08-14 20:13:24 -10:00
Brian Smith
278cf73cb5 Create intermediate directory before processing PerlAsm.
Things currently work accidentally because MSBuild is generating the
intermediate directory before the GenerateAsm target. Create the
directory explicitly to avoid relying on this kind of happy accident.
2016-08-14 20:12:48 -10:00
Brian Smith
fb776c6bc6 Windows: Fix formatting in mk/perlasm-msbuild.targets. 2016-08-14 20:12:43 -10:00
Brian Smith
499c752af6 Windows: Remove unused MSBuild Rule for PerlAsm stuff. 2016-08-14 20:12:34 -10:00
Brian Smith
ea497f0c64 Windows: Rename libtest to libring-test. 2016-08-14 20:12:32 -10:00
Brian Smith
849a6ac871 Windows: Remove "Tests" project folder from ring.sln.
This was a relic from when we had multiple test executable projects.
2016-08-14 20:12:27 -10:00
Brian Smith
ec39fbde04 Update appveyor.yml for Rust 1.10.0; update README.me for VS2015.3. 2016-08-13 09:38:24 -10:00
Brian Smith
13a62c8b02 Avoid Reader::mark() & Reader::get_input_between_marks().
This API is a little awkward and doesn't statically guarantee
correctness (e.g. the start is before the end, or that the marks are
for the same `Input`) as much as we would like. This is a step toward
getting rid of it.
2016-08-12 21:40:48 -10:00
Brian Smith
35538d887c Wrap GitHub link in documentation in <code></code>. 2016-08-12 17:08:50 -10:00
Brian Smith
086963a21a Add documentation links. 2016-08-12 10:31:06 -10:00
Brian Smith
61049a410d Move digest_tests.txt to src/digest/. 2016-08-11 14:48:48 -10:00
Brian Smith
4db74881e4 Move ed25519_tests to src/ec/, where the Ed25519 code is. 2016-08-11 14:48:40 -10:00
Sam Scott
4f34ef2ec3 Move rsa.rs and other rsa files to separate folder.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-08-11 10:09:29 -10:00
Brian Smith
247f828500 Fix --no-default-features Linux build. 2016-08-11 09:55:52 -10:00
Brian Smith
78a960752a Fix build failure on non-Windows platforms RE: error::Untrusted. 2016-08-11 09:42:26 -10:00
Brian Smith
ac848e11c5 Use ring::error::Unspecified instead of () as the error type.
This may help users of *ring* map *ring* errors into their own error
types.
2016-08-11 09:09:22 -10:00
Brian Smith
180d0595bb Use "reference" style links in rustdoc comments.
This makes the documentation easier to read in source form. It is the
form that the Rust team recommends to use. I didn't change all the
links to the Go analogs to reference style since there seemed to be
no benefit to doing so and it would be time-consuming.
2016-08-11 09:04:44 -10:00
Brian Smith
2aad174c80 Fix typo in comment in ring::agreement. 2016-08-11 09:04:43 -10:00
Brian Smith
5f7e741ae9 Fix "-features=rsa_signing" build. 2016-08-06 07:55:50 -10:00
Brian Smith
4db2684a04 Remove BN_FLG_CONSTTIME.
Nothing uses this any more.
2016-08-05 14:59:53 -10:00
Brian Smith
81959833df Remove the non-"no_branch" code paths in BN_div. 2016-08-05 14:36:48 -10:00
Brian Smith
73b8bc2cbf Replace BN_mod_inverse_vartime with BN_mod_inverse_odd. 2016-08-05 14:24:49 -10:00
Brian Smith
a981226be9 Merge BoringSSL a432757: Use BN_mod_inverse_odd instead of |BN_mod_inverse| for ECC.
The ECC code in *ring* doesn't use this inversion code at all now, but
the related changes are useful and necessary for *ring*.
2016-08-05 14:22:09 -10:00
Brian Smith
4c0cf4f177 No-op merge BoringSSL 4cfdf41: Use bn_mod_inverse_odd for RSA/inversion blinding.
*ring* was already doing this.
2016-08-05 14:16:58 -10:00