@@ -22,11 +22,16 @@ fn main() -> ! {
22
22
let mut rcc = dp. RCC . constrain ( ) ;
23
23
let aes = dp. AES . constrain ( & mut rcc) ;
24
24
let message = b"The quick brown " ;
25
- let key = Key :: try_from_slice ( & [ 01 ; 32 ] ) . unwrap ( ) ;
25
+ let key = Key :: try_from_slice ( & [
26
+ 0x03 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
27
+ 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 ,
28
+ 0x01 , 0x07 ,
29
+ ] )
30
+ . unwrap ( ) ;
26
31
27
32
let mut aes_ecb_encrypt = aes. ecb_encrypt ( key) ;
28
33
let encrypted = aes_ecb_encrypt. process ( & message) . unwrap ( ) ;
29
- defmt:: info!( "encrypred: {:02x}, check: [c9, ca, 52, 28, e5, f8, f2, 7e, ce, b9, 5b, 4d, 3c, 51, 77, 10 ]" , encrypted) ;
34
+ defmt:: info!( "encrypred: {:02x}, check: [81, 2b, 02, 01, e6, 20, 7b, e9, 11, 79, b7, 1c, 42, 05, 99, 9d ]" , encrypted) ;
30
35
31
36
let mut aes_ecb_decrypt = aes_ecb_encrypt. disable ( ) . ecb_decrypt ( key) ;
32
37
let decrypted = aes_ecb_decrypt. process ( & encrypted) . unwrap ( ) ;
0 commit comments