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
mkp224o
calcest
test_*
*.o
# generated onions
@ -7,6 +9,7 @@ mkp224o
# garbage
configure
configure~
GNUmakefile
GNUmakefile.in.bak
config.status

View file

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

View file

@ -15,19 +15,20 @@
*/
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(" |");
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("---+");
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
printf("--------------+");
printf("------------------+");
}
printf("\n");
@ -35,7 +36,7 @@ int main(void)
printf("%2d |",charcounts[i]);
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])));
printf(" %12.0f |",t);
printf(" %16.0f |",t);
}
printf("\n");
}

View file

@ -112,7 +112,7 @@ AC_ARG_ENABLE([donna-sse2],
)
# default
AS_IF([test "x$ed25519impl" == "x"],[ed25519impl="donna"])
AS_IF([test "x$ed25519impl" = "x"],[ed25519impl="donna"])
if test "$ed25519impl" = "donna-sse2"
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.
ge_p3 ALIGN(16) point;
u8 testpk[PUBLIC_LEN];
ge_scalarmult_base(&point, secret);
ge_p3_tobytes(testpk, &point);
if (!memcmp(testpk, pubonion, PUBLIC_LEN))
ge_scalarmult_base(&point,&secret[SKPREFIX_SIZE]);
ge_p3_tobytes(testpk,&point);
if (memcmp(testpk,&pubonion[PKPREFIX_SIZE],PUBLIC_LEN) != 0)
abort();
#endif

View file

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

View file

@ -22,6 +22,8 @@ void *worker_batch_pass(void *task)
#ifdef STATISTICS
struct statstruct *st = (struct statstruct *)task;
#else
(void) task;
#endif
PREFILTER
@ -37,6 +39,7 @@ void *worker_batch_pass(void *task)
sname = makesname();
initseed:
#ifdef STATISTICS
++st->numrestart.v;
#endif
@ -133,7 +136,7 @@ initseed:
ge_p1p1_to_p3(&ge_public,&sum);
}
// 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
st->numcalc.v += remaining;
@ -189,9 +192,12 @@ initseed:
end:
free(sname);
POSTFILTER
sodium_memzero(secret,sizeof(secret));
sodium_memzero(seed,sizeof(seed));
return 0;
}
#endif // PASSPHRASE

View file

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

View file

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

View file

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