Skip to content

Commit

Permalink
Janitor go brr
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Aug 26, 2024
1 parent 5f0dc14 commit f9284df
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 81 deletions.
4 changes: 2 additions & 2 deletions esp-hal/src/aes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! ```rust, no_run
#![doc = crate::before_snippet!()]
//! # use esp_hal::aes::{Aes, Mode};
//! # let keytext = "SUp4SeCp@sSw0rd".as_bytes();
//! # let plaintext = "message".as_bytes();
//! # let keytext = b"SUp4SeCp@sSw0rd";
//! # let plaintext = b"message";
//! # let mut keybuf = [0_u8; 16];
//! # keybuf[..keytext.len()].copy_from_slice(keytext);
//! let mut block_buf = [0_u8; 16];
Expand Down
1 change: 0 additions & 1 deletion esp-hal/src/analog/adc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
//! # use esp_hal::analog::adc::Adc;
//! # use esp_hal::delay::Delay;
//! # use esp_hal::gpio::Io;
//! # use core::result::Result::Err;
//!
//! # let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
#![cfg_attr(esp32, doc = "let analog_pin = io.pins.gpio32;")]
Expand Down
2 changes: 0 additions & 2 deletions esp-hal/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#![doc = crate::before_snippet!()]
//! # use esp_hal::i2c::I2C;
//! # use esp_hal::gpio::Io;
//! # use core::option::Option::None;
//! # use crate::esp_hal::prelude::_fugit_RateExtU32;
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // Create a new peripheral object with the described wiring
Expand Down Expand Up @@ -50,7 +49,6 @@
#![doc = crate::before_snippet!()]
//! # use esp_hal::i2c::I2C;
//! # use esp_hal::gpio::Io;
//! # use core::option::Option::None;
//! # use crate::esp_hal::prelude::_fugit_RateExtU32;
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // Create a new peripheral object with the described wiring
Expand Down
3 changes: 1 addition & 2 deletions esp-hal/src/sha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
#![doc = crate::before_snippet!()]
//! # use esp_hal::sha::Sha;
//! # use esp_hal::sha::Sha256;
//! # use core::option::Option::None;
//! # use nb::block;
//! let source_data = "HELLO, ESPRESSIF!".as_bytes();
//! let source_data = b"HELLO, ESPRESSIF!";
//! let mut remaining = source_data;
//! let mut hasher = Sha256::new();
//! // Short hashes can be created by decreasing the output buffer to the
Expand Down
2 changes: 0 additions & 2 deletions esp-hal/src/twai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
//! # use esp_hal::twai::TwaiMode;
//! # use esp_hal::gpio::Io;
//! # use embedded_can::Frame;
//! # use core::option::Option::None;
//! # use nb::block;
//! # let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // Use GPIO pins 2 and 3 to connect to the respective pins on the TWAI
Expand Down Expand Up @@ -87,7 +86,6 @@
//! # use esp_hal::twai::TwaiMode;
//! # use esp_hal::gpio::Io;
//! # use embedded_can::Frame;
//! # use core::option::Option::None;
//! # use nb::block;
//! # let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
//! // Use GPIO pins 2 and 3 to connect to the respective pins on the TWAI
Expand Down
5 changes: 2 additions & 3 deletions esp-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
//!
//! ```rust, no_run
#![doc = crate::before_snippet!()]
//! # use core::option::Option::Some;
//! # use esp_hal::uart::{config::Config, Uart};
//! use esp_hal::gpio::Io;
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
Expand All @@ -31,7 +30,7 @@
//! ```
//!
//! The UART controller can be configured to invert the polarity of the pins.
//! This is achived by inverting the desired pins, and then constucting the
//! This is achived by inverting the desired pins, and then constructing the
//! UART instance using the inverted pins.
//!
//! ## Usage
Expand Down Expand Up @@ -60,7 +59,7 @@
//! # io.pins.gpio2,
//! # ).unwrap();
//! // Write bytes out over the UART:
//! uart1.write_bytes("Hello, world!".as_bytes()).expect("write error!");
//! uart1.write_bytes(v"Hello, world!").expect("write error!");
//! # }
//! ```
//!
Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/usb_serial_jtag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
//! let mut usb_serial = UsbSerialJtag::new(peripherals.USB_DEVICE);
//!
//! // Write bytes out over the USB Serial/JTAG:
//! usb_serial.write_bytes("Hello, world!".as_bytes()).expect("write error!");
//! usb_serial.write_bytes(b"Hello, world!"").expect("write error!");
//! }
//! ```
//!
Expand Down
24 changes: 12 additions & 12 deletions hil-test/tests/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ mod tests {

#[test]
fn test_aes_128_encryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let encrypted_message = [
0xb3, 0xc8, 0xd2, 0x3b, 0xa7, 0x36, 0x5f, 0x18, 0x61, 0x70, 0x0, 0x3e, 0xd9, 0x3a,
0x31, 0x96,
Expand All @@ -58,8 +58,8 @@ mod tests {

#[test]
fn test_aes_128_decryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let mut encrypted_message = [
0xb3, 0xc8, 0xd2, 0x3b, 0xa7, 0x36, 0x5f, 0x18, 0x61, 0x70, 0x0, 0x3e, 0xd9, 0x3a,
0x31, 0x96,
Expand All @@ -76,8 +76,8 @@ mod tests {
#[test]
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
fn test_aes_192_encryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let encrypted_message = [
0x79, 0x88, 0x3f, 0x9d, 0x67, 0x27, 0xf4, 0x18, 0x3, 0xe3, 0xc6, 0x6a, 0x2e, 0x76,
0xb6, 0xf7,
Expand All @@ -97,8 +97,8 @@ mod tests {
#[test]
#[cfg(any(feature = "esp32", feature = "esp32s2"))]
fn test_aes_192_decryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let mut encrypted_message = [
0x79, 0x88, 0x3f, 0x9d, 0x67, 0x27, 0xf4, 0x18, 0x3, 0xe3, 0xc6, 0x6a, 0x2e, 0x76,
0xb6, 0xf7,
Expand All @@ -114,8 +114,8 @@ mod tests {

#[test]
fn test_aes_256_encryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let encrypted_message = [
0x0, 0x63, 0x3f, 0x2, 0xa4, 0x53, 0x9, 0x72, 0x20, 0x6d, 0xc9, 0x8, 0x7c, 0xe5, 0xfd,
0xc,
Expand All @@ -134,8 +134,8 @@ mod tests {

#[test]
fn test_aes_256_decryption(mut ctx: Context<'static>) {
let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let plaintext = "message".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let plaintext = b"message";
let mut encrypted_message = [
0x0, 0x63, 0x3f, 0x2, 0xa4, 0x53, 0x9, 0x72, 0x20, 0x6d, 0xc9, 0x8, 0x7c, 0xe5, 0xfd,
0xc,
Expand Down
16 changes: 8 additions & 8 deletions hil-test/tests/aes_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ mod tests {
rx_descriptors,
);

let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let mut keybuf = [0_u8; 16];
keybuf[..keytext.len()].copy_from_slice(keytext);

let plaintext = "message".as_bytes();
let plaintext = b"message";
input[..plaintext.len()].copy_from_slice(plaintext);

let encrypted_message = [
Expand Down Expand Up @@ -88,11 +88,11 @@ mod tests {
rx_descriptors,
);

let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let mut keybuf = [0_u8; 16];
keybuf[..keytext.len()].copy_from_slice(keytext);

let plaintext = "message".as_bytes();
let plaintext = b"message";
let encrypted_message = [
0xb3, 0xc8, 0xd2, 0x3b, 0xa7, 0x36, 0x5f, 0x18, 0x61, 0x70, 0x0, 0x3e, 0xd9, 0x3a,
0x31, 0x96,
Expand Down Expand Up @@ -131,11 +131,11 @@ mod tests {
rx_descriptors,
);

let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let mut keybuf = [0_u8; 16];
keybuf[..keytext.len()].copy_from_slice(keytext);

let plaintext = "message".as_bytes();
let plaintext = b"message";
input[..plaintext.len()].copy_from_slice(plaintext);

let encrypted_message = [
Expand Down Expand Up @@ -175,11 +175,11 @@ mod tests {
rx_descriptors,
);

let keytext = "SUp4SeCp@sSw0rd".as_bytes();
let keytext = b"SUp4SeCp@sSw0rd";
let mut keybuf = [0_u8; 16];
keybuf[..keytext.len()].copy_from_slice(keytext);

let plaintext = "message".as_bytes();
let plaintext = b"message";
let encrypted_message = [
0x0, 0x63, 0x3f, 0x2, 0xa4, 0x53, 0x9, 0x72, 0x20, 0x6d, 0xc9, 0x8, 0x7c, 0xe5, 0xfd,
0xc,
Expand Down
Loading

0 comments on commit f9284df

Please sign in to comment.