mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-24 09:57:39 -03:00
more autism
This commit is contained in:
parent
3bae9caa97
commit
f649eedb70
4 changed files with 70 additions and 28 deletions
10
Makefile.in
10
Makefile.in
|
@ -1,6 +1,6 @@
|
|||
|
||||
CC= @CC@
|
||||
CSTD= @CSTD@ -Wall
|
||||
CSTD= @CSTD@
|
||||
CFLAGS= $(CSTD) @CFLAGS@ @CPPFLAGS@ -DED25519_@ED25519IMPL@ @MYDEFS@
|
||||
ASFLAGS=
|
||||
LDFLAGS= @NOPIE@ @LDFLAGS@
|
||||
|
@ -84,6 +84,13 @@ clean:
|
|||
$(RM) $(CLEANO)
|
||||
$(RM) $(EXE)
|
||||
|
||||
distclean:
|
||||
$(RM) $(CLEANO)
|
||||
$(RM) $(EXE)
|
||||
$(RM) -r autom4te.cache
|
||||
$(RM) configure config.status config.log
|
||||
$(RM) Makefile
|
||||
|
||||
depend:
|
||||
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-x86.h
|
||||
test_ed25519.c.o: ed25519/ed25519-donna/ed25519-donna-impl-base.h
|
||||
vec.c.o: vec.h
|
||||
|
|
51
configure.ac
51
configure.ac
|
@ -25,17 +25,6 @@ then
|
|||
CFLAGS="$oldcflags"
|
||||
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=""
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
|
@ -128,6 +117,46 @@ then
|
|||
CFLAGS="$CFLAGS -msse2"
|
||||
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],
|
||||
[AS_HELP_STRING([--enable-intfilter],
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "cpucount.h"
|
||||
|
||||
#ifndef BSD
|
||||
# ifndef __linux__
|
||||
|
@ -108,8 +109,6 @@ static int parsecpuinfo()
|
|||
}
|
||||
#endif
|
||||
|
||||
#include "cpucount.h"
|
||||
|
||||
int cpucount()
|
||||
{
|
||||
int ncpu;
|
||||
|
|
34
main.c
34
main.c
|
@ -345,7 +345,7 @@ static void filters_prepare()
|
|||
{
|
||||
if (!quietflag)
|
||||
fprintf(stderr,"sorting filters...");
|
||||
filter_sort(filter_compare);
|
||||
filter_sort(&filter_compare);
|
||||
if (!quietflag)
|
||||
fprintf(stderr," done.\n");
|
||||
// TODO remove duplicates
|
||||
|
@ -369,9 +369,15 @@ static size_t filters_count()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef STATISTICS
|
||||
#define ADDNUMSUCCESS ++st->numsuccess.v
|
||||
#else
|
||||
#define ADDNUMSUCCESS do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef INTFILTER
|
||||
|
||||
#ifndef BINSEARCH
|
||||
# ifndef BINSEARCH
|
||||
|
||||
#define MATCHFILTER(it,pk) \
|
||||
((*(IFT *)(pk) & VEC_BUF(ifilters,it).m) == VEC_BUF(ifilters,it).f)
|
||||
|
@ -385,7 +391,7 @@ static size_t filters_count()
|
|||
} \
|
||||
}
|
||||
|
||||
#else // BINSEARCH
|
||||
# else // BINSEARCH
|
||||
|
||||
#define DOFILTER(it,pk,code) { \
|
||||
register IFT maskedpk = *(IFT *)(pk) & ifiltermask; \
|
||||
|
@ -402,11 +408,11 @@ static size_t filters_count()
|
|||
} \
|
||||
}
|
||||
|
||||
#endif // BINSEARCH
|
||||
# endif // BINSEARCH
|
||||
|
||||
#else // INTFILTER
|
||||
|
||||
#ifndef BINSEARCH
|
||||
# ifndef BINSEARCH
|
||||
|
||||
#define MATCHFILTER(it,pk) ( \
|
||||
memcmp(pk,VEC_BUF(bfilters,it).f,VEC_BUF(bfilters,it).len) == 0 && \
|
||||
|
@ -421,7 +427,7 @@ static size_t filters_count()
|
|||
} \
|
||||
}
|
||||
|
||||
#else // BINSEARCH
|
||||
# else // BINSEARCH
|
||||
|
||||
#define DOFILTER(it,pk,code) { \
|
||||
for (size_t down = 0,up = VEC_LENGTH(bfilters);down < up;) { \
|
||||
|
@ -456,7 +462,7 @@ static size_t filters_count()
|
|||
} \
|
||||
}
|
||||
|
||||
#endif // BINSEARCH
|
||||
# endif // BINSEARCH
|
||||
|
||||
#endif // INTFILTER
|
||||
|
||||
|
@ -680,9 +686,8 @@ again:
|
|||
#endif
|
||||
|
||||
DOFILTER(i,pk,{
|
||||
#ifdef STATISTICS
|
||||
++st->numsuccess.v;
|
||||
#endif
|
||||
ADDNUMSUCCESS;
|
||||
|
||||
// calc checksum
|
||||
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
||||
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
||||
|
@ -774,10 +779,11 @@ initseed:
|
|||
sk[31] &= 63;
|
||||
sk[31] |= 64;
|
||||
}
|
||||
else goto initseed;
|
||||
#ifdef STATISTICS
|
||||
++st->numsuccess.v;
|
||||
#endif
|
||||
else
|
||||
goto initseed;
|
||||
|
||||
ADDNUMSUCCESS;
|
||||
|
||||
// calc checksum
|
||||
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
||||
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
||||
|
|
Loading…
Add table
Reference in a new issue