more :>
This commit is contained in:
parent
01062d70d1
commit
6438396a33
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#ifndef ED25519_donna
|
#ifndef ED25519_donna
|
||||||
# if defined(_MSC_VER)
|
# if defined(_MSC_VER)
|
||||||
# define ALIGN(x) __declspec(align(x))
|
# define ALIGN(x) __declspec(align(x))
|
||||||
|
10
main.c
10
main.c
@ -666,16 +666,16 @@ int main(int argc,char **argv)
|
|||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
deterministic
|
deterministic
|
||||||
? (wt == WT_BATCH
|
? (wt == WT_BATCH
|
||||||
? worker_batch_pass
|
? CRYPTO_NAMESPACE(worker_batch_pass)
|
||||||
: worker_fast_pass)
|
: CRYPTO_NAMESPACE(worker_fast_pass))
|
||||||
:
|
:
|
||||||
#endif
|
#endif
|
||||||
wt == WT_BATCH
|
wt == WT_BATCH
|
||||||
? worker_batch
|
? CRYPTO_NAMESPACE(worker_batch)
|
||||||
:
|
:
|
||||||
wt == WT_FAST
|
wt == WT_FAST
|
||||||
? worker_fast
|
? CRYPTO_NAMESPACE(worker_fast)
|
||||||
: worker_slow,
|
: CRYPTO_NAMESPACE(worker_slow),
|
||||||
tp
|
tp
|
||||||
);
|
);
|
||||||
if (tret) {
|
if (tret) {
|
||||||
|
63
worker.c
63
worker.c
@ -17,8 +17,6 @@
|
|||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "base32.h"
|
#include "base32.h"
|
||||||
#include "keccak.h"
|
#include "keccak.h"
|
||||||
#include "ed25519/ed25519.h"
|
|
||||||
#include "ed25519/ed25519_impl_pre.h"
|
|
||||||
#include "ioutil.h"
|
#include "ioutil.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "yaml.h"
|
#include "yaml.h"
|
||||||
@ -53,10 +51,6 @@ size_t numneedgenerate = 0;
|
|||||||
char *workdir = 0;
|
char *workdir = 0;
|
||||||
size_t workdirlen = 0;
|
size_t workdirlen = 0;
|
||||||
|
|
||||||
void worker_init(void)
|
|
||||||
{
|
|
||||||
ge_initeightpoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
// How many times we loop before a reseed
|
// How many times we loop before a reseed
|
||||||
@ -218,20 +212,57 @@ static void reseedright(u8 sk[SECRET_LEN])
|
|||||||
#define BATCHNUM 2048
|
#define BATCHNUM 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "ed25519/ed25519.h"
|
||||||
|
|
||||||
|
#include "worker_impl.inc.h"
|
||||||
|
|
||||||
size_t worker_batch_memuse(void)
|
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
|
||||||
|
|
||||||
|
#ifdef ED25519_donna
|
||||||
|
x = crypto_sign_ed25519_donna_worker_batch_memuse();
|
||||||
|
if (x > s)
|
||||||
|
s = x;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "worker_slow.inc.h"
|
void worker_init(void)
|
||||||
|
{
|
||||||
|
#ifdef ED25519_ref10
|
||||||
|
crypto_sign_ed25519_ref10_ge_initeightpoint();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "worker_fast.inc.h"
|
#ifdef ED25519_amd64_51_30k
|
||||||
|
crypto_sign_ed25519_amd64_51_30k_ge_initeightpoint();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "worker_fast_pass.inc.h"
|
#ifdef ED25519_amd64_64_24k
|
||||||
|
crypto_sign_ed25519_amd64_64_24k_ge_initeightpoint();
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "worker_batch.inc.h"
|
#ifdef ED25519_donna
|
||||||
|
crypto_sign_ed25519_donna_ge_initeightpoint();
|
||||||
#include "worker_batch_pass.inc.h"
|
#endif
|
||||||
|
}
|
||||||
// XXX this is useless here, but will end up somewhere like that when i'll modularize stuff
|
|
||||||
#include "ed25519/ed25519_impl_post.h"
|
|
||||||
|
10
worker.h
10
worker.h
@ -40,10 +40,10 @@ extern void worker_init(void);
|
|||||||
extern char *makesname(void);
|
extern char *makesname(void);
|
||||||
extern size_t worker_batch_memuse(void);
|
extern size_t worker_batch_memuse(void);
|
||||||
|
|
||||||
extern void *worker_slow(void *task);
|
extern void *CRYPTO_NAMESPACE(worker_slow)(void *task);
|
||||||
extern void *worker_fast(void *task);
|
extern void *CRYPTO_NAMESPACE(worker_fast)(void *task);
|
||||||
extern void *worker_batch(void *task);
|
extern void *CRYPTO_NAMESPACE(worker_batch)(void *task);
|
||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
extern void *worker_fast_pass(void *task);
|
extern void *CRYPTO_NAMESPACE(worker_fast_pass)(void *task);
|
||||||
extern void *worker_batch_pass(void *task);
|
extern void *CRYPTO_NAMESPACE(worker_batch_pass)(void *task);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
void *worker_batch(void *task)
|
void *CRYPTO_NAMESPACE(worker_batch)(void *task)
|
||||||
{
|
{
|
||||||
union pubonionunion pubonion;
|
union pubonionunion pubonion;
|
||||||
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
void *worker_batch_pass(void *task)
|
void *CRYPTO_NAMESPACE(worker_batch_pass)(void *task)
|
||||||
{
|
{
|
||||||
union pubonionunion pubonion;
|
union pubonionunion pubonion;
|
||||||
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
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;
|
union pubonionunion pubonion;
|
||||||
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#ifdef PASSPHRASE
|
#ifdef PASSPHRASE
|
||||||
void *worker_fast_pass(void *task)
|
void *CRYPTO_NAMESPACE(worker_fast_pass)(void *task)
|
||||||
{
|
{
|
||||||
union pubonionunion pubonion;
|
union pubonionunion pubonion;
|
||||||
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
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;
|
union pubonionunion pubonion;
|
||||||
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
u8 * const pk = &pubonion.raw[PKPREFIX_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user