diff --git a/Cargo.lock b/Cargo.lock index 26bba4132..b36b04e9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -410,15 +410,15 @@ dependencies = [ ] [[package]] -name = "curve25519-dalek" -version = "3.0.0" +name = "curve25519-dalek-ng" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307" +checksum = "574d8b2cd0bae5434fd50d53280f8299d95557a978686555880aaf5b8f4f81e9" dependencies = [ "byteorder", "digest", - "rand_core 0.5.1", - "subtle", + "rand_core", + "subtle-ng", "zeroize", ] @@ -494,13 +494,12 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +version = "1.0.2" +source = "git+https://github.com/daviddrysdale/ed25519-dalek?branch=rand-bump#eebf0b3fead5690101c0d44d5cc6de45e63b9aa8" dependencies = [ - "curve25519-dalek", + "curve25519-dalek-ng", "ed25519", - "rand 0.7.3", + "rand", "sha2", "zeroize", ] @@ -522,7 +521,7 @@ dependencies = [ "generic-array", "group", "pkcs8", - "rand_core 0.6.2", + "rand_core", "subtle", "zeroize", ] @@ -618,7 +617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72a4d941a5b7c2a75222e2d44fcdf634a67133d9db31e177ae5ff6ecda852bfe" dependencies = [ "bitvec", - "rand_core 0.6.2", + "rand_core", "subtle", ] @@ -769,17 +768,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.2" @@ -788,7 +776,7 @@ checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -808,7 +796,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61b3c1e8b4f1ca07e6605ea1be903a5f6956aec5c8a67fd44d56076631675ed8" dependencies = [ "ff", - "rand_core 0.6.2", + "rand_core", "subtle", ] @@ -1464,18 +1452,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.15", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", -] - [[package]] name = "rand" version = "0.8.3" @@ -1483,19 +1459,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -1505,16 +1471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.15", + "rand_core", ] [[package]] @@ -1523,16 +1480,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ - "getrandom 0.2.2", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -1541,7 +1489,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.2", + "rand_core", ] [[package]] @@ -1559,7 +1507,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.2.2", + "getrandom", "redox_syscall", ] @@ -1917,7 +1865,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335" dependencies = [ "digest", - "rand_core 0.6.2", + "rand_core", ] [[package]] @@ -1996,6 +1944,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subtle-ng" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8049cf85f0e715d6af38dde439cb0ccb91f67fb9f5f63c80f8b43e48356e1a3f" + [[package]] name = "syn" version = "1.0.60" @@ -2033,7 +1987,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", + "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -2084,7 +2038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi", "winapi", ] @@ -2099,7 +2053,7 @@ dependencies = [ "chacha20poly1305", "generic-array", "prost", - "rand 0.7.3", + "rand", "spin 0.9.2", "tink-core", "tink-mac", @@ -2128,7 +2082,7 @@ dependencies = [ "hkdf", "lazy_static", "prost", - "rand 0.7.3", + "rand", "serde", "serde_json", "sha-1", @@ -2216,7 +2170,7 @@ dependencies = [ "generic-array", "p256", "prost", - "rand 0.7.3", + "rand", "signature", "spin 0.9.2", "tink-core", @@ -2230,7 +2184,7 @@ dependencies = [ "aes", "aes-gcm", "prost", - "rand 0.7.3", + "rand", "tink-core", "tink-mac", "tink-proto", @@ -2271,7 +2225,7 @@ dependencies = [ "maplit", "p256", "prost", - "rand 0.7.3", + "rand", "regex", "serde", "serde_json", @@ -2442,7 +2396,7 @@ dependencies = [ "futures-util", "indexmap", "pin-project 1.0.2", - "rand 0.8.3", + "rand", "slab", "tokio", "tokio-stream", @@ -2611,12 +2565,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 3e412477e..057b375b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,8 @@ members = [ # Patch dependencies on tink crates so that they refer to the versions within this same repository. [patch.crates-io] +# TODO(#7): remove if/when https://github.com/dalek-cryptography/ed25519-dalek/pull/160 is merged. +ed25519-dalek = { git = "https://github.com/daviddrysdale/ed25519-dalek", branch = "rand-bump" } rinkey = { path = "rinkey" } tink-aead = { path = "aead" } tink-awskms = { path = "integration/awskms" } diff --git a/aead/Cargo.toml b/aead/Cargo.toml index 7509ef6d4..6f2d4aca6 100644 --- a/aead/Cargo.toml +++ b/aead/Cargo.toml @@ -17,7 +17,7 @@ aes-gcm-siv = "^0.10" chacha20poly1305 = "^0.8" generic-array = "^0.14.4" prost = { version = "^0.8", default-features = false } -rand = { version = "^0.7", default-features = false, features = ["alloc", "getrandom"] } +rand = { version = "^0.8", default-features = false, features = ["alloc", "getrandom"] } spin = { version = "^0.9.2", features = ["once"] } tink-core = "^0.3" tink-mac = "^0.3" diff --git a/core/Cargo.toml b/core/Cargo.toml index 125ed4439..be99bb5d6 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,7 +26,7 @@ digest = "^0.9" hkdf = "^0.11" lazy_static = { version = "^1.4", features = ["spin_no_std"] } prost = { version = "^0.8", default-features = false } -rand = { version = "^0.7", default-features = false, features = ["alloc", "getrandom"] } +rand = { version = "^0.8", default-features = false, features = ["alloc", "getrandom"] } serde = { version = "^1.0.126", features = ["derive"], optional = true } serde_json = { version = "^1.0.64", optional = true } sha-1 = { version = "^0.9.7", default-features = false } diff --git a/deny.toml b/deny.toml index 346a7eb9a..26af18332 100644 --- a/deny.toml +++ b/deny.toml @@ -9,6 +9,9 @@ targets = [ { triple = "x86_64-pc-windows-msvc" }, ] +[sources] +allow-git = [ "https://github.com/daviddrysdale/ed25519-dalek" ] + # Deny all advisories unless explicitly ignored. [advisories] vulnerability = "deny" @@ -50,21 +53,6 @@ version = "=0.4.4" name = "security-framework-sys" version = "=0.4.3" -# ed25519-dalek(v1.0.1) => rand_core(v0.5.x), {rand(v0.7.3) => getrandom(v0.1.*)} -# tonic(v0.4.0) ..=> rand(v0.8.3) ..=> {rand_core(v0.6.x), getrandom(v0.2.x)} -[[bans.skip]] -name = "getrandom" -version = "0.1.15" -[[bans.skip]] -name = "rand" -version = "0.7.3" -[[bans.skip]] -name = "rand_core" -version = "0.5.1" -[[bans.skip]] -name = "rand_chacha" -version = "0.2.2" - # hyper-rustls(v0.22.1) => rustls => ring(v0.16.20) => spin(v0.5.2) [[bans.skip]] name = "spin" diff --git a/no-std-check/Cargo.lock b/no-std-check/Cargo.lock index 6754b145b..f6de296a9 100644 --- a/no-std-check/Cargo.lock +++ b/no-std-check/Cargo.lock @@ -206,15 +206,15 @@ dependencies = [ ] [[package]] -name = "curve25519-dalek" -version = "3.1.0" +name = "curve25519-dalek-ng" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "639891fde0dbea823fc3d798a0fdf9d2f9440a42d64a78ab3488b0ca025117b3" +checksum = "574d8b2cd0bae5434fd50d53280f8299d95557a978686555880aaf5b8f4f81e9" dependencies = [ "byteorder", "digest", - "rand_core 0.5.1", - "subtle", + "rand_core", + "subtle-ng", "zeroize", ] @@ -269,13 +269,12 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +version = "1.0.2" +source = "git+https://github.com/daviddrysdale/ed25519-dalek?branch=rand-bump#eebf0b3fead5690101c0d44d5cc6de45e63b9aa8" dependencies = [ - "curve25519-dalek", + "curve25519-dalek-ng", "ed25519", - "rand 0.7.3", + "rand", "sha2", "zeroize", ] @@ -297,7 +296,7 @@ dependencies = [ "generic-array", "group", "pkcs8", - "rand_core 0.6.3", + "rand_core", "subtle", "zeroize", ] @@ -309,7 +308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72a4d941a5b7c2a75222e2d44fcdf634a67133d9db31e177ae5ff6ecda852bfe" dependencies = [ "bitvec", - "rand_core 0.6.3", + "rand_core", "subtle", ] @@ -335,17 +334,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.3" @@ -354,7 +342,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -374,7 +362,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61b3c1e8b4f1ca07e6605ea1be903a5f6956aec5c8a67fd44d56076631675ed8" dependencies = [ "ff", - "rand_core 0.6.3", + "rand_core", "subtle", ] @@ -626,18 +614,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", -] - [[package]] name = "rand" version = "0.8.4" @@ -645,19 +621,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rand_hc 0.3.1", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -667,16 +633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -685,16 +642,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -703,7 +651,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -763,7 +711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335" dependencies = [ "digest", - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -796,6 +744,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subtle-ng" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8049cf85f0e715d6af38dde439cb0ccb91f67fb9f5f63c80f8b43e48356e1a3f" + [[package]] name = "syn" version = "1.0.73" @@ -833,7 +787,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if", "libc", - "rand 0.8.4", + "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -850,7 +804,7 @@ dependencies = [ "chacha20poly1305", "generic-array", "prost", - "rand 0.7.3", + "rand", "spin 0.9.2", "tink-core", "tink-mac", @@ -865,7 +819,7 @@ dependencies = [ "hkdf", "lazy_static", "prost", - "rand 0.7.3", + "rand", "sha-1", "sha2", "spin 0.9.2", @@ -930,7 +884,7 @@ dependencies = [ "generic-array", "p256", "prost", - "rand 0.7.3", + "rand", "signature", "spin 0.9.2", "tink-core", @@ -971,12 +925,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/no-std-check/Cargo.toml b/no-std-check/Cargo.toml index ea2c37e9e..da6e1a410 100644 --- a/no-std-check/Cargo.toml +++ b/no-std-check/Cargo.toml @@ -28,6 +28,8 @@ panic = "abort" # Patch dependencies on tink crates so that they refer to the versions within this same repository. [patch.crates-io] +# TODO(#7): remove if/when https://github.com/dalek-cryptography/ed25519-dalek/pull/160 is merged. +ed25519-dalek = { git = "https://github.com/daviddrysdale/ed25519-dalek", branch = "rand-bump" } tink-aead = { path = "../aead" } tink-core = { path = "../core" } tink-daead = { path = "../daead" } diff --git a/signature/Cargo.toml b/signature/Cargo.toml index 09e2aa638..df866eb06 100644 --- a/signature/Cargo.toml +++ b/signature/Cargo.toml @@ -11,11 +11,11 @@ categories = ["cryptography"] [dependencies] ecdsa = { version = "^0.11", features = ["der"] } -ed25519-dalek = { version = "^1.0.1", default-features = false, features = ["rand", "u64_backend"]} +ed25519-dalek = { version = "^1.0.2", default-features = false, features = ["rand", "u64_backend"]} generic-array = "^0.14.4" p256 = "^0.8.1" prost = { version = "^0.8", default-features = false } -rand = { version = "^0.7", default-features = false, features = ["alloc", "getrandom"] } +rand = { version = "^0.8", default-features = false, features = ["alloc", "getrandom"] } signature = { version = "^1.3", default-features = false } spin = { version = "^0.9.2", features = ["once"] } tink-core = "^0.3" diff --git a/streaming/Cargo.toml b/streaming/Cargo.toml index 48b5d8ca2..86fbc9441 100644 --- a/streaming/Cargo.toml +++ b/streaming/Cargo.toml @@ -13,7 +13,7 @@ categories = ["cryptography"] aes = { version = "^0.7.4", features = ["ctr"] } aes-gcm = { version = "^0.9.2" } prost = { version = "^0.8", default-features = false } -rand = { version = "^0.7", default-features = false, features = ["alloc", "getrandom"] } +rand = { version = "^0.8", default-features = false, features = ["alloc", "getrandom"] } tink-core = { version = "^0.3", features = ["std"] } tink-mac = "^0.3" tink-proto = "^0.3" diff --git a/tests/Cargo.toml b/tests/Cargo.toml index d5299fc9a..cd6e1cea9 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -11,12 +11,12 @@ categories = ["cryptography"] [dependencies] base64 = "^0.13" -ed25519-dalek = { version = "^1.0.1", default-features = false, features = ["rand", "u64_backend"]} +ed25519-dalek = { version = "^1.0.2", default-features = false, features = ["rand", "u64_backend"]} generic-array = "^0.14.4" hex = "^0.4.3" p256 = "^0.8.1" prost = { version = "^0.8", default-features = false } -rand = { version = "^0.7", default-features = false, features = ["alloc", "getrandom"] } +rand = { version = "^0.8", default-features = false, features = ["alloc", "getrandom"] } regex = "^1.5.4" serde = { version = "^1.0.126", features = ["derive"] } serde_json = "^1.0.64" diff --git a/tests/tests/aead/subtle/chacha20poly1305_test.rs b/tests/tests/aead/subtle/chacha20poly1305_test.rs index f5e87e2a1..19a73eb90 100644 --- a/tests/tests/aead/subtle/chacha20poly1305_test.rs +++ b/tests/tests/aead/subtle/chacha20poly1305_test.rs @@ -172,7 +172,7 @@ fn test_cha_cha20_poly1305_modify_ciphertext() { .unwrap_or_else(|e| panic!("#{}: encrypt failed: {:?}", i, e)); if !aad.is_empty() { - let alter_aad_idx = OsRng.gen_range(0, aad.len()); + let alter_aad_idx = OsRng.gen_range(0..aad.len()); aad[alter_aad_idx] ^= 0x80; assert!( ca.decrypt(&ct, &aad).is_err(), @@ -182,7 +182,7 @@ fn test_cha_cha20_poly1305_modify_ciphertext() { aad[alter_aad_idx] ^= 0x80; } - let alter_ct_idx = OsRng.gen_range(0, ct.len()); + let alter_ct_idx = OsRng.gen_range(0..ct.len()); ct[alter_ct_idx] ^= 0x80; assert!( ca.decrypt(&ct, &aad).is_err(), diff --git a/tests/tests/aead/subtle/xchacha20poly1305_test.rs b/tests/tests/aead/subtle/xchacha20poly1305_test.rs index 4a7ab0ee9..88307dc1f 100644 --- a/tests/tests/aead/subtle/xchacha20poly1305_test.rs +++ b/tests/tests/aead/subtle/xchacha20poly1305_test.rs @@ -173,7 +173,7 @@ fn test_x_cha_cha20_poly1305_modify_ciphertext() { .unwrap_or_else(|e| panic!("#{}: encrypt failed: {:?}", i, e)); if !aad.is_empty() { - let alter_aad_idx = OsRng.gen_range(0, aad.len()); + let alter_aad_idx = OsRng.gen_range(0..aad.len()); aad[alter_aad_idx] ^= 0x80; assert!( ca.decrypt(&ct, &aad).is_err(), @@ -183,7 +183,7 @@ fn test_x_cha_cha20_poly1305_modify_ciphertext() { aad[alter_aad_idx] ^= 0x80; } - let alter_ct_idx = OsRng.gen_range(0, ct.len()); + let alter_ct_idx = OsRng.gen_range(0..ct.len()); ct[alter_ct_idx] ^= 0x80; assert!( ca.decrypt(&ct, &aad).is_err(), diff --git a/tests/tests/streaming/integration_test.rs b/tests/tests/streaming/integration_test.rs index 139d596c6..bc7dd1cc4 100644 --- a/tests/tests/streaming/integration_test.rs +++ b/tests/tests/streaming/integration_test.rs @@ -174,7 +174,7 @@ impl std::io::Read for PartialReader { // when more data is available. This is valid for Rust's `std::io::Read`, but // would not be valid for an `io::Writer` in Go. fn read(&mut self, buf: &mut [u8]) -> std::io::Result { - if rand::rngs::OsRng.gen_range(0, 3) == 0 { + if rand::rngs::OsRng.gen_range(0..3) == 0 { // Randomly pretend to have been interrupted. return Err(std::io::Error::new( std::io::ErrorKind::Interrupted,