[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libscrypt



Hi Dan & list,

On 01/03/12 09:40, Dan Kaminsky wrote:
>    I just released phidelius, which basically uses the output of scrypt's PRNG
> to feed /dev/random and the like.  Go to dankaminsky.com/phidelius
> <http://dankaminsky.com/phidelius> to see why I'd do such a horrifying thing.

Cool. :-)

>    Anyway, the release is sort of ugly right now, since there's no libscrypt. 
> It'd be nice if there was one, or if at least configure.ac <http://configure.ac>
> was public in some way.

I've attached the autocrap files.  BTW, I'm planning on adding scrypt to Google
code soon (to join kivaloo, spiped, and libcperciva, with which it shares some
code).

-- 
Colin Percival
Security Officer, FreeBSD | freebsd.org | The power to serve
Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid
AUTOMAKE_OPTIONS=	foreign

bin_PROGRAMS=	scrypt
dist_man_MANS=$(scrypt_man_MANS)

scrypt_SOURCES=		main.c				\
			lib/util/memlimit.c		\
			lib/util/readpass.c		\
			lib/util/warn.c			\
			lib/scryptenc/scryptenc.c	\
			lib/scryptenc/scryptenc_cpuperf.c	\
			lib/crypto/crypto_aesctr.c	\
			lib/crypto/sha256.c		\
			lib/crypto/crypto_scrypt-@SCRYPTVER@.c
scrypt_CFLAGS=		-I . -I lib/util -I lib/scryptenc -I lib/crypto
scrypt_LDADD=		-lcrypto
scrypt_man_MANS=	scrypt.1
# CHECK_SYSCTL_HW_USERMEM
# -----------------------
AC_DEFUN([CHECK_SYSCTL_HW_USERMEM],
[if sysctl hw.usermem >/dev/null 2>/dev/null; then
	AC_DEFINE([HAVE_SYSCTL_HW_USERMEM], [1],
	    [Define to 1 if the OS has a hw.usermem sysctl])
fi
AC_SUBST([HAVE_SYSCTL_HW_USERMEM])
])# CHECK_SYSCTL_HW_USERMEM
m4_define([SCRYPT_VERS],m4_include([scrypt-version]))
AC_INIT([scrypt],SCRYPT_VERS())
AC_CONFIG_AUX_DIR([config.aux])
AM_INIT_AUTOMAKE()
AM_MAINTAINER_MODE
AC_PROG_CC

# Look for sys/endian.h and be64enc.  Old versions of NetBSD have
# sys/endian.h but don't have the (le|be)(32|64)(enc|dec) functions in it.
AC_CHECK_HEADERS([sys/endian.h])
AC_CHECK_DECLS([be64enc], [], [], [[#include <sys/endian.h>]])

# Check for err.h; if not present, we need to provide warn() and warnx().
AC_CHECK_HEADERS([err.h])

# Check for clock_gettime.  On some systems, this is provided via librt.
AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_FUNCS([clock_gettime])

# Check for a linuxy sysinfo syscall; and while we're doing that, check if
# struct sysinfo is the old version (total RAM == totalmem) or the new
# version (total RAM == totalmem * mem_unit).
AC_CHECK_HEADERS([sys/sysinfo.h])
AC_CHECK_FUNCS([sysinfo])
AC_CHECK_TYPES([struct sysinfo], [], [], [[#include <sys/sysinfo.h>]])
AC_CHECK_MEMBERS([struct sysinfo.totalram, struct sysinfo.mem_unit],
    [], [], [[#include <sys/sysinfo.h>]])

# Check if we have a hw.usermem sysctl.
CHECK_SYSCTL_HW_USERMEM

# Check if we have <sys/param.h>, since some systems require it for sysctl
# to work.
AC_CHECK_HEADERS([sys/param.h])

# Check for posix_memalign
AC_CHECK_FUNCS([posix_memalign])

# Figure out whether we want to use the SSE version of the scrypt code or not.
AC_ARG_ENABLE([sse2],
    [AS_HELP_STRING([--enable-sse2],
	[use optimized SSE2 code])],
    [],
    [enable_sse2=no])
AS_IF([test "x$enable_sse2" != xno], [SCRYPTVER=sse], [SCRYPTVER=nosse])
AC_SUBST([SCRYPTVER])

AC_SYS_LARGEFILE

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT