Skip to main content

ring/
lib.rs

1//! A drop-in replacement for ring 0.17, implemented with scytale.
2//!
3//! This crate presents the public interface of
4//! [ring](https://crates.io/crates/ring) 0.17, and does the work with
5//! [scytale](https://crates.io/crates/scytale). It is not a fork: no
6//! line of ring's implementation is here, and there is no C or
7//! assembly to build. Code written against ring compiles against it
8//! unchanged, because the library is named `ring`.
9//!
10//! This release presents ring 0.17's API, checked against ring 0.17.14,
11//! and is tested with rustls 0.23.45 and rustls-webpki 0.103.15. The
12//! version number is this crate's own, not ring's; the README keeps a
13//! table of which ring each release presents.
14//!
15//! Switch a crate over in its own manifest:
16//!
17//! ```toml
18//! [dependencies]
19//! ring = { package = "scytale-ring", version = "0.10" }
20//! ```
21//!
22//! That reaches the crate whose manifest it is. It cannot reach a
23//! dependency that names ring itself: cargo's `[patch]` matches a
24//! replacement by its real package name, which this is not.
25//!
26//! # Where it differs from ring
27//!
28//! ECDSA signatures are deterministic here (RFC 6979), where ring
29//! draws a random nonce. Both verify against the other, and the
30//! random source ring asks for is accepted and not used, but a test
31//! that compares signature bytes with stored ones will not match.
32//!
33//! The minimum Rust is scytale's, 1.88, where ring's is 1.66.
34
35#![no_std]
36#![forbid(unsafe_code)]
37
38#[cfg(feature = "alloc")]
39extern crate alloc;
40#[cfg(any(feature = "std", feature = "test_logging"))]
41extern crate std;
42
43mod debug;
44mod pkcs8_peek;
45
46/// A vector file for [`test::run`], read at compile time.
47#[cfg(feature = "alloc")]
48#[macro_export]
49macro_rules! test_file {
50    ($file_name:expr) => {
51        $crate::test::File {
52            file_name: $file_name,
53            contents: include_str!($file_name),
54        }
55    };
56}
57
58pub mod aead;
59pub mod agreement;
60#[doc(hidden)]
61#[deprecated(note = "Will be removed. Internal module not intended for \
62                    external use, with no promises regarding side channels.")]
63pub mod constant_time;
64pub mod digest;
65pub mod error;
66pub mod hkdf;
67pub mod hmac;
68pub mod io;
69pub mod pbkdf2;
70pub mod pkcs8;
71pub mod rand;
72pub mod rsa;
73pub mod signature;
74#[cfg(feature = "alloc")]
75#[doc(hidden)]
76#[deprecated(note = "internal API that will be removed")]
77pub mod test;
78
79mod sealed {
80    pub trait Sealed {}
81}