fix ed25519-donna makedepends

This commit is contained in:
cathugger 2019-11-15 02:48:19 +00:00
parent c0ef36f200
commit 6f7e220b60
No known key found for this signature in database
GPG key ID: 9BADDA2DAF6F01A8
12 changed files with 67 additions and 28 deletions

View file

@ -410,12 +410,20 @@ test_ed25519.c.o: ed25519/amd64-64-24k/ge25519.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-portable.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-portable-identify.h
test_ed25519.c.o: ed25519/ed25519-donna/curve25519-donna-sse2.h
test_ed25519.c.o: ed25519/ed25519-donna/curve25519-donna-64bit.h
test_ed25519.c.o: ed25519/ed25519-donna/curve25519-donna-32bit.h
test_ed25519.c.o: ed25519/ed25519-donna/curve25519-donna-helpers.h
test_ed25519.c.o: ed25519/ed25519-donna/modm-donna-64bit.h
test_ed25519.c.o: ed25519/ed25519-donna/modm-donna-32bit.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-basepoint-table.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-tables.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-32bit-tables.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86-32bit.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-32bit-sse2.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-sse2.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-impl-sse2.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-impl-base.h
vec.c.o: vec.h
worker.c.o: types.h likely.h vec.h base32.h keccak.h ed25519/ed25519.h
@ -427,12 +435,20 @@ worker.c.o: ed25519/amd64-64-24k/ge25519.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-portable.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-portable-identify.h
worker.c.o: ed25519/ed25519-donna/curve25519-donna-sse2.h
worker.c.o: ed25519/ed25519-donna/curve25519-donna-64bit.h
worker.c.o: ed25519/ed25519-donna/curve25519-donna-32bit.h
worker.c.o: ed25519/ed25519-donna/curve25519-donna-helpers.h
worker.c.o: ed25519/ed25519-donna/modm-donna-64bit.h
worker.c.o: ed25519/ed25519-donna/modm-donna-32bit.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-basepoint-table.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-tables.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-32bit-tables.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86-32bit.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-32bit-sse2.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-sse2.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-impl-sse2.h
worker.c.o: ed25519/ed25519-donna/ed25519-donna-impl-base.h ioutil.h common.h
worker.c.o: yaml.h worker.h filters.h filters_worker.inc.h
worker.c.o: filters_common.inc.h worker_slow.inc.h worker_fast.inc.h

View file

@ -5,6 +5,8 @@
32 bit integer curve25519 implementation
*/
#if !defined(ED25519_SSE2) && !defined(ED25519_64BIT)
typedef uint32_t bignum25519[10];
typedef uint32_t bignum25519align16[12];
@ -577,3 +579,5 @@ curve25519_swap_conditional(bignum25519 a, bignum25519 b, uint32_t iswap) {
x8 = swap & (a[8] ^ b[8]); a[8] ^= x8; b[8] ^= x8;
x9 = swap & (a[9] ^ b[9]); a[9] ^= x9; b[9] ^= x9;
}
#endif /* !defined(ED25519_SSE2) && !defined(ED25519_64BIT) */

View file

@ -6,6 +6,8 @@
64bit integer curve25519 implementation
*/
#if !defined(ED25519_SSE2) && defined(ED25519_64BIT)
typedef uint64_t bignum25519[5];
static const uint64_t reduce_mask_40 = ((uint64_t)1 << 40) - 1;
@ -411,3 +413,4 @@ curve25519_swap_conditional(bignum25519 a, bignum25519 b, uint64_t iswap) {
#define ED25519_64BIT_TABLES
#endif /* !defined(ED25519_SSE2) && defined(ED25519_64BIT) */

View file

@ -5,6 +5,8 @@
SSE2 curve25519 implementation
*/
#if defined(ED25519_SSE2)
#include <emmintrin.h>
typedef __m128i xmmi;
@ -1110,3 +1112,4 @@ curve25519_move_conditional_bytes(uint8_t out[96], const uint8_t in[96], uint32_
_mm_store_si128((xmmi*)out + 5, a5);
}
#endif /* defined(ED25519_SSE2) */

View file

@ -1,3 +1,5 @@
#if !defined(ED25519_64BIT)
static const ge25519 ALIGN(16) ge25519_basepoint = {
{0x0325d51a,0x018b5823,0x00f6592a,0x0104a92d,0x01a4b31d,0x01d6dc5c,0x027118fe,0x007fd814,0x013cd6e5,0x0085a4db},
{0x02666658,0x01999999,0x00cccccc,0x01333333,0x01999999,0x00666666,0x03333333,0x00cccccc,0x02666666,0x01999999},
@ -59,3 +61,5 @@ static const ge25519_niels ALIGN(16) ge25519_niels_sliding_multiples[32] = {
{{0x01085cf2,0x01fd47af,0x03e3f5e1,0x004b3e99,0x01e3d46a,0x0060033c,0x015ff0a8,0x0150cdd8,0x029e8e21,0x008cf1bc},{0x00156cb1,0x003d623f,0x01a4f069,0x00d8d053,0x01b68aea,0x01ca5ab6,0x0316ae43,0x0134dc44,0x001c8d58,0x0084b343},{0x0318c781,0x0135441f,0x03a51a5e,0x019293f4,0x0048bb37,0x013d3341,0x0143151e,0x019c74e1,0x00911914,0x0076ddde}},
{{0x006bc26f,0x00d48e5f,0x00227bbe,0x00629ea8,0x01ea5f8b,0x0179a330,0x027a1d5f,0x01bf8f8e,0x02d26e2a,0x00c6b65e},{0x01701ab6,0x0051da77,0x01b4b667,0x00a0ce7c,0x038ae37b,0x012ac852,0x03a0b0fe,0x0097c2bb,0x00a017d2,0x01eb8b2a},{0x0120b962,0x0005fb42,0x0353b6fd,0x0061f8ce,0x007a1463,0x01560a64,0x00e0a792,0x01907c92,0x013a6622,0x007b47f1}}
};
#endif /* !defined(ED25519_64BIT) */

View file

@ -1,3 +1,5 @@
#if defined(ED25519_64BIT)
static const ge25519 ge25519_basepoint = {
{0x00062d608f25d51a,0x000412a4b4f6592a,0x00075b7171a4b31d,0x0001ff60527118fe,0x000216936d3cd6e5},
{0x0006666666666658,0x0004cccccccccccc,0x0001999999999999,0x0003333333333333,0x0006666666666666},
@ -51,3 +53,5 @@ static const ge25519_niels ge25519_niels_sliding_multiples[32] = {
{{0x0007f51ebd085cf2,0x00012cfa67e3f5e1,0x0001800cf1e3d46a,0x00054337615ff0a8,0x000233c6f29e8e21},{0x0000f588fc156cb1,0x000363414da4f069,0x0007296ad9b68aea,0x0004d3711316ae43,0x000212cd0c1c8d58},{0x0004d5107f18c781,0x00064a4fd3a51a5e,0x0004f4cd0448bb37,0x000671d38543151e,0x0001db7778911914}},
{{0x000352397c6bc26f,0x00018a7aa0227bbe,0x0005e68cc1ea5f8b,0x0006fe3e3a7a1d5f,0x00031ad97ad26e2a},{0x00014769dd701ab6,0x00028339f1b4b667,0x0004ab214b8ae37b,0x00025f0aefa0b0fe,0x0007ae2ca8a017d2},{0x000017ed0920b962,0x000187e33b53b6fd,0x00055829907a1463,0x000641f248e0a792,0x0001ed1fc53a6622}}
};
#endif /* defined(ED25519_64BIT) */

View file

@ -1,3 +1,5 @@
#if !defined(ED25519_SSE2)
/*
conversions
*/
@ -387,3 +389,4 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t basepoint_table[256][96]
}
}
#endif /* !defined(ED25519_SSE2) */

View file

@ -1,3 +1,5 @@
#if defined(ED25519_SSE2)
/*
conversions
*/
@ -412,3 +414,5 @@ ge25519_scalarmult_base_niels(ge25519 *r, const uint8_t table[256][96], const bi
ge25519_nielsadd2(r, &t);
}
}
#endif /* defined(ED25519_SSE2) */

View file

@ -41,22 +41,14 @@
#endif
#endif
#if defined(ED25519_SSE2)
#include "curve25519-donna-sse2.h"
#elif defined(ED25519_64BIT)
#include "curve25519-donna-64bit.h"
#else
#include "curve25519-donna-32bit.h"
#endif
#include "curve25519-donna-sse2.h"
#include "curve25519-donna-64bit.h"
#include "curve25519-donna-32bit.h"
#include "curve25519-donna-helpers.h"
/* separate uint128 check for 64 bit sse2 */
#if defined(HAVE_UINT128) && !defined(ED25519_FORCE_32BIT)
#include "modm-donna-64bit.h"
#else
#include "modm-donna-32bit.h"
#endif
#include "modm-donna-64bit.h"
#include "modm-donna-32bit.h"
typedef unsigned char hash_512bits[64];
@ -98,20 +90,15 @@ typedef unsigned char bytes32[32];
#include "ed25519-donna-basepoint-table.h"
#if defined(ED25519_64BIT)
#include "ed25519-donna-64bit-tables.h"
#include "ed25519-donna-64bit-x86.h"
#else
#include "ed25519-donna-32bit-tables.h"
#include "ed25519-donna-64bit-x86-32bit.h"
#endif
#include "ed25519-donna-64bit-tables.h"
#include "ed25519-donna-64bit-x86.h"
#include "ed25519-donna-32bit-tables.h"
#include "ed25519-donna-64bit-x86-32bit.h"
#if defined(ED25519_SSE2)
#include "ed25519-donna-32bit-sse2.h"
#include "ed25519-donna-64bit-sse2.h"
#include "ed25519-donna-impl-sse2.h"
#else
#include "ed25519-donna-impl-base.h"
#endif
#include "ed25519-donna-32bit-sse2.h"
#include "ed25519-donna-64bit-sse2.h"
#include "ed25519-donna-impl-sse2.h"
#include "ed25519-donna-impl-base.h"

View file

@ -2,6 +2,8 @@
Public domain by Andrew M. <liquidsun@gmail.com>
*/
/* separate uint128 check for 64 bit sse2 */
#if !defined(HAVE_UINT128) || defined(ED25519_FORCE_32BIT)
/*
Arithmetic modulo the group order n = 2^252 + 27742317777372353535851937790883648493 = 7237005577332262213973186563042994240857116359379907606001950938285454250989
@ -467,3 +469,5 @@ isatmost128bits256_modm_batch(const bignum256modm a) {
return (mask == 0);
}
#endif /* !defined(HAVE_UINT128) || defined(ED25519_FORCE_32BIT) */

View file

@ -2,6 +2,8 @@
Public domain by Andrew M. <liquidsun@gmail.com>
*/
/* separate uint128 check for 64 bit sse2 */
#if defined(HAVE_UINT128) && !defined(ED25519_FORCE_32BIT)
/*
Arithmetic modulo the group order n = 2^252 + 27742317777372353535851937790883648493 = 7237005577332262213973186563042994240857116359379907606001950938285454250989
@ -359,3 +361,5 @@ isatmost128bits256_modm_batch(const bignum256modm a) {
return (mask == 0);
}
#endif /* defined(HAVE_UINT128) && !defined(ED25519_FORCE_32BIT) */

View file

@ -11,6 +11,7 @@ void *worker_batch(void *task)
ge_p3 ge_public;
char *sname;
// state to keep batch data
ge_p3 ge_batch[BATCHNUM];
fe *(batchgez)[BATCHNUM];
fe tmp_batch[BATCHNUM];
@ -23,6 +24,7 @@ void *worker_batch(void *task)
struct statstruct *st = (struct statstruct *)task;
#endif
// set up right pointers
for (size_t b = 0;b < BATCHNUM;++b)
batchgez[b] = &GEZ(ge_batch[b]);
@ -53,12 +55,13 @@ initseed:
if (unlikely(endwork))
goto end;
for (size_t b = 0;b < BATCHNUM;++b) {
ge_batch[b] = ge_public;
ge_add(&sum,&ge_public,&ge_eightpoint);
ge_p1p1_to_p3(&ge_public,&sum);
}
// NOTE: leaves unfinished
// NOTE: leaves unfinished one bit at the very end
ge_p3_batchtobytes_destructive_1(pk_batch,ge_batch,batchgez,tmp_batch,BATCHNUM);
#ifdef STATISTICS