mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-12-05 21:27:13 -06:00
Merge github-cathugger:cathugger/mkp224o into checkpointing
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -57,6 +57,7 @@ TEST_ED25519_OBJ= \
|
||||
|
||||
ALL_O= $(sort \
|
||||
$(MAIN_OBJ) \
|
||||
$(UTIL_CALCEST_OBJ) \
|
||||
$(TEST_BASE64_OBJ) \
|
||||
$(TEST_BASE32_OBJ) \
|
||||
$(TEST_BASE16_OBJ) \
|
||||
|
||||
11
calcest.c
11
calcest.c
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
6
worker.c
6
worker.c
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user