mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-09 11:07:19 -03:00
various things
disable paranoid check which was never triggered as far as I'm aware add editorconfig some whitespace changes in configure.ac which to batch mode by default start working on putting all filtering options in one bin some other tweaks
This commit is contained in:
parent
9eb4b328f0
commit
30491bd9f8
7 changed files with 79 additions and 39 deletions
15
.editorconfig
Normal file
15
.editorconfig
Normal file
|
@ -0,0 +1,15 @@
|
|||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{c,h}]
|
||||
indent_style = tab
|
||||
|
||||
[{GNUmakefile.in,configure.ac}]
|
||||
indent_style = tab
|
||||
|
||||
[ed25519/{ref10,amd64-51-30k,amd64-64-24k}/*.{c,h,py}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -122,6 +122,7 @@ distclean: clean
|
|||
$(RM) GNUmakefile
|
||||
|
||||
depend:
|
||||
# makedepend from imake
|
||||
cd "@SRCDIR@" && makedepend -Y -fGNUmakefile.in -o.c.o -- $(CSTD) $(ED25519_DEFS) -- $(ALL_C)
|
||||
|
||||
VPATH=@SRCDIR@
|
||||
|
@ -397,7 +398,8 @@ ed25519/ref10/sign.c.o: ed25519/ref10/crypto_int32.h ed25519/ref10/sc.h
|
|||
ioutil.c.o: types.h ioutil.h
|
||||
keccak.c.o: types.h keccak.h
|
||||
main.c.o: types.h vec.h base32.h cpucount.h keccak.h ioutil.h common.h yaml.h
|
||||
main.c.o: filters.h worker.h filters_main.inc.h filters_common.inc.h
|
||||
main.c.o: filters.h worker.h filters_inc.inc.h filters_main.inc.h
|
||||
main.c.o: filters_common.inc.h
|
||||
test_base16.c.o: types.h base16.h
|
||||
test_base32.c.o: types.h base32.h
|
||||
test_base64.c.o: types.h base64.h
|
||||
|
@ -452,7 +454,7 @@ 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: yaml.h worker.h filters.h filters_inc.inc.h filters_worker.inc.h
|
||||
worker.c.o: filters_common.inc.h worker_slow.inc.h worker_fast.inc.h
|
||||
worker.c.o: worker_fast_pass.inc.h worker_batch.inc.h worker_batch_pass.inc.h
|
||||
yaml.c.o: types.h yaml.h ioutil.h base32.h base64.h common.h
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef INTFILTER
|
||||
|
||||
static inline size_t filter_len(size_t i)
|
||||
static inline size_t S(filter_len)(size_t i)
|
||||
{
|
||||
# ifndef OMITMASK
|
||||
const u8 *m = (const u8 *)&VEC_BUF(filters,i).m;
|
||||
|
@ -23,12 +23,13 @@ static inline size_t filter_len(size_t i)
|
|||
}
|
||||
return c;
|
||||
}
|
||||
#define filter_len S(filter_len)
|
||||
|
||||
#endif // INTFILTER
|
||||
|
||||
#ifdef BINFILTER
|
||||
|
||||
static inline size_t filter_len(size_t i)
|
||||
static inline size_t S(filter_len)(size_t i)
|
||||
{
|
||||
size_t c = VEC_BUF(filters,i).len * 8;
|
||||
u8 v = VEC_BUF(filters,i).mask;
|
||||
|
@ -41,6 +42,7 @@ static inline size_t filter_len(size_t i)
|
|||
v <<= 1;
|
||||
}
|
||||
}
|
||||
#define filter_len S(filter_len)
|
||||
|
||||
#endif // BINFILTER
|
||||
|
||||
|
|
1
filters_inc.inc.h
Normal file
1
filters_inc.inc.h
Normal file
|
@ -0,0 +1 @@
|
|||
#define S(x) x
|
42
main.c
42
main.c
|
@ -100,9 +100,9 @@ static void printhelp(FILE *out,const char *progname)
|
|||
"\t-j numthreads - same as -t\n"
|
||||
"\t-n numkeys - specify number of keys (default - 0 - unlimited)\n"
|
||||
"\t-N numwords - specify number of words per key (default - 1)\n"
|
||||
"\t-z - use faster key generation method; this is now default\n"
|
||||
"\t-Z - use slower key generation method\n"
|
||||
"\t-B - use batching key generation method (>10x faster than -z, experimental)\n"
|
||||
"\t-Z - use \"slower\" key generation method (initial default)\n"
|
||||
"\t-z - use \"faster\" key generation method (later default)\n"
|
||||
"\t-B - use batching key generation method (>10x faster than -z, current default)\n"
|
||||
"\t-s - print statistics each 10 seconds\n"
|
||||
"\t-S t - print statistics every specified ammount of seconds\n"
|
||||
"\t-T - do not reset statistics counters when printing\n"
|
||||
|
@ -177,8 +177,15 @@ static void setpassphrase(const char *pass)
|
|||
|
||||
VEC_STRUCT(threadvec, pthread_t);
|
||||
|
||||
#include "filters_inc.inc.h"
|
||||
#include "filters_main.inc.h"
|
||||
|
||||
enum worker_type {
|
||||
WT_SLOW,
|
||||
WT_FAST,
|
||||
WT_BATCH,
|
||||
};
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *outfile = 0;
|
||||
|
@ -188,8 +195,7 @@ int main(int argc,char **argv)
|
|||
int ignoreargs = 0;
|
||||
int dirnameflag = 0;
|
||||
int numthreads = 0;
|
||||
int fastkeygen = 1;
|
||||
int batchkeygen = 0;
|
||||
enum worker_type wt = WT_BATCH;
|
||||
int yamlinput = 0;
|
||||
#ifdef PASSPHRASE
|
||||
int deterministic = 0;
|
||||
|
@ -319,11 +325,11 @@ int main(int argc,char **argv)
|
|||
e_additional();
|
||||
}
|
||||
else if (*arg == 'Z')
|
||||
fastkeygen = 0;
|
||||
wt = WT_SLOW;
|
||||
else if (*arg == 'z')
|
||||
fastkeygen = 1;
|
||||
wt = WT_FAST;
|
||||
else if (*arg == 'B')
|
||||
batchkeygen = 1;
|
||||
wt = WT_BATCH;
|
||||
else if (*arg == 's') {
|
||||
#ifdef STATISTICS
|
||||
reportdelay = 10000000;
|
||||
|
@ -531,13 +537,23 @@ int main(int argc,char **argv)
|
|||
#ifdef STATISTICS
|
||||
tp = &VEC_BUF(stats,i);
|
||||
#endif
|
||||
tret = pthread_create(&VEC_BUF(threads,i),0,
|
||||
tret = pthread_create(
|
||||
&VEC_BUF(threads,i),0,
|
||||
#ifdef PASSPHRASE
|
||||
deterministic ? (
|
||||
batchkeygen ? worker_batch_pass : worker_fast_pass) :
|
||||
deterministic
|
||||
? (wt == WT_BATCH
|
||||
? worker_batch_pass
|
||||
: worker_fast_pass)
|
||||
:
|
||||
#endif
|
||||
batchkeygen ? worker_batch :
|
||||
(fastkeygen ? worker_fast : worker_slow),tp);
|
||||
wt == WT_BATCH
|
||||
? worker_batch
|
||||
:
|
||||
wt == WT_FAST
|
||||
? worker_fast
|
||||
: worker_slow,
|
||||
tp
|
||||
);
|
||||
if (tret) {
|
||||
fprintf(stderr,"error while making " FSZ "th thread: %s\n",i,strerror(tret));
|
||||
exit(1);
|
||||
|
|
4
worker.c
4
worker.c
|
@ -93,6 +93,8 @@ static void onionready(char *sname,const u8 *secret,const u8 *pubonion)
|
|||
pthread_mutex_unlock(&keysgenerated_mutex);
|
||||
}
|
||||
|
||||
// disabled as this was never ever triggered as far as I'm aware
|
||||
#if 0
|
||||
// Sanity check that the public key matches the private one.
|
||||
ge_p3 point;
|
||||
u8 testpk[PUBLIC_LEN];
|
||||
|
@ -100,6 +102,7 @@ static void onionready(char *sname,const u8 *secret,const u8 *pubonion)
|
|||
ge_p3_tobytes(testpk, &point);
|
||||
if (!memcmp(testpk, pubonion, PUBLIC_LEN))
|
||||
abort();
|
||||
#endif
|
||||
|
||||
if (!yamloutput) {
|
||||
if (createdir(sname,1) != 0) {
|
||||
|
@ -133,6 +136,7 @@ static void onionready(char *sname,const u8 *secret,const u8 *pubonion)
|
|||
yamlout_writekeys(&sname[direndpos],pubonion,secret,yamlraw);
|
||||
}
|
||||
|
||||
#include "filters_inc.inc.h"
|
||||
#include "filters_worker.inc.h"
|
||||
|
||||
#ifdef STATISTICS
|
||||
|
|
Loading…
Reference in a new issue