pull/72/head
cathugger 9 months ago
parent 01062d70d1
commit 6438396a33
No known key found for this signature in database
GPG Key ID: 9BADDA2DAF6F01A8

@ -1,3 +1,4 @@
#ifndef ED25519_donna
# if defined(_MSC_VER)
# define ALIGN(x) __declspec(align(x))

@ -666,16 +666,16 @@ int main(int argc,char **argv)
#ifdef PASSPHRASE
deterministic
? (wt == WT_BATCH
? worker_batch_pass
: worker_fast_pass)
? CRYPTO_NAMESPACE(worker_batch_pass)
: CRYPTO_NAMESPACE(worker_fast_pass))
:
#endif
wt == WT_BATCH
? worker_batch
? CRYPTO_NAMESPACE(worker_batch)
:
wt == WT_FAST
? worker_fast
: worker_slow,
? CRYPTO_NAMESPACE(worker_fast)
: CRYPTO_NAMESPACE(worker_slow),
tp
);
if (tret) {

@ -17,8 +17,6 @@
#include "vec.h"
#include "base32.h"
#include "keccak.h"
#include "ed25519/ed25519.h"
#include "ed25519/ed25519_impl_pre.h"
#include "ioutil.h"
#include "common.h"
#include "yaml.h"
@ -53,10 +51,6 @@ size_t numneedgenerate = 0;
char *workdir = 0;
size_t workdirlen = 0;
void worker_init(void)
{
ge_initeightpoint();
}
#ifdef PASSPHRASE
// How many times we loop before a reseed
@ -218,20 +212,57 @@ static void reseedright(u8 sk[SECRET_LEN])
#define BATCHNUM 2048
#endif
#include "ed25519/ed25519.h"
#include "worker_impl.inc.h"
size_t worker_batch_memuse(void)
{
return (sizeof(ge_p3) + sizeof(fe) + sizeof(bytes32)) * BATCHNUM;
}
size_t s = 0,x;
#ifdef ED25519_ref10
x = crypto_sign_ed25519_ref10_worker_batch_memuse();
if (x > s)
s = x;
#endif
#ifdef ED25519_amd64_51_30k
x = crypto_sign_ed25519_amd64_51_30k_worker_batch_memuse();
if (x > s)
s = x;
#endif
#ifdef ED25519_amd64_64_24k
x = crypto_sign_ed25519_amd64_64_24k_worker_batch_memuse();
if (x > s)
s = x;
#endif
#include "worker_slow.inc.h"
#ifdef ED25519_donna
x = crypto_sign_ed25519_donna_worker_batch_memuse();
if (x > s)
s = x;
#endif
#include "worker_fast.inc.h"
return s;
}
#include "worker_fast_pass.inc.h"
void worker_init(void)
{
#ifdef ED25519_ref10
crypto_sign_ed25519_ref10_ge_initeightpoint();
#endif
#include "worker_batch.inc.h"
#ifdef ED25519_amd64_51_30k
crypto_sign_ed25519_amd64_51_30k_ge_initeightpoint();
#endif
#include "worker_batch_pass.inc.h"
#ifdef ED25519_amd64_64_24k
crypto_sign_ed25519_amd64_64_24k_ge_initeightpoint();
#endif
// XXX this is useless here, but will end up somewhere like that when i'll modularize stuff
#include "ed25519/ed25519_impl_post.h"
#ifdef ED25519_donna
crypto_sign_ed25519_donna_ge_initeightpoint();
#endif
}

@ -40,10 +40,10 @@ extern void worker_init(void);
extern char *makesname(void);
extern size_t worker_batch_memuse(void);
extern void *worker_slow(void *task);
extern void *worker_fast(void *task);
extern void *worker_batch(void *task);
extern void *CRYPTO_NAMESPACE(worker_slow)(void *task);
extern void *CRYPTO_NAMESPACE(worker_fast)(void *task);
extern void *CRYPTO_NAMESPACE(worker_batch)(void *task);
#ifdef PASSPHRASE
extern void *worker_fast_pass(void *task);
extern void *worker_batch_pass(void *task);
extern void *CRYPTO_NAMESPACE(worker_fast_pass)(void *task);
extern void *CRYPTO_NAMESPACE(worker_batch_pass)(void *task);
#endif

@ -1,5 +1,5 @@
void *worker_batch(void *task)
void *CRYPTO_NAMESPACE(worker_batch)(void *task)
{
union pubonionunion pubonion;
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];

@ -1,6 +1,6 @@
#ifdef PASSPHRASE
void *worker_batch_pass(void *task)
void *CRYPTO_NAMESPACE(worker_batch_pass)(void *task)
{
union pubonionunion pubonion;
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];

@ -1,5 +1,5 @@
void *worker_fast(void *task)
void *CRYPTO_NAMESPACE(worker_fast)(void *task)
{
union pubonionunion pubonion;
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];

@ -1,6 +1,6 @@
#ifdef PASSPHRASE
void *worker_fast_pass(void *task)
void *CRYPTO_NAMESPACE(worker_fast_pass)(void *task)
{
union pubonionunion pubonion;
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];

@ -1 +1,15 @@
// TODO
#include "ed25519/ed25519_impl_pre.h"
static size_t CRYPTO_NAMESPACE(worker_batch_memuse)(void)
{
return (sizeof(ge_p3) + sizeof(fe) + sizeof(bytes32)) * BATCHNUM;
}
#include "worker_slow.inc.h"
#include "worker_fast.inc.h"
#include "worker_fast_pass.inc.h"
#include "worker_batch.inc.h"
#include "worker_batch_pass.inc.h"
#include "ed25519/ed25519_impl_post.h"

@ -1,5 +1,5 @@
void *worker_slow(void *task)
void *CRYPTO_NAMESPACE(worker_slow)(void *task)
{
union pubonionunion pubonion;
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];

Loading…
Cancel
Save