working on sha512_internal

This commit is contained in:
joonicks
2025-10-22 22:40:31 +02:00
parent a13b780c35
commit 0b713ea5e4
8 changed files with 677 additions and 12 deletions

39
configure vendored
View File

@@ -306,6 +306,7 @@ do
--silence=options) silentopt=yes ;;
--md5=internal) ft_md5=internal ;;
--sha=internal) ft_sha=internal ;;
--sha=internal512) ft_sha=internal512 ;;
--use-cpuflags) cc_arch_opt=yes ;;
--no-cpuflags) cc_arch_opt=no ;;
--use-optimize) cc_optimize_opt=yes ;;
@@ -636,7 +637,7 @@ fi
oflag="-O2"
if [ "$optitype" = size ]; then
oflag="-Os"
oflag="-Os -fcf-protection=none"
fi
if [ -z "$cf_cflags" -a -z "$cc_optimize_opt" ]; then
@@ -853,20 +854,35 @@ if [ ! "$ft_sha" = no ]; then
TESTC=config/pw.c
echo $ac_n "checking for SHA in crypt() ... "$ac_c
sha_internal=
sha_object=
crypt_func='-DCRYPT_FUNC=crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC crypt'
if [ "$ft_sha" = internal512 ]; then
sha_internal=config/sha512.c
sha_object=config/sha512.o
crypt_func='-DCRYPT_FUNC=__crypt_sha512'
CRYPT_FUNCTION='#define CRYPT_FUNC __crypt_sha512'
$CC -c $sha_internal -o $sha_object
fi
if [ "$ft_sha" = internal ]; then
sha_internal=config/sha_internal.c
sha_internal=config/sha1.c
sha_object=config/sha1.o
crypt_func='-DCRYPT_FUNC=sha_crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC sha_crypt'
fi
$CC -o $TESTP $TESTC $sha_internal $crypt_func 1> /dev/null 2> /dev/null
#
$CC -o $TESTP $TESTC $sha_object $crypt_func 1> /dev/null 2> /dev/null
#
if [ ! -x $TESTP ]; then
crypt_func='-DCRYPT_FUNC=crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC crypt'
libcrypt=-lcrypt
has_sha=yes
$CC -o $TESTP $TESTC $crypt_func $libcrypt 1> /dev/null 2> /dev/null
fi
if [ ! -x $TESTP ]; then
crypt_func='-DCRYPT_FUNC=crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC crypt'
libcrypt=/usr/lib/libcrypt.so
has_sha=yes
$CC -o $TESTP $TESTC $crypt_func $libcrypt 1> /dev/null 2> /dev/null
@@ -879,6 +895,7 @@ if [ ! "$ft_sha" = no ]; then
pwhash=`$TESTP`
case "$pwhash" in
MD5 ) has_md5=yes ;;
SHA ) has_sha=yes ;;
SHAMD5 )
has_md5=yes
has_sha=yes
@@ -887,9 +904,8 @@ if [ ! "$ft_sha" = no ]; then
fi
echo $ac_t "$has_sha"
[ "$has_sha" = yes -a "$sha_internal" ] && has_sha=internal
rm -f $TESTP
rm -f $TESTP $sha_object
fi
#
# check for MD5 capabilities in libc/glibc/libcrypt
#
@@ -898,13 +914,13 @@ if [ "$has_md5" = yes ]; then
elif [ "$ft_md5" = no ]; then
has_md5=notest
elif [ ! "$ft_md5" = no ]; then
TESTC=config/pw.c
echo $ac_n "checking for MD5 in crypt() ... "$ac_c
TESTC=config/pw.c
md5_internal=
crypt_func='-DCRYPT_FUNC=crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC crypt'
if [ "$ft_md5" = internal ]; then
md5_internal=config/md5_internal.c
md5_internal=config/md5.c
crypt_func='-DCRYPT_FUNC=md5_crypt'
CRYPT_FUNCTION='#define CRYPT_FUNC md5_crypt'
fi
@@ -1107,7 +1123,11 @@ SHA_C=
SHA_O=
if [ "$ft_sha" = internal ]; then
SHA_C=lib/sha1.c
SHA_O=lib/sha.o
SHA_O=lib/sha1.o
fi
if [ "$ft_sha" = internal512 ]; then
SHA_C=lib/sha512.c
SHA_O=lib/sha512.o
fi
out=echo
@@ -1306,7 +1326,7 @@ if [ "$has_sha" = no ]; then
else
test "$ft_sha" && $out "$ft_sha" && ans=$ft_sha
test -z "$ft_sha" && read ans
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes -o "$ans" = internal && def_sha='#define SHACRYPT'
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes -o "$ans" = internal -o "$ans" = internal512 && def_sha='#define SHACRYPT'
fi
def_perl='#undef PERL'
@@ -1539,6 +1559,7 @@ save_myconfig() {
test "$silentopt" = yes && echo "--silence=options \\" >> ./myconfig
test "$ft_md5" = internal && echo "--md5=internal \\" >> ./myconfig
test "$ft_sha" = internal && echo "--sha=internal \\" >> ./myconfig
test "$ft_sha" = internal512 && echo "--sha=internal512 \\" >> ./myconfig
test "$optitype" = speed && echo "--optimize=speed \\" >> ./myconfig
test "$optitype" = size && echo "--optimize=size \\" >> ./myconfig
test "$cc_ofp_opt" = yes && echo "--use-ofp \\" >> ./myconfig