File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 75
75
run : vendor/bin/phpunit
76
76
--coverage-clover coverage.xml
77
77
--coverage-text
78
- --printer mheap\\GithubActionsReporter\\Printer
79
78
80
79
- name : Submit code coverage
81
80
if : ${{ always() }}
Original file line number Diff line number Diff line change 12
12
use Sop \ASN1 \Type as ASN ;
13
13
use UnexpectedValueException ;
14
14
15
- use function gmp_pow ;
16
- use function gmp_add ;
17
15
use function gmp_cmp ;
18
16
use function gmp_import ;
19
- use function gmp_mod ;
20
- use function gmp_mul ;
21
17
22
18
/**
23
19
* @internal
@@ -156,13 +152,15 @@ private function isOnCurve(): bool
156
152
157
153
// This is only tested with P256 (secp256r1) but SHOULD be the same for
158
154
// the other curves (none of which are supported yet)/
159
- $ x3 = gmp_pow ( $ x , 3 );
160
- $ ax = gmp_mul ( $ a , $ x );
161
- $ rhs = gmp_mod ( gmp_add ( $ x3, gmp_add ( $ ax, $ b )), $ p );
155
+ $ x3 = $ x ** 3 ; // @phpstan-ignore binaryOp.invalid (phpstan/phpstan#12123)
156
+ $ ax = $ a * $ x ; // @phpstan-ignore binaryOp.invalid
157
+ $ rhs = ( $ x3 + $ ax + $ b ) % $ p ; // @phpstan-ignore binaryOp.invalid
162
158
163
- $ y2 = gmp_pow ( $ y , 2 );
164
- $ lhs = gmp_mod ( $ y2, $ p ) ;
159
+ $ y2 = $ y ** 2 ; // @phpstan-ignore binaryOp.invalid
160
+ $ lhs = $ y2 % $ p ;
165
161
166
- return 0 === gmp_cmp ($ lhs , $ rhs ); // Values match
162
+ // Functionaly, `$lhs === $rhs` but avoids reference equality issues
163
+ // w/out having to introduce loose comparision ($lhs == $rhs works)
164
+ return 0 === gmp_cmp ($ lhs , $ rhs );
167
165
}
168
166
}
You can’t perform that action at this time.
0 commit comments