42 Commits

Author SHA1 Message Date
Brian Smith
7d36600ec8 Use alloc instead of std when possible. 2019-07-09 21:15:18 -10:00
Brian Smith
7b6e9dd911 Rename SHA1 to SHA1_FOR_LEGACY_USE_ONLY. 2019-07-09 14:16:39 -10:00
Joe Richey
7b0f9ad021 Simplify core vs std usage 2019-06-13 08:51:09 -10:00
Brian Smith
fdc558da0f cargo +nightly fix && cargo fmt. 2019-06-13 08:40:58 -10:00
Brian Smith
f0d4d21e85 Use stable rustfmt. 2019-04-10 09:33:38 -10:00
Brian Smith
306d163613 Refactor ring::signature verification API.
Introduce `UnparsedPublicKey`. Remove public use of `untrusted::Input`.
Replace `signature::verify()` with `UnparsedPublicKey::verify()`.
2019-04-05 16:21:40 -10:00
Brian Smith
c40df473cb Update to latest untrusted prerelease. 2019-04-05 09:45:53 -10:00
Brian Smith
c125b2b4b1 Stop renaming symbols when publicly exporting them.
Rust tooling (rustdoc, and rustc error reporting) doesn't handle very well
the renaming of a symbol when exporting it.
2019-04-04 13:20:48 -10:00
Brian Smith
d9633e27f4 Update to the latest (unreleased) untrusted. 2019-03-14 19:39:56 -10:00
Brian Smith
366a62171a Use libcore integer <-> byte array conversion API. 2019-03-06 15:25:39 -10:00
Brian Smith
ab0726d0cd Embed test data into test executables.
Embed test data files into test executables so that file I/O isn't
necessary during tests. This allows the tests to run on platforms that
don't have file I/O. It also makes it easier to run the tests on a
separate (virtual) machine from the build machine since the test
automation no longer needs to keep track of the test files.
2019-02-02 13:21:02 -10:00
Brian Smith
6dd3026adb Replace manual core::fmt::Debug implementation for RSA parameters. 2019-01-02 17:01:32 -10:00
Brian Smith
faaef278dc Move der under IO. 2018-12-21 15:22:30 -10:00
Brian Smith
6609177e63 Rename RSA* to Rsa*. 2018-12-21 15:21:50 -10:00
Brian Smith
ac28d386d4 Rename ring::private to ring::sealed.
This seems to the common naming convention.
2018-12-18 16:40:11 -10:00
Brian Smith
67425b7463 Enable RSA signign by default; remove rsa_signing feature. 2018-12-12 20:09:46 -10:00
Brian Smith
2843931bb7 Switch to Rust 2018 Edition.
Switch to Rust 2018 Edition. Fix up some build breakage for different
configurations that were found in the process of testing this,
particularly `--no-default-features`.
2018-12-08 21:39:17 -10:00
Brian Smith
948846061e cargo fix --edition && cargo +nightly fmt. 2018-12-08 21:39:17 -10:00
Brian Smith
a51cd824f6 Call cpu::cache_detected_features() in verify_rsa().
`verify_rsa()` skips over the call done in `ring::signature::verify()`.
2018-12-01 08:56:05 -10:00
Brian Smith
b673c6482c Remove ring::polyfill::ref_from_mut_ref. 2018-12-01 05:05:23 -10:00
Brian Smith
730a46f665 Reformat src/rsa. 2018-11-15 16:17:49 -10:00
Brian Smith
0664405705 Fix license typo. 2018-11-13 11:54:20 -10:00
Brian Smith
26ac52b250 Replace "use {...}" with "use crate::{...}" 2018-11-12 16:51:43 -10:00
Brian Smith
687bc1db65 Rename private::Private to private::Sealed.
`private::Sealed` is the name suggested in
https://rust-lang-nursery.github.io/api-guidelines/future-proofing.html#c-sealed.
2018-06-04 13:36:15 -10:00
Brian Smith
ee08ec97e1 Remove unneeded mut.
This was breaking the build in the current nightly.
2017-08-27 15:26:29 -10:00
Brian Smith
f66121467d Switch to ? syntax in ring::rsa. 2017-05-17 21:41:17 -10:00
Sam Scott
46b7a2b32e Add PSS padding encoding tests.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-12-20 19:49:44 -10:00
Sam Scott
7110b191c6 Expand PSS padding verification test cases.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2016-12-20 19:49:44 -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
a38d9a4ef9 Verify RSA PKCS#1 1.5 signatures by encode-then-check.
When we first implemented PKCS#1 1.5 signature verification we had not
implemented signature generation, so we implemented verification by
parsing the padding. Now that we have generation we can save some code
and arguably make verification safer. Also, this is the way RFC 3447
recommends to do it.
2016-11-23 09:01:36 -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
5fb1fc8a5e Add and use PUBLIC_KEY_PUBLIC_MODULUS_MAX_LEN.
`PUBLIC_KEY_PUBLIC_MODULUS_MAX_LEN` is measured in bytes, whereas
`PUBLIC_MODULUS_MAX_LEN` was measured in bits.
2016-11-15 10:43:31 -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
Brian Smith
4c9a9c8751 Refactor PSS encoding. 2016-11-15 10:43:29 -10:00
Brian Smith
eeb99a780e Factor out common metric calculations in PSS padding. 2016-11-15 10:43:27 -10:00
Brian Smith
18ff68f90c Factor out shared digesting logic in PSS padding. 2016-11-15 10:41:18 -10:00
Brian Smith
5be8b7f960 Fix (mod_bits - 1) % 8 == 0 case for PSS encoding.
fix encoding
2016-11-15 10:41:16 -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
8cb3673417 Factor out common logic in internal RSA padding interface.
Factor out the duplicate checks that `m` is fully consumed.
2016-11-15 10:39:34 -10:00
Brian Smith
7520d283eb Fix (mod_bits - 1) % == 0 case in RSA PSS verification.
Output the extra leading zero byte when necessary.

Rename parameters in the `Encoding` interface to match the
specification and update the implementations to use the updated
variable names.
2016-11-15 10:39:32 -10:00
Sam Scott
4e5145157c Implement RSA-PSS verification.
-  Add tests for RSA-PSS verification from NIST 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:28 -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