File: gate-randomize.patch

package info (click to toggle)
rust-fixed-hash 0.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 172 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 965 bytes parent folder | download
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
diff --git a/src/hash.rs b/src/hash.rs
index 9dc356c..ca8d661 100644
--- a/src/hash.rs
+++ b/src/hash.rs
@@ -500,7 +500,8 @@ macro_rules! impl_rand_for_fixed_hash {
 				*self = $crate::rand::distributions::Standard.sample(rng);
 			}
 
-			/// Assign `self` to a cryptographically random value.
+                        /// Assign `self` to a cryptographically random value.
+                        #[cfg(feature = "getrandom")]
 			pub fn randomize(&mut self) {
 				let mut rng = $crate::rand::rngs::OsRng;
 				self.randomize_using(&mut rng);
@@ -517,8 +518,9 @@ macro_rules! impl_rand_for_fixed_hash {
 				ret
 			}
 
-			/// Create a new hash with cryptographically random content.
-			pub fn random() -> Self {
+                        /// Create a new hash with cryptographically random content.
+                        #[cfg(feature = "getrandom")]
+		        pub fn random() -> Self {
 				let mut hash = Self::zero();
 				hash.randomize();
 				hash