more autism

This commit is contained in:
cathugger 2017-10-22 00:40:23 +00:00
parent 3bae9caa97
commit f649eedb70
4 changed files with 70 additions and 28 deletions

View file

@ -1,6 +1,6 @@
CC= @CC@ CC= @CC@
CSTD= @CSTD@ -Wall CSTD= @CSTD@
CFLAGS= $(CSTD) @CFLAGS@ @CPPFLAGS@ -DED25519_@ED25519IMPL@ @MYDEFS@ CFLAGS= $(CSTD) @CFLAGS@ @CPPFLAGS@ -DED25519_@ED25519IMPL@ @MYDEFS@
ASFLAGS= ASFLAGS=
LDFLAGS= @NOPIE@ @LDFLAGS@ LDFLAGS= @NOPIE@ @LDFLAGS@
@ -84,6 +84,13 @@ clean:
$(RM) $(CLEANO) $(RM) $(CLEANO)
$(RM) $(EXE) $(RM) $(EXE)
distclean:
$(RM) $(CLEANO)
$(RM) $(EXE)
$(RM) -r autom4te.cache
$(RM) configure config.status config.log
$(RM) Makefile
depend: depend:
makedepend -Y -fMakefile.in -o.c.o -- $(CSTD) $(ED25519_DEFS) -- $(ALLC) makedepend -Y -fMakefile.in -o.c.o -- $(CSTD) $(ED25519_DEFS) -- $(ALLC)
@ -390,3 +397,4 @@ test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-basepoint-table.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-tables.h test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-tables.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86.h test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-64bit-x86.h
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-impl-base.h test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-impl-base.h
vec.c.o: vec.h

View file

@ -25,17 +25,6 @@ then
CFLAGS="$oldcflags" CFLAGS="$oldcflags"
fi fi
cstd=""
oldcflags="$CFLAGS"
CFLAGS="-std=c99"
AC_MSG_CHECKING([whether CC supports -std=c99])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="-std=c99"],
[AC_MSG_RESULT([no])]
)
CFLAGS="$oldcflags"
nopie="" nopie=""
oldcflags="$CFLAGS" oldcflags="$CFLAGS"
@ -128,6 +117,46 @@ then
CFLAGS="$CFLAGS -msse2" CFLAGS="$CFLAGS -msse2"
fi fi
cstd=""
c99=""
oldcflags="$CFLAGS"
CFLAGS="-std=c99"
AC_MSG_CHECKING([whether CC supports -std=c99])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[c99="yes"]
[cstd="-std=c99"],
[AC_MSG_RESULT([no])]
)
CFLAGS="$cstd -Wall"
AC_MSG_CHECKING([whether CC supports -Wall])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wall"],
[AC_MSG_RESULT([no])]
)
if test "x$c99" = "xyes" -a "x$ed25519impl" != "xdonna"
then
CFLAGS="$cstd -Wpedantic"
AC_MSG_CHECKING([whether CC supports -Wpedantic])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wpedantic"],
[AC_MSG_RESULT([no])]
)
fi
if test "x$ed25519impl" = "xdonna"
then
CFLAGS="$cstd -Wno-unused-function"
AC_MSG_CHECKING([whether CC supports -Wno-unused-function])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cstd="$cstd -Wno-unused-function"],
[AC_MSG_RESULT([no])]
)
fi
CFLAGS="$oldcflags"
AC_ARG_ENABLE([intfilter], AC_ARG_ENABLE([intfilter],
[AS_HELP_STRING([--enable-intfilter], [AS_HELP_STRING([--enable-intfilter],

View file

@ -1,3 +1,4 @@
#include "cpucount.h"
#ifndef BSD #ifndef BSD
# ifndef __linux__ # ifndef __linux__
@ -108,8 +109,6 @@ static int parsecpuinfo()
} }
#endif #endif
#include "cpucount.h"
int cpucount() int cpucount()
{ {
int ncpu; int ncpu;

22
main.c
View file

@ -345,7 +345,7 @@ static void filters_prepare()
{ {
if (!quietflag) if (!quietflag)
fprintf(stderr,"sorting filters..."); fprintf(stderr,"sorting filters...");
filter_sort(filter_compare); filter_sort(&filter_compare);
if (!quietflag) if (!quietflag)
fprintf(stderr," done.\n"); fprintf(stderr," done.\n");
// TODO remove duplicates // TODO remove duplicates
@ -369,6 +369,12 @@ static size_t filters_count()
#endif #endif
} }
#ifdef STATISTICS
#define ADDNUMSUCCESS ++st->numsuccess.v
#else
#define ADDNUMSUCCESS do {} while (0)
#endif
#ifdef INTFILTER #ifdef INTFILTER
# ifndef BINSEARCH # ifndef BINSEARCH
@ -680,9 +686,8 @@ again:
#endif #endif
DOFILTER(i,pk,{ DOFILTER(i,pk,{
#ifdef STATISTICS ADDNUMSUCCESS;
++st->numsuccess.v;
#endif
// calc checksum // calc checksum
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN); memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]); FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
@ -774,10 +779,11 @@ initseed:
sk[31] &= 63; sk[31] &= 63;
sk[31] |= 64; sk[31] |= 64;
} }
else goto initseed; else
#ifdef STATISTICS goto initseed;
++st->numsuccess.v;
#endif ADDNUMSUCCESS;
// calc checksum // calc checksum
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN); memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]); FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);