@@ -27,7 +27,7 @@ use stm32u545::gpio::PinId;
2727use stm32u545:: hash:: md5:: Md5Adapter ;
2828use stm32u545:: hash:: sha1:: Sha1Adapter ;
2929use stm32u545:: hash:: sha224:: { self , Sha224Adapter } ;
30- use stm32u545:: hash:: traits :: HashAdaptee ;
30+ use stm32u545:: hash:: sha256 :: Sha256Adapter ;
3131
3232pub mod io;
3333
@@ -65,14 +65,14 @@ struct NucleoU545RE {
6565 > ,
6666 > ,
6767 // SHA256
68- // hash: &'static capsules_extra::test::sha256::TestSha256<
69- // 'static,
70- // stm32u545::hash::sha256::Sha256Adapter<'static>,
71- // >,
68+ hash : & ' static capsules_extra:: test:: sha256:: TestSha256 <
69+ ' static ,
70+ stm32u545:: hash:: sha256:: Sha256Adapter < ' static > ,
71+ > ,
7272 // HMAC-SHA256
7373 // hash: &'static capsules_extra::test::hmac_sha256::TestHmacSha256<
7474 // 'static,
75- // stm32u545::hash::md5::Md5Adapter <'static>,
75+ // stm32u545::hash::sha256::Sha256Adapter <'static>,
7676 // >,
7777 // MD5
7878 // hash: &'static capsules_extra::test::md5::TestMd5<
@@ -90,10 +90,10 @@ struct NucleoU545RE {
9090 // stm32u545::hash::sha224::Sha224Adapter<'static>,
9191 // >,
9292 // HMAC-SHA224
93- hash : & ' static capsules_extra:: test:: hmac_sha224:: TestHmacSha224 <
94- ' static ,
95- stm32u545:: hash:: sha224:: Sha224Adapter < ' static > ,
96- > ,
93+ // hash: &'static capsules_extra::test::hmac_sha224::TestHmacSha224<
94+ // 'static,
95+ // stm32u545::hash::sha224::Sha224Adapter<'static>,
96+ // >,
9797 // SHA1
9898 // hash: &'static capsules_extra::test::sha1::TestSha1<
9999 // 'static,
@@ -204,8 +204,8 @@ unsafe fn start() -> (
204204 ) ;
205205
206206 let hash = static_init ! (
207- stm32u545:: hash:: Hash <' static >,
208- stm32u545:: hash:: Hash :: new( stm32u545:: hash:: HASH_BASE )
207+ stm32u545:: hash:: core_unit :: Hash <' static >,
208+ stm32u545:: hash:: core_unit :: Hash :: new( stm32u545:: hash:: core_unit :: HASH_BASE )
209209 ) ;
210210
211211 // let hash = stm32u545::hash::init();
@@ -224,26 +224,26 @@ unsafe fn start() -> (
224224 periphs. tim2 . start ( ) ;
225225 set_pin_primary_functions ( periphs) ;
226226
227- // let sha256 = static_init!(
228- // stm32u545::hash::sha256::Sha256Adapter<'static>,
229- // stm32u545::hash::sha256::Sha256Adapter::new(hash)
230- // );
227+ let sha256 = static_init ! (
228+ stm32u545:: hash:: sha256:: Sha256Adapter <' static >,
229+ stm32u545:: hash:: sha256:: Sha256Adapter :: new( hash)
230+ ) ;
231231 // let md5 = static_init!(
232232 // stm32u545::hash::md5::Md5Adapter<'static>,
233233 // stm32u545::hash::md5::Md5Adapter::new(hash)
234234 // );
235235
236- let sha224 = static_init ! (
237- stm32u545:: hash:: sha224:: Sha224Adapter <' static >,
238- stm32u545:: hash:: sha224:: Sha224Adapter :: new( hash)
239- ) ;
236+ // let sha224 = static_init!(
237+ // stm32u545::hash::sha224::Sha224Adapter<'static>,
238+ // stm32u545::hash::sha224::Sha224Adapter::new(hash)
239+ // );
240240
241241 // let sha1 = static_init!(
242242 // stm32u545::hash::sha1::Sha1Adapter<'static>,
243243 // stm32u545::hash::sha1::Sha1Adapter::new(hash)
244244 // );
245245
246- hash. set_adapter ( sha224 ) ;
246+ let _ = hash. set_sha256_adapter ( sha256 ) ;
247247
248248 // Kernel and Muxes
249249 let processes = components:: process_array:: ProcessArrayComponent :: new ( )
@@ -370,25 +370,25 @@ unsafe fn start() -> (
370370 // ]
371371 // );
372372
373- // let hash_data_buffer = static_init!(
374- // [u8; 70],
375- // [
376- // 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x52, 0x75, 0x73, 0x74, 0x79, 0x21, 0x20,
377- // 0x57, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67,
378- // 0x20, 0x48, 0x41, 0x53, 0x48, 0x20, 0x70, 0x65, 0x72, 0x69, 0x70, 0x68, 0x65, 0x72,
379- // 0x61, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x54, 0x6f, 0x63, 0x6b, 0x20, 0x4f, 0x53, 0x2e,
380- // 0x20, 0x4e, 0x6f, 0x77, 0x20, 0x77, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x74, 0x72,
381- // ]
382- // );
373+ let hash_data_buffer = static_init ! (
374+ [ u8 ; 70 ] ,
375+ [
376+ 0x48 , 0x65 , 0x6c , 0x6c , 0x6f , 0x2c , 0x20 , 0x52 , 0x75 , 0x73 , 0x74 , 0x79 , 0x21 , 0x20 ,
377+ 0x57 , 0x65 , 0x20 , 0x61 , 0x72 , 0x65 , 0x20 , 0x70 , 0x6f , 0x72 , 0x74 , 0x69 , 0x6e , 0x67 ,
378+ 0x20 , 0x48 , 0x41 , 0x53 , 0x48 , 0x20 , 0x70 , 0x65 , 0x72 , 0x69 , 0x70 , 0x68 , 0x65 , 0x72 ,
379+ 0x61 , 0x6c , 0x20 , 0x74 , 0x6f , 0x20 , 0x54 , 0x6f , 0x63 , 0x6b , 0x20 , 0x4f , 0x53 , 0x2e ,
380+ 0x20 , 0x4e , 0x6f , 0x77 , 0x20 , 0x77 , 0x65 , 0x20 , 0x61 , 0x72 , 0x65 , 0x20 , 0x74 , 0x72 ,
381+ ]
382+ ) ;
383383
384- // let hash_digest_buffer = static_init!(
385- // [u8; 32],
386- // [
387- // 0x4e, 0xd3, 0xe3, 0xe2, 0x3c, 0x13, 0x3c, 0xff, 0xf3, 0xe8, 0x86, 0x67, 0x06, 0xa6,
388- // 0x59, 0x0c, 0xdc, 0xa4, 0x6d, 0xd7, 0xff, 0x0b, 0x51, 0x88, 0x55, 0x03, 0x67, 0x7a,
389- // 0x83, 0x9c, 0x19, 0x94
390- // ]
391- // );
384+ let hash_digest_buffer = static_init ! (
385+ [ u8 ; 32 ] ,
386+ [
387+ 0x4e , 0xd3 , 0xe3 , 0xe2 , 0x3c , 0x13 , 0x3c , 0xff , 0xf3 , 0xe8 , 0x86 , 0x67 , 0x06 , 0xa6 ,
388+ 0x59 , 0x0c , 0xdc , 0xa4 , 0x6d , 0xd7 , 0xff , 0x0b , 0x51 , 0x88 , 0x55 , 0x03 , 0x67 , 0x7a ,
389+ 0x83 , 0x9c , 0x19 , 0x94
390+ ]
391+ ) ;
392392 //
393393 //
394394
@@ -438,6 +438,20 @@ unsafe fn start() -> (
438438 // ]
439439 // );
440440
441+ // let hmac_key = static_init!([u8; 5], [0x12, 0x34, 0x56, 0x78, 0x90]);
442+
443+ // let hash_data_buffer = static_init!([u8; 4], [0x61, 0x62, 0x63, 0x64]);
444+
445+ // let hash_digest_buffer = static_init!([u8; 32], [0u8; 32]);
446+ // let correct = static_init!(
447+ // [u8; 32],
448+ // [
449+ // 0xb4, 0xc3, 0x83, 0xe6, 0xc6, 0xe4, 0x2d, 0xaa, 0x9f, 0x2f, 0x3b, 0xf2, 0xa8, 0x00,
450+ // 0x1b, 0x11, 0xc0, 0x67, 0x40, 0x2a, 0xda, 0xe9, 0xeb, 0x34, 0x77, 0x59, 0xdc, 0xc7,
451+ // 0xa9, 0xfd, 0x24, 0x96
452+ // ]
453+ // );
454+
441455 // let hash_data_buffer = static_init!(
442456 // [u8; 113],
443457 // [
@@ -522,11 +536,10 @@ unsafe fn start() -> (
522536 // )
523537 // );
524538
525- // let test_hash = static_init!(
526- // TestSha256<'static, Sha256Adapter<'static>>,
527- // TestSha256::new(sha256, hash_data_buffer, hash_digest_buffer, true)
528- // );
529- //
539+ let test_hash = static_init ! (
540+ TestSha256 <' static , Sha256Adapter <' static >>,
541+ TestSha256 :: new( sha256, hash_data_buffer, hash_digest_buffer, true )
542+ ) ;
530543
531544 // MD5
532545 // let hash_data_buffer = static_init!([u8; 4], [0x61, 0x62, 0x63, 0x64]);
@@ -617,28 +630,28 @@ unsafe fn start() -> (
617630 // TestSha224::new(sha224, hash_data_buffer, hash_digest_buffer, true)
618631 // );
619632 // HMAC-SHA224
620- let hmac_key = static_init ! ( [ u8 ; 6 ] , [ 0x12 , 0x34 , 0x56 , 0x78 , 0x91 , 0x01 ] ) ;
633+ // let hmac_key = static_init!([u8; 6], [0x12, 0x34, 0x56, 0x78, 0x91, 0x01]);
621634
622- let hash_data_buffer = static_init ! ( [ u8 ; 5 ] , [ 0x61 , 0x62 , 0x63 , 0x64 , 0x65 ] ) ;
635+ // let hash_data_buffer = static_init!([u8; 5], [0x61, 0x62, 0x63, 0x64, 0x65]);
623636
624- let hash_digest_buffer = static_init ! ( [ u8 ; 28 ] , [ 0u8 ; 28 ] ) ;
625- let correct = static_init ! (
626- [ u8 ; 28 ] ,
627- [
628- 0x50 , 0x64 , 0x2b , 0x2c , 0xfe , 0x92 , 0xa5 , 0x2e , 0xd5 , 0x99 , 0x81 , 0x97 , 0xcc , 0x14 ,
629- 0x2b , 0x44 , 0x71 , 0xea , 0xd6 , 0xcc , 0x71 , 0x97 , 0xc8 , 0x67 , 0xc2 , 0x64 , 0x9a , 0x86
630- ]
631- ) ;
632- let test_hash = static_init ! (
633- TestHmacSha224 <' static , Sha224Adapter <' static >>,
634- TestHmacSha224 :: new(
635- sha224,
636- hmac_key,
637- hash_data_buffer,
638- hash_digest_buffer,
639- correct
640- )
641- ) ;
637+ // let hash_digest_buffer = static_init!([u8; 28], [0u8; 28]);
638+ // let correct = static_init!(
639+ // [u8; 28],
640+ // [
641+ // 0x50, 0x64, 0x2b, 0x2c, 0xfe, 0x92, 0xa5, 0x2e, 0xd5, 0x99, 0x81, 0x97, 0xcc, 0x14,
642+ // 0x2b, 0x44, 0x71, 0xea, 0xd6, 0xcc, 0x71, 0x97, 0xc8, 0x67, 0xc2, 0x64, 0x9a, 0x86
643+ // ]
644+ // );
645+ // let test_hash = static_init!(
646+ // TestHmacSha224<'static, Sha224Adapter<'static>>,
647+ // TestHmacSha224::new(
648+ // sha224,
649+ // hmac_key,
650+ // hash_data_buffer,
651+ // hash_digest_buffer,
652+ // correct
653+ // )
654+ // );
642655
643656 // Platform and Interrupts
644657 let platform = static_init ! (
0 commit comments