20 Commits

Author SHA1 Message Date
Brian Smith
f72ca3a422 Remove redundant copy of iqmp in RSA private keys. 2016-11-28 09:15:54 -10:00
Brian Smith
2a180893ae Expose deterministic SecureRandoms in ring::test::rand. 2016-11-23 14:06:12 -10:00
Brian Smith
5a96fa8bb3 Factor out RSA padding message digest computation.
Instead of every padding verification implementation and every padding
encoding implementation doing the digesting, have `sign()` and
`verify()` to it themselves.
2016-11-23 11:38:24 -10:00
Brian Smith
f0f9b00e1a Expose RSAEncoding in the public API.
Expose `RSAEncoding` in the public API so that users of *ring* can use
it in type signatures. Add an "RSA" prefix to the exported types, since
they will be exported from `ring::signature`. Modify RSA tests to use
only the public API so as to ensure that enough of the API is public.
2016-11-15 12:02:42 -10:00
Brian Smith
be08baa959 Add BitLength type and use it in RSA padding.
Besides improving type safety generally, this fixes a bug in RSA PSS
signing where the wrong value of `mod_bits` was being passed to
`Encoding::encode()`.
2016-11-15 10:43:30 -10:00
Sam Scott
2e9ef69c23 Implement RSA-PSS signing.
-  Refactor Encoding trait to be randomised.
 -  Add RSA-PSS signing test cases.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-11-15 10:39:48 -10:00
Brian Smith
424d276014 Make PositiveInteger::into_raw() safer.
At the time the code was written, I didn't know `mut self` was an
option.

With the new move semanticsfor `into_raw()`, more of the complexity of
the pointer handling can be removed as there's no potential for any
null dereference.
2016-11-12 12:52:05 -10:00
Brian Smith
7ca6c31d77 Implement Drop directly on the private RSA structure.
With Rust 1.13 it is now OK to implement `Drop` on `extern "C"`
types, since drop flags were dropped.
2016-11-12 12:04:32 -10:00
Brian Smith
17d533863c Match algorithm names in PKCS#1 tests the way upcoming PSS tests do. 2016-11-09 12:07:17 -10:00
Brian Smith
ec9bbdb4c0 Stop skipping some RSA signing tests on ARM Android.
This workaround for slow test runs is no longer necessary and didn't
seem to work all the time anyway.
2016-11-09 11:46:45 -10:00
Brian Smith
77c8c8091c Allow unsafe_code everywhere.
Since the unsafe code is already in `unsafe` blocks, it's redundant to
also require `#[allow(unsafe_code)]`.
2016-09-18 10:48:44 -10:00
Sam Scott
cb3ce35061 Refactor RSA padding to new Encoding/Verification traits.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-09-12 10:42:45 -10:00
Brian Smith
f1000c73f3 Normalize formatting of RSA code with rustfmt.
There are still some manual exceptions.
2016-09-12 09:47:06 -10:00
Brian Smith
8b7bb0cf6b 0.4.2: Fix build breakaged caused by Rust language change.
Rust Nightly now doesn't allow using an extern "C" static value unless
the reference is wrapped in `unsafe { }`, so do that.
2016-09-11 09:18:05 -10:00
Brian Smith
7900e986f7 Use the "GFp_" prefix for RSA externs. 2016-08-28 17:33:06 -10:00
Brian Smith
e95806f0ed Use the "GFp_" prefix for BIGNUM externs. 2016-08-28 17:32:58 -10:00
Brian Smith
279bd0a2e9 Reformat based on suggestions from rustfmt.
This is a first step toward fully-automated formatting. A custom format
is used, primarily to tell rustfmt to wrap at column 80(-ish) instead of
column 100(-ish), and to use more compact styles.

Many rustfmt suggestions for rewrapping function calls were ignored
because they did not result in the minimum number of lines and/or
because I'm still unsure the best way to format a long chain. Some
suggestions for reformatting macros were ignored because they ruined
the indention. Some other suggestions were ignored because they seemed
like bugs and/or seemed to make things clearly worse.

Further work is planned, in order to make the formatting fully
automatic.
2016-08-28 17:32:32 -10:00
Brian Smith
5b75fb123f Refactor RSA signing API to allow concurrent use of RSAKeyPair. 2016-08-27 10:50:49 -10:00
Brian Smith
d478370db3 Remove unnecssary boxing of RSA within RSAKeyPair. 2016-08-27 10:47:01 -10:00
Brian Smith
bf6ccac2db Split RSA verification- & signing- specific code into submodules. 2016-08-27 10:47:01 -10:00