@@ -61,7 +61,6 @@ void BSL_TestUtils_InitBCB_Appendix2(BCBTestContext *context, BSL_SecRole_e role
6161 quick_data (context -> auth_tag , ApxA2_AuthTag );
6262 quick_data (context -> wrapped_key , ApxA2_WrappedKey );
6363 quick_data (context -> key_enc_key , ApxA2_KeyEncKey );
64- quick_data (context -> content_enc_key , ApxA2_ContentEncKey );
6564
6665 BSL_SecParam_InitInt64 (& context -> param_scope_flags , RFC9173_BCB_SECPARAM_AADSCOPE , 0 );
6766 BSL_SecParam_InitStr (& context -> param_test_key_id , BSL_SECPARAM_TYPE_KEY_ID , RFC9173_EXAMPLE_A2_KEY );
@@ -70,8 +69,6 @@ void BSL_TestUtils_InitBCB_Appendix2(BCBTestContext *context, BSL_SecRole_e role
7069 BSL_SecParam_InitBytestr (& context -> param_init_vec , RFC9173_BCB_SECPARAM_IV , context -> init_vector );
7170 BSL_SecParam_InitBytestr (& context -> param_auth_tag , BSL_SECPARAM_TYPE_AUTH_TAG , context -> auth_tag );
7271 BSL_SecParam_InitBytestr (& context -> param_wrapped_key , RFC9173_BCB_SECPARAM_WRAPPEDKEY , context -> wrapped_key );
73- BSL_SecParam_InitBytestr (& context -> param_content_enc_key , BSL_SECPARAM_TYPE_INT_FIXED_KEY ,
74- context -> content_enc_key );
7572
7673 BSL_SecOper_Init (& context -> sec_oper , 2 , 1 , 2 , BSL_SECBLOCKTYPE_BCB , role , BSL_POLICYACTION_NOTHING );
7774
@@ -81,8 +78,6 @@ void BSL_TestUtils_InitBCB_Appendix2(BCBTestContext *context, BSL_SecRole_e role
8178 BSL_SecOper_AppendParam (& context -> sec_oper , & context -> param_scope_flags );
8279 if (role != BSL_SECROLE_SOURCE )
8380 BSL_SecOper_AppendParam (& context -> sec_oper , & context -> param_auth_tag );
84- if (role == BSL_SECROLE_SOURCE )
85- BSL_SecOper_AppendParam (& context -> sec_oper , & context -> param_content_enc_key );
8681 BSL_SecOper_AppendParam (& context -> sec_oper , & context -> param_test_key_id );
8782}
8883
@@ -102,6 +97,71 @@ BSL_SecurityResponseSet_t *BSL_TestUtils_MallocEmptyPolicyResponse(void)
10297 return calloc (BSL_SecurityResponseSet_Sizeof (), 1 );
10398}
10499
100+ int rfc9173_byte_gen_fn_a1 (unsigned char * buf , int len )
101+ {
102+ if (len == 12 ) // IV
103+ {
104+ uint8_t iv [] = { 0x54 , 0x77 , 0x65 , 0x6c , 0x76 , 0x65 , 0x31 , 0x32 , 0x31 , 0x32 , 0x31 , 0x32 };
105+ memcpy (buf , iv , 12 );
106+ }
107+ else // A1 KEY
108+ {
109+ uint8_t rfc9173A1_key [] = { 0x1a , 0x2b , 0x1a , 0x2b , 0x1a , 0x2b , 0x1a , 0x2b ,
110+ 0x1a , 0x2b , 0x1a , 0x2b , 0x1a , 0x2b , 0x1a , 0x2b };
111+ memcpy (buf , rfc9173A1_key , len );
112+ }
113+ return 1 ;
114+ }
115+
116+ int rfc9173_byte_gen_fn_a2_kek (unsigned char * buf , int len )
117+ {
118+ if (len == 12 ) // IV
119+ {
120+ uint8_t iv [] = { 0x54 , 0x77 , 0x65 , 0x6c , 0x76 , 0x65 , 0x31 , 0x32 , 0x31 , 0x32 , 0x31 , 0x32 };
121+ memcpy (buf , iv , 12 );
122+ }
123+ else // A2 KEY
124+ {
125+ uint8_t rfc9173A2_key [] = { 0x61 , 0x62 , 0x63 , 0x64 , 0x65 , 0x66 , 0x67 , 0x68 ,
126+ 0x69 , 0x6a , 0x6b , 0x6c , 0x6d , 0x6e , 0x6f , 0x70 };
127+ memcpy (buf , rfc9173A2_key , len );
128+ }
129+ return 1 ;
130+ }
131+
132+ int rfc9173_byte_gen_fn_a2_cek (unsigned char * buf , int len )
133+ {
134+ if (len == 12 ) // IV
135+ {
136+ uint8_t iv [] = { 0x54 , 0x77 , 0x65 , 0x6c , 0x76 , 0x65 , 0x31 , 0x32 , 0x31 , 0x32 , 0x31 , 0x32 };
137+ memcpy (buf , iv , 12 );
138+ }
139+ else // A3 KEY
140+ {
141+ uint8_t rfc9173A3_key [] = { 0x71 , 0x77 , 0x65 , 0x72 , 0x74 , 0x79 , 0x75 , 0x69 ,
142+ 0x6f , 0x70 , 0x61 , 0x73 , 0x64 , 0x66 , 0x67 , 0x68 };
143+ memcpy (buf , rfc9173A3_key , len );
144+ }
145+ return 1 ;
146+ }
147+
148+ int rfc9173_byte_gen_fn_a4 (unsigned char * buf , int len )
149+ {
150+ if (len == 12 ) // IV
151+ {
152+ uint8_t iv [] = { 0x54 , 0x77 , 0x65 , 0x6c , 0x76 , 0x65 , 0x31 , 0x32 , 0x31 , 0x32 , 0x31 , 0x32 };
153+ memcpy (buf , iv , 12 );
154+ }
155+ else // A4 KEY
156+ {
157+ uint8_t rfc9173A4_key [] = { 0x71 , 0x77 , 0x65 , 0x72 , 0x74 , 0x79 , 0x75 , 0x69 , 0x6f , 0x70 , 0x61 ,
158+ 0x73 , 0x64 , 0x66 , 0x67 , 0x68 , 0x71 , 0x77 , 0x65 , 0x72 , 0x74 , 0x79 ,
159+ 0x75 , 0x69 , 0x6f , 0x70 , 0x61 , 0x73 , 0x64 , 0x66 , 0x67 , 0x68 };
160+ memcpy (buf , rfc9173A4_key , len );
161+ }
162+ return 1 ;
163+ }
164+
105165void BSL_TestUtils_SetupDefaultSecurityContext (BSL_LibCtx_t * bsl_lib )
106166{
107167 assert (bsl_lib != NULL );
0 commit comments