@@ -45,23 +45,24 @@ static status_t run_test_vector(void) {
4545 .data = act_tag ,
4646 .len = digest_len ,
4747 };
48+ otcrypto_const_byte_buf_t msg_buf = otcrypto_make_const_byte_buf (
49+ current_test_vector -> message .data , current_test_vector -> message .len );
4850 switch (current_test_vector -> test_operation ) {
4951 case kHmacTestOperationSha256 :
50- TRY (otcrypto_sha2_256 (& current_test_vector -> message , & hash_digest ));
52+ TRY (otcrypto_sha2_256 (& msg_buf , & hash_digest ));
5153 break ;
5254 case kHmacTestOperationSha384 :
53- TRY (otcrypto_sha2_384 (& current_test_vector -> message , & hash_digest ));
55+ TRY (otcrypto_sha2_384 (& msg_buf , & hash_digest ));
5456 break ;
5557 case kHmacTestOperationSha512 :
56- TRY (otcrypto_sha2_512 (& current_test_vector -> message , & hash_digest ));
58+ TRY (otcrypto_sha2_512 (& msg_buf , & hash_digest ));
5759 break ;
5860 case kHmacTestOperationHmacSha256 :
5961 OT_FALLTHROUGH_INTENDED ;
6062 case kHmacTestOperationHmacSha384 :
6163 OT_FALLTHROUGH_INTENDED ;
6264 case kHmacTestOperationHmacSha512 :
63- TRY (otcrypto_hmac (& current_test_vector -> key ,
64- & current_test_vector -> message , & tag_buf ));
65+ TRY (otcrypto_hmac (& current_test_vector -> key , & msg_buf , & tag_buf ));
6566 break ;
6667 default :
6768 return INVALID_ARGUMENT ();
0 commit comments