@@ -482,26 +482,29 @@ pub fn credential_check_or_fetch<'a>(
482
482
}
483
483
484
484
#[ cfg( test) ]
485
- mod test {
486
- use super :: * ;
487
-
485
+ mod test_vectors_common {
488
486
use hexlit:: hex;
489
487
490
- use lakers_crypto:: default_crypto;
491
-
492
- const ID_CRED_I : & [ u8 ] = & hex ! ( "a104412b" ) ;
493
- const ID_CRED_R : & [ u8 ] = & hex ! ( "a104410a" ) ;
494
- const CRED_I : & [ u8 ] = & hex ! ( "A2027734322D35302D33312D46462D45462D33372D33322D333908A101A5010202412B2001215820AC75E9ECE3E50BFC8ED60399889522405C47BF16DF96660A41298CB4307F7EB62258206E5DE611388A4B8A8211334AC7D37ECB52A387D257E6DB3C2A93DF21FF3AFFC8" ) ;
495
- const I : & [ u8 ] = & hex ! ( "fb13adeb6518cee5f88417660841142e830a81fe334380a953406a1305e8706b" ) ;
496
- const R : & [ u8 ] = & hex ! ( "72cc4761dbd4c78f758931aa589d348d1ef874a7e303ede2f140dcf3e6aa4aac" ) ;
497
- const _G_I_Y_COORD: & [ u8 ] =
488
+ pub const ID_CRED_I : & [ u8 ] = & hex ! ( "a104412b" ) ;
489
+ pub const ID_CRED_R : & [ u8 ] = & hex ! ( "a104410a" ) ;
490
+ pub const CRED_I : & [ u8 ] = & hex ! ( "A2027734322D35302D33312D46462D45462D33372D33322D333908A101A5010202412B2001215820AC75E9ECE3E50BFC8ED60399889522405C47BF16DF96660A41298CB4307F7EB62258206E5DE611388A4B8A8211334AC7D37ECB52A387D257E6DB3C2A93DF21FF3AFFC8" ) ;
491
+ pub const I : & [ u8 ] = & hex ! ( "fb13adeb6518cee5f88417660841142e830a81fe334380a953406a1305e8706b" ) ;
492
+ pub const R : & [ u8 ] = & hex ! ( "72cc4761dbd4c78f758931aa589d348d1ef874a7e303ede2f140dcf3e6aa4aac" ) ;
493
+ pub const _G_I_Y_COORD: & [ u8 ] =
498
494
& hex ! ( "6e5de611388a4b8a8211334ac7d37ecb52a387d257e6db3c2a93df21ff3affc8" ) ; // not used
499
- const CRED_R : & [ u8 ] = & hex ! ( "A2026008A101A5010202410A2001215820BBC34960526EA4D32E940CAD2A234148DDC21791A12AFBCBAC93622046DD44F02258204519E257236B2A0CE2023F0931F1F386CA7AFDA64FCDE0108C224C51EABF6072" ) ;
495
+ pub const CRED_R : & [ u8 ] = & hex ! ( "A2026008A101A5010202410A2001215820BBC34960526EA4D32E940CAD2A234148DDC21791A12AFBCBAC93622046DD44F02258204519E257236B2A0CE2023F0931F1F386CA7AFDA64FCDE0108C224C51EABF6072" ) ;
500
496
501
- const MESSAGE_1_TV_FIRST_TIME : & str =
497
+ pub const MESSAGE_1_TV_FIRST_TIME : & str =
502
498
"03065820741a13d7ba048fbb615e94386aa3b61bea5b3d8f65f32620b749bee8d278efa90e" ;
503
- const MESSAGE_1_TV : & str =
499
+ pub const MESSAGE_1_TV : & str =
504
500
"0382060258208af6f430ebe18d34184017a9a11bf511c8dff8f834730b96c1b7c8dbca2fc3b637" ;
501
+ }
502
+
503
+ #[ cfg( test) ]
504
+ mod test {
505
+ use super :: * ;
506
+ use lakers_crypto:: default_crypto;
507
+ use test_vectors_common:: * ;
505
508
506
509
#[ test]
507
510
fn test_new_initiator ( ) {
@@ -560,7 +563,7 @@ mod test {
560
563
assert ! ( conn_id >= -24 && conn_id <= 23 ) ;
561
564
}
562
565
563
- #[ cfg( feature = "ead-none" ) ]
566
+ #[ cfg( feature = "test- ead-none" ) ]
564
567
#[ test]
565
568
fn test_handshake ( ) {
566
569
let cred_i = CredentialRPK :: new ( CRED_I . try_into ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -626,6 +629,16 @@ mod test {
626
629
627
630
assert_eq ! ( i_prk_out_new, r_prk_out_new) ;
628
631
}
632
+ }
633
+
634
+ #[ cfg( feature = "test-ead-authz" ) ]
635
+ #[ cfg( test) ]
636
+ mod test_authz {
637
+ use super :: * ;
638
+ use hexlit:: hex;
639
+ use lakers_crypto:: default_crypto;
640
+ use lakers_ead:: * ;
641
+ use test_vectors_common:: * ;
629
642
630
643
// U
631
644
const ID_U_TV : & [ u8 ] = & hex ! ( "a104412b" ) ;
@@ -639,9 +652,8 @@ mod test {
639
652
const LOC_W_TV : & [ u8 ] = & hex ! ( "636F61703A2F2F656E726F6C6C6D656E742E736572766572" ) ;
640
653
641
654
// TODO: have a setup_test function that prepares the common objects for the ead tests
642
- #[ cfg( feature = "ead-authz" ) ]
643
655
#[ test]
644
- fn test_ead_authz ( ) {
656
+ fn test_handshake_authz ( ) {
645
657
let cred_i = CredentialRPK :: new ( CRED_I . try_into ( ) . unwrap ( ) ) . unwrap ( ) ;
646
658
let cred_r = CredentialRPK :: new ( CRED_R . try_into ( ) . unwrap ( ) ) . unwrap ( ) ;
647
659
0 commit comments