mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
Static-ify what we currently don't need in crypto_core/curve25519_ref10
This commit is contained in:
parent
5c8b8ea01c
commit
c72ef48f01
@ -119,7 +119,7 @@ fe_add(fe h, const fe f, const fe g)
|
||||
Preconditions: b in {0,1}.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
fe_cmov(fe f, const fe g, unsigned int b)
|
||||
{
|
||||
int32_t f0 = f[0];
|
||||
@ -428,7 +428,7 @@ fe_tobytes(unsigned char *s, const fe h)
|
||||
|f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
fe_isnegative(const fe f)
|
||||
{
|
||||
unsigned char s[32];
|
||||
@ -759,7 +759,7 @@ fe_mul(fe h, const fe f, const fe g)
|
||||
|h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
fe_neg(fe h, const fe f)
|
||||
{
|
||||
int32_t f0 = f[0];
|
||||
@ -987,7 +987,7 @@ fe_sq(fe h, const fe f)
|
||||
See fe_mul.c for discussion of implementation strategy.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
fe_sq2(fe h, const fe f)
|
||||
{
|
||||
int32_t f0 = f[0];
|
||||
@ -1217,7 +1217,7 @@ fe_invert(fe out, const fe z)
|
||||
fe_mul(out, t1, t0);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
fe_pow22523(fe out, const fe z)
|
||||
{
|
||||
fe t0;
|
||||
@ -1457,7 +1457,7 @@ ge_frombytes_negate_vartime(ge_p3 *h, const unsigned char *s)
|
||||
r = p + q
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q)
|
||||
{
|
||||
fe t0;
|
||||
@ -1478,7 +1478,7 @@ ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q)
|
||||
r = p - q
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q)
|
||||
{
|
||||
fe t0;
|
||||
@ -1499,7 +1499,7 @@ ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q)
|
||||
r = p
|
||||
*/
|
||||
|
||||
extern void
|
||||
void
|
||||
ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p)
|
||||
{
|
||||
fe_mul(r->X, p->X, p->T);
|
||||
@ -1511,7 +1511,7 @@ ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p)
|
||||
r = p
|
||||
*/
|
||||
|
||||
extern void
|
||||
static void
|
||||
ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p)
|
||||
{
|
||||
fe_mul(r->X, p->X, p->T);
|
||||
@ -1520,7 +1520,7 @@ ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p)
|
||||
fe_mul(r->T, p->X, p->Y);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ge_p2_0(ge_p2 *h)
|
||||
{
|
||||
fe_0(h->X);
|
||||
@ -1532,7 +1532,7 @@ ge_p2_0(ge_p2 *h)
|
||||
r = 2 * p
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p)
|
||||
{
|
||||
fe t0;
|
||||
@ -1548,7 +1548,7 @@ ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p)
|
||||
fe_sub(r->T, r->T, r->Z);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ge_p3_0(ge_p3 *h)
|
||||
{
|
||||
fe_0(h->X);
|
||||
@ -1567,7 +1567,7 @@ ge_p3_0(ge_p3 *h)
|
||||
static const fe d2 = { -21827239, -5839606, -30745221, 13898782, 229458,
|
||||
15978800, -12551817, -6495438, 29715968, 9444199 };
|
||||
|
||||
extern void
|
||||
void
|
||||
ge_p3_to_cached(ge_cached *r, const ge_p3 *p)
|
||||
{
|
||||
fe_add(r->YplusX, p->Y, p->X);
|
||||
@ -1580,7 +1580,7 @@ ge_p3_to_cached(ge_cached *r, const ge_p3 *p)
|
||||
r = p
|
||||
*/
|
||||
|
||||
extern void
|
||||
static void
|
||||
ge_p3_to_p2(ge_p2 *r, const ge_p3 *p)
|
||||
{
|
||||
fe_copy(r->X, p->X);
|
||||
@ -1606,7 +1606,7 @@ ge_p3_tobytes(unsigned char *s, const ge_p3 *h)
|
||||
r = 2 * p
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
ge_p3_dbl(ge_p1p1 *r, const ge_p3 *p)
|
||||
{
|
||||
ge_p2 q;
|
||||
@ -1614,7 +1614,7 @@ ge_p3_dbl(ge_p1p1 *r, const ge_p3 *p)
|
||||
ge_p2_dbl(r, &q);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ge_precomp_0(ge_precomp *h)
|
||||
{
|
||||
fe_1(h->yplusx);
|
||||
@ -1686,7 +1686,7 @@ ge_select(ge_precomp *t, int pos, signed char b)
|
||||
r = p - q
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q)
|
||||
{
|
||||
fe t0;
|
||||
|
@ -19,36 +19,26 @@ typedef int32_t fe[10];
|
||||
#define fe_tobytes crypto_core_curve25519_ref10_fe_tobytes
|
||||
#define fe_copy crypto_core_curve25519_ref10_fe_copy
|
||||
#define fe_isnonzero crypto_core_curve25519_ref10_fe_isnonzero
|
||||
#define fe_isnegative crypto_core_curve25519_ref10_fe_isnegative
|
||||
#define fe_0 crypto_core_curve25519_ref10_fe_0
|
||||
#define fe_1 crypto_core_curve25519_ref10_fe_1
|
||||
#define fe_cmov crypto_core_curve25519_ref10_fe_cmov
|
||||
#define fe_add crypto_core_curve25519_ref10_fe_add
|
||||
#define fe_sub crypto_core_curve25519_ref10_fe_sub
|
||||
#define fe_neg crypto_core_curve25519_ref10_fe_neg
|
||||
#define fe_mul crypto_core_curve25519_ref10_fe_mul
|
||||
#define fe_sq crypto_core_curve25519_ref10_fe_sq
|
||||
#define fe_sq2 crypto_core_curve25519_ref10_fe_sq2
|
||||
#define fe_invert crypto_core_curve25519_ref10_fe_invert
|
||||
#define fe_pow22523 crypto_core_curve25519_ref10_fe_pow22523
|
||||
|
||||
extern void fe_frombytes(fe,const unsigned char *);
|
||||
extern void fe_tobytes(unsigned char *,const fe);
|
||||
|
||||
extern void fe_copy(fe,const fe);
|
||||
extern int fe_isnonzero(const fe);
|
||||
extern int fe_isnegative(const fe);
|
||||
extern void fe_0(fe);
|
||||
extern void fe_1(fe);
|
||||
extern void fe_cmov(fe,const fe,unsigned int);
|
||||
extern void fe_add(fe,const fe,const fe);
|
||||
extern void fe_sub(fe,const fe,const fe);
|
||||
extern void fe_neg(fe,const fe);
|
||||
extern void fe_mul(fe,const fe,const fe);
|
||||
extern void fe_sq(fe,const fe);
|
||||
extern void fe_sq2(fe,const fe);
|
||||
extern void fe_invert(fe,const fe);
|
||||
extern void fe_pow22523(fe,const fe);
|
||||
|
||||
/*
|
||||
ge means group element.
|
||||
@ -106,20 +96,10 @@ typedef struct {
|
||||
#define ge_tobytes crypto_core_curve25519_ref10_ge_tobytes
|
||||
#define ge_p3_tobytes crypto_core_curve25519_ref10_ge_p3_tobytes
|
||||
|
||||
#define ge_p2_0 crypto_core_curve25519_ref10_ge_p2_0
|
||||
#define ge_p3_0 crypto_core_curve25519_ref10_ge_p3_0
|
||||
#define ge_precomp_0 crypto_core_curve25519_ref10_ge_precomp_0
|
||||
#define ge_p3_to_p2 crypto_core_curve25519_ref10_ge_p3_to_p2
|
||||
#define ge_p3_to_cached crypto_core_curve25519_ref10_ge_p3_to_cached
|
||||
#define ge_p1p1_to_p2 crypto_core_curve25519_ref10_ge_p1p1_to_p2
|
||||
#define ge_p1p1_to_p3 crypto_core_curve25519_ref10_ge_p1p1_to_p3
|
||||
#define ge_p2_dbl crypto_core_curve25519_ref10_ge_p2_dbl
|
||||
#define ge_p3_dbl crypto_core_curve25519_ref10_ge_p3_dbl
|
||||
|
||||
#define ge_madd crypto_core_curve25519_ref10_ge_madd
|
||||
#define ge_msub crypto_core_curve25519_ref10_ge_msub
|
||||
#define ge_add crypto_core_curve25519_ref10_ge_add
|
||||
#define ge_sub crypto_core_curve25519_ref10_ge_sub
|
||||
#define ge_scalarmult_base crypto_core_curve25519_ref10_ge_scalarmult_base
|
||||
#define ge_double_scalarmult_vartime crypto_core_curve25519_ref10_ge_double_scalarmult_vartime
|
||||
#define ge_scalarmult_vartime crypto_core_curve25519_ref10_ge_scalarmult_vartime
|
||||
@ -129,20 +109,10 @@ extern void ge_tobytes(unsigned char *,const ge_p2 *);
|
||||
extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
|
||||
extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
|
||||
|
||||
extern void ge_p2_0(ge_p2 *);
|
||||
extern void ge_p3_0(ge_p3 *);
|
||||
extern void ge_precomp_0(ge_precomp *);
|
||||
extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
|
||||
extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
|
||||
extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
|
||||
extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
|
||||
extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
|
||||
extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
|
||||
|
||||
extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
|
||||
extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
|
||||
extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
|
||||
extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
|
||||
extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
|
||||
extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
|
||||
extern void ge_scalarmult_vartime(ge_p3 *,const unsigned char *,const ge_p3 *);
|
||||
|
Loading…
Reference in New Issue
Block a user