@@ -636,6 +636,29 @@ void run_silentpayments_test_vector_receive(const struct bip352_test_vector *tes
636636 CHECK (n_found == test -> num_found_output_pubkeys );
637637}
638638
639+ static void silentpayments_sha256_tag_test (void ) {
640+ secp256k1_sha256 sha ;
641+ {
642+ /* "BIP0352/Inputs" */
643+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'I' ,'n' ,'p' ,'u' ,'t' ,'s' };
644+ secp256k1_silentpayments_sha256_init_inputs (& sha );
645+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
646+ }
647+ {
648+ /* "BIP0352/SharedSecret" */
649+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'S' ,'h' ,'a' ,'r' ,'e' ,'d' , 'S' ,'e' ,'c' ,'r' ,'e' ,'t' };
650+ secp256k1_silentpayments_sha256_init_sharedsecret (& sha );
651+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
652+ }
653+ {
654+ /* "BIP0352/Label" */
655+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'L' ,'a' ,'b' ,'e' ,'l' };
656+ secp256k1_silentpayments_sha256_init_label (& sha );
657+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
658+ }
659+ }
660+
661+
639662void run_silentpayments_test_vectors (void ) {
640663 size_t i ;
641664
@@ -653,6 +676,7 @@ static const struct tf_test_entry tests_silentpayments[] = {
653676 CASE1 (test_label_api ),
654677 CASE1 (test_recipient_api ),
655678 CASE1 (run_silentpayments_test_vectors ),
679+ CASE1 (silentpayments_sha256_tag_test ),
656680};
657681
658682#endif
0 commit comments