[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/sodium_compat/src/Core/ -> Curve25519.php (summary)

Class ParagonIE_Sodium_Core_Curve25519 Implements Curve25519 core functions

File Size: 3836 lines (143 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 51 functions

  fe_0()
  fe_1()
  fe_add()
  fe_cmov()
  fe_copy()
  fe_frombytes()
  fe_tobytes()
  fe_isnegative()
  fe_isnonzero()
  fe_mul()
  fe_neg()
  fe_sq()
  fe_sq2()
  fe_invert()
  fe_pow22523()
  fe_sub()
  ge_add()
  slide()
  ge_frombytes_negate_vartime()
  ge_madd()
  ge_msub()
  ge_p1p1_to_p2()
  ge_p1p1_to_p3()
  ge_p2_0()
  ge_p2_dbl()
  ge_p3_0()
  ge_p3_to_cached()
  ge_p3_to_p2()
  ge_p3_tobytes()
  ge_p3_dbl()
  ge_precomp_0()
  equal()
  negative()
  cmov()
  ge_cmov_cached()
  ge_cmov8_cached()
  ge_select()
  ge_sub()
  ge_tobytes()
  ge_double_scalarmult_vartime()
  ge_scalarmult()
  ge_scalarmult_base()
  sc_muladd()
  sc_reduce()
  ge_mul_l()
  sc25519_mul()
  sc25519_sq()
  sc25519_sqmul()
  sc25519_invert()
  clamp()
  fe_normalize()

Functions
Functions that are not part of a class:

fe_0()   X-Ref
Get a field element of size 10 with a value of 0

return: ParagonIE_Sodium_Core_Curve25519_Fe

fe_1()   X-Ref
Get a field element of size 10 with a value of 1

return: ParagonIE_Sodium_Core_Curve25519_Fe

fe_add(ParagonIE_Sodium_Core_Curve25519_Fe $f,ParagonIE_Sodium_Core_Curve25519_Fe $g)   X-Ref
Add two field elements.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f
param: ParagonIE_Sodium_Core_Curve25519_Fe $g

fe_cmov(ParagonIE_Sodium_Core_Curve25519_Fe $f,ParagonIE_Sodium_Core_Curve25519_Fe $g,$b = 0)   X-Ref
Constant-time conditional move.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f
param: ParagonIE_Sodium_Core_Curve25519_Fe $g
param: int $b

fe_copy(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Create a copy of a field element.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_frombytes($s)   X-Ref
Give: 32-byte string.
Receive: A field element object to use for internal calculations.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: string $s

fe_tobytes(ParagonIE_Sodium_Core_Curve25519_Fe $h)   X-Ref
Convert a field element to a byte string.

return: string
param: ParagonIE_Sodium_Core_Curve25519_Fe $h

fe_isnegative(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Is a field element negative? (1 = yes, 0 = no. Used in calculations.)

return: int
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_isnonzero(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Returns 0 if this field element results in all NUL bytes.

return: bool
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_mul(ParagonIE_Sodium_Core_Curve25519_Fe $f,ParagonIE_Sodium_Core_Curve25519_Fe $g)   X-Ref
Multiply two field elements

h = f * g

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f
param: ParagonIE_Sodium_Core_Curve25519_Fe $g

fe_neg(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Get the negative values for each piece of the field element.

h = -f

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_sq(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Square a field element

h = f * f

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_sq2(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Square and double a field element

h = 2 * f * f

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f

fe_invert(ParagonIE_Sodium_Core_Curve25519_Fe $Z)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $Z

fe_pow22523(ParagonIE_Sodium_Core_Curve25519_Fe $z)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $z

fe_sub(ParagonIE_Sodium_Core_Curve25519_Fe $f, ParagonIE_Sodium_Core_Curve25519_Fe $g)   X-Ref
Subtract two field elements.

h = f - g

Preconditions:
|f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.

Postconditions:
|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f
param: ParagonIE_Sodium_Core_Curve25519_Fe $g

ge_add(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p,ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q)   X-Ref
Add two group elements.

r = p + q

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
param: ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q

slide($a)   X-Ref

return: array<int, mixed>
param: string $a

ge_frombytes_negate_vartime($s)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3
param: string $s

ge_madd(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $R,ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p,ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $q)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $R
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
param: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $q

ge_msub(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $R,ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p,ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $q)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $R
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
param: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $q

ge_p1p1_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P2
param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p

ge_p1p1_to_p3(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3
param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p

ge_p2_0()   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P2

ge_p2_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p

ge_p3_0()   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3

ge_p3_to_cached(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Cached
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p

ge_p3_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P2
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p

ge_p3_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h)   X-Ref

return: string
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h

ge_p3_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p

ge_precomp_0()   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp

equal($b, $c)   X-Ref

return: int
param: int $b
param: int $c

negative($char)   X-Ref

return: int (1 = yes, 0 = no)
param: int|string $char

cmov(ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $t,ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $u,$b)   X-Ref
Conditional move

return: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp
param: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $t
param: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp $u
param: int $b

ge_cmov_cached(ParagonIE_Sodium_Core_Curve25519_Ge_Cached $t,ParagonIE_Sodium_Core_Curve25519_Ge_Cached $u,$b)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Cached
param: ParagonIE_Sodium_Core_Curve25519_Ge_Cached $t
param: ParagonIE_Sodium_Core_Curve25519_Ge_Cached $u
param: int $b

ge_cmov8_cached(array $cached, $b)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Cached
param: ParagonIE_Sodium_Core_Curve25519_Ge_Cached[] $cached
param: int $b

ge_select($pos = 0, $b = 0)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp
param: int $pos
param: int $b

ge_sub(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p,ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q)   X-Ref
Subtract two group elements.

r = p - q

return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
param: ParagonIE_Sodium_Core_Curve25519_Ge_Cached $q

ge_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h)   X-Ref
Convert a group element to a byte string.

return: string
param: ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h

ge_double_scalarmult_vartime($a,ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A,$b)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P2
param: string $a
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A
param: string $b

ge_scalarmult($a, $p)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3
param: string $a
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p

ge_scalarmult_base($a)   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3
param: string $a

sc_muladd($a, $b, $c)   X-Ref
Calculates (ab + c) mod l
where l = 2^252 + 27742317777372353535851937790883648493

return: string
param: string $a
param: string $b
param: string $c

sc_reduce($s)   X-Ref

return: string
param: string $s

ge_mul_l(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A)   X-Ref
multiply by the order of the main subgroup l = 2^252+27742317777372353535851937790883648493

return: ParagonIE_Sodium_Core_Curve25519_Ge_P3
param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A

sc25519_mul($a, $b)   X-Ref

return: string
param: string $a
param: string $b

sc25519_sq($s)   X-Ref

return: string
param: string $s

sc25519_sqmul($s, $n, $a)   X-Ref

return: string
param: string $s
param: int $n
param: string $a

sc25519_invert($s)   X-Ref

return: string
param: string $s

clamp($s)   X-Ref

return: string
param: string $s

fe_normalize(ParagonIE_Sodium_Core_Curve25519_Fe $f)   X-Ref
Ensure limbs are less than 28 bits long to prevent float promotion.

This uses a constant-time conditional swap under the hood.

return: ParagonIE_Sodium_Core_Curve25519_Fe
param: ParagonIE_Sodium_Core_Curve25519_Fe $f



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1