4898 Commits

Author SHA1 Message Date
Brian Smith
43cb96508a Remove BN_CTX usage from BN_from_montgomery; rename to BN_from_mont. 2016-08-22 10:52:55 -10:00
Brian Smith
0984e094fe Replace BN_mul with BN_mul_no_alias, which doesn't require BN_CTX. 2016-08-22 10:52:54 -10:00
Brian Smith
1ab61fa874 Stop using BN_CTX in BN_{mod_inverse_odd, div, nnmod, MONT_CTX_set}. 2016-08-22 10:52:54 -10:00
Brian Smith
30b4b5bb9f Add back prototype of BN_rand to bn_test_lib.h. 2016-08-22 10:33:00 -10:00
Brian Smith
3b9031181f Remove prototypes of already-removed functions. 2016-08-22 10:12:08 -10:00
Brian Smith
1206420d94 Fix typo in bn.h comment. 2016-08-22 10:11:51 -10:00
Brian Smith
9cf1e168e7 Replace scalar_is_in_range with direct use of Range. 2016-08-22 10:08:32 -10:00
Brian Smith
1bc7c7fcfd Adapt the ECDH key generation tests to test Range::sample_into_limbs. 2016-08-22 10:02:05 -10:00
Brian Smith
36a91ba649 Expand Range::are_limbs_within tests. 2016-08-22 10:01:44 -10:00
Brian Smith
bb520362ca Simplify conversions from masks => bool => Err to masks => Err. 2016-08-22 10:01:42 -10:00
Brian Smith
01fea0f4a3 Expand and clarify comments regarding origin of sample_into_limbs. 2016-08-22 10:01:42 -10:00
Brian Smith
ee97b4309e Factor out most-significant-limb masking and test it. 2016-08-22 10:01:41 -10:00
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