[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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.

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

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

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

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

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: ParagonIE_Sodium_Core_Curve25519_Fe

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

param: string $s
return: ParagonIE_Sodium_Core_Curve25519_Fe

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

param: ParagonIE_Sodium_Core_Curve25519_Fe $h
return: string

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

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: int

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

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: bool

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

h = f * g

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

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

h = -f

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: ParagonIE_Sodium_Core_Curve25519_Fe

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

h = f * f

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: ParagonIE_Sodium_Core_Curve25519_Fe

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

h = 2 * f * f

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: ParagonIE_Sodium_Core_Curve25519_Fe

fe_invert(ParagonIE_Sodium_Core_Curve25519_Fe $Z)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Fe $Z
return: ParagonIE_Sodium_Core_Curve25519_Fe

fe_pow22523(ParagonIE_Sodium_Core_Curve25519_Fe $z)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Fe $z
return: ParagonIE_Sodium_Core_Curve25519_Fe

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.

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

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

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

slide($a)   X-Ref

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

ge_frombytes_negate_vartime($s)   X-Ref

param: string $s
return: ParagonIE_Sodium_Core_Curve25519_Ge_P3

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

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

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

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

ge_p1p1_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_P2

ge_p1p1_to_p3(ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_P3

ge_p2_0()   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_P2

ge_p2_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P2 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1

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

param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_Cached

ge_p3_to_p2(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_P2

ge_p3_tobytes(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $h
return: string

ge_p3_dbl(ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p)   X-Ref

param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $p
return: ParagonIE_Sodium_Core_Curve25519_Ge_P1p1

ge_precomp_0()   X-Ref

return: ParagonIE_Sodium_Core_Curve25519_Ge_Precomp

equal($b, $c)   X-Ref

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

negative($char)   X-Ref

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

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

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

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

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

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

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

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

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

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

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

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

param: ParagonIE_Sodium_Core_Curve25519_Ge_P2 $h
return: string

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

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

ge_scalarmult($a, $p)   X-Ref

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

ge_scalarmult_base($a)   X-Ref

param: string $a
return: ParagonIE_Sodium_Core_Curve25519_Ge_P3

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

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

sc_reduce($s)   X-Ref

param: string $s
return: string

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

param: ParagonIE_Sodium_Core_Curve25519_Ge_P3 $A
return: ParagonIE_Sodium_Core_Curve25519_Ge_P3

sc25519_mul($a, $b)   X-Ref

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

sc25519_sq($s)   X-Ref

param: string $s
return: string

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

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

sc25519_invert($s)   X-Ref

param: string $s
return: string

clamp($s)   X-Ref

param: string $s
return: string

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.

param: ParagonIE_Sodium_Core_Curve25519_Fe $f
return: ParagonIE_Sodium_Core_Curve25519_Fe



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref