Skip to content

Commit 785c869

Browse files
committed
rename is_positive -> has_square_y
1 parent 1a3ce77 commit 785c869

11 files changed

Lines changed: 42 additions & 42 deletions

secp256k1/secp256k1.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_secp256k1_xonly_pubkey_tweak_add, I
444444
#endif
445445
ZEND_ARG_TYPE_INFO(0, context, IS_RESOURCE, 0)
446446
ZEND_ARG_TYPE_INFO(1, outputPubKey, IS_RESOURCE, 1)
447-
ZEND_ARG_TYPE_INFO(1, isPositive, IS_LONG, 1)
447+
ZEND_ARG_TYPE_INFO(1, hasSquareY, IS_LONG, 1)
448448
ZEND_ARG_TYPE_INFO(0, internalPubKey, IS_RESOURCE, 0)
449449
ZEND_ARG_TYPE_INFO(0, tweak32, IS_STRING, 0)
450450
ZEND_END_ARG_INFO();
@@ -456,7 +456,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_secp256k1_xonly_pubkey_tweak_verify
456456
#endif
457457
ZEND_ARG_TYPE_INFO(0, context, IS_RESOURCE, 0)
458458
ZEND_ARG_TYPE_INFO(0, outputPubKey, IS_RESOURCE, 0)
459-
ZEND_ARG_TYPE_INFO(0, isPositive, IS_LONG, 0)
459+
ZEND_ARG_TYPE_INFO(0, hasSquareY, IS_LONG, 0)
460460
ZEND_ARG_TYPE_INFO(0, internalPubKey, IS_RESOURCE, 0)
461461
ZEND_ARG_TYPE_INFO(0, tweak32, IS_STRING, 0)
462462
ZEND_END_ARG_INFO();
@@ -1978,18 +1978,18 @@ PHP_FUNCTION(secp256k1_xonly_privkey_tweak_add)
19781978
}
19791979
/* }}} */
19801980

1981-
/* {{{ proto int secp256k1_xonly_pubkey_tweak_add(resource context, resource &output_pubkey, resource internal_pubkey, string tweak32)
1981+
/* {{{ proto int secp256k1_xonly_pubkey_tweak_add(resource context, resource &output_pubkey, int &has_square_y, resource internal_pubkey, string tweak32)
19821982
* Tweak a public key by adding tweak times the generator to it. */
19831983
PHP_FUNCTION(secp256k1_xonly_pubkey_tweak_add)
19841984
{
1985-
zval *zCtx, *zOutputPubKey, *zIsPositive, *zInternalPubKey;
1985+
zval *zCtx, *zOutputPubKey, *zHasSquareY, *zInternalPubKey;
19861986
secp256k1_context *ctx;
19871987
secp256k1_xonly_pubkey *output_pubkey, *internal_pubkey;
19881988
zend_string *zTweak;
1989-
int is_positive;
1989+
int has_square_y;
19901990
int result;
19911991

1992-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/z/rS", &zCtx, &zOutputPubKey, &zIsPositive, &zInternalPubKey, &zTweak) == FAILURE) {
1992+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/z/rS", &zCtx, &zOutputPubKey, &zHasSquareY, &zInternalPubKey, &zTweak) == FAILURE) {
19931993
RETURN_LONG(0);
19941994
}
19951995

@@ -2005,12 +2005,12 @@ PHP_FUNCTION(secp256k1_xonly_pubkey_tweak_add)
20052005
}
20062006

20072007
output_pubkey = emalloc(sizeof(secp256k1_xonly_pubkey));
2008-
result = secp256k1_xonly_pubkey_tweak_add(ctx, output_pubkey, &is_positive, internal_pubkey, (unsigned char *)zTweak->val);
2008+
result = secp256k1_xonly_pubkey_tweak_add(ctx, output_pubkey, &has_square_y, internal_pubkey, (unsigned char *)zTweak->val);
20092009
if (result) {
20102010
zval_dtor(zOutputPubKey);
20112011
ZVAL_RES(zOutputPubKey, zend_register_resource(output_pubkey, le_secp256k1_xonly_pubkey));
2012-
zval_dtor(zIsPositive);
2013-
ZVAL_LONG(zIsPositive, is_positive);
2012+
zval_dtor(zHasSquareY);
2013+
ZVAL_LONG(zHasSquareY, has_square_y);
20142014
} else {
20152015
efree(output_pubkey);
20162016
}
@@ -2026,11 +2026,11 @@ PHP_FUNCTION(secp256k1_xonly_pubkey_tweak_verify)
20262026
zval *zCtx, *zOutputPubKey, *zInternalPubKey;
20272027
secp256k1_context *ctx;
20282028
secp256k1_xonly_pubkey *output_pubkey, *internal_pubkey;
2029-
zend_long is_positive;
2029+
zend_long has_square_y;
20302030
zend_string *zTweak32;
20312031
int result;
20322032

2033-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlrS", &zCtx, &zOutputPubKey, &is_positive, &zInternalPubKey, &zTweak32) == FAILURE) {
2033+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlrS", &zCtx, &zOutputPubKey, &has_square_y, &zInternalPubKey, &zTweak32) == FAILURE) {
20342034
RETURN_LONG(0);
20352035
}
20362036

@@ -2047,7 +2047,7 @@ PHP_FUNCTION(secp256k1_xonly_pubkey_tweak_verify)
20472047
return;
20482048
}
20492049

2050-
result = secp256k1_xonly_pubkey_tweak_verify(ctx, output_pubkey, (int)is_positive, internal_pubkey, (unsigned char *)zTweak32->val);
2050+
result = secp256k1_xonly_pubkey_tweak_verify(ctx, output_pubkey, (int)has_square_y, internal_pubkey, (unsigned char *)zTweak32->val);
20512051

20522052
RETURN_LONG(result);
20532053
}

secp256k1/tests/secp256k1_xonly_pubkey_tweak_add_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey2, $privKey2);
2727
echo $result . PHP_EOL;
2828
echo get_resource_type($pubkey2) . PHP_EOL;
2929

30-
$isPositive = null;
31-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweakTwo);
30+
$hasSquareY = null;
31+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweakTwo);
3232
echo $result . PHP_EOL;
3333

3434
$result = secp256k1_xonly_pubkey_serialize($ctx, $pubKey1Out, $tweakedPub);

secp256k1/tests/secp256k1_xonly_pubkey_tweak_add_error2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ echo get_resource_type($pubkey1) . PHP_EOL;
2323
$badCtx = tmpfile();
2424

2525
set_error_handler(function($code, $str) { echo $str . PHP_EOL; });
26-
$isPositive = null;
27-
$result = secp256k1_xonly_pubkey_tweak_add($badCtx, $tweakedPub, $isPositive, $pubkey1, $tweakTwo);
26+
$hasSquareY = null;
27+
$result = secp256k1_xonly_pubkey_tweak_add($badCtx, $tweakedPub, $hasSquareY, $pubkey1, $tweakTwo);
2828
echo $result . PHP_EOL;
2929

3030
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_add_error3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ $privKey1 = str_repeat("\x42", 32);
1717

1818
$badKey = tmpfile();
1919
set_error_handler(function($code, $str) { echo $str . PHP_EOL; });
20-
$isPositive = null;
21-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $badKey, $tweakTwo);
20+
$hasSquareY = null;
21+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $badKey, $tweakTwo);
2222
echo $result . PHP_EOL;
2323

2424
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_add_error4.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ echo get_resource_type($pubkey1) . PHP_EOL;
2525

2626
$expecting = "secp256k1_xonly_pubkey_tweak_add(): Parameter 5 should be 32 bytes";
2727

28-
$isPositive = null;
28+
$hasSquareY = null;
2929
try {
30-
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweakEmpty);
30+
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweakEmpty);
3131
} catch (\Exception $e) {
3232
if ($e->getMessage() !== $expecting) {
3333
echo "ERROR\n";
@@ -36,7 +36,7 @@ try {
3636
}
3737

3838
try {
39-
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak31);
39+
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak31);
4040
} catch (\Exception $e) {
4141
if ($e->getMessage() !== $expecting) {
4242
echo "ERROR\n";
@@ -45,7 +45,7 @@ try {
4545
}
4646

4747
try {
48-
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak33);
48+
secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak33);
4949
} catch (\Exception $e) {
5050
if ($e->getMessage() !== $expecting) {
5151
echo "ERROR\n";

secp256k1/tests/secp256k1_xonly_pubkey_tweak_add_error5.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey1, $privKey1);
1919
echo $result . PHP_EOL;
2020
echo get_resource_type($pubkey1) . PHP_EOL;
2121

22-
$isPositive = null;
23-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweakOverflow);
22+
$hasSquareY = null;
23+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweakOverflow);
2424
echo $result . PHP_EOL;
2525

2626
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_verify.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey1, $privKey1);
2121
echo $result . PHP_EOL;
2222
echo get_resource_type($pubkey1) . PHP_EOL;
2323

24-
$isPositive = null;
25-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak);
24+
$hasSquareY = null;
25+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
2626
echo $result . PHP_EOL;
2727

28-
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $isPositive, $pubkey1, $tweakInvalid);
28+
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweakInvalid);
2929
echo $result.PHP_EOL;
3030

31-
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak);
31+
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
3232
echo $result.PHP_EOL;
3333

3434
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_verify_error2.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey1, $privKey1);
2020
echo $result . PHP_EOL;
2121
echo get_resource_type($pubkey1) . PHP_EOL;
2222

23-
$isPositive = null;
24-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak);
23+
$hasSquareY = null;
24+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
2525
echo $result . PHP_EOL;
2626

2727
set_error_handler(function($code, $str) { echo $str . PHP_EOL; });
2828

2929
$badCtx = tmpfile();
30-
$result = secp256k1_xonly_pubkey_tweak_verify($badCtx, $tweakedPub, $isPositive, $pubkey1, $tweak);
30+
$result = secp256k1_xonly_pubkey_tweak_verify($badCtx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
3131
echo $result.PHP_EOL;
3232

3333
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_verify_error3.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey1, $privKey1);
2020
echo $result . PHP_EOL;
2121
echo get_resource_type($pubkey1) . PHP_EOL;
2222

23-
$isPositive = null;
24-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak);
23+
$hasSquareY = null;
24+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
2525
echo $result . PHP_EOL;
2626

2727
set_error_handler(function($code, $str) { echo $str . PHP_EOL; });
2828
$badTweakedPub = tmpfile();
29-
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $badTweakedPub, $isPositive, $pubkey1, $tweak);
29+
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $badTweakedPub, $hasSquareY, $pubkey1, $tweak);
3030
echo $result.PHP_EOL;
3131

3232
?>

secp256k1/tests/secp256k1_xonly_pubkey_tweak_verify_error4.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ $result = secp256k1_xonly_pubkey_create($ctx, $pubkey1, $privKey1);
2020
echo $result . PHP_EOL;
2121
echo get_resource_type($pubkey1) . PHP_EOL;
2222

23-
$isPositive = null;
24-
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $isPositive, $pubkey1, $tweak);
23+
$hasSquareY = null;
24+
$result = secp256k1_xonly_pubkey_tweak_add($ctx, $tweakedPub, $hasSquareY, $pubkey1, $tweak);
2525
echo $result . PHP_EOL;
2626

2727
$badInternal = tmpfile();
2828
set_error_handler(function($code, $str) { echo $str . PHP_EOL; });
29-
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $isPositive, $badInternal, $tweak);
29+
$result = secp256k1_xonly_pubkey_tweak_verify($ctx, $tweakedPub, $hasSquareY, $badInternal, $tweak);
3030
echo $result.PHP_EOL;
3131

3232
?>

0 commit comments

Comments
 (0)