[domistream] WIP: rustfmt, doc link, clippy fixes (one collapsible-if left in rtsp/mod.rs), PROTOCOL.md status
Paused at Mark's request.
This commit is contained in:
@@ -32,8 +32,8 @@ fn ecb(key: &PairingKey, data: &[u8], encrypt: bool) -> Result<Vec<u8>> {
|
||||
}
|
||||
let cipher = Aes128::new(key.into());
|
||||
let mut out = data.to_vec();
|
||||
for chunk in out.chunks_exact_mut(16) {
|
||||
let block: &mut aes::Block = chunk.try_into().map_err(|_| malformed("aes block"))?;
|
||||
for chunk in out.as_chunks_mut::<16>().0 {
|
||||
let block: &mut aes::Block = chunk.into();
|
||||
if encrypt {
|
||||
cipher.encrypt_block(block);
|
||||
} else {
|
||||
|
||||
@@ -271,10 +271,8 @@ impl ServerCert {
|
||||
const END: &[u8] = b"-----END CERTIFICATE-----";
|
||||
cap("host certificate PEM", MAX_CERT_PEM_BYTES, pem.len())?;
|
||||
let trimmed = pem.trim_ascii();
|
||||
let body = trimmed
|
||||
.strip_prefix(BEGIN)
|
||||
.and_then(|b| b.strip_suffix(END))
|
||||
.ok_or(malformed("host certificate PEM"))?;
|
||||
let body =
|
||||
trimmed.strip_prefix(BEGIN).and_then(|b| b.strip_suffix(END)).ok_or(malformed("host certificate PEM"))?;
|
||||
if body.windows(5).any(|w| w == b"-----") {
|
||||
return Err(malformed("host certificate PEM holds more than one block"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user