mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-12-05 21:27:13 -06:00
rebase on newer SUPERCOP, use PIE, some other stuff
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#define crypto_sign ed25519_ref10_sign
|
||||
#define crypto_sign_keypair ed25519_ref10_keygen
|
||||
#define crypto_sign_seckey ed25519_ref10_seckey
|
||||
#define crypto_sign_seckey_expand ed25519_ref10_seckey_expand
|
||||
#define crypto_sign_pubkey ed25519_ref10_pubkey
|
||||
#define crypto_sign_open ed25519_ref10_open
|
||||
#define crypto_sign CRYPTO_NAMESPACE(sign)
|
||||
#define crypto_sign_keypair CRYPTO_NAMESPACE(keygen)
|
||||
#define crypto_sign_seckey CRYPTO_NAMESPACE(seckey)
|
||||
#define crypto_sign_seckey_expand CRYPTO_NAMESPACE(seckey_expand)
|
||||
#define crypto_sign_pubkey CRYPTO_NAMESPACE(pubkey)
|
||||
#define crypto_sign_open CRYPTO_NAMESPACE(open)
|
||||
#define crypto_sign_open_batch CRYPTO_NAMESPACE(open_batch)
|
||||
|
||||
#include "ed25519.h"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
int ed25519_ref10_seckey(unsigned char *sk);
|
||||
int ed25519_ref10_seckey_expand(unsigned char *sk,const unsigned char *seed);
|
||||
int ed25519_ref10_pubkey(unsigned char *pk,const unsigned char *sk);
|
||||
int ed25519_ref10_keygen(unsigned char *pk,unsigned char *sk);
|
||||
int ed25519_ref10_sign(
|
||||
int crypto_sign_seckey(unsigned char *sk);
|
||||
int crypto_sign_seckey_expand(unsigned char *sk,const unsigned char *seed);
|
||||
int crypto_sign_pubkey(unsigned char *pk,const unsigned char *sk);
|
||||
int crypto_sign_keypair(unsigned char *pk,unsigned char *sk);
|
||||
int crypto_sign(
|
||||
unsigned char *sm,unsigned long long *smlen,
|
||||
const unsigned char *m,unsigned long long mlen,
|
||||
const unsigned char *sk
|
||||
);
|
||||
int ed25519_ref10_open(
|
||||
int crypto_sign_open(
|
||||
unsigned char *m,unsigned long long *mlen,
|
||||
const unsigned char *sm,unsigned long long smlen,
|
||||
const unsigned char *pk
|
||||
|
||||
@@ -14,25 +14,25 @@ t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
|
||||
Bounds on each t[i] vary depending on context.
|
||||
*/
|
||||
|
||||
#define fe_frombytes crypto_sign_ed25519_ref10_fe_frombytes
|
||||
#define fe_tobytes crypto_sign_ed25519_ref10_fe_tobytes
|
||||
#define fe_copy crypto_sign_ed25519_ref10_fe_copy
|
||||
#define fe_isnonzero crypto_sign_ed25519_ref10_fe_isnonzero
|
||||
#define fe_isnegative crypto_sign_ed25519_ref10_fe_isnegative
|
||||
#define fe_0 crypto_sign_ed25519_ref10_fe_0
|
||||
#define fe_1 crypto_sign_ed25519_ref10_fe_1
|
||||
#define fe_cswap crypto_sign_ed25519_ref10_fe_cswap
|
||||
#define fe_cmov crypto_sign_ed25519_ref10_fe_cmov
|
||||
#define fe_add crypto_sign_ed25519_ref10_fe_add
|
||||
#define fe_sub crypto_sign_ed25519_ref10_fe_sub
|
||||
#define fe_neg crypto_sign_ed25519_ref10_fe_neg
|
||||
#define fe_mul crypto_sign_ed25519_ref10_fe_mul
|
||||
#define fe_sq crypto_sign_ed25519_ref10_fe_sq
|
||||
#define fe_sq2 crypto_sign_ed25519_ref10_fe_sq2
|
||||
#define fe_mul121666 crypto_sign_ed25519_ref10_fe_mul121666
|
||||
#define fe_invert crypto_sign_ed25519_ref10_fe_invert
|
||||
#define fe_batchinvert crypto_sign_ed25519_ref10_fe_batchinvert
|
||||
#define fe_pow22523 crypto_sign_ed25519_ref10_fe_pow22523
|
||||
#define fe_frombytes CRYPTO_NAMESPACE(fe_frombytes)
|
||||
#define fe_tobytes CRYPTO_NAMESPACE(fe_tobytes)
|
||||
#define fe_copy CRYPTO_NAMESPACE(fe_copy)
|
||||
#define fe_isnonzero CRYPTO_NAMESPACE(fe_isnonzero)
|
||||
#define fe_isnegative CRYPTO_NAMESPACE(fe_isnegative)
|
||||
#define fe_0 CRYPTO_NAMESPACE(fe_0)
|
||||
#define fe_1 CRYPTO_NAMESPACE(fe_1)
|
||||
#define fe_cswap CRYPTO_NAMESPACE(fe_cswap)
|
||||
#define fe_cmov CRYPTO_NAMESPACE(fe_cmov)
|
||||
#define fe_add CRYPTO_NAMESPACE(fe_add)
|
||||
#define fe_sub CRYPTO_NAMESPACE(fe_sub)
|
||||
#define fe_neg CRYPTO_NAMESPACE(fe_neg)
|
||||
#define fe_mul CRYPTO_NAMESPACE(fe_mul)
|
||||
#define fe_sq CRYPTO_NAMESPACE(fe_sq)
|
||||
#define fe_sq2 CRYPTO_NAMESPACE(fe_sq2)
|
||||
#define fe_mul121666 CRYPTO_NAMESPACE(fe_mul121666)
|
||||
#define fe_invert CRYPTO_NAMESPACE(fe_invert)
|
||||
#define fe_batchinvert CRYPTO_NAMESPACE(fe_batchinvert)
|
||||
#define fe_pow22523 CRYPTO_NAMESPACE(fe_pow22523)
|
||||
|
||||
extern void fe_frombytes(fe,const unsigned char *);
|
||||
extern void fe_tobytes(unsigned char *,const fe);
|
||||
|
||||
@@ -9,7 +9,7 @@ Preconditions:
|
||||
|f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
|
||||
*/
|
||||
|
||||
static const unsigned char zero[32] = {0};
|
||||
static const unsigned char zero[32];
|
||||
|
||||
int fe_isnonzero(const fe f)
|
||||
{
|
||||
|
||||
@@ -52,28 +52,28 @@ typedef struct {
|
||||
|
||||
typedef unsigned char bytes32[32];
|
||||
|
||||
#define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
|
||||
#define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
|
||||
#define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes
|
||||
#define ge_p3_batchtobytes_destructive_1 crypto_sign_ed25519_ref10_ge_p3_batchtobytes_destructive_1
|
||||
#define ge_p3_batchtobytes_destructive_finish crypto_sign_ed25519_ref10_ge_p3_batchtobytes_destructive_finish
|
||||
#define ge_frombytes_negate_vartime CRYPTO_NAMESPACE(ge_frombytes_negate_vartime)
|
||||
#define ge_tobytes CRYPTO_NAMESPACE(ge_tobytes)
|
||||
#define ge_p3_tobytes CRYPTO_NAMESPACE(ge_p3_tobytes)
|
||||
#define ge_p3_batchtobytes_destructive_1 CRYPTO_NAMESPACE(ge_p3_batchtobytes_destructive_1)
|
||||
#define ge_p3_batchtobytes_destructive_finish CRYPTO_NAMESPACE(ge_p3_batchtobytes_destructive_finish)
|
||||
|
||||
#define ge_p2_0 crypto_sign_ed25519_ref10_ge_p2_0
|
||||
#define ge_p3_0 crypto_sign_ed25519_ref10_ge_p3_0
|
||||
#define ge_precomp_0 crypto_sign_ed25519_ref10_ge_precomp_0
|
||||
#define ge_p3_to_p2 crypto_sign_ed25519_ref10_ge_p3_to_p2
|
||||
#define ge_p3_to_cached crypto_sign_ed25519_ref10_ge_p3_to_cached
|
||||
#define ge_p1p1_to_p2 crypto_sign_ed25519_ref10_ge_p1p1_to_p2
|
||||
#define ge_p1p1_to_p3 crypto_sign_ed25519_ref10_ge_p1p1_to_p3
|
||||
#define ge_p2_dbl crypto_sign_ed25519_ref10_ge_p2_dbl
|
||||
#define ge_p3_dbl crypto_sign_ed25519_ref10_ge_p3_dbl
|
||||
#define ge_p2_0 CRYPTO_NAMESPACE(ge_p2_0)
|
||||
#define ge_p3_0 CRYPTO_NAMESPACE(ge_p3_0)
|
||||
#define ge_precomp_0 CRYPTO_NAMESPACE(ge_precomp_0)
|
||||
#define ge_p3_to_p2 CRYPTO_NAMESPACE(ge_p3_to_p2)
|
||||
#define ge_p3_to_cached CRYPTO_NAMESPACE(ge_p3_to_cached)
|
||||
#define ge_p1p1_to_p2 CRYPTO_NAMESPACE(ge_p1p1_to_p2)
|
||||
#define ge_p1p1_to_p3 CRYPTO_NAMESPACE(ge_p1p1_to_p3)
|
||||
#define ge_p2_dbl CRYPTO_NAMESPACE(ge_p2_dbl)
|
||||
#define ge_p3_dbl CRYPTO_NAMESPACE(ge_p3_dbl)
|
||||
|
||||
#define ge_madd crypto_sign_ed25519_ref10_ge_madd
|
||||
#define ge_msub crypto_sign_ed25519_ref10_ge_msub
|
||||
#define ge_add crypto_sign_ed25519_ref10_ge_add
|
||||
#define ge_sub crypto_sign_ed25519_ref10_ge_sub
|
||||
#define ge_scalarmult_base crypto_sign_ed25519_ref10_ge_scalarmult_base
|
||||
#define ge_double_scalarmult_vartime crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
|
||||
#define ge_madd CRYPTO_NAMESPACE(ge_madd)
|
||||
#define ge_msub CRYPTO_NAMESPACE(ge_msub)
|
||||
#define ge_add CRYPTO_NAMESPACE(ge_add)
|
||||
#define ge_sub CRYPTO_NAMESPACE(ge_sub)
|
||||
#define ge_scalarmult_base CRYPTO_NAMESPACE(ge_scalarmult_base)
|
||||
#define ge_double_scalarmult_vartime CRYPTO_NAMESPACE(ge_double_scalarmult_vartime)
|
||||
|
||||
extern void ge_tobytes(unsigned char *,const ge_p2 *);
|
||||
extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
|
||||
|
||||
@@ -32,7 +32,7 @@ static void slide(signed char *r,const unsigned char *a)
|
||||
|
||||
}
|
||||
|
||||
static ge_precomp Bi[8] = {
|
||||
static const ge_precomp Bi[8] = {
|
||||
#include "base2.h"
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ge.h"
|
||||
|
||||
void ge_p3_tobytes(bytes32 s,const ge_p3 *h)
|
||||
void ge_p3_tobytes(unsigned char *s,const ge_p3 *h)
|
||||
{
|
||||
fe recip;
|
||||
fe x;
|
||||
|
||||
@@ -19,7 +19,7 @@ static unsigned char negative(signed char b)
|
||||
return x;
|
||||
}
|
||||
|
||||
static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
|
||||
static void cmov(ge_precomp *t,const ge_precomp *u,unsigned char b)
|
||||
{
|
||||
fe_cmov(t->yplusx,u->yplusx,b);
|
||||
fe_cmov(t->yminusx,u->yminusx,b);
|
||||
@@ -27,7 +27,7 @@ static void cmov(ge_precomp *t,ge_precomp *u,unsigned char b)
|
||||
}
|
||||
|
||||
/* base[i][j] = (j+1)*256^i*B */
|
||||
static ge_precomp base[32][8] = {
|
||||
static const ge_precomp base[32][8] = {
|
||||
#include "base.h"
|
||||
} ;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ The set of scalars is \Z/l
|
||||
where l = 2^252 + 27742317777372353535851937790883648493.
|
||||
*/
|
||||
|
||||
#define sc_reduce crypto_sign_ed25519_ref10_sc_reduce
|
||||
#define sc_muladd crypto_sign_ed25519_ref10_sc_muladd
|
||||
#define sc_reduce CRYPTO_NAMESPACE(sc_reduce)
|
||||
#define sc_muladd CRYPTO_NAMESPACE(sc_muladd)
|
||||
|
||||
extern void sc_reduce(unsigned char *);
|
||||
extern void sc_muladd(unsigned char *,const unsigned char *,const unsigned char *,const unsigned char *);
|
||||
|
||||
Reference in New Issue
Block a user