Address CI build issues.

This commit is contained in:
Caleb Garrett 2024-02-24 16:14:44 -05:00
parent 25ec838af5
commit f352b6d68b
3 changed files with 13 additions and 12 deletions

View file

@ -70,7 +70,7 @@ rand_core = "0.6.3"
sdio-host = "0.5.0" sdio-host = "0.5.0"
critical-section = "1.1" critical-section = "1.1"
#stm32-metapac = { version = "15" } #stm32-metapac = { version = "15" }
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-6097928f720646c73d6483a3245f922bd5faee2f" } stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ca48d946840840c5b311c96ff17cf4f8a865f9fb" }
vcell = "0.1.3" vcell = "0.1.3"
bxcan = "0.7.0" bxcan = "0.7.0"
nb = "1.0.0" nb = "1.0.0"
@ -94,7 +94,7 @@ critical-section = { version = "1.1", features = ["std"] }
proc-macro2 = "1.0.36" proc-macro2 = "1.0.36"
quote = "1.0.15" quote = "1.0.15"
#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} #stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-6097928f720646c73d6483a3245f922bd5faee2f", default-features = false, features = ["metadata"]} stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-ca48d946840840c5b311c96ff17cf4f8a865f9fb", default-features = false, features = ["metadata"]}
[features] [features]

View file

@ -2,12 +2,11 @@
#[cfg(cryp_v2)] #[cfg(cryp_v2)]
use core::cmp::min; use core::cmp::min;
use core::marker::PhantomData; use core::marker::PhantomData;
use embassy_hal_internal::{into_ref, PeripheralRef}; use embassy_hal_internal::{into_ref, PeripheralRef};
use crate::pac;
use crate::peripherals::CRYP;
use crate::rcc::sealed::RccPeripheral; use crate::rcc::sealed::RccPeripheral;
use crate::{interrupt, peripherals, Peripheral}; use crate::{interrupt, pac, peripherals, Peripheral};
const DES_BLOCK_SIZE: usize = 8; // 64 bits const DES_BLOCK_SIZE: usize = 8; // 64 bits
const AES_BLOCK_SIZE: usize = 16; // 128 bits const AES_BLOCK_SIZE: usize = 16; // 128 bits
@ -827,7 +826,7 @@ pub struct Cryp<'d, T: Instance> {
impl<'d, T: Instance> Cryp<'d, T> { impl<'d, T: Instance> Cryp<'d, T> {
/// Create a new CRYP driver. /// Create a new CRYP driver.
pub fn new(peri: impl Peripheral<P = T> + 'd) -> Self { pub fn new(peri: impl Peripheral<P = T> + 'd) -> Self {
CRYP::enable_and_reset(); T::enable_and_reset();
into_ref!(peri); into_ref!(peri);
let instance = Self { _peripheral: peri }; let instance = Self { _peripheral: peri };
instance instance

View file

@ -1,10 +1,9 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aes_gcm::{ use aes_gcm::aead::heapless::Vec;
aead::{heapless::Vec, AeadInPlace, KeyInit}, use aes_gcm::aead::{AeadInPlace, KeyInit};
Aes128Gcm, use aes_gcm::Aes128Gcm;
};
use defmt::info; use defmt::info;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::cryp::*; use embassy_stm32::cryp::*;
@ -55,9 +54,12 @@ async fn main(_spawner: Spawner) -> ! {
let mut payload_vec: Vec<u8, 32> = Vec::from_slice(&payload).unwrap(); let mut payload_vec: Vec<u8, 32> = Vec::from_slice(&payload).unwrap();
let cipher = Aes128Gcm::new(&key.into()); let cipher = Aes128Gcm::new(&key.into());
let _ = cipher.encrypt_in_place(&iv.into(), aad.into(), &mut payload_vec); let _ = cipher.encrypt_in_place(&iv.into(), aad.into(), &mut payload_vec);
assert_eq!(ciphertext, payload_vec[0..ciphertext.len()]); assert_eq!(ciphertext, payload_vec[0..ciphertext.len()]);
assert_eq!(encrypt_tag, payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]); assert_eq!(
encrypt_tag,
payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]
);
// Decrypt in software using AES-GCM 128-bit // Decrypt in software using AES-GCM 128-bit
let _ = cipher.decrypt_in_place(&iv.into(), aad.into(), &mut payload_vec); let _ = cipher.decrypt_in_place(&iv.into(), aad.into(), &mut payload_vec);