Merge github-cathugger:cathugger/mkp224o into checkpointing

This commit is contained in:
cathugger 2021-12-08 17:28:43 +00:00
commit f575bbe011
No known key found for this signature in database
GPG key ID: 9BADDA2DAF6F01A8
10 changed files with 40 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,5 +1,7 @@
# output files # output files
mkp224o mkp224o
calcest
test_*
*.o *.o
# generated onions # generated onions
@ -7,6 +9,7 @@ mkp224o
# garbage # garbage
configure configure
configure~
GNUmakefile GNUmakefile
GNUmakefile.in.bak GNUmakefile.in.bak
config.status config.status

View file

@ -57,6 +57,7 @@ TEST_ED25519_OBJ= \
ALL_O= $(sort \ ALL_O= $(sort \
$(MAIN_OBJ) \ $(MAIN_OBJ) \
$(UTIL_CALCEST_OBJ) \
$(TEST_BASE64_OBJ) \ $(TEST_BASE64_OBJ) \
$(TEST_BASE32_OBJ) \ $(TEST_BASE32_OBJ) \
$(TEST_BASE16_OBJ) \ $(TEST_BASE16_OBJ) \

View file

@ -15,19 +15,20 @@
*/ */
const double probs[] = { 0.5, 0.8, 0.9, 0.95, 0.99 }; const double probs[] = { 0.5, 0.8, 0.9, 0.95, 0.99 };
const int charcounts[] = { 2, 3, 4, 5, 6, 7 }; const int charcounts[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int main(void) int main(int argc,char **argv)
{ {
printf(" |"); printf(" |");
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) { for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
printf(" %11d%% |",(int)((probs[i]*100)+0.5)); printf(" %15d%% |",(int)((probs[i]*100)+0.5));
} }
printf("\n"); printf("\n");
printf("---+"); printf("---+");
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) { for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
printf("--------------+"); printf("------------------+");
} }
printf("\n"); printf("\n");
@ -35,7 +36,7 @@ int main(void)
printf("%2d |",charcounts[i]); printf("%2d |",charcounts[i]);
for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) { for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) {
double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i]))); double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i])));
printf(" %12.0f |",t); printf(" %16.0f |",t);
} }
printf("\n"); printf("\n");
} }

View file

@ -112,7 +112,7 @@ AC_ARG_ENABLE([donna-sse2],
) )
# default # default
AS_IF([test "x$ed25519impl" == "x"],[ed25519impl="donna"]) AS_IF([test "x$ed25519impl" = "x"],[ed25519impl="donna"])
if test "$ed25519impl" = "donna-sse2" if test "$ed25519impl" = "donna-sse2"
then then

View file

@ -98,9 +98,9 @@ static void onionready(char *sname,const u8 *secret,const u8 *pubonion)
// Sanity check that the public key matches the private one. // Sanity check that the public key matches the private one.
ge_p3 ALIGN(16) point; ge_p3 ALIGN(16) point;
u8 testpk[PUBLIC_LEN]; u8 testpk[PUBLIC_LEN];
ge_scalarmult_base(&point, secret); ge_scalarmult_base(&point,&secret[SKPREFIX_SIZE]);
ge_p3_tobytes(testpk, &point); ge_p3_tobytes(testpk,&point);
if (!memcmp(testpk, pubonion, PUBLIC_LEN)) if (memcmp(testpk,&pubonion[PKPREFIX_SIZE],PUBLIC_LEN) != 0)
abort(); abort();
#endif #endif

View file

@ -21,6 +21,8 @@ void *worker_batch(void *task)
#ifdef STATISTICS #ifdef STATISTICS
struct statstruct *st = (struct statstruct *)task; struct statstruct *st = (struct statstruct *)task;
#else
(void) task;
#endif #endif
PREFILTER PREFILTER
@ -36,6 +38,7 @@ void *worker_batch(void *task)
sname = makesname(); sname = makesname();
initseed: initseed:
#ifdef STATISTICS #ifdef STATISTICS
++st->numrestart.v; ++st->numrestart.v;
#endif #endif
@ -112,8 +115,11 @@ initseed:
end: end:
free(sname); free(sname);
POSTFILTER POSTFILTER
sodium_memzero(secret,sizeof(secret)); sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed)); sodium_memzero(seed,sizeof(seed));
return 0; return 0;
} }

View file

@ -22,6 +22,8 @@ void *worker_batch_pass(void *task)
#ifdef STATISTICS #ifdef STATISTICS
struct statstruct *st = (struct statstruct *)task; struct statstruct *st = (struct statstruct *)task;
#else
(void) task;
#endif #endif
PREFILTER PREFILTER
@ -37,6 +39,7 @@ void *worker_batch_pass(void *task)
sname = makesname(); sname = makesname();
initseed: initseed:
#ifdef STATISTICS #ifdef STATISTICS
++st->numrestart.v; ++st->numrestart.v;
#endif #endif
@ -133,7 +136,7 @@ initseed:
ge_p1p1_to_p3(&ge_public,&sum); ge_p1p1_to_p3(&ge_public,&sum);
} }
// NOTE: leaves unfinished one bit at the very end // NOTE: leaves unfinished one bit at the very end
ge_p3_batchtobytes_destructive_1(pk_batch,ge_batch,batchgez,tmp_batch,remaining); ge_p3_batchtobytes_destructive_1(pk_batch,ge_batch,tmp_batch,remaining);
#ifdef STATISTICS #ifdef STATISTICS
st->numcalc.v += remaining; st->numcalc.v += remaining;
@ -189,9 +192,12 @@ initseed:
end: end:
free(sname); free(sname);
POSTFILTER POSTFILTER
sodium_memzero(secret,sizeof(secret)); sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed)); sodium_memzero(seed,sizeof(seed));
return 0; return 0;
} }
#endif // PASSPHRASE #endif // PASSPHRASE

View file

@ -33,6 +33,7 @@ void *worker_fast(void *task)
sname = makesname(); sname = makesname();
initseed: initseed:
#ifdef STATISTICS #ifdef STATISTICS
++st->numrestart.v; ++st->numrestart.v;
#endif #endif
@ -96,8 +97,11 @@ initseed:
end: end:
free(sname); free(sname);
POSTFILTER POSTFILTER
sodium_memzero(secret,sizeof(secret)); sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed)); sodium_memzero(seed,sizeof(seed));
return 0; return 0;
} }

View file

@ -34,6 +34,7 @@ void *worker_fast_pass(void *task)
sname = makesname(); sname = makesname();
initseed: initseed:
#ifdef STATISTICS #ifdef STATISTICS
++st->numrestart.v; ++st->numrestart.v;
#endif #endif
@ -104,9 +105,12 @@ initseed:
end: end:
free(sname); free(sname);
POSTFILTER POSTFILTER
sodium_memzero(secret,sizeof(secret)); sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed)); sodium_memzero(seed,sizeof(seed));
return 0; return 0;
} }
#endif // PASSPHRASE #endif // PASSPHRASE

View file

@ -17,6 +17,7 @@ void *worker_slow(void *task)
#else #else
(void) task; (void) task;
#endif #endif
PREFILTER PREFILTER
memcpy(secret,skprefix,SKPREFIX_SIZE); memcpy(secret,skprefix,SKPREFIX_SIZE);
@ -32,6 +33,7 @@ void *worker_slow(void *task)
initseed: initseed:
randombytes(seed,sizeof(seed)); randombytes(seed,sizeof(seed));
ed25519_seckey_expand(sk,seed); ed25519_seckey_expand(sk,seed);
#ifdef STATISTICS #ifdef STATISTICS
++st->numrestart.v; ++st->numrestart.v;
#endif #endif
@ -82,8 +84,11 @@ next:
end: end:
free(sname); free(sname);
POSTFILTER POSTFILTER
sodium_memzero(secret,sizeof(secret)); sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed)); sodium_memzero(seed,sizeof(seed));
return 0; return 0;
} }