|
Packit |
aea12f |
#!/bin/sh
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
# Copyright (C) 2016 Nikos Mavrogiannopoulos
|
|
Packit |
aea12f |
# Copyright (C) 2017 Red Hat, Inc.
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
# Author: Nikos Mavrogiannopoulos
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
# This file is part of GnuTLS.
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
# GnuTLS is free software; you can redistribute it and/or modify it
|
|
Packit |
aea12f |
# under the terms of the GNU General Public License as published by the
|
|
Packit |
aea12f |
# Free Software Foundation; either version 3 of the License, or (at
|
|
Packit |
aea12f |
# your option) any later version.
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
# GnuTLS is distributed in the hope that it will be useful, but
|
|
Packit |
aea12f |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
aea12f |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
aea12f |
# General Public License for more details.
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
# You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
aea12f |
# along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
Packit |
aea12f |
#
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
PROG=./hash-large${EXEEXT}
|
|
Packit |
aea12f |
unset RETCODE
|
|
Packit |
aea12f |
if ! test -z "${VALGRIND}"; then
|
|
Packit |
aea12f |
VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
|
|
Packit |
aea12f |
fi
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
srcdir="${srcdir:-.}"
|
|
Packit |
aea12f |
. "${srcdir}/../scripts/common.sh"
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
run_test() {
|
|
Packit |
aea12f |
GNUTLS_CPUID_OVERRIDE=$1 ${PROG}
|
|
Packit |
aea12f |
ret=$?
|
|
Packit |
aea12f |
if test $ret != 0; then
|
|
Packit |
aea12f |
echo "tests failed for flags $1"
|
|
Packit |
aea12f |
exit $ret
|
|
Packit |
aea12f |
fi
|
|
Packit |
aea12f |
}
|
|
Packit |
aea12f |
|
|
Packit Service |
991b93 |
#0x20: SHA_NI
|
|
Packit |
aea12f |
#0x4: SSSE3
|
|
Packit |
aea12f |
#0x1: no optimizations
|
|
Packit |
aea12f |
#"": default optimizations
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
SSSE3FLAG=""
|
|
Packit Service |
991b93 |
SHANIFLAG=""
|
|
Packit |
aea12f |
which lscpu >/dev/null 2>&1
|
|
Packit |
aea12f |
if test $? = 0;then
|
|
Packit |
aea12f |
$(which lscpu)|grep Architecture|grep x86 >/dev/null
|
|
Packit |
aea12f |
if test $? = 0;then
|
|
Packit |
aea12f |
SSSE3FLAG="0x4"
|
|
Packit |
aea12f |
fi
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
$(which lscpu)|grep Flags|grep sha_ni >/dev/null
|
|
Packit Service |
991b93 |
if test $? = 0;then
|
|
Packit Service |
991b93 |
SHANIFLAG="0x20"
|
|
Packit Service |
991b93 |
fi
|
|
Packit |
aea12f |
fi
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
WAITPID=""
|
|
Packit Service |
991b93 |
for flags in "" "0x1" ${SSSE3FLAG} ${SHANIFLAG};do
|
|
Packit |
aea12f |
run_test ${flags} &
|
|
Packit |
aea12f |
WAITPID="${WAITPID} $!"
|
|
Packit |
aea12f |
done
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
for i in "$WAITPID";do
|
|
Packit |
aea12f |
wait $i
|
|
Packit |
aea12f |
ret=$?
|
|
Packit |
aea12f |
test ${ret} != 0 && exit ${ret}
|
|
Packit |
aea12f |
done
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
exit_if_non_padlock
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
#0x200000: Padlock PHE
|
|
Packit |
aea12f |
#0x400000: Padlock PHE SHA512
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
WAITPID=""
|
|
Packit |
aea12f |
for flags in "0x200000" "0x400000";do
|
|
Packit |
aea12f |
run_test ${flags} &
|
|
Packit |
aea12f |
WAITPID="${WAITPID} $!"
|
|
Packit |
aea12f |
done
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
for i in "$WAITPID";do
|
|
Packit |
aea12f |
wait $i
|
|
Packit |
aea12f |
ret=$?
|
|
Packit |
aea12f |
test ${ret} != 0 && exit ${ret}
|
|
Packit |
aea12f |
done
|
|
Packit |
aea12f |
|
|
Packit |
aea12f |
exit 0
|