diff --git a/src/kex.rs b/src/kex.rs index 265719b1389056600e238a75862020f91789f65c..c04770fffdfdd7a40038272ada6f3cbfa625ab43 100644 --- a/src/kex.rs +++ b/src/kex.rs @@ -132,8 +132,9 @@ impl KexHash { // TODO: q_c and q_s need to be padded as mpint (extra 0x00 if high bit set) // for ecdsa and DH modes, but not for curve25519. - // Hack test for ed25519 algo - assert_eq!(q_c.len(), 32); + + // A hacky sanity check that this is curve25519 + debug_assert_eq!(q_c.len(), 32); self.hash_slice(q_c); self.hash_slice(q_s); @@ -573,6 +574,9 @@ mod tests { use crate::*; use crate::sunsetlog::init_test_log; + // TODO: + // - test algo negotiation + use super::SSH_NAME_CURVE25519; #[test] @@ -594,6 +598,8 @@ mod tests { // Unknown names fail. This is easy to hit if the names of from_name() // match statements are mistyped or aren't imported. + // These are separate tests because they trigger `Error::bug()` which + // is an explicit panic in debug builds. #[test] #[should_panic] fn test_unknown_kex() { diff --git a/src/runner.rs b/src/runner.rs index 46d6d89a4d542d54687950cb4c96631947e32692..8b505adac87a83c36ff22ed95761f1cd41a9f900 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -256,6 +256,8 @@ impl<'a> Runner<'a> { // Returns the maximum data that may be sent to a channel, or // `None` on channel closed pub fn ready_channel_send(&self, chan: u32, is_ext: bool) -> Option<usize> { + // TODO: return 0 if InKex means we can't transmit packets. + // minimum of buffer space and channel window available let payload_space = self.traf_out.send_allowed(&self.keys); let offset = if is_ext { diff --git a/src/sshwire.rs b/src/sshwire.rs index 93e5c1834e120ffe3a11792f86b15c87a2a5d7ff..c564bd8118ef9d79703c321949d174d5ef5159c3 100644 --- a/src/sshwire.rs +++ b/src/sshwire.rs @@ -285,13 +285,14 @@ impl<'de> SSHDecode<'de> for BinString<'de> { /// /// The SSH protocol defines it to be UTF-8, though /// in some applications it could be treated as ASCII-only. -/// The library treats it as an opaque `&[u8]`, leaving +/// Sunset treats it as an opaque `&[u8]`, leaving /// decoding to the [`Behaviour`]. /// -/// Note that SSH protocol identifiers in `Packet` etc -/// are `&str` rather than `TextString`, and always defined as ASCII. +/// Note that SSH protocol identifiers in `Packet` +/// are `&str` rather than `TextString`, and always defined as ASCII. For +/// example `"publickey"`, `"ssh-rsa"`. /// Application API -#[derive(Clone,PartialEq,Copy)] +#[derive(Clone,PartialEq,Copy,Default)] pub struct TextString<'a>(pub &'a [u8]); impl<'a> TextString<'a> {