1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//! The crypto-profile backend on the AWS-LC FIPS 3.x module (aws-lc-rs 1.17, `fips`).
//! `rustls` is re-exported because its types are this crate's API; `aws-lc-rs` is not.
pub use *;
pub use rcgen;
pub use rustls;
/// `Admitted` is built only by `admit`, and its lists are read-only:
///
/// ```
/// use crypto_profile_awslc3::{KdfAlgorithm, MacAlgorithm, Options, Profile, admit};
/// let a = admit(Profile::Cnsa2, Options::default());
/// assert!(!a.macs().contains(&MacAlgorithm::HmacSha256));
/// assert!(!a.kdfs().contains(&KdfAlgorithm::HkdfSha256));
/// ```
///
/// ```
/// use crypto_profile_awslc3::{Options, Profile, admit};
/// let mut a = admit(Profile::Cnsa2, Options::default());
/// let x = a.macs()[0];
/// let _ = (&mut a, x);
/// ```
///
/// ```compile_fail,E0616
/// use crypto_profile_awslc3::{Options, Profile, admit};
/// let mut a = admit(Profile::Cnsa2, Options::default());
/// let x = a.macs()[0];
/// a.macs.push(x);
/// ```
///
/// ```
/// use crypto_profile_awslc3::{Options, Profile, admit};
/// let mut a = admit(Profile::Cnsa2, Options::default());
/// let x = a.kdfs()[0];
/// let _ = (&mut a, x);
/// ```
///
/// ```compile_fail,E0616
/// use crypto_profile_awslc3::{Options, Profile, admit};
/// let mut a = admit(Profile::Cnsa2, Options::default());
/// let x = a.kdfs()[0];
/// a.kdfs.push(x);
/// ```
/// An `ecdh::EphemeralKey` agrees once: `agree` consumes it.
///
/// ```
/// use crypto_profile_awslc3::{KdfAlgorithm, KeyAgreementAlgorithm, Options, Profile, admit, ecdh, kdf};
/// let a = admit(Profile::Fips1403, Options::default());
/// let peer = ecdh::EphemeralKey::generate(&a, KeyAgreementAlgorithm::EcdhP384).unwrap();
/// let spec = kdf::Spec::Hkdf { algorithm: KdfAlgorithm::HkdfSha384, salt: None, info: b"doc" };
/// let mine = ecdh::EphemeralKey::generate(&a, KeyAgreementAlgorithm::EcdhP384).unwrap();
/// let key = mine.agree(peer.public_key(), &spec, 32).unwrap();
/// assert_eq!(key.as_bytes().len(), 32);
/// ```
///
/// ```compile_fail,E0382
/// use crypto_profile_awslc3::{KdfAlgorithm, KeyAgreementAlgorithm, Options, Profile, admit, ecdh, kdf};
/// let a = admit(Profile::Fips1403, Options::default());
/// let peer = ecdh::EphemeralKey::generate(&a, KeyAgreementAlgorithm::EcdhP384).unwrap();
/// let spec = kdf::Spec::Hkdf { algorithm: KdfAlgorithm::HkdfSha384, salt: None, info: b"doc" };
/// let mine = ecdh::EphemeralKey::generate(&a, KeyAgreementAlgorithm::EcdhP384).unwrap();
/// let key = mine.agree(peer.public_key(), &spec, 32).unwrap();
/// let again = mine.agree(peer.public_key(), &spec, 32).unwrap();
/// ```
/// An `aead::Key` is not `Clone`, so its seal count cannot be copied:
///
/// ```
/// use crypto_profile_awslc3::{AeadAlgorithm, Options, Profile, admit, aead};
/// let a = admit(Profile::Fips1403, Options::default());
/// let key = aead::Key::new(&a, AeadAlgorithm::Aes256Gcm, &[7; 32]).unwrap();
/// assert_eq!(key.algorithm(), AeadAlgorithm::Aes256Gcm);
/// ```
///
/// ```compile_fail,E0599
/// use crypto_profile_awslc3::{AeadAlgorithm, Options, Profile, admit, aead};
/// let a = admit(Profile::Fips1403, Options::default());
/// let key = aead::Key::new(&a, AeadAlgorithm::Aes256Gcm, &[7; 32]).unwrap();
/// let copy = key.clone();
/// ```
/// A `digest::Hasher` is not `Clone`, so a partial hash cannot be forked:
///
/// ```
/// use crypto_profile_awslc3::{HashAlgorithm, Options, Profile, admit, digest};
/// let a = admit(Profile::Fips1403, Options::default());
/// let hasher = digest::Hasher::new(&a, HashAlgorithm::Sha384).unwrap();
/// assert_eq!(hasher.algorithm(), HashAlgorithm::Sha384);
/// ```
///
/// ```compile_fail,E0599
/// use crypto_profile_awslc3::{HashAlgorithm, Options, Profile, admit, digest};
/// let a = admit(Profile::Fips1403, Options::default());
/// let hasher = digest::Hasher::new(&a, HashAlgorithm::Sha384).unwrap();
/// let copy = hasher.clone();
/// ```
/// A `signature::KeyPair` is not `Clone`, so its private key is held once:
///
/// ```
/// use crypto_profile_awslc3::{Options, Profile, SignatureAlgorithm, admit, signature};
/// let a = admit(Profile::Fips1403, Options::default());
/// let key = signature::KeyPair::generate(&a, SignatureAlgorithm::EcdsaP384Sha384).unwrap();
/// assert_eq!(key.algorithm(), SignatureAlgorithm::EcdsaP384Sha384);
/// ```
///
/// ```compile_fail,E0599
/// use crypto_profile_awslc3::{Options, Profile, SignatureAlgorithm, admit, signature};
/// let a = admit(Profile::Fips1403, Options::default());
/// let key = signature::KeyPair::generate(&a, SignatureAlgorithm::EcdsaP384Sha384).unwrap();
/// let copy = key.clone();
/// ```
provider!;
backend_body!;
pub use test_support;
pub use ;
pub use ;
/// The AWS-LC FIPS module (line and linkage) this build links. Its certificate status is
/// [`fips::certificate()`]; for 3.x the certified release is 3.1.0.
pub const MODULE: Module = Module ;
/// Returns the exact runtime-linked AWS-LC release, independently of its certificate release.
///
/// This initializes the linked library and also reflects its version with dynamic linkage.
pub