fix amd64 asm stuff calling on windows
This commit is contained in:
parent
fca1c18def
commit
4e20f086e3
10
ed25519/amd64-51-30k/compat.h
Normal file
10
ed25519/amd64-51-30k/compat.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
#define SYSVABI __attribute__((sysv_abi))
|
||||
#else
|
||||
#define SYSVABI
|
||||
#endif
|
||||
|
||||
#endif
|
@ -2,6 +2,7 @@
|
||||
#define FE25519_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "compat.h"
|
||||
|
||||
#define fe25519 CRYPTO_NAMESPACE(batch_fe25519)
|
||||
#define fe25519_freeze CRYPTO_NAMESPACE(batch_fe25519_freeze)
|
||||
@ -29,7 +30,7 @@ typedef struct
|
||||
}
|
||||
fe25519;
|
||||
|
||||
void fe25519_freeze(fe25519 *r);
|
||||
void fe25519_freeze(fe25519 *r) SYSVABI;
|
||||
|
||||
void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
|
||||
|
||||
@ -53,13 +54,13 @@ void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y) SYSVABI;
|
||||
|
||||
void fe25519_mul121666(fe25519 *r, const fe25519 *x);
|
||||
|
||||
void fe25519_square(fe25519 *r, const fe25519 *x);
|
||||
void fe25519_square(fe25519 *r, const fe25519 *x) SYSVABI;
|
||||
|
||||
void fe25519_nsquare(fe25519 *r, unsigned long long n);
|
||||
void fe25519_nsquare(fe25519 *r, unsigned long long n) SYSVABI;
|
||||
|
||||
void fe25519_invert(fe25519 *r, const fe25519 *x);
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "fe25519.h"
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define ge25519 CRYPTO_NAMESPACE(batch_ge25519)
|
||||
#define ge25519_base CRYPTO_NAMESPACE(batch_ge25519_base)
|
||||
@ -28,7 +29,6 @@
|
||||
#define ge25519_add_p1p1 CRYPTO_NAMESPACE(batch_ge25519_add_p1p1)
|
||||
#define ge25519_dbl_p1p1 CRYPTO_NAMESPACE(batch_ge25519_dbl_p1p1)
|
||||
#define choose_t CRYPTO_NAMESPACE(batch_choose_t)
|
||||
#define choose_t_smultq CRYPTO_NAMESPACE(batch_choose_t_smultq)
|
||||
#define ge25519_nielsadd2 CRYPTO_NAMESPACE(batch_ge25519_nielsadd2)
|
||||
#define ge25519_nielsadd_p1p1 CRYPTO_NAMESPACE(batch_ge25519_nielsadd_p1p1)
|
||||
#define ge25519_pnielsadd_p1p1 CRYPTO_NAMESPACE(batch_ge25519_pnielsadd_p1p1)
|
||||
@ -75,16 +75,15 @@ typedef struct
|
||||
|
||||
typedef unsigned char bytes32[32];
|
||||
|
||||
extern void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_p1p1_to_pniels(ge25519_pniels *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q);
|
||||
extern void ge25519_dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p);
|
||||
extern void choose_t(ge25519_niels *t, unsigned long long pos, signed long long b, const ge25519_niels *base_multiples);
|
||||
extern void choose_t_smultq(ge25519_pniels *t, signed long long b, const ge25519_pniels *pre);
|
||||
extern void ge25519_nielsadd2(ge25519_p3 *r, const ge25519_niels *q);
|
||||
extern void ge25519_nielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_niels *q);
|
||||
extern void ge25519_pnielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_pniels *q);
|
||||
extern void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p) SYSVABI;
|
||||
extern void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p) SYSVABI;
|
||||
extern void ge25519_p1p1_to_pniels(ge25519_pniels *r, const ge25519_p1p1 *p) SYSVABI;
|
||||
extern void ge25519_add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q) SYSVABI;
|
||||
extern void ge25519_dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p) SYSVABI;
|
||||
extern void choose_t(ge25519_niels *t, unsigned long long pos, signed long long b, const ge25519_niels *base_multiples) SYSVABI;
|
||||
extern void ge25519_nielsadd2(ge25519_p3 *r, const ge25519_niels *q) SYSVABI;
|
||||
extern void ge25519_nielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_niels *q) SYSVABI;
|
||||
extern void ge25519_pnielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_pniels *q) SYSVABI;
|
||||
|
||||
extern const ge25519 ge25519_base;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define INDEX_HEAP_H
|
||||
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define heap_init CRYPTO_NAMESPACE(batch_heap_init)
|
||||
#define heap_extend CRYPTO_NAMESPACE(batch_heap_extend)
|
||||
@ -23,9 +24,9 @@ void heap_push(unsigned long long *h, unsigned long long *hlen, unsigned long lo
|
||||
|
||||
void heap_get2max(unsigned long long *h, unsigned long long *max1, unsigned long long *max2, sc25519 *scalars);
|
||||
|
||||
void heap_rootreplaced(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_3limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_2limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_1limb(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_3limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_2limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_1limb(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef SC25519_H
|
||||
#define SC25519_H
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define sc25519 CRYPTO_NAMESPACE(batch_sc25519)
|
||||
#define shortsc25519 CRYPTO_NAMESPACE(batch_shortsc25519)
|
||||
#define sc25519_from32bytes CRYPTO_NAMESPACE(batch_sc25519_from32bytes)
|
||||
@ -43,11 +45,11 @@ void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
|
||||
|
||||
int sc25519_iszero_vartime(const sc25519 *x);
|
||||
|
||||
int sc25519_lt(const sc25519 *x, const sc25519 *y);
|
||||
int sc25519_lt(const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
|
||||
@ -64,6 +66,6 @@ void sc25519_slide(signed char r[256], const sc25519 *s, int swindowsize);
|
||||
|
||||
void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);
|
||||
|
||||
void sc25519_barrett(sc25519 *r, unsigned long long x[8]);
|
||||
void sc25519_barrett(sc25519 *r, unsigned long long x[8]) SYSVABI;
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define ull4_mul CRYPTO_NAMESPACE(batch_ull4_mul)
|
||||
|
||||
extern void ull4_mul(unsigned long long r[8], const unsigned long long x[4], const unsigned long long y[4]);
|
||||
extern void ull4_mul(unsigned long long r[8], const unsigned long long x[4], const unsigned long long y[4]) SYSVABI;
|
||||
|
||||
void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y)
|
||||
{
|
||||
|
10
ed25519/amd64-64-24k/compat.h
Normal file
10
ed25519/amd64-64-24k/compat.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
#define SYSVABI __attribute__((sysv_abi))
|
||||
#else
|
||||
#define SYSVABI
|
||||
#endif
|
||||
|
||||
#endif
|
@ -2,6 +2,7 @@
|
||||
#define FE25519_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "compat.h"
|
||||
|
||||
#define fe25519 CRYPTO_NAMESPACE(fe25519)
|
||||
#define fe25519_freeze CRYPTO_NAMESPACE(fe25519_freeze)
|
||||
@ -16,7 +17,6 @@
|
||||
#define fe25519_add CRYPTO_NAMESPACE(fe25519_add)
|
||||
#define fe25519_sub CRYPTO_NAMESPACE(fe25519_sub)
|
||||
#define fe25519_mul CRYPTO_NAMESPACE(fe25519_mul)
|
||||
#define fe25519_mul121666 CRYPTO_NAMESPACE(fe25519_mul121666)
|
||||
#define fe25519_square CRYPTO_NAMESPACE(fe25519_square)
|
||||
#define fe25519_invert CRYPTO_NAMESPACE(fe25519_invert)
|
||||
#define fe25519_batchinvert CRYPTO_NAMESPACE(fe25519_batchinvert)
|
||||
@ -28,7 +28,7 @@ typedef struct
|
||||
}
|
||||
fe25519;
|
||||
|
||||
void fe25519_freeze(fe25519 *r);
|
||||
void fe25519_freeze(fe25519 *r) SYSVABI;
|
||||
|
||||
void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
|
||||
|
||||
@ -48,15 +48,13 @@ int fe25519_iszero_vartime(const fe25519 *x);
|
||||
|
||||
int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y) SYSVABI;
|
||||
|
||||
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y) SYSVABI;
|
||||
|
||||
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y) SYSVABI;
|
||||
|
||||
void fe25519_mul121666(fe25519 *r, const fe25519 *x);
|
||||
|
||||
void fe25519_square(fe25519 *r, const fe25519 *x);
|
||||
void fe25519_square(fe25519 *r, const fe25519 *x) SYSVABI;
|
||||
|
||||
void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "fe25519.h"
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define ge25519 CRYPTO_NAMESPACE(ge25519)
|
||||
#define ge25519_base CRYPTO_NAMESPACE(ge25519_base)
|
||||
@ -66,14 +67,14 @@ typedef struct
|
||||
|
||||
typedef unsigned char bytes32[32];
|
||||
|
||||
extern void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q);
|
||||
extern void ge25519_dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p);
|
||||
extern void choose_t(ge25519_niels *t, unsigned long long pos, signed long long b, const ge25519_niels *base_multiples);
|
||||
extern void ge25519_nielsadd2(ge25519_p3 *r, const ge25519_niels *q);
|
||||
extern void ge25519_nielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_niels *q);
|
||||
extern void ge25519_pnielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_pniels *q);
|
||||
extern void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p) SYSVABI;
|
||||
extern void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p) SYSVABI;
|
||||
extern void ge25519_add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q) SYSVABI;
|
||||
extern void ge25519_dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p) SYSVABI;
|
||||
extern void choose_t(ge25519_niels *t, unsigned long long pos, signed long long b, const ge25519_niels *base_multiples) SYSVABI;
|
||||
extern void ge25519_nielsadd2(ge25519_p3 *r, const ge25519_niels *q) SYSVABI;
|
||||
extern void ge25519_nielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_niels *q) SYSVABI;
|
||||
extern void ge25519_pnielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_pniels *q) SYSVABI;
|
||||
|
||||
extern const ge25519 ge25519_base;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define INDEX_HEAP_H
|
||||
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define heap_init CRYPTO_NAMESPACE(heap_init)
|
||||
#define heap_extend CRYPTO_NAMESPACE(heap_extend)
|
||||
@ -23,9 +24,9 @@ void heap_push(unsigned long long *h, unsigned long long *hlen, unsigned long lo
|
||||
|
||||
void heap_get2max(unsigned long long *h, unsigned long long *max1, unsigned long long *max2, sc25519 *scalars);
|
||||
|
||||
void heap_rootreplaced(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_3limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_2limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced_1limb(unsigned long long *h, unsigned long long hlen, sc25519 *scalars);
|
||||
void heap_rootreplaced(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_3limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_2limbs(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
void heap_rootreplaced_1limb(unsigned long long *h, unsigned long long hlen, sc25519 *scalars) SYSVABI;
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef SC25519_H
|
||||
#define SC25519_H
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define sc25519 CRYPTO_NAMESPACE(sc25519)
|
||||
#define shortsc25519 CRYPTO_NAMESPACE(shortsc25519)
|
||||
#define sc25519_from32bytes CRYPTO_NAMESPACE(sc25519_from32bytes)
|
||||
@ -42,11 +44,11 @@ void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
|
||||
|
||||
int sc25519_iszero_vartime(const sc25519 *x);
|
||||
|
||||
int sc25519_lt(const sc25519 *x, const sc25519 *y);
|
||||
int sc25519_lt(const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y) SYSVABI;
|
||||
|
||||
void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
|
||||
|
||||
@ -61,6 +63,6 @@ void sc25519_slide(signed char r[256], const sc25519 *s, int swindowsize);
|
||||
|
||||
void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);
|
||||
|
||||
void sc25519_barrett(sc25519 *r, unsigned long long x[8]);
|
||||
void sc25519_barrett(sc25519 *r, unsigned long long x[8]) SYSVABI;
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "sc25519.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define ull4_mul CRYPTO_NAMESPACE(ull4_mul)
|
||||
|
||||
extern void ull4_mul(unsigned long long r[8], const unsigned long long x[4], const unsigned long long y[4]);
|
||||
extern void ull4_mul(unsigned long long r[8], const unsigned long long x[4], const unsigned long long y[4]) SYSVABI;
|
||||
|
||||
void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user