@@ -215,28 +215,36 @@ static void test_schnorrsig_sha256_tagged(void) {
215
215
216
216
/* Helper function for schnorrsig_bip_vectors
217
217
* Signs the message and checks that it's the same as expected_sig. */
218
- static void test_schnorrsig_bip_vectors_check_signing (const unsigned char * sk , const unsigned char * pk_serialized , const unsigned char * aux_rand , const unsigned char * msg32 , const unsigned char * expected_sig ) {
218
+ static void test_schnorrsig_bip_vectors_check_signing (const unsigned char * sk , const unsigned char * pk_serialized , const unsigned char * aux_rand , const unsigned char * msg , size_t msglen , const unsigned char * expected_sig ) {
219
219
unsigned char sig [64 ];
220
220
secp256k1_keypair keypair ;
221
221
secp256k1_xonly_pubkey pk , pk_expected ;
222
222
223
+ secp256k1_schnorrsig_extraparams extraparams = SECP256K1_SCHNORRSIG_EXTRAPARAMS_INIT ;
224
+ extraparams .ndata = (unsigned char * )aux_rand ;
225
+
223
226
CHECK (secp256k1_keypair_create (CTX , & keypair , sk ));
224
- CHECK (secp256k1_schnorrsig_sign32 (CTX , sig , msg32 , & keypair , aux_rand ));
227
+ CHECK (secp256k1_schnorrsig_sign_custom (CTX , sig , msg , msglen , & keypair , & extraparams ));
225
228
CHECK (secp256k1_memcmp_var (sig , expected_sig , 64 ) == 0 );
229
+ if (msglen == 32 ) {
230
+ memset (sig , 0 , 64 );
231
+ CHECK (secp256k1_schnorrsig_sign32 (CTX , sig , msg , & keypair , aux_rand ));
232
+ CHECK (secp256k1_memcmp_var (sig , expected_sig , 64 ) == 0 );
233
+ }
226
234
227
235
CHECK (secp256k1_xonly_pubkey_parse (CTX , & pk_expected , pk_serialized ));
228
236
CHECK (secp256k1_keypair_xonly_pub (CTX , & pk , NULL , & keypair ));
229
237
CHECK (secp256k1_memcmp_var (& pk , & pk_expected , sizeof (pk )) == 0 );
230
- CHECK (secp256k1_schnorrsig_verify (CTX , sig , msg32 , 32 , & pk ));
238
+ CHECK (secp256k1_schnorrsig_verify (CTX , sig , msg , msglen , & pk ));
231
239
}
232
240
233
241
/* Helper function for schnorrsig_bip_vectors
234
242
* Checks that both verify and verify_batch (TODO) return the same value as expected. */
235
- static void test_schnorrsig_bip_vectors_check_verify (const unsigned char * pk_serialized , const unsigned char * msg32 , const unsigned char * sig , int expected ) {
243
+ static void test_schnorrsig_bip_vectors_check_verify (const unsigned char * pk_serialized , const unsigned char * msg , size_t msglen , const unsigned char * sig , int expected ) {
236
244
secp256k1_xonly_pubkey pk ;
237
245
238
246
CHECK (secp256k1_xonly_pubkey_parse (CTX , & pk , pk_serialized ));
239
- CHECK (expected == secp256k1_schnorrsig_verify (CTX , sig , msg32 , 32 , & pk ));
247
+ CHECK (expected == secp256k1_schnorrsig_verify (CTX , sig , msg , msglen , & pk ));
240
248
}
241
249
242
250
/* Test vectors according to BIP-340 ("Schnorr Signatures for secp256k1"). See
@@ -256,7 +264,7 @@ static void test_schnorrsig_bip_vectors(void) {
256
264
0xB5 , 0x31 , 0xC8 , 0x45 , 0x83 , 0x6F , 0x99 , 0xB0 ,
257
265
0x86 , 0x01 , 0xF1 , 0x13 , 0xBC , 0xE0 , 0x36 , 0xF9
258
266
};
259
- unsigned char aux_rand [32 ] = {
267
+ const unsigned char aux_rand [32 ] = {
260
268
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
261
269
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
262
270
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
@@ -278,8 +286,8 @@ static void test_schnorrsig_bip_vectors(void) {
278
286
0xEB , 0xEE , 0xE8 , 0xFD , 0xB2 , 0x17 , 0x2F , 0x47 ,
279
287
0x7D , 0xF4 , 0x90 , 0x0D , 0x31 , 0x05 , 0x36 , 0xC0
280
288
};
281
- test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sig );
282
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 1 );
289
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof ( msg ), sig );
290
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 1 );
283
291
}
284
292
{
285
293
/* Test vector 1 */
@@ -295,7 +303,7 @@ static void test_schnorrsig_bip_vectors(void) {
295
303
0x58 , 0xFE , 0xAE , 0x1D , 0xA2 , 0xDE , 0xCE , 0xD8 ,
296
304
0x43 , 0x24 , 0x0F , 0x7B , 0x50 , 0x2B , 0xA6 , 0x59
297
305
};
298
- unsigned char aux_rand [32 ] = {
306
+ const unsigned char aux_rand [32 ] = {
299
307
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
300
308
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
301
309
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
@@ -317,8 +325,8 @@ static void test_schnorrsig_bip_vectors(void) {
317
325
0x89 , 0x7E , 0xFC , 0xB6 , 0x39 , 0xEA , 0x87 , 0x1C ,
318
326
0xFA , 0x95 , 0xF6 , 0xDE , 0x33 , 0x9E , 0x4B , 0x0A
319
327
};
320
- test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sig );
321
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 1 );
328
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof ( msg ), sig );
329
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 1 );
322
330
}
323
331
{
324
332
/* Test vector 2 */
@@ -334,7 +342,7 @@ static void test_schnorrsig_bip_vectors(void) {
334
342
0x01 , 0x39 , 0x71 , 0x53 , 0x09 , 0xB0 , 0x86 , 0xC9 ,
335
343
0x60 , 0xE1 , 0x8F , 0xD9 , 0x69 , 0x77 , 0x4E , 0xB8
336
344
};
337
- unsigned char aux_rand [32 ] = {
345
+ const unsigned char aux_rand [32 ] = {
338
346
0xC8 , 0x7A , 0xA5 , 0x38 , 0x24 , 0xB4 , 0xD7 , 0xAE ,
339
347
0x2E , 0xB0 , 0x35 , 0xA2 , 0xB5 , 0xBB , 0xBC , 0xCC ,
340
348
0x08 , 0x0E , 0x76 , 0xCD , 0xC6 , 0xD1 , 0x69 , 0x2C ,
@@ -356,8 +364,8 @@ static void test_schnorrsig_bip_vectors(void) {
356
364
0x7A , 0xDE , 0xA9 , 0x8D , 0x82 , 0xF8 , 0x48 , 0x1E ,
357
365
0x0E , 0x1E , 0x03 , 0x67 , 0x4A , 0x6F , 0x3F , 0xB7
358
366
};
359
- test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sig );
360
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 1 );
367
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof ( msg ), sig );
368
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 1 );
361
369
}
362
370
{
363
371
/* Test vector 3 */
@@ -373,7 +381,7 @@ static void test_schnorrsig_bip_vectors(void) {
373
381
0x3A , 0x0D , 0x95 , 0xFB , 0xF2 , 0x1D , 0x46 , 0x8A ,
374
382
0x1B , 0x33 , 0xF8 , 0xC1 , 0x60 , 0xD8 , 0xF5 , 0x17
375
383
};
376
- unsigned char aux_rand [32 ] = {
384
+ const unsigned char aux_rand [32 ] = {
377
385
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
378
386
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
379
387
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
@@ -395,8 +403,8 @@ static void test_schnorrsig_bip_vectors(void) {
395
403
0xF2 , 0x5F , 0xD7 , 0x88 , 0x81 , 0xEB , 0xB3 , 0x27 ,
396
404
0x71 , 0xFC , 0x59 , 0x22 , 0xEF , 0xC6 , 0x6E , 0xA3
397
405
};
398
- test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sig );
399
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 1 );
406
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof ( msg ), sig );
407
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 1 );
400
408
}
401
409
{
402
410
/* Test vector 4 */
@@ -422,7 +430,7 @@ static void test_schnorrsig_bip_vectors(void) {
422
430
0x60 , 0xCB , 0x71 , 0xC0 , 0x4E , 0x80 , 0xF5 , 0x93 ,
423
431
0x06 , 0x0B , 0x07 , 0xD2 , 0x83 , 0x08 , 0xD7 , 0xF4
424
432
};
425
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 1 );
433
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 1 );
426
434
}
427
435
{
428
436
/* Test vector 5 */
@@ -460,7 +468,7 @@ static void test_schnorrsig_bip_vectors(void) {
460
468
0x7A , 0x73 , 0xC6 , 0x43 , 0xE1 , 0x66 , 0xBE , 0x5E ,
461
469
0xBE , 0xAF , 0xA3 , 0x4B , 0x1A , 0xC5 , 0x53 , 0xE2
462
470
};
463
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
471
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
464
472
}
465
473
{
466
474
/* Test vector 7 */
@@ -486,7 +494,7 @@ static void test_schnorrsig_bip_vectors(void) {
486
494
0x62 , 0x2A , 0x95 , 0x4C , 0xFE , 0x54 , 0x57 , 0x35 ,
487
495
0xAA , 0xEA , 0x51 , 0x34 , 0xFC , 0xCD , 0xB2 , 0xBD
488
496
};
489
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
497
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
490
498
}
491
499
{
492
500
/* Test vector 8 */
@@ -512,7 +520,7 @@ static void test_schnorrsig_bip_vectors(void) {
512
520
0xE8 , 0xD7 , 0xC9 , 0x3E , 0x00 , 0xC5 , 0xED , 0x0C ,
513
521
0x18 , 0x34 , 0xFF , 0x0D , 0x0C , 0x2E , 0x6D , 0xA6
514
522
};
515
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
523
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
516
524
}
517
525
{
518
526
/* Test vector 9 */
@@ -538,7 +546,7 @@ static void test_schnorrsig_bip_vectors(void) {
538
546
0x4F , 0xB7 , 0x34 , 0x76 , 0xF0 , 0xD5 , 0x94 , 0xDC ,
539
547
0xB6 , 0x5C , 0x64 , 0x25 , 0xBD , 0x18 , 0x60 , 0x51
540
548
};
541
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
549
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
542
550
}
543
551
{
544
552
/* Test vector 10 */
@@ -564,7 +572,7 @@ static void test_schnorrsig_bip_vectors(void) {
564
572
0xDB , 0xA8 , 0x7F , 0x11 , 0xAC , 0x67 , 0x54 , 0xF9 ,
565
573
0x37 , 0x80 , 0xD5 , 0xA1 , 0x83 , 0x7C , 0xF1 , 0x97
566
574
};
567
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
575
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
568
576
}
569
577
{
570
578
/* Test vector 11 */
@@ -590,7 +598,7 @@ static void test_schnorrsig_bip_vectors(void) {
590
598
0xD1 , 0xD7 , 0x13 , 0xA8 , 0xAE , 0x82 , 0xB3 , 0x2F ,
591
599
0xA7 , 0x9D , 0x5F , 0x7F , 0xC4 , 0x07 , 0xD3 , 0x9B
592
600
};
593
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
601
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
594
602
}
595
603
{
596
604
/* Test vector 12 */
@@ -616,7 +624,7 @@ static void test_schnorrsig_bip_vectors(void) {
616
624
0xD1 , 0xD7 , 0x13 , 0xA8 , 0xAE , 0x82 , 0xB3 , 0x2F ,
617
625
0xA7 , 0x9D , 0x5F , 0x7F , 0xC4 , 0x07 , 0xD3 , 0x9B
618
626
};
619
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
627
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
620
628
}
621
629
{
622
630
/* Test vector 13 */
@@ -642,7 +650,7 @@ static void test_schnorrsig_bip_vectors(void) {
642
650
0xBA , 0xAE , 0xDC , 0xE6 , 0xAF , 0x48 , 0xA0 , 0x3B ,
643
651
0xBF , 0xD2 , 0x5E , 0x8C , 0xD0 , 0x36 , 0x41 , 0x41
644
652
};
645
- test_schnorrsig_bip_vectors_check_verify (pk , msg , sig , 0 );
653
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof ( msg ), sig , 0 );
646
654
}
647
655
{
648
656
/* Test vector 14 */
@@ -656,6 +664,147 @@ static void test_schnorrsig_bip_vectors(void) {
656
664
/* No need to check the signature of the test vector as parsing the pubkey already fails */
657
665
CHECK (!secp256k1_xonly_pubkey_parse (CTX , & pk_parsed , pk ));
658
666
}
667
+ {
668
+ /* Test vector 15 */
669
+ const unsigned char sk [32 ] = {
670
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
671
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
672
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
673
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
674
+ };
675
+ const unsigned char pk [32 ] = {
676
+ 0x77 , 0x8C , 0xAA , 0x53 , 0xB4 , 0x39 , 0x3A , 0xC4 ,
677
+ 0x67 , 0x77 , 0x4D , 0x09 , 0x49 , 0x7A , 0x87 , 0x22 ,
678
+ 0x4B , 0xF9 , 0xFA , 0xB6 , 0xF6 , 0xE6 , 0x8B , 0x23 ,
679
+ 0x08 , 0x64 , 0x97 , 0x32 , 0x4D , 0x6F , 0xD1 , 0x17 ,
680
+ };
681
+ const unsigned char aux_rand [32 ] = {
682
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
683
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
684
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
685
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
686
+ };
687
+ /* const unsigned char msg[0] = {}; */
688
+ const unsigned char sig [64 ] = {
689
+ 0x71 , 0x53 , 0x5D , 0xB1 , 0x65 , 0xEC , 0xD9 , 0xFB ,
690
+ 0xBC , 0x04 , 0x6E , 0x5F , 0xFA , 0xEA , 0x61 , 0x18 ,
691
+ 0x6B , 0xB6 , 0xAD , 0x43 , 0x67 , 0x32 , 0xFC , 0xCC ,
692
+ 0x25 , 0x29 , 0x1A , 0x55 , 0x89 , 0x54 , 0x64 , 0xCF ,
693
+ 0x60 , 0x69 , 0xCE , 0x26 , 0xBF , 0x03 , 0x46 , 0x62 ,
694
+ 0x28 , 0xF1 , 0x9A , 0x3A , 0x62 , 0xDB , 0x8A , 0x64 ,
695
+ 0x9F , 0x2D , 0x56 , 0x0F , 0xAC , 0x65 , 0x28 , 0x27 ,
696
+ 0xD1 , 0xAF , 0x05 , 0x74 , 0xE4 , 0x27 , 0xAB , 0x63 ,
697
+ };
698
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , NULL , 0 , sig );
699
+ test_schnorrsig_bip_vectors_check_verify (pk , NULL , 0 , sig , 1 );
700
+ }
701
+ {
702
+ /* Test vector 16 */
703
+ const unsigned char sk [32 ] = {
704
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
705
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
706
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
707
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
708
+ };
709
+ const unsigned char pk [32 ] = {
710
+ 0x77 , 0x8C , 0xAA , 0x53 , 0xB4 , 0x39 , 0x3A , 0xC4 ,
711
+ 0x67 , 0x77 , 0x4D , 0x09 , 0x49 , 0x7A , 0x87 , 0x22 ,
712
+ 0x4B , 0xF9 , 0xFA , 0xB6 , 0xF6 , 0xE6 , 0x8B , 0x23 ,
713
+ 0x08 , 0x64 , 0x97 , 0x32 , 0x4D , 0x6F , 0xD1 , 0x17 ,
714
+ };
715
+ const unsigned char aux_rand [32 ] = {
716
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
717
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
718
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
719
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
720
+ };
721
+ const unsigned char msg [] = { 0x11 };
722
+ const unsigned char sig [64 ] = {
723
+ 0x08 , 0xA2 , 0x0A , 0x0A , 0xFE , 0xF6 , 0x41 , 0x24 ,
724
+ 0x64 , 0x92 , 0x32 , 0xE0 , 0x69 , 0x3C , 0x58 , 0x3A ,
725
+ 0xB1 , 0xB9 , 0x93 , 0x4A , 0xE6 , 0x3B , 0x4C , 0x35 ,
726
+ 0x11 , 0xF3 , 0xAE , 0x11 , 0x34 , 0xC6 , 0xA3 , 0x03 ,
727
+ 0xEA , 0x31 , 0x73 , 0xBF , 0xEA , 0x66 , 0x83 , 0xBD ,
728
+ 0x10 , 0x1F , 0xA5 , 0xAA , 0x5D , 0xBC , 0x19 , 0x96 ,
729
+ 0xFE , 0x7C , 0xAC , 0xFC , 0x5A , 0x57 , 0x7D , 0x33 ,
730
+ 0xEC , 0x14 , 0x56 , 0x4C , 0xEC , 0x2B , 0xAC , 0xBF ,
731
+ };
732
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof (msg ), sig );
733
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof (msg ), sig , 1 );
734
+ }
735
+ {
736
+ /* Test vector 17 */
737
+ const unsigned char sk [32 ] = {
738
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
739
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
740
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
741
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
742
+ };
743
+ const unsigned char pk [32 ] = {
744
+ 0x77 , 0x8C , 0xAA , 0x53 , 0xB4 , 0x39 , 0x3A , 0xC4 ,
745
+ 0x67 , 0x77 , 0x4D , 0x09 , 0x49 , 0x7A , 0x87 , 0x22 ,
746
+ 0x4B , 0xF9 , 0xFA , 0xB6 , 0xF6 , 0xE6 , 0x8B , 0x23 ,
747
+ 0x08 , 0x64 , 0x97 , 0x32 , 0x4D , 0x6F , 0xD1 , 0x17 ,
748
+ };
749
+ const unsigned char aux_rand [32 ] = {
750
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
751
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
752
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
753
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
754
+ };
755
+ const unsigned char msg [] = {
756
+ 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 ,
757
+ 0x09 , 0x0A , 0x0B , 0x0C , 0x0D , 0x0E , 0x0F , 0x10 ,
758
+ 0x11 ,
759
+ };
760
+ const unsigned char sig [64 ] = {
761
+ 0x51 , 0x30 , 0xF3 , 0x9A , 0x40 , 0x59 , 0xB4 , 0x3B ,
762
+ 0xC7 , 0xCA , 0xC0 , 0x9A , 0x19 , 0xEC , 0xE5 , 0x2B ,
763
+ 0x5D , 0x86 , 0x99 , 0xD1 , 0xA7 , 0x1E , 0x3C , 0x52 ,
764
+ 0xDA , 0x9A , 0xFD , 0xB6 , 0xB5 , 0x0A , 0xC3 , 0x70 ,
765
+ 0xC4 , 0xA4 , 0x82 , 0xB7 , 0x7B , 0xF9 , 0x60 , 0xF8 ,
766
+ 0x68 , 0x15 , 0x40 , 0xE2 , 0x5B , 0x67 , 0x71 , 0xEC ,
767
+ 0xE1 , 0xE5 , 0xA3 , 0x7F , 0xD8 , 0x0E , 0x5A , 0x51 ,
768
+ 0x89 , 0x7C , 0x55 , 0x66 , 0xA9 , 0x7E , 0xA5 , 0xA5 ,
769
+ };
770
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof (msg ), sig );
771
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof (msg ), sig , 1 );
772
+ }
773
+ {
774
+ /* Test vector 18 */
775
+ const unsigned char sk [32 ] = {
776
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
777
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
778
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
779
+ 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 , 0x03 , 0x40 ,
780
+ };
781
+ const unsigned char pk [32 ] = {
782
+ 0x77 , 0x8C , 0xAA , 0x53 , 0xB4 , 0x39 , 0x3A , 0xC4 ,
783
+ 0x67 , 0x77 , 0x4D , 0x09 , 0x49 , 0x7A , 0x87 , 0x22 ,
784
+ 0x4B , 0xF9 , 0xFA , 0xB6 , 0xF6 , 0xE6 , 0x8B , 0x23 ,
785
+ 0x08 , 0x64 , 0x97 , 0x32 , 0x4D , 0x6F , 0xD1 , 0x17 ,
786
+ };
787
+ const unsigned char aux_rand [32 ] = {
788
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
789
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
790
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
791
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
792
+ };
793
+ const unsigned char sig [64 ] = {
794
+ 0x40 , 0x3B , 0x12 , 0xB0 , 0xD8 , 0x55 , 0x5A , 0x34 ,
795
+ 0x41 , 0x75 , 0xEA , 0x7E , 0xC7 , 0x46 , 0x56 , 0x63 ,
796
+ 0x03 , 0x32 , 0x1E , 0x5D , 0xBF , 0xA8 , 0xBE , 0x6F ,
797
+ 0x09 , 0x16 , 0x35 , 0x16 , 0x3E , 0xCA , 0x79 , 0xA8 ,
798
+ 0x58 , 0x5E , 0xD3 , 0xE3 , 0x17 , 0x08 , 0x07 , 0xE7 ,
799
+ 0xC0 , 0x3B , 0x72 , 0x0F , 0xC5 , 0x4C , 0x7B , 0x23 ,
800
+ 0x89 , 0x7F , 0xCB , 0xA0 , 0xE9 , 0xD0 , 0xB4 , 0xA0 ,
801
+ 0x68 , 0x94 , 0xCF , 0xD2 , 0x49 , 0xF2 , 0x23 , 0x67 ,
802
+ };
803
+ unsigned char msg [100 ];
804
+ memset (msg , 0x99 , sizeof (msg ));
805
+ test_schnorrsig_bip_vectors_check_signing (sk , pk , aux_rand , msg , sizeof (msg ), sig );
806
+ test_schnorrsig_bip_vectors_check_verify (pk , msg , sizeof (msg ), sig , 1 );
807
+ }
659
808
}
660
809
661
810
/* Nonce function that returns constant 0 */
0 commit comments