Skip to content

Commit a277e9f

Browse files
authored
Fix for the broken ci test, also bump aes to v0.8 (#1)
* fix workflows * bump aes to 0.8, fix workflows
1 parent 003e6bd commit a277e9f

File tree

8 files changed

+27
-13
lines changed

8 files changed

+27
-13
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ jobs:
9898
- name: run ssh
9999
run: mkdir /run/sshd && /usr/sbin/sshd -T &&/usr/sbin/sshd -D -p 8888 &
100100
- name: Test
101-
run: cargo test --all-features
101+
run: cargo test --all-features -- --test-threads 1
102102
- name: Doc test
103103
run: cargo test --doc --all-features

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ strum_macros = "0.25"
2828
sha1 = { version = "0.10.5", default-features = false, features = ["oid"], optional = true }
2929
sha2 = { version = "0.10.6", default-features = false, features = ["oid"]}
3030
rsa = "0.9"
31-
aes = { version = "0.7", features = ["ctr"] }
31+
aes = "0.8"
32+
ctr = "0.9"
3233
ssh-key = { version = "0.6", features = ["rsa", "ed25519", "alloc"]}
3334
signature = "2.1"
3435
ring = "0.16"

build_check.sh

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ cargo fmt --all -- --check > /dev/null
55
echo done
66
echo
77
echo
8+
echo clippy check
9+
cargo clippy -- -D warnings > /dev/null
10+
echo
11+
echo
12+
echo clippy all check
13+
cargo clippy --all-features -- -D warnings > /dev/null
14+
echo
15+
echo
816
echo linux build check
917
cargo build --target x86_64-unknown-linux-gnu > /dev/null
1018
echo done

changelog

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
v0.3.3 (TBD)
1+
v0.3.3 (2023-09-10)
22
1. fix hang when tcp connects to a non-existent host
33
2. refactor aes_ctr file
44
3. translate the changelogs
55
4. use std::time::Duration as timeout rather than u128
66
5. add the support for ssh message `SSH_MSG_CHANNEL_EXTENDED_DATA`
7+
6. bump dependencies
78

89
v0.3.2 (2023-01-10)
910
1. fix some error with hmac2

src/algorithm/encryption/aes_ctr.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ use crate::algorithm::hash::Hash;
33
use crate::algorithm::mac::Mac;
44
use crate::error::SshError;
55
use crate::SshResult;
6-
use aes::cipher::{NewCipher, StreamCipher, StreamCipherSeek};
7-
use aes::{Aes128Ctr, Aes192Ctr, Aes256Ctr};
6+
use aes::cipher::{KeyIvInit, StreamCipher, StreamCipherSeek};
7+
use ctr;
8+
9+
type Aes128Ctr64BE = ctr::Ctr64BE<aes::Aes128>;
10+
type Aes192Ctr64BE = ctr::Ctr64BE<aes::Aes192>;
11+
type Aes256Ctr64BE = ctr::Ctr64BE<aes::Aes256>;
812

913
const CTR128_BLOCK_SIZE: usize = 16;
1014
const CTR192_BLOCK_SIZE: usize = 24;
@@ -65,8 +69,8 @@ macro_rules! crate_aes {
6569
siv.clone_from_slice(&hash.iv_s_c[..$iv_size]);
6670

6771
// TODO unwrap
68-
let c = $alg::new_from_slices(&ckey, &civ).unwrap();
69-
let r = $alg::new_from_slices(&skey, &siv).unwrap();
72+
let c = $alg::new(&ckey.into(), &civ.into());
73+
let r = $alg::new(&skey.into(), &siv.into());
7074
// hmac
7175
let (ik_c_s, ik_s_c) = hash.mix_ik(mac.bsize());
7276
$name {
@@ -133,8 +137,8 @@ macro_rules! crate_aes {
133137
}
134138

135139
// aes-128-ctr
136-
crate_aes!(Ctr128, Aes128Ctr, CTR128_BLOCK_SIZE, IV_SIZE);
140+
crate_aes!(Ctr128, Aes128Ctr64BE, CTR128_BLOCK_SIZE, IV_SIZE);
137141
// aes-192-ctr
138-
crate_aes!(Ctr192, Aes192Ctr, CTR192_BLOCK_SIZE, IV_SIZE);
142+
crate_aes!(Ctr192, Aes192Ctr64BE, CTR192_BLOCK_SIZE, IV_SIZE);
139143
// aes-256-ctr
140-
crate_aes!(Ctr256, Aes256Ctr, CTR256_BLOCK_SIZE, IV_SIZE);
144+
crate_aes!(Ctr256, Aes256Ctr64BE, CTR256_BLOCK_SIZE, IV_SIZE);

src/algorithm/public_key/rsa.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl PubK for RsaSha512 {
4747
let e = rsa::BigUint::from_bytes_be(data.get_u8s().as_slice());
4848
let n = rsa::BigUint::from_bytes_be(data.get_u8s().as_slice());
4949
let public_key = rsa::RsaPublicKey::new(n, e).unwrap();
50-
let scheme = Pkcs1v15Sign::new::<sha2::Sha256>();
50+
let scheme = Pkcs1v15Sign::new::<sha2::Sha512>();
5151

5252
let digest = ring::digest::digest(&ring::digest::SHA512, message);
5353
let msg = digest.as_ref();

src/channel/local/channel_scp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ where
388388
self.save_file(scp_file)
389389
}
390390

391-
fn save_file(&mut self, scp_file: &ScpFile) -> SshResult<()> {
391+
fn save_file(&mut self, scp_file: &mut ScpFile) -> SshResult<()> {
392392
log::debug!(
393393
"name: [{}] size: [{}] type: [file] start download.",
394394
scp_file.name,

src/config/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl KeyPair {
9898
ring::digest::digest(&ring::digest::SHA512, sd),
9999
),
100100
PubKey::RsaSha2_256 => (
101-
Pkcs1v15Sign::new::<sha2::Sha512>(),
101+
Pkcs1v15Sign::new::<sha2::Sha256>(),
102102
ring::digest::digest(&ring::digest::SHA256, sd),
103103
),
104104
#[cfg(feature = "dangerous-rsa-sha1")]

0 commit comments

Comments
 (0)