@@ -639,6 +639,29 @@ void run_silentpayments_test_vector_receive(const struct bip352_test_vector *tes
639639 CHECK (n_found == test -> num_found_output_pubkeys );
640640}
641641
642+ static void silentpayments_sha256_tag_test (void ) {
643+ secp256k1_sha256 sha ;
644+ {
645+ /* "BIP0352/Inputs" */
646+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'I' ,'n' ,'p' ,'u' ,'t' ,'s' };
647+ secp256k1_silentpayments_sha256_init_inputs (& sha );
648+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
649+ }
650+ {
651+ /* "BIP0352/SharedSecret" */
652+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'S' ,'h' ,'a' ,'r' ,'e' ,'d' , 'S' ,'e' ,'c' ,'r' ,'e' ,'t' };
653+ secp256k1_silentpayments_sha256_init_sharedsecret (& sha );
654+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
655+ }
656+ {
657+ /* "BIP0352/Label" */
658+ static const unsigned char tag [] = {'B' ,'I' ,'P' ,'0' ,'3' ,'5' ,'2' ,'/' ,'L' ,'a' ,'b' ,'e' ,'l' };
659+ secp256k1_silentpayments_sha256_init_label (& sha );
660+ test_sha256_tag_midstate (& sha , tag , sizeof (tag ));
661+ }
662+ }
663+
664+
642665void run_silentpayments_test_vectors (void ) {
643666 size_t i ;
644667
@@ -656,6 +679,7 @@ static const struct tf_test_entry tests_silentpayments[] = {
656679 CASE1 (test_label_api ),
657680 CASE1 (test_recipient_api ),
658681 CASE1 (run_silentpayments_test_vectors ),
682+ CASE1 (silentpayments_sha256_tag_test ),
659683};
660684
661685#endif
0 commit comments