@@ -2557,21 +2557,23 @@ PHP_FUNCTION (secp256k1_schnorrsig_sign)
25572557/* {{{ proto int secp256k1_schnorrsig_verify(resource context, resource sig, string msg32, resource pubKey)
25582558 * Verify a Schnorr signature. */
25592559PHP_FUNCTION (secp256k1_schnorrsig_verify ) {
2560- zval * zCtx , * zSchnorrSig , * zSchnorrSigPubKey ;
2560+ zval * zCtx , * zSchnorrSig , * zXOnlyPubKey ;
25612561 secp256k1_context * ctx ;
25622562 secp256k1_schnorrsig * sig ;
25632563 secp256k1_xonly_pubkey * pubkey ;
25642564 zend_string * msg32 ;
25652565 int result ;
25662566
2567- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "rrSr" , & zCtx , & zSchnorrSig , & msg32 , & zSchnorrSigPubKey ) == FAILURE ) {
2567+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "rrSr" , & zCtx , & zSchnorrSig , & msg32 , & zXOnlyPubKey ) == FAILURE ) {
25682568 RETURN_LONG (0 );
25692569 }
25702570
25712571 if ((ctx = php_get_secp256k1_context (zCtx )) == NULL ) {
25722572 RETURN_LONG (0 );
25732573 } else if ((sig = php_get_secp256k1_schnorr_signature (zSchnorrSig )) == NULL ) {
25742574 RETURN_LONG (0 );
2575+ } else if ((pubkey = php_get_secp256k1_xonly_pubkey (zXOnlyPubKey )) == NULL ) {
2576+ RETURN_LONG (0 );
25752577 }
25762578
25772579 if (msg32 -> len != HASH_LENGTH ) {
@@ -2580,10 +2582,6 @@ PHP_FUNCTION(secp256k1_schnorrsig_verify) {
25802582 return ;
25812583 }
25822584
2583- if ((pubkey = php_get_secp256k1_xonly_pubkey (zSchnorrSigPubKey )) == NULL ) {
2584- RETURN_LONG (0 );
2585- }
2586-
25872585 result = secp256k1_schnorrsig_verify (ctx , sig , (unsigned char * ) msg32 -> val , pubkey );
25882586 RETURN_LONG (result );
25892587}
@@ -2593,7 +2591,7 @@ PHP_FUNCTION(secp256k1_schnorrsig_verify) {
25932591 * Verify a Schnorr signature. */
25942592PHP_FUNCTION (secp256k1_schnorrsig_verify_batch )
25952593{
2596- zval * zCtx , * zScratch , * zSigArray , * zMsg32Array , * zSchnorrSigPubKeyArray , * arrayZval ;
2594+ zval * zCtx , * zScratch , * zSigArray , * zMsg32Array , * zXOnlyPubKeyArray , * arrayZval ;
25972595 zend_long numsigs ;
25982596 secp256k1_context * ctx ;
25992597 secp256k1_scratch_space_wrapper * scratch_wrap ;
@@ -2607,7 +2605,7 @@ PHP_FUNCTION(secp256k1_schnorrsig_verify_batch)
26072605 int result = 0 , i = 0 ;
26082606
26092607 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "rraaal" ,
2610- & zCtx , & zScratch , & zSigArray , & zMsg32Array , & zSchnorrSigPubKeyArray , & numsigs ) == FAILURE ) {
2608+ & zCtx , & zScratch , & zSigArray , & zMsg32Array , & zXOnlyPubKeyArray , & numsigs ) == FAILURE ) {
26112609 RETURN_LONG (result );
26122610 }
26132611
@@ -2619,7 +2617,7 @@ PHP_FUNCTION(secp256k1_schnorrsig_verify_batch)
26192617 RETURN_LONG (result );
26202618 }
26212619
2622- if ((size_t ) numsigs != (size_t ) zend_hash_num_elements (Z_ARRVAL_P (zSchnorrSigPubKeyArray )) ||
2620+ if ((size_t ) numsigs != (size_t ) zend_hash_num_elements (Z_ARRVAL_P (zXOnlyPubKeyArray )) ||
26232621 (size_t ) numsigs != (size_t ) zend_hash_num_elements (Z_ARRVAL_P (zMsg32Array )) ||
26242622 (size_t ) numsigs != (size_t ) zend_hash_num_elements (Z_ARRVAL_P (zSigArray ))) {
26252623 RETURN_LONG (result );
@@ -2647,7 +2645,7 @@ PHP_FUNCTION(secp256k1_schnorrsig_verify_batch)
26472645 } ZEND_HASH_FOREACH_END ();
26482646
26492647 pubkeys = emalloc (sizeof (secp256k1_xonly_pubkey * ) * numsigs );
2650- arr_hash = Z_ARRVAL_P (zSchnorrSigPubKeyArray );
2648+ arr_hash = Z_ARRVAL_P (zXOnlyPubKeyArray );
26512649 ZEND_HASH_FOREACH_KEY_VAL (arr_hash , i , arrayKeyStr , arrayZval ) {
26522650 if ((pubkey = php_get_secp256k1_xonly_pubkey (arrayZval )) == NULL ) {
26532651 efree (sigs );
0 commit comments