Skip to content

Commit 9c56470

Browse files
authored
Merge pull request #186 from str4d/dependency-updates
Dependency updates
2 parents 5b38e29 + 6ce0942 commit 9c56470

File tree

10 files changed

+472
-451
lines changed

10 files changed

+472
-451
lines changed

Cargo.lock

+242-212
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

age-core/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ maintenance = { status = "experimental" }
1414
[dependencies]
1515
# Dependencies required by the age specification:
1616
# - Base64 from RFC 4648
17-
base64 = "0.12"
17+
base64 = "0.13"
1818

1919
# - ChaCha20-Poly1305 from RFC 7539
2020
c2-chacha = "0.3"
@@ -29,7 +29,7 @@ rand = "0.7"
2929

3030
# Parsing
3131
cookie-factory = "0.3.1"
32-
nom = "5"
32+
nom = { version = "6", default-features = false, features = ["alloc"] }
3333

3434
# Secret management
3535
secrecy = "0.7"

age-core/src/format.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub mod read {
108108
bytes::streaming::{tag, take_while, take_while1},
109109
character::streaming::newline,
110110
combinator::{map, map_opt, opt, verify},
111-
multi::{many0, separated_nonempty_list},
111+
multi::{many0, separated_list1},
112112
sequence::{pair, preceded, terminated},
113113
IResult,
114114
};
@@ -189,7 +189,7 @@ pub mod read {
189189
}
190190

191191
fn legacy_wrapped_encoded_data(input: &[u8]) -> IResult<&[u8], Vec<u8>> {
192-
map_opt(separated_nonempty_list(newline, take_b64_line1), |chunks| {
192+
map_opt(separated_list1(newline, take_b64_line1), |chunks| {
193193
// Enforce that the only chunk allowed to be shorter than 64 characters
194194
// is the last chunk.
195195
if chunks.iter().rev().skip(1).any(|s| s.len() != 64)
@@ -218,7 +218,7 @@ pub mod read {
218218
pair(
219219
preceded(
220220
tag(STANZA_TAG),
221-
terminated(separated_nonempty_list(tag(" "), arbitrary_string), newline),
221+
terminated(separated_list1(tag(" "), arbitrary_string), newline),
222222
),
223223
wrapped_encoded_data,
224224
),
@@ -232,10 +232,7 @@ pub mod read {
232232
fn legacy_age_stanza_inner<'a>(input: &'a [u8]) -> IResult<&'a [u8], AgeStanza<'a>> {
233233
map(
234234
pair(
235-
preceded(
236-
tag(STANZA_TAG),
237-
separated_nonempty_list(tag(" "), arbitrary_string),
238-
),
235+
preceded(tag(STANZA_TAG), separated_list1(tag(" "), arbitrary_string)),
239236
terminated(opt(preceded(newline, legacy_wrapped_encoded_data)), newline),
240237
),
241238
|(mut args, body)| {

age/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ age-core = { version = "0.5.0", path = "../age-core" }
1818

1919
# Dependencies required by the age specification:
2020
# - Base64 from RFC 4648
21-
base64 = "0.12"
21+
base64 = "0.13"
2222

2323
# - ChaCha20-Poly1305 from RFC 7539
2424
c2-chacha = "0.3"
@@ -58,7 +58,7 @@ block-modes = { version = "0.7", optional = true }
5858

5959
# Parsing
6060
cookie-factory = "0.3.1"
61-
nom = "5"
61+
nom = { version = "6", default-features = false, features = ["alloc"] }
6262

6363
# Secret management
6464
secrecy = "0.7"
@@ -76,8 +76,8 @@ lazy_static = "1"
7676
rust-embed = "5"
7777

7878
# Common CLI dependencies
79-
console = { version = "0.13", optional = true }
80-
pinentry = { version = "0.2", optional = true }
79+
console = { version = "0.14", optional = true }
80+
pinentry = { version = "0.3", optional = true }
8181
rpassword = { version = "5", optional = true }
8282

8383
[target.'cfg(any(unix, windows))'.dependencies]
@@ -89,8 +89,8 @@ wsl = { version = "0.1", optional = true }
8989
criterion = "0.3"
9090
criterion-cycles-per-byte = "0.1"
9191
futures-test = "0.3"
92-
quickcheck = "0.9"
93-
quickcheck_macros = "0.9"
92+
quickcheck = "1"
93+
quickcheck_macros = "1"
9494

9595
[features]
9696
default = []

age/src/format.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ impl Header {
7777
// parser is constructed, because if we read more than we need, the
7878
// remainder of the input will be truncated.
7979
let m = data.len();
80-
data.resize(m + n, 0);
81-
input.read_exact(&mut data[m..m + n])?;
80+
let new_len = m + n.get();
81+
data.resize(new_len, 0);
82+
input.read_exact(&mut data[m..new_len])?;
8283
}
8384
Err(_) => {
8485
break Err(DecryptError::InvalidHeader);
@@ -105,8 +106,9 @@ impl Header {
105106
// parser is constructed, because if we read more than we need, the
106107
// remainder of the input will be truncated.
107108
let m = data.len();
108-
data.resize(m + n, 0);
109-
input.read_exact(&mut data[m..m + n]).await?;
109+
let new_len = m + n.get();
110+
data.resize(new_len, 0);
111+
input.read_exact(&mut data[m..new_len]).await?;
110112
}
111113
Err(_) => {
112114
break Err(DecryptError::InvalidHeader);

age/src/ssh.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl EncryptedKey {
103103
.cipher
104104
.decrypt(&self.kdf, passphrase, &self.encrypted)?;
105105

106-
let parser = read_ssh::openssh_unencrypted_privkey(&self.ssh_key);
106+
let mut parser = read_ssh::openssh_unencrypted_privkey(&self.ssh_key);
107107
parser(&decrypted)
108108
.map(|(_, sk)| sk)
109109
.map_err(|_| DecryptError::KeyDecryptionFailed)
@@ -450,7 +450,7 @@ mod read_ssh {
450450
#[allow(clippy::needless_lifetimes)]
451451
pub(super) fn openssh_unencrypted_privkey<'a>(
452452
ssh_key: &[u8],
453-
) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], UnencryptedKey> {
453+
) -> impl FnMut(&'a [u8]) -> IResult<&'a [u8], UnencryptedKey> {
454454
// We need to own, move, and clone these in order to keep them alive.
455455
let ssh_key_rsa = ssh_key.to_vec();
456456
let ssh_key_ed25519 = ssh_key.to_vec();

age/src/util.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) mod read {
1616
use nom::{
1717
combinator::map_res,
1818
error::{make_error, ErrorKind},
19-
multi::separated_nonempty_list,
19+
multi::separated_list1,
2020
IResult,
2121
};
2222

@@ -31,15 +31,7 @@ pub(crate) mod read {
3131
let encoded_count = ((4 * count) + 2) / 3;
3232

3333
move |input: &str| {
34-
// take() returns the total number of bytes it needs, not the
35-
// additional number of bytes like other APIs.
36-
let (i, data) = take(encoded_count)(input).map_err(|e| match e {
37-
nom::Err::Incomplete(nom::Needed::Size(n)) if n == encoded_count => {
38-
nom::Err::Incomplete(nom::Needed::Size(encoded_count - input.len()))
39-
}
40-
e => e,
41-
})?;
42-
34+
let (i, data) = take(encoded_count)(input)?;
4335
match base64::decode_config(data, config) {
4436
Ok(decoded) => Ok((i, decoded)),
4537
Err(_) => Err(nom::Err::Failure(make_error(input, ErrorKind::Eof))),
@@ -74,7 +66,7 @@ pub(crate) mod read {
7466

7567
move |input: &str| {
7668
map_res(
77-
separated_nonempty_list(
69+
separated_list1(
7870
line_ending,
7971
take_while1(|c| {
8072
let c = c as u8;

0 commit comments

Comments
 (0)