aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f7
diff options
context:
space:
mode:
authorCaleb Garrett <[email protected]>2024-02-24 16:14:44 -0500
committerCaleb Garrett <[email protected]>2024-02-25 20:59:07 -0500
commitf352b6d68b17fee886af58494b7e793cea3ea383 (patch)
tree13ccbc3bc16b29d2a39db405a6a891a5ecf5c778 /examples/stm32f7
parent25ec838af597cc2e39c530b44f1a101c80b24260 (diff)
Address CI build issues.
Diffstat (limited to 'examples/stm32f7')
-rw-r--r--examples/stm32f7/src/bin/cryp.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/stm32f7/src/bin/cryp.rs b/examples/stm32f7/src/bin/cryp.rs
index be41955c5..04927841a 100644
--- a/examples/stm32f7/src/bin/cryp.rs
+++ b/examples/stm32f7/src/bin/cryp.rs
@@ -1,10 +1,9 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use aes_gcm::{ 4use aes_gcm::aead::heapless::Vec;
5 aead::{heapless::Vec, AeadInPlace, KeyInit}, 5use aes_gcm::aead::{AeadInPlace, KeyInit};
6 Aes128Gcm, 6use aes_gcm::Aes128Gcm;
7};
8use defmt::info; 7use defmt::info;
9use embassy_executor::Spawner; 8use embassy_executor::Spawner;
10use embassy_stm32::cryp::*; 9use embassy_stm32::cryp::*;
@@ -55,9 +54,12 @@ async fn main(_spawner: Spawner) -> ! {
55 let mut payload_vec: Vec<u8, 32> = Vec::from_slice(&payload).unwrap(); 54 let mut payload_vec: Vec<u8, 32> = Vec::from_slice(&payload).unwrap();
56 let cipher = Aes128Gcm::new(&key.into()); 55 let cipher = Aes128Gcm::new(&key.into());
57 let _ = cipher.encrypt_in_place(&iv.into(), aad.into(), &mut payload_vec); 56 let _ = cipher.encrypt_in_place(&iv.into(), aad.into(), &mut payload_vec);
58 57
59 assert_eq!(ciphertext, payload_vec[0..ciphertext.len()]); 58 assert_eq!(ciphertext, payload_vec[0..ciphertext.len()]);
60 assert_eq!(encrypt_tag, payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]); 59 assert_eq!(
60 encrypt_tag,
61 payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]
62 );
61 63
62 // Decrypt in software using AES-GCM 128-bit 64 // Decrypt in software using AES-GCM 128-bit
63 let _ = cipher.decrypt_in_place(&iv.into(), aad.into(), &mut payload_vec); 65 let _ = cipher.decrypt_in_place(&iv.into(), aad.into(), &mut payload_vec);