Replace NSS with Pale Moon's

This commit is contained in:
wuggy 2026-06-29 21:29:25 +01:00
commit 8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions

View file

@ -38,7 +38,7 @@ tasks:
description: | description: |
The task that creates all of the other tasks in the task graph The task that creates all of the other tasks in the task graph
workerType: "linux" workerType: "linux-gcp"
provisionerId: "nss-${repository.level}" provisionerId: "nss-${repository.level}"
scopes: scopes:

View file

@ -47,9 +47,14 @@ include $(CORE_DEPTH)/coreconf/rules.mk
# (7) Execute "local" rules. (OPTIONAL). # # (7) Execute "local" rules. (OPTIONAL). #
####################################################################### #######################################################################
nss_build_all: build_nspr all latest nss_build_all:
$(MAKE) build_nspr
$(MAKE) all
$(MAKE) latest
nss_clean_all: clobber_nspr clobber nss_clean_all:
$(MAKE) clobber_nspr
$(MAKE) clobber
NSPR_CONFIG_STATUS = $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/config.status NSPR_CONFIG_STATUS = $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/config.status
NSPR_CONFIGURE = $(CORE_DEPTH)/../nspr/configure NSPR_CONFIGURE = $(CORE_DEPTH)/../nspr/configure

View file

@ -1,8 +0,0 @@
4 Added functions:
'function SECStatus CERT_FilterCertListByCertList(CERTCertList*, const CERTCertList*)' {CERT_FilterCertListByCertList@@NSS_3.77}
'function SECStatus CERT_FilterCertListByNickname(CERTCertList*, char*, void*)' {CERT_FilterCertListByNickname@@NSS_3.77}
'function PRBool CERT_IsInList(const CERTCertificate*, const CERTCertList*)' {CERT_IsInList@@NSS_3.77}
'function CK_OBJECT_HANDLE PK11_FindObjectForCert(CERTCertificate*, void*, PK11SlotInfo**)' {PK11_FindObjectForCert@@NSS_3.77}

View file

@ -0,0 +1,5 @@
1 Added function:
'function void NSS_SecureSelect(void*, void*, void*, size_t, unsigned char)' {NSS_SecureSelect@@NSSUTIL_3.90}

View file

@ -1,17 +0,0 @@
1 function with some indirect sub-type change:
[C]'function SECStatus SSL_GetPreliminaryChannelInfo(PRFileDesc*, SSLPreliminaryChannelInfo*, PRUintn)' at sslinfo.c:113:1 has some indirect sub-type changes:
parameter 2 of type 'SSLPreliminaryChannelInfo*' has sub-type changes:
in pointed to type 'typedef SSLPreliminaryChannelInfo' at sslt.h:424:1:
underlying type 'struct SSLPreliminaryChannelInfoStr' at sslt.h:373:1 changed:
type size changed from 192 to 288 (in bits)
3 data member insertions:
'PRBool SSLPreliminaryChannelInfoStr::peerDelegCred', at offset 192 (in bits) at sslt.h:418:1
'PRUint32 SSLPreliminaryChannelInfoStr::authKeyBits', at offset 224 (in bits) at sslt.h:419:1
'SSLSignatureScheme SSLPreliminaryChannelInfoStr::signatureScheme', at offset 256 (in bits) at sslt.h:420:1
2 Added functions:
'function PRBool SSL_CertIsUsable(PRFileDesc*, CERTCertificate*)' {SSL_CertIsUsable@@NSS_3.77}
'function SECStatus SSL_FilterClientCertListBySocket(PRFileDesc*, CERTCertList*)' {SSL_FilterClientCertListBySocket@@NSS_3.77}

View file

@ -1 +1 @@
NSS_3_47_BRANCH NSS_3_89_BRANCH

View file

@ -1,67 +0,0 @@
#! /bin/bash
# Each buildbot-slave requires a bbenv.sh file that defines
# machine specific variables. This is an example file.
HOST=$(hostname | cut -d. -f1)
export HOST
# if your machine's IP isn't registered in DNS,
# you must set appropriate environment variables
# that can be resolved locally.
# For example, if localhost.localdomain works on your system, set:
#HOST=localhost
#DOMSUF=localdomain
#export DOMSUF
ARCH=$(uname -s)
ulimit -c unlimited 2> /dev/null
export NSPR_LOG_MODULES="pkix:1"
#export JAVA_HOME_32=
#export JAVA_HOME_64=
#enable if you have PKITS data
#export PKITS_DATA=$HOME/pkits/data/
NSS_BUILD_TARGET="clean nss_build_all"
JSS_BUILD_TARGET="clean all"
MAKE=gmake
AWK=awk
PATCH=patch
if [ "${ARCH}" = "SunOS" ]; then
AWK=nawk
PATCH=gpatch
ARCH=SunOS/$(uname -p)
fi
if [ "${ARCH}" = "Linux" -a -f /etc/system-release ]; then
VERSION=`sed -e 's; release ;;' -e 's; (.*)$;;' -e 's;Red Hat Enterprise Linux Server;RHEL;' -e 's;Red Hat Enterprise Linux Workstation;RHEL;' /etc/system-release`
ARCH=Linux/${VERSION}
echo ${ARCH}
fi
PROCESSOR=$(uname -p)
if [ "${PROCESSOR}" = "ppc64" ]; then
ARCH="${ARCH}/ppc64"
fi
if [ "${PROCESSOR}" = "powerpc" ]; then
ARCH="${ARCH}/ppc"
fi
PORT_64_DBG=8543
PORT_64_OPT=8544
PORT_32_DBG=8545
PORT_32_OPT=8546
if [ "${NSS_TESTS}" = "memleak" ]; then
PORT_64_DBG=8547
PORT_64_OPT=8548
PORT_32_DBG=8549
PORT_32_OPT=8550
fi

View file

@ -1,548 +0,0 @@
#! /bin/bash
# Ensure a failure of the first command inside a pipe
# won't be hidden by commands later in the pipe.
# (e.g. as in ./dosomething | grep)
set -o pipefail
proc_args()
{
while [ -n "$1" ]; do
OPT=$(echo $1 | cut -d= -f1)
VAL=$(echo $1 | cut -d= -f2)
case $OPT in
"--build-nss")
BUILD_NSS=1
;;
"--test-nss")
TEST_NSS=1
;;
"--check-abi")
CHECK_ABI=1
;;
"--build-jss")
BUILD_JSS=1
;;
"--test-jss")
TEST_JSS=1
;;
"--memtest")
NSS_TESTS="memleak"
export NSS_TESTS
;;
"--nojsssign")
NO_JSS_SIGN=1
;;
*)
echo "Usage: $0 ..."
echo " --memtest - run the memory leak tests"
echo " --nojsssign - try to sign jss"
echo " --build-nss"
echo " --build-jss"
echo " --test-nss"
echo " --test-jss"
echo " --check-abi"
exit 1
;;
esac
shift
done
}
set_env()
{
TOPDIR=$(pwd)
HGDIR=$(pwd)$(echo "/hg")
OUTPUTDIR=$(pwd)$(echo "/output")
LOG_ALL="${OUTPUTDIR}/all.log"
LOG_TMP="${OUTPUTDIR}/tmp.log"
echo "hello" |grep --line-buffered hello >/dev/null 2>&1
[ $? -eq 0 ] && GREP_BUFFER="--line-buffered"
}
print_log()
{
DATE=$(date "+TB [%Y-%m-%d %H:%M:%S]")
echo "${DATE} $*"
echo "${DATE} $*" >> ${LOG_ALL}
}
print_result()
{
TESTNAME=$1
RET=$2
EXP=$3
if [ ${RET} -eq ${EXP} ]; then
print_log "${TESTNAME} PASSED"
else
print_log "${TESTNAME} FAILED"
fi
}
print_env()
{
print_log "######## Environment variables ########"
uname -a | tee -a ${LOG_ALL}
if [ -e "/etc/redhat-release" ]; then
cat "/etc/redhat-release" | tee -a ${LOG_ALL}
fi
# don't print the MAIL command, it might contain a password
env | grep -v "^MAIL=" | tee -a ${LOG_ALL}
}
set_cycle()
{
BITS=$1
OPT=$2
if [ "${BITS}" = "64" ]; then
USE_64=1
JAVA_HOME=${JAVA_HOME_64}
PORT_DBG=${PORT_64_DBG}
PORT_OPT=${PORT_64_OPT}
else
USE_64=
JAVA_HOME=${JAVA_HOME_32}
PORT_DBG=${PORT_32_DBG}
PORT_OPT=${PORT_32_OPT}
fi
export USE_64
export JAVA_HOME
BUILD_OPT=
if [ "${OPT}" = "OPT" ]; then
BUILD_OPT=1
XPCLASS=xpclass.jar
PORT=${PORT_OPT}
else
BUILD_OPT=
XPCLASS=xpclass_dbg.jar
PORT=${PORT_DBG}
fi
export BUILD_OPT
PORT_JSS_SERVER=$(expr ${PORT} + 20)
PORT_JSSE_SERVER=$(expr ${PORT} + 40)
export PORT
export PORT_JSS_SERVER
export PORT_JSSE_SERVER
}
build_nss()
{
print_log "######## NSS - build - ${BITS} bits - ${OPT} ########"
print_log "$ cd ${HGDIR}/nss"
cd ${HGDIR}/nss
print_log "$ ${MAKE} ${NSS_BUILD_TARGET}"
#${MAKE} ${NSS_BUILD_TARGET} 2>&1 | tee -a ${LOG_ALL} | grep ${GREP_BUFFER} "^${MAKE}"
${MAKE} ${NSS_BUILD_TARGET} 2>&1 | tee -a ${LOG_ALL}
RET=$?
print_result "NSS - build - ${BITS} bits - ${OPT}" ${RET} 0
if [ ${RET} -eq 0 ]; then
return 0
else
tail -100 ${LOG_ALL}
return ${RET}
fi
}
build_jss()
{
print_log "######## JSS - build - ${BITS} bits - ${OPT} ########"
print_log "$ cd ${HGDIR}/jss"
cd ${HGDIR}/jss
print_log "$ ${MAKE} ${JSS_BUILD_TARGET}"
#${MAKE} ${JSS_BUILD_TARGET} 2>&1 | tee -a ${LOG_ALL} | grep ${GREP_BUFFER} "^${MAKE}"
${MAKE} ${JSS_BUILD_TARGET} 2>&1 | tee -a ${LOG_ALL}
RET=$?
print_result "JSS build - ${BITS} bits - ${OPT}" ${RET} 0
[ ${RET} -eq 0 ] || return ${RET}
print_log "$ cd ${HGDIR}/dist"
cd ${HGDIR}/dist
if [ -z "${NO_JSS_SIGN}" ]; then
print_log "cat ${TOPDIR}/keystore.pw | ${JAVA_HOME}/bin/jarsigner -keystore ${TOPDIR}/keystore -internalsf ${XPCLASS} jssdsa"
cat ${TOPDIR}/keystore.pw | ${JAVA_HOME}/bin/jarsigner -keystore ${TOPDIR}/keystore -internalsf ${XPCLASS} jssdsa >> ${LOG_ALL} 2>&1
RET=$?
print_result "JSS - sign JAR files - ${BITS} bits - ${OPT}" ${RET} 0
[ ${RET} -eq 0 ] || return ${RET}
fi
print_log "${JAVA_HOME}/bin/jarsigner -verify -certs ${XPCLASS}"
${JAVA_HOME}/bin/jarsigner -verify -certs ${XPCLASS} >> ${LOG_ALL} 2>&1
RET=$?
print_result "JSS - verify JAR files - ${BITS} bits - ${OPT}" ${RET} 0
[ ${RET} -eq 0 ] || return ${RET}
return 0
}
test_nss()
{
print_log "######## NSS - tests - ${BITS} bits - ${OPT} ########"
if [ "${OS_TARGET}" = "Android" ]; then
print_log "$ cd ${HGDIR}/nss/tests/remote"
cd ${HGDIR}/nss/tests/remote
print_log "$ make test_android"
make test_android 2>&1 | tee ${LOG_TMP} | grep ${GREP_BUFFER} ": #"
OUTPUTFILE=${HGDIR}/tests_results/security/*.1/output.log
else
print_log "$ cd ${HGDIR}/nss/tests"
cd ${HGDIR}/nss/tests
print_log "$ ./all.sh"
./all.sh 2>&1 | tee ${LOG_TMP} | egrep ${GREP_BUFFER} ": #|^\[.{10}\] "
OUTPUTFILE=${LOG_TMP}
fi
cat ${LOG_TMP} >> ${LOG_ALL}
tail -n2 ${HGDIR}/tests_results/security/*.1/results.html | grep END_OF_TEST >> ${LOG_ALL}
RET=$?
print_log "######## details of detected failures (if any) ########"
grep -B50 -w FAILED ${OUTPUTFILE}
[ $? -eq 1 ] || RET=1
print_result "NSS - tests - ${BITS} bits - ${OPT}" ${RET} 0
return ${RET}
}
check_abi()
{
print_log "######## NSS ABI CHECK - ${BITS} bits - ${OPT} ########"
print_log "######## creating temporary HG clones ########"
rm -rf ${HGDIR}/baseline
mkdir ${HGDIR}/baseline
BASE_NSS=`cat ${HGDIR}/nss/automation/abi-check/previous-nss-release`
hg clone -u "${BASE_NSS}" "${HGDIR}/nss" "${HGDIR}/baseline/nss"
if [ $? -ne 0 ]; then
echo "invalid tag in automation/abi-check/previous-nss-release"
return 1
fi
BASE_NSPR=NSPR_$(head -1 ${HGDIR}/baseline/nss/automation/release/nspr-version.txt | cut -d . -f 1-2 | tr . _)_BRANCH
hg clone -u "${BASE_NSPR}" "${HGDIR}/nspr" "${HGDIR}/baseline/nspr"
if [ $? -ne 0 ]; then
echo "nonexisting tag ${BASE_NSPR} derived from ${BASE_NSS} automation/release/nspr-version.txt"
# Assume that version hasn't been released yet, fall back to trunk
pushd "${HGDIR}/baseline/nspr"
hg update default
popd
fi
print_log "######## building baseline NSPR/NSS ########"
pushd ${HGDIR}/baseline/nss
print_log "$ ${MAKE} ${NSS_BUILD_TARGET}"
${MAKE} ${NSS_BUILD_TARGET} 2>&1 | tee -a ${LOG_ALL}
RET=$?
print_result "NSS - build - ${BITS} bits - ${OPT}" ${RET} 0
if [ ${RET} -ne 0 ]; then
tail -100 ${LOG_ALL}
return ${RET}
fi
popd
ABI_PROBLEM_FOUND=0
ABI_REPORT=${OUTPUTDIR}/abi-diff.txt
rm -f ${ABI_REPORT}
PREVDIST=${HGDIR}/baseline/dist
NEWDIST=${HGDIR}/dist
ALL_SOs="libfreebl3.so libfreeblpriv3.so libnspr4.so libnss3.so libnssckbi.so libnssdbm3.so libnsssysinit.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so"
for SO in ${ALL_SOs}; do
if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
touch ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt
fi
abidiff --hd1 $PREVDIST/public/ --hd2 $NEWDIST/public \
$PREVDIST/*/lib/$SO $NEWDIST/*/lib/$SO \
> ${HGDIR}/nss/automation/abi-check/new-report-temp$SO.txt
RET=$?
cat ${HGDIR}/nss/automation/abi-check/new-report-temp$SO.txt \
| grep -v "^Functions changes summary:" \
| grep -v "^Variables changes summary:" \
> ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt
rm -f ${HGDIR}/nss/automation/abi-check/new-report-temp$SO.txt
ABIDIFF_ERROR=$((($RET & 0x01) != 0))
ABIDIFF_USAGE_ERROR=$((($RET & 0x02) != 0))
ABIDIFF_ABI_CHANGE=$((($RET & 0x04) != 0))
ABIDIFF_ABI_INCOMPATIBLE_CHANGE=$((($RET & 0x08) != 0))
ABIDIFF_UNKNOWN_BIT_SET=$((($RET & 0xf0) != 0))
# If abidiff reports an error, or a usage error, or if it sets a result
# bit value this script doesn't know yet about, we'll report failure.
# For ABI changes, we don't yet report an error. We'll compare the
# result report with our whitelist. This allows us to silence changes
# that we're already aware of and have been declared acceptable.
REPORT_RET_AS_FAILURE=0
if [ $ABIDIFF_ERROR -ne 0 ]; then
print_log "abidiff reported ABIDIFF_ERROR."
REPORT_RET_AS_FAILURE=1
fi
if [ $ABIDIFF_USAGE_ERROR -ne 0 ]; then
print_log "abidiff reported ABIDIFF_USAGE_ERROR."
REPORT_RET_AS_FAILURE=1
fi
if [ $ABIDIFF_UNKNOWN_BIT_SET -ne 0 ]; then
print_log "abidiff reported ABIDIFF_UNKNOWN_BIT_SET."
REPORT_RET_AS_FAILURE=1
fi
if [ $ABIDIFF_ABI_CHANGE -ne 0 ]; then
print_log "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-whitelisted differences."
fi
if [ $ABIDIFF_ABI_INCOMPATIBLE_CHANGE -ne 0 ]; then
print_log "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-whitelisted differences."
fi
if [ $REPORT_RET_AS_FAILURE -ne 0 ]; then
ABI_PROBLEM_FOUND=1
print_log "abidiff {$PREVDIST , $NEWDIST} for $SO FAILED with result $RET, or failed writing to ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
fi
if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
ABI_PROBLEM_FOUND=1
print_log "FAILED to access report file: ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt"
fi
diff -wB -u ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt \
${HGDIR}/nss/automation/abi-check/new-report-$SO.txt >> ${ABI_REPORT}
if [ ! -f ${ABI_REPORT} ]; then
ABI_PROBLEM_FOUND=1
print_log "FAILED to compare exepcted and new report: ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
fi
done
if [ -s ${ABI_REPORT} ]; then
print_log "FAILED: there are new unexpected ABI changes"
cat ${ABI_REPORT}
return 1
elif [ $ABI_PROBLEM_FOUND -ne 0 ]; then
print_log "FAILED: failure executing the ABI checks"
cat ${ABI_REPORT}
return 1
fi
return 0
}
test_jss()
{
print_log "######## JSS - tests - ${BITS} bits - ${OPT} ########"
print_log "$ cd ${HGDIR}/jss"
cd ${HGDIR}/jss
print_log "$ ${MAKE} platform"
PLATFORM=$(${MAKE} platform)
print_log "PLATFORM=${PLATFORM}"
print_log "$ cd ${HGDIR}/jss/org/mozilla/jss/tests"
cd ${HGDIR}/jss/org/mozilla/jss/tests
print_log "$ perl all.pl dist ${HGDIR}/dist/${PLATFORM}"
perl all.pl dist ${HGDIR}/dist/${PLATFORM} 2>&1 | tee ${LOG_TMP}
cat ${LOG_TMP} >> ${LOG_ALL}
tail -n2 ${LOG_TMP} | grep JSSTEST_RATE > /dev/null
RET=$?
grep FAIL ${LOG_TMP}
[ $? -eq 1 ] || RET=1
print_result "JSS - tests - ${BITS} bits - ${OPT}" ${RET} 0
return ${RET}
}
create_objdir_dist_link()
{
# compute relevant 'dist' OBJDIR_NAME subdirectory names for JSS and NSS
OS_TARGET=`uname -s`
OS_RELEASE=`uname -r | sed 's/-.*//' | sed 's/-.*//' | cut -d . -f1,2`
CPU_TAG=_`uname -m`
# OBJDIR_NAME_COMPILER appears to be defined for NSS but not JSS
OBJDIR_NAME_COMPILER=_cc
LIBC_TAG=_glibc
IMPL_STRATEGY=_PTH
if [ "${RUN_BITS}" = "64" ]; then
OBJDIR_TAG=_${RUN_BITS}_${RUN_OPT}.OBJ
else
OBJDIR_TAG=_${RUN_OPT}.OBJ
fi
# define NSS_OBJDIR_NAME
NSS_OBJDIR_NAME=${OS_TARGET}${OS_RELEASE}${CPU_TAG}${OBJDIR_NAME_COMPILER}
NSS_OBJDIR_NAME=${NSS_OBJDIR_NAME}${LIBC_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}
print_log "create_objdir_dist_link(): NSS_OBJDIR_NAME='${NSS_OBJDIR_NAME}'"
# define JSS_OBJDIR_NAME
JSS_OBJDIR_NAME=${OS_TARGET}${OS_RELEASE}${CPU_TAG}
JSS_OBJDIR_NAME=${JSS_OBJDIR_NAME}${LIBC_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}
print_log "create_objdir_dist_link(): JSS_OBJDIR_NAME='${JSS_OBJDIR_NAME}'"
if [ -e "${HGDIR}/dist/${NSS_OBJDIR_NAME}" ]; then
SOURCE=${HGDIR}/dist/${NSS_OBJDIR_NAME}
TARGET=${HGDIR}/dist/${JSS_OBJDIR_NAME}
ln -s ${SOURCE} ${TARGET} >/dev/null 2>&1
fi
}
build_and_test()
{
if [ -n "${BUILD_NSS}" ]; then
build_nss
[ $? -eq 0 ] || return 1
fi
if [ -n "${TEST_NSS}" ]; then
test_nss
[ $? -eq 0 ] || return 1
fi
if [ -n "${CHECK_ABI}" ]; then
check_abi
[ $? -eq 0 ] || return 1
fi
if [ -n "${BUILD_JSS}" ]; then
create_objdir_dist_link
build_jss
[ $? -eq 0 ] || return 1
fi
if [ -n "${TEST_JSS}" ]; then
test_jss
[ $? -eq 0 ] || return 1
fi
return 0
}
run_cycle()
{
print_env
build_and_test
RET=$?
grep ^TinderboxPrint ${LOG_ALL}
return ${RET}
}
prepare()
{
rm -rf ${OUTPUTDIR}.oldest >/dev/null 2>&1
mv ${OUTPUTDIR}.older ${OUTPUTDIR}.oldest >/dev/null 2>&1
mv ${OUTPUTDIR}.old ${OUTPUTDIR}.older >/dev/null 2>&1
mv ${OUTPUTDIR}.last ${OUTPUTDIR}.old >/dev/null 2>&1
mv ${OUTPUTDIR} ${OUTPUTDIR}.last >/dev/null 2>&1
mkdir -p ${OUTPUTDIR}
# Remove temporary test files from previous jobs, that weren't cleaned up
# by move_results(), e.g. caused by unexpected interruptions.
rm -rf ${HGDIR}/tests_results/
cd ${HGDIR}/nss
if [ -n "${FEWER_STRESS_ITERATIONS}" ]; then
sed -i 's/-c_1000_/-c_500_/g' tests/ssl/sslstress.txt
fi
return 0
}
move_results()
{
cd ${HGDIR}
if [ -n "${TEST_NSS}" ]; then
mv -f tests_results ${OUTPUTDIR}
fi
tar -c -z --dereference -f ${OUTPUTDIR}/dist.tgz dist
rm -rf dist
}
run_all()
{
set_cycle ${BITS} ${OPT}
prepare
run_cycle
RESULT=$?
print_log "### result of run_cycle is ${RESULT}"
move_results
return ${RESULT}
}
main()
{
VALID=0
RET=1
FAIL=0
for BITS in 32 64; do
echo ${RUN_BITS} | grep ${BITS} > /dev/null
[ $? -eq 0 ] || continue
for OPT in DBG OPT; do
echo ${RUN_OPT} | grep ${OPT} > /dev/null
[ $? -eq 0 ] || continue
VALID=1
set_env
run_all
RET=$?
print_log "### result of run_all is ${RET}"
if [ ${RET} -ne 0 ]; then
FAIL=${RET}
fi
done
done
if [ ${VALID} -ne 1 ]; then
echo "Need to set valid bits/opt values."
return 1
fi
return ${FAIL}
}
#function killallsub()
#{
# FINAL_RET=$?
# for proc in `jobs -p`
# do
# kill -9 $proc
# done
# return ${FINAL_RET}
#}
#trap killallsub EXIT
#IS_RUNNING_FILE="./build-is-running"
#if [ -a $IS_RUNNING_FILE ]; then
# echo "exiting, because old job is still running"
# exit 1
#fi
#touch $IS_RUNNING_FILE
echo "tinderbox args: $0 $@"
. ${ENVVARS}
proc_args "$@"
main
RET=$?
print_log "### result of main is ${RET}"
#rm $IS_RUNNING_FILE
exit ${RET}

View file

@ -1,6 +0,0 @@
IF EXIST ..\buildbot-is-building (
del ..\buildbot-is-building
shutdown /r /t 0
timeout /t 120
)

View file

@ -1,14 +0,0 @@
echo running > ..\buildbot-is-building
echo running: "%MOZILLABUILD%\msys\bin\bash" -c "hg/nss/automation/buildbot-slave/build.sh %*"
"%MOZILLABUILD%\msys\bin\bash" -c "hg/nss/automation/buildbot-slave/build.sh %*"
if %errorlevel% neq 0 (
set EXITCODE=1
) else (
set EXITCODE=0
)
del ..\buildbot-is-building
exit /b %EXITCODE%

View file

@ -5,14 +5,21 @@ LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
clang-format-3.9 \ clang-format-10 \
locales \ locales \
mercurial \ python-dev \
python-pip \
python-setuptools \
python-wheel \
build-essential \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y && apt-get autoremove -y && apt-get clean -y
RUN pip install mercurial==6.1.1
RUN update-alternatives --install /usr/bin/clang-format \ RUN update-alternatives --install /usr/bin/clang-format \
clang-format $(which clang-format-3.9) 10 clang-format $(which clang-format-10) 10
ENV SHELL /bin/bash ENV SHELL /bin/bash
ENV USER worker ENV USER worker

View file

@ -13,7 +13,7 @@ set -e
# Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong. # Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong.
# Includes a default set of directories NOT to clang-format on. # Includes a default set of directories NOT to clang-format on.
blacklist=( blocklist=(
"./automation" \ "./automation" \
"./coreconf" \ "./coreconf" \
"./doc" \ "./doc" \
@ -37,8 +37,8 @@ fi
format_folder() format_folder()
{ {
for black in "${blacklist[@]}"; do for block in "${blocklist[@]}"; do
if [[ "$1" == "$black"* ]]; then if [[ "$1" == "$block"* ]]; then
echo "skip $1" echo "skip $1"
return 1 return 1
fi fi
@ -54,7 +54,7 @@ for dir in "${dirs[@]}"; do
if [ "${#c}" == "1" ]; then if [ "${#c}" == "1" ]; then
depth+=(-maxdepth 1) depth+=(-maxdepth 1)
fi fi
find "$dir" "${depth[@]}" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+ find "$dir" "${depth[@]}" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -sort-includes=false -i {} \+
fi fi
done done

0
security/nss/automation/ossfuzz/build.sh Normal file → Executable file
View file

View file

@ -1,4 +1,4 @@
4.24 4.35
# The first line of this file must contain the human readable NSPR # The first line of this file must contain the human readable NSPR
# version number, which is the minimum required version of NSPR # version number, which is the minimum required version of NSPR

View file

@ -5,9 +5,9 @@
import os import os
import sys import sys
import datetime
import shutil import shutil
import glob import re
import tempfile
from optparse import OptionParser from optparse import OptionParser
from subprocess import check_call from subprocess import check_call
from subprocess import check_output from subprocess import check_output
@ -32,136 +32,204 @@ abi_report_files = ['automation/abi-check/expected-report-libfreebl3.so.txt',
'automation/abi-check/expected-report-libsoftokn3.so.txt', 'automation/abi-check/expected-report-libsoftokn3.so.txt',
'automation/abi-check/expected-report-libssl3.so.txt'] 'automation/abi-check/expected-report-libssl3.so.txt']
def check_call_noisy(cmd, *args, **kwargs): def check_call_noisy(cmd, *args, **kwargs):
print "Executing command:", cmd print(("Executing command: {}".format(cmd)))
check_call(cmd, *args, **kwargs) check_call(cmd, *args, **kwargs)
o = OptionParser(usage="client.py [options] remove_beta | set_beta | print_library_versions | print_root_ca_version | set_root_ca_version | set_version_to_minor_release | set_version_to_patch_release | set_release_candidate_number | set_4_digit_release_number | create_nss_release_archive")
try:
options, args = o.parse_args()
action = args[0]
except IndexError:
o.print_help()
sys.exit(2)
def exit_with_failure(what): def exit_with_failure(what):
print "failure: ", what print(("failure: {}".format(what)))
sys.exit(2) sys.exit(2)
def check_files_exist(): def check_files_exist():
if (not os.path.exists(nssutil_h) or not os.path.exists(softkver_h) if (not os.path.exists(nssutil_h) or not os.path.exists(softkver_h)
or not os.path.exists(nss_h) or not os.path.exists(nssckbi_h)): or not os.path.exists(nss_h) or not os.path.exists(nssckbi_h)):
exit_with_failure("cannot find expected header files, must run from inside NSS hg directory") exit_with_failure("cannot find expected header files, must run from inside NSS hg directory")
def sed_inplace(sed_expression, filename):
backup_file = filename + '.tmp' class Replacement():
check_call_noisy(["sed", "-i.tmp", sed_expression, filename]) def __init__(self, regex="", repl=""):
os.remove(backup_file) self.regex = regex
self.repl = repl
self.matcher = re.compile(self.regex)
def replace(self, line):
return self.matcher.sub(self.repl, line)
def inplace_replace(replacements=[], filename=""):
for r in replacements:
if not isinstance(r, Replacement):
raise TypeError("Expecting a list of Replacement objects")
with tempfile.NamedTemporaryFile(mode="w", delete=False) as tmp_file:
with open(filename) as in_file:
for line in in_file:
for r in replacements:
line = r.replace(line)
tmp_file.write(line)
tmp_file.flush()
shutil.copystat(filename, tmp_file.name)
shutil.move(tmp_file.name, filename)
def toggle_beta_status(is_beta): def toggle_beta_status(is_beta):
check_files_exist() check_files_exist()
if (is_beta): if (is_beta):
print "adding Beta status to version numbers" print("adding Beta status to version numbers")
sed_inplace('s/^\(#define *NSSUTIL_VERSION *\"[0-9.]\+\)\" *$/\\1 Beta\"/', nssutil_h) inplace_replace(filename=nssutil_h, replacements=[
sed_inplace('s/^\(#define *NSSUTIL_BETA *\)PR_FALSE *$/\\1PR_TRUE/', nssutil_h) Replacement(regex=r'^(#define *NSSUTIL_VERSION *\"[0-9.]+)\" *$',
sed_inplace('s/^\(#define *SOFTOKEN_VERSION *\"[0-9.]\+\" *SOFTOKEN_ECC_STRING\) *$/\\1 \" Beta"/', softkver_h) repl=r'\g<1> Beta"'),
sed_inplace('s/^\(#define *SOFTOKEN_BETA *\)PR_FALSE *$/\\1PR_TRUE/', softkver_h) Replacement(regex=r'^(#define *NSSUTIL_BETA *)PR_FALSE *$',
sed_inplace('s/^\(#define *NSS_VERSION *\"[0-9.]\+\" *_NSS_CUSTOMIZED\) *$/\\1 \" Beta"/', nss_h) repl=r'\g<1>PR_TRUE')])
sed_inplace('s/^\(#define *NSS_BETA *\)PR_FALSE *$/\\1PR_TRUE/', nss_h) inplace_replace(filename=softkver_h, replacements=[
Replacement(regex=r'^(#define *SOFTOKEN_VERSION *\"[0-9.]+\" *SOFTOKEN_ECC_STRING) *$',
repl=r'\g<1> " Beta"'),
Replacement(regex=r'^(#define *SOFTOKEN_BETA *)PR_FALSE *$',
repl=r'\g<1>PR_TRUE')])
inplace_replace(filename=nss_h, replacements=[
Replacement(regex=r'^(#define *NSS_VERSION *\"[0-9.]+\" *_NSS_CUSTOMIZED) *$',
repl=r'\g<1> " Beta"'),
Replacement(regex=r'^(#define *NSS_BETA *)PR_FALSE *$',
repl=r'\g<1>PR_TRUE')])
else: else:
print "removing Beta status from version numbers" print("removing Beta status from version numbers")
sed_inplace('s/^\(#define *NSSUTIL_VERSION *\"[0-9.]\+\) *Beta\" *$/\\1\"/', nssutil_h) inplace_replace(filename=nssutil_h, replacements=[
sed_inplace('s/^\(#define *NSSUTIL_BETA *\)PR_TRUE *$/\\1PR_FALSE/', nssutil_h) Replacement(regex=r'^(#define *NSSUTIL_VERSION *\"[0-9.]+) *Beta\" *$',
sed_inplace('s/^\(#define *SOFTOKEN_VERSION *\"[0-9.]\+\" *SOFTOKEN_ECC_STRING\) *\" *Beta\" *$/\\1/', softkver_h) repl=r'\g<1>"'),
sed_inplace('s/^\(#define *SOFTOKEN_BETA *\)PR_TRUE *$/\\1PR_FALSE/', softkver_h) Replacement(regex=r'^(#define *NSSUTIL_BETA *)PR_TRUE *$',
sed_inplace('s/^\(#define *NSS_VERSION *\"[0-9.]\+\" *_NSS_CUSTOMIZED\) *\" *Beta\" *$/\\1/', nss_h) repl=r'\g<1>PR_FALSE')])
sed_inplace('s/^\(#define *NSS_BETA *\)PR_TRUE *$/\\1PR_FALSE/', nss_h) inplace_replace(filename=softkver_h, replacements=[
print "please run 'hg stat' and 'hg diff' to verify the files have been verified correctly" Replacement(regex=r'^(#define *SOFTOKEN_VERSION *\"[0-9.]+\" *SOFTOKEN_ECC_STRING) *\" *Beta\" *$',
repl=r'\g<1>'),
Replacement(regex=r'^(#define *SOFTOKEN_BETA *)PR_TRUE *$',
repl=r'\g<1>PR_FALSE')])
inplace_replace(filename=nss_h, replacements=[
Replacement(regex=r'^(#define *NSS_VERSION *\"[0-9.]+\" *_NSS_CUSTOMIZED) *\" *Beta\" *$',
repl=r'\g<1>'),
Replacement(regex=r'^(#define *NSS_BETA *)PR_TRUE *$',
repl=r'\g<1>PR_FALSE')])
print("please run 'hg stat' and 'hg diff' to verify the files have been verified correctly")
def print_beta_versions(): def print_beta_versions():
check_call_noisy(["egrep", "#define *NSSUTIL_VERSION|#define *NSSUTIL_BETA", nssutil_h]) check_call_noisy(["egrep", "#define *NSSUTIL_VERSION|#define *NSSUTIL_BETA", nssutil_h])
check_call_noisy(["egrep", "#define *SOFTOKEN_VERSION|#define *SOFTOKEN_BETA", softkver_h]) check_call_noisy(["egrep", "#define *SOFTOKEN_VERSION|#define *SOFTOKEN_BETA", softkver_h])
check_call_noisy(["egrep", "#define *NSS_VERSION|#define *NSS_BETA", nss_h]) check_call_noisy(["egrep", "#define *NSS_VERSION|#define *NSS_BETA", nss_h])
def remove_beta_status(): def remove_beta_status():
print "--- removing beta flags. Existing versions were:" print("--- removing beta flags. Existing versions were:")
print_beta_versions() print_beta_versions()
toggle_beta_status(False) toggle_beta_status(False)
print "--- finished modifications, new versions are:" print("--- finished modifications, new versions are:")
print_beta_versions() print_beta_versions()
def set_beta_status(): def set_beta_status():
print "--- adding beta flags. Existing versions were:" print("--- adding beta flags. Existing versions were:")
print_beta_versions() print_beta_versions()
toggle_beta_status(True) toggle_beta_status(True)
print "--- finished modifications, new versions are:" print("--- finished modifications, new versions are:")
print_beta_versions() print_beta_versions()
def print_library_versions(): def print_library_versions():
check_files_exist() check_files_exist()
check_call_noisy(["egrep", "#define *NSSUTIL_VERSION|#define NSSUTIL_VMAJOR|#define *NSSUTIL_VMINOR|#define *NSSUTIL_VPATCH|#define *NSSUTIL_VBUILD|#define *NSSUTIL_BETA", nssutil_h]) check_call_noisy(["egrep", "#define *NSSUTIL_VERSION|#define NSSUTIL_VMAJOR|#define *NSSUTIL_VMINOR|#define *NSSUTIL_VPATCH|#define *NSSUTIL_VBUILD|#define *NSSUTIL_BETA", nssutil_h])
check_call_noisy(["egrep", "#define *SOFTOKEN_VERSION|#define SOFTOKEN_VMAJOR|#define *SOFTOKEN_VMINOR|#define *SOFTOKEN_VPATCH|#define *SOFTOKEN_VBUILD|#define *SOFTOKEN_BETA", softkver_h]) check_call_noisy(["egrep", "#define *SOFTOKEN_VERSION|#define SOFTOKEN_VMAJOR|#define *SOFTOKEN_VMINOR|#define *SOFTOKEN_VPATCH|#define *SOFTOKEN_VBUILD|#define *SOFTOKEN_BETA", softkver_h])
check_call_noisy(["egrep", "#define *NSS_VERSION|#define NSS_VMAJOR|#define *NSS_VMINOR|#define *NSS_VPATCH|#define *NSS_VBUILD|#define *NSS_BETA", nss_h]) check_call_noisy(["egrep", "#define *NSS_VERSION|#define NSS_VMAJOR|#define *NSS_VMINOR|#define *NSS_VPATCH|#define *NSS_VBUILD|#define *NSS_BETA", nss_h])
def print_root_ca_version(): def print_root_ca_version():
check_files_exist() check_files_exist()
check_call_noisy(["grep", "define *NSS_BUILTINS_LIBRARY_VERSION", nssckbi_h]) check_call_noisy(["grep", "define *NSS_BUILTINS_LIBRARY_VERSION", nssckbi_h])
def ensure_arguments_after_action(how_many, usage): def ensure_arguments_after_action(how_many, usage):
if (len(sys.argv) != (2+how_many)): if (len(sys.argv) != (2 + how_many)):
exit_with_failure("incorrect number of arguments, expected parameters are:\n" + usage) exit_with_failure("incorrect number of arguments, expected parameters are:\n" + usage)
def set_major_versions(major): def set_major_versions(major):
sed_inplace('s/^\(#define *NSSUTIL_VMAJOR *\).*$/\\1' + major + '/', nssutil_h) for name, file in [["NSSUTIL_VMAJOR", nssutil_h],
sed_inplace('s/^\(#define *SOFTOKEN_VMAJOR *\).*$/\\1' + major + '/', softkver_h) ["SOFTOKEN_VMAJOR", softkver_h],
sed_inplace('s/^\(#define *NSS_VMAJOR *\).*$/\\1' + major + '/', nss_h) ["NSS_VMAJOR", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(major))])
def set_minor_versions(minor): def set_minor_versions(minor):
sed_inplace('s/^\(#define *NSSUTIL_VMINOR *\).*$/\\1' + minor + '/', nssutil_h) for name, file in [["NSSUTIL_VMINOR", nssutil_h],
sed_inplace('s/^\(#define *SOFTOKEN_VMINOR *\).*$/\\1' + minor + '/', softkver_h) ["SOFTOKEN_VMINOR", softkver_h],
sed_inplace('s/^\(#define *NSS_VMINOR *\).*$/\\1' + minor + '/', nss_h) ["NSS_VMINOR", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(minor))])
def set_patch_versions(patch): def set_patch_versions(patch):
sed_inplace('s/^\(#define *NSSUTIL_VPATCH *\).*$/\\1' + patch + '/', nssutil_h) for name, file in [["NSSUTIL_VPATCH", nssutil_h],
sed_inplace('s/^\(#define *SOFTOKEN_VPATCH *\).*$/\\1' + patch + '/', softkver_h) ["SOFTOKEN_VPATCH", softkver_h],
sed_inplace('s/^\(#define *NSS_VPATCH *\).*$/\\1' + patch + '/', nss_h) ["NSS_VPATCH", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(patch))])
def set_build_versions(build): def set_build_versions(build):
sed_inplace('s/^\(#define *NSSUTIL_VBUILD *\).*$/\\1' + build + '/', nssutil_h) for name, file in [["NSSUTIL_VBUILD", nssutil_h],
sed_inplace('s/^\(#define *SOFTOKEN_VBUILD *\).*$/\\1' + build + '/', softkver_h) ["SOFTOKEN_VBUILD", softkver_h],
sed_inplace('s/^\(#define *NSS_VBUILD *\).*$/\\1' + build + '/', nss_h) ["NSS_VBUILD", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} ?).*$'.format(name),
repl=r'\g<1>{}'.format(build))])
def set_full_lib_versions(version): def set_full_lib_versions(version):
sed_inplace('s/^\(#define *NSSUTIL_VERSION *\"\)\([0-9.]\+\)\(.*\)$/\\1' + version + '\\3/', nssutil_h) for name, file in [["NSSUTIL_VERSION", nssutil_h],
sed_inplace('s/^\(#define *SOFTOKEN_VERSION *\"\)\([0-9.]\+\)\(.*\)$/\\1' + version + '\\3/', softkver_h) ["SOFTOKEN_VERSION", softkver_h],
sed_inplace('s/^\(#define *NSS_VERSION *\"\)\([0-9.]\+\)\(.*\)$/\\1' + version + '\\3/', nss_h) ["NSS_VERSION", nss_h]]:
inplace_replace(filename=file, replacements=[
Replacement(regex=r'^(#define *{} *\")([0-9.]+)(.*)$'.format(name),
repl=r'\g<1>{}\g<3>'.format(version))])
def set_root_ca_version(): def set_root_ca_version():
ensure_arguments_after_action(2, "major_version minor_version") ensure_arguments_after_action(2, "major_version minor_version")
major = args[1].strip() major = args[1].strip()
minor = args[2].strip() minor = args[2].strip()
version = major + '.' + minor version = major + '.' + minor
sed_inplace('s/^\(#define *NSS_BUILTINS_LIBRARY_VERSION *\"\).*$/\\1' + version + '/', nssckbi_h)
sed_inplace('s/^\(#define *NSS_BUILTINS_LIBRARY_VERSION_MAJOR *\).*$/\\1' + major + '/', nssckbi_h) inplace_replace(filename=nssckbi_h, replacements=[
sed_inplace('s/^\(#define *NSS_BUILTINS_LIBRARY_VERSION_MINOR *\).*$/\\1' + minor + '/', nssckbi_h) Replacement(regex=r'^(#define *NSS_BUILTINS_LIBRARY_VERSION *\").*$',
repl=r'\g<1>{}"'.format(version)),
Replacement(regex=r'^(#define *NSS_BUILTINS_LIBRARY_VERSION_MAJOR ?).*$',
repl=r'\g<1>{}'.format(major)),
Replacement(regex=r'^(#define *NSS_BUILTINS_LIBRARY_VERSION_MINOR ?).*$',
repl=r'\g<1>{}'.format(minor))])
def set_all_lib_versions(version, major, minor, patch, build): def set_all_lib_versions(version, major, minor, patch, build):
grep_major = check_output(['grep', 'define.*NSS_VMAJOR', nss_h]) grep_major = check_output(['grep', 'define.*NSS_VMAJOR', nss_h])
grep_minor = check_output(['grep', 'define.*NSS_VMINOR', nss_h]) grep_minor = check_output(['grep', 'define.*NSS_VMINOR', nss_h])
old_major = int(grep_major.split()[2]); old_major = int(grep_major.split()[2])
old_minor = int(grep_minor.split()[2]); old_minor = int(grep_minor.split()[2])
new_major = int(major) new_major = int(major)
new_minor = int(minor) new_minor = int(minor)
if (old_major < new_major or (old_major == new_major and old_minor < new_minor)): if (old_major < new_major or (old_major == new_major and old_minor < new_minor)):
print "You're increasing the minor (or major) version:" print("You're increasing the minor (or major) version:")
print "- erasing ABI comparison expectations" print("- erasing ABI comparison expectations")
new_branch = "NSS_" + str(old_major) + "_" + str(old_minor) + "_BRANCH" new_branch = "NSS_" + str(old_major) + "_" + str(old_minor) + "_BRANCH"
print "- setting reference branch to the branch of the previous version: " + new_branch print(("- setting reference branch to the branch of the previous version: " + new_branch))
with open(abi_base_version_file, "w") as abi_base: with open(abi_base_version_file, "w") as abi_base:
abi_base.write("%s\n" % new_branch) abi_base.write("%s\n" % new_branch)
for report_file in abi_report_files: for report_file in abi_report_files:
@ -174,6 +242,7 @@ def set_all_lib_versions(version, major, minor, patch, build):
set_patch_versions(patch) set_patch_versions(patch)
set_build_versions(build) set_build_versions(build)
def set_version_to_minor_release(): def set_version_to_minor_release():
ensure_arguments_after_action(2, "major_version minor_version") ensure_arguments_after_action(2, "major_version minor_version")
major = args[1].strip() major = args[1].strip()
@ -183,6 +252,7 @@ def set_version_to_minor_release():
build = "0" build = "0"
set_all_lib_versions(version, major, minor, patch, build) set_all_lib_versions(version, major, minor, patch, build)
def set_version_to_patch_release(): def set_version_to_patch_release():
ensure_arguments_after_action(3, "major_version minor_version patch_release") ensure_arguments_after_action(3, "major_version minor_version patch_release")
major = args[1].strip() major = args[1].strip()
@ -192,11 +262,13 @@ def set_version_to_patch_release():
build = "0" build = "0"
set_all_lib_versions(version, major, minor, patch, build) set_all_lib_versions(version, major, minor, patch, build)
def set_release_candidate_number(): def set_release_candidate_number():
ensure_arguments_after_action(1, "release_candidate_number") ensure_arguments_after_action(1, "release_candidate_number")
build = args[1].strip() build = args[1].strip()
set_build_versions(build) set_build_versions(build)
def set_4_digit_release_number(): def set_4_digit_release_number():
ensure_arguments_after_action(4, "major_version minor_version patch_release 4th_digit_release_number") ensure_arguments_after_action(4, "major_version minor_version patch_release 4th_digit_release_number")
major = args[1].strip() major = args[1].strip()
@ -206,21 +278,22 @@ def set_4_digit_release_number():
version = major + '.' + minor + '.' + patch + '.' + build version = major + '.' + minor + '.' + patch + '.' + build
set_all_lib_versions(version, major, minor, patch, build) set_all_lib_versions(version, major, minor, patch, build)
def create_nss_release_archive(): def create_nss_release_archive():
ensure_arguments_after_action(3, "nss_release_version nss_hg_release_tag path_to_stage_directory") ensure_arguments_after_action(3, "nss_release_version nss_hg_release_tag path_to_stage_directory")
nssrel = args[1].strip() #e.g. 3.19.3 nssrel = args[1].strip() # e.g. 3.19.3
nssreltag = args[2].strip() #e.g. NSS_3_19_3_RTM nssreltag = args[2].strip() # e.g. NSS_3_19_3_RTM
stagedir = args[3].strip() #e.g. ../stage stagedir = args[3].strip() # e.g. ../stage
with open('automation/release/nspr-version.txt') as nspr_version_file: with open('automation/release/nspr-version.txt') as nspr_version_file:
nsprrel = next(nspr_version_file).strip() nsprrel = next(nspr_version_file).strip()
nspr_tar = "nspr-" + nsprrel + ".tar.gz" nspr_tar = "nspr-" + nsprrel + ".tar.gz"
nsprtar_with_path= stagedir + "/v" + nsprrel + "/src/" + nspr_tar nsprtar_with_path = stagedir + "/v" + nsprrel + "/src/" + nspr_tar
if (not os.path.exists(nsprtar_with_path)): if (not os.path.exists(nsprtar_with_path)):
exit_with_failure("cannot find nspr archive at expected location " + nsprtar_with_path) exit_with_failure("cannot find nspr archive at expected location " + nsprtar_with_path)
nss_stagedir= stagedir + "/" + nssreltag + "/src" nss_stagedir = stagedir + "/" + nssreltag + "/src"
if (os.path.exists(nss_stagedir)): if (os.path.exists(nss_stagedir)):
exit_with_failure("nss stage directory already exists: " + nss_stagedir) exit_with_failure("nss stage directory already exists: " + nss_stagedir)
@ -230,7 +303,7 @@ def create_nss_release_archive():
check_call_noisy(["hg", "archive", "-r", nssreltag, "--prefix=nss-" + nssrel + "/nss", check_call_noisy(["hg", "archive", "-r", nssreltag, "--prefix=nss-" + nssrel + "/nss",
stagedir + "/" + nssreltag + "/src/" + nss_tar, "-X", ".hgtags"]) stagedir + "/" + nssreltag + "/src/" + nss_tar, "-X", ".hgtags"])
check_call_noisy(["tar", "-xz", "-C", nss_stagedir, "-f", nsprtar_with_path]) check_call_noisy(["tar", "-xz", "-C", nss_stagedir, "-f", nsprtar_with_path])
print "changing to directory " + nss_stagedir print(("changing to directory " + nss_stagedir))
os.chdir(nss_stagedir) os.chdir(nss_stagedir)
check_call_noisy(["tar", "-xz", "-f", nss_tar]) check_call_noisy(["tar", "-xz", "-f", nss_tar])
check_call_noisy(["mv", "-i", "nspr-" + nsprrel + "/nspr", "nss-" + nssrel + "/"]) check_call_noisy(["mv", "-i", "nspr-" + nsprrel + "/nspr", "nss-" + nssrel + "/"])
@ -241,9 +314,23 @@ def create_nss_release_archive():
check_call_noisy(["tar", "-cz", "--remove-files", "-f", nss_nspr_tar, "nss-" + nssrel]) check_call_noisy(["tar", "-cz", "--remove-files", "-f", nss_nspr_tar, "nss-" + nssrel])
check_call("sha1sum " + nss_tar + " " + nss_nspr_tar + " > SHA1SUMS", shell=True) check_call("sha1sum " + nss_tar + " " + nss_nspr_tar + " > SHA1SUMS", shell=True)
check_call("sha256sum " + nss_tar + " " + nss_nspr_tar + " > SHA256SUMS", shell=True) check_call("sha256sum " + nss_tar + " " + nss_nspr_tar + " > SHA256SUMS", shell=True)
print "created directory " + nss_stagedir + " with files:" print(("created directory " + nss_stagedir + " with files:"))
check_call_noisy(["ls", "-l"]) check_call_noisy(["ls", "-l"])
o = OptionParser(usage="client.py [options] " + " | ".join([
"remove_beta", "set_beta", "print_library_versions", "print_root_ca_version",
"set_root_ca_version", "set_version_to_minor_release",
"set_version_to_patch_release", "set_release_candidate_number",
"set_4_digit_release_number", "create_nss_release_archive"]))
try:
options, args = o.parse_args()
action = args[0]
except IndexError:
o.print_help()
sys.exit(2)
if action in ('remove_beta'): if action in ('remove_beta'):
remove_beta_status() remove_beta_status()

View file

@ -1,8 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
bmul : {n,m} (fin n, n >= 1, m == n*2 - 1) => [n] -> [n] -> ([n], [n])
bmul a b = (take`{n} prod, drop`{n} prod)
where prod = pad (pmult a b : [m])
pad x = zero # x

View file

@ -1,26 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import "bmul.cry";
print "Loading LLVM bitcode...";
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
let SpecBinaryMul n = do {
x <- llvm_var "x" (llvm_int n);
y <- llvm_var "y" (llvm_int n);
llvm_ptr "r_high" (llvm_int n);
r_high <- llvm_var "*r_high" (llvm_int n);
llvm_ptr "r_low" (llvm_int n);
r_low <- llvm_var "*r_low" (llvm_int n);
let res = {{ bmul x y }};
llvm_ensure_eq "*r_high" {{ res.0 }};
llvm_ensure_eq "*r_low" {{ res.1 }};
llvm_verify_tactic abc;
};
print "Proving equality for 32-bit bmul()...";
time (llvm_verify m "bmul32" [] (SpecBinaryMul 32));

View file

@ -1,357 +0,0 @@
/*
** ChaCha20 specification
** Author: Austin Seipp <aseipp@pobox.com>. Released in the Public Domain.
**
** Based on RFC 7539 - "ChaCha20 and Poly1305 for IETF Protocols"
** https://tools.ietf.org/html/rfc7539
*/
module chacha20 where
/* -------------------------------------------------------------------------- */
/* -- Implementation -------------------------------------------------------- */
type Round = [16][32] // An input to the ChaCha20 core function
type Block = [64][8] // An output block from the ChaCha20 core function.
type Key = [32][8] // A 32-byte input key
type Nonce = [12][8] // A 12-byte nonce
type Counter = [32] // Starting block counter. Usually 1 or 0.
/* ---------------------------------- */
/* -- Quarter Round ----------------- */
// The quarter round. This takes 4 32-bit integers and diffuses them
// appropriately, and is the core of the column and diagonal round.
qround : [4][32] -> [4][32]
qround [ a0, b0, c0, d0 ] = [ a2, b4, c2, d4 ]
where
a1 = a0 + b0 /* a += b; d ^= a; d <<<= 16 */
d1 = d0 ^ a1
d2 = d1 <<< 16
c1 = c0 + d2 /* c += d; b ^= c; b <<<= 12 */
b1 = b0 ^ c1
b2 = b1 <<< 12
a2 = a1 + b2 /* a += b; d ^= a; d <<<= 8 */
d3 = d2 ^ a2
d4 = d3 <<< 8
c2 = c1 + d4 /* c += d; b ^= c; b <<<= 7 */
b3 = b2 ^ c2
b4 = b3 <<< 7
/* ---------------------------------- */
/* -- Column and diagonal rounds ---- */
// Perform the column round, followed by the diagonal round on the
// input state, which are both defined in terms of the quarter
// round. ChaCha20 requires 20 total rounds of interleaving
// column/diagonal passes on the state, and therefore `cdround` actually
// does two passes at once (mostly for simplicity).
cdround : Round -> Round
cdround [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 ]
= [ z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15 ]
where
// Column round
[ y0, y4, y8, y12 ] = qround [ x0, x4, x8, x12 ]
[ y1, y5, y9, y13 ] = qround [ x1, x5, x9, x13 ]
[ y2, y6, y10, y14 ] = qround [ x2, x6, x10, x14 ]
[ y3, y7, y11, y15 ] = qround [ x3, x7, x11, x15 ]
// Diagonal round
[ z0, z5, z10, z15 ] = qround [ y0, y5, y10, y15 ]
[ z1, z6, z11, z12 ] = qround [ y1, y6, y11, y12 ]
[ z2, z7, z8, z13 ] = qround [ y2, y7, y8, y13 ]
[ z3, z4, z9, z14 ] = qround [ y3, y4, y9, y14 ]
/* ---------------------------------- */
/* -- Block encryption -------------- */
// Given an input round, calculate the core ChaCha20 algorithm over
// the round and return an output block. These output blocks form the
// stream which you XOR your plaintext with, and successive iterations of
// the core algorithm result in an infinite stream you can use as a
// cipher.
core : Round -> Block
core x = block
where
rounds = iterate cdround x // Do a bunch of column/diagonal passes...
result = rounds @ 10 // And grab the 10th result (20 total passes)
block = blocked (x + result) // Add to input, convert to output block
/* ---------------------------------- */
/* -- Key Expansion ----------------- */
// Key expansion. Given a nonce and a key, compute a round (which is
// fed to the core algorithm above) by taking the initial round state and
// mixing in the key and nonce appropriately.
kexp : Key -> Counter -> Nonce -> Round
kexp k c n = [ c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15 ]
where
// The following describes the layout of the output round, which
// is fed into the core algorithm successively.
// Bytes 0-3: Constants
[ c0, c1, c2, c3 ] = [ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 ]
// Bytes 4-11: Key
[ c4, c5, c6, c7 ] = map rjoin (groupBy`{4} kslice1 : [4][4][8]) : [4][32]
[ c8, c9, c10, c11 ] = map rjoin (groupBy`{4} kslice2 : [4][4][8]) : [4][32]
kslice1 = k @@ ([ 0 .. 15 ] : [16][32]) // Top half
kslice2 = k @@ ([ 16 .. 31 ] : [16][32]) // Bottom half
// Bytes 12: Counter, starts off with whatever the user specified
// (usually 0 or 1)
[ c12 ] = [ c ]
// Bytes 14-15: Nonce
[ c13, c14, c15 ] = map rjoin (groupBy`{4} n)
/* ---------------------------------- */
/* -- Round increments -------------- */
// Take a given number of iterations and the input round (after key
// expansion!), and calculate the input round for the core algorithm
// function. This allows you to index into a particular Round which
// can be passed to the 'core' function.
iround : [64] -> Round -> Round
iround n r = (iterate once r) @ n where
// Given a round, increment the counter inside (index no 12)
once [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15 ]
= [ x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12+1, x13, x14, x15 ]
/* ---------------------------------- */
/* -- ChaCha20 encryption ----------- */
// Produce a psuedo-random stream given a nonce and a key, which can
// be XOR'd with your data to encrypt it.
stream : {n} (fin n) => Key -> Counter -> Nonce -> [n][8]
stream k c n = take`{n} (join rounds) // Take n bytes from the final result
where
// Expand key
key = kexp k c n
// Produce the stream by successively incrementing the input round
// by `i`, and running the core algorithm to get the resulting
// stream for the `i`th input. Once these are concatenated, you have
// an infinite list representing the ChaCha20 stream.
rounds = [ core (iround i key) | i <- [ 0, 1 ... ] ]
// Given an message, a nonce, and a key, produce an encrypted
// message. This is simply defined as the XOR of the message and the
// corresponding encryption stream.
encrypt : {n} (fin n) => Key -> Counter -> Nonce -> [n][8] -> [n][8]
encrypt k c n m = m ^ (stream k c n)
/* -------------------------------------------------------------------------- */
/* -- Theorems, tests ------------------------------------------------------- */
// Tests are private
private
qround01 = qround in == out
where
in = [ 0x11111111, 0x01020304, 0x9b8d6f43, 0x01234567 ]
out = [ 0xea2a92f4, 0xcb1cf8ce, 0x4581472e, 0x5881c4bb ]
core01 = kexp k 1 n == out
where
n = [ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a,
0x00, 0x00, 0x00, 0x00 ]
k = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f ]
out = [ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574,
0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c,
0x00000001, 0x09000000, 0x4a000000, 0x00000000 ]
core02 = core (kexp k 1 n) == out
where
n = [ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4a,
0x00, 0x00, 0x00, 0x00 ]
k = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f ]
out = [ 0x10, 0xf1, 0xe7, 0xe4, 0xd1, 0x3b, 0x59, 0x15,
0x50, 0x0f, 0xdd, 0x1f, 0xa3, 0x20, 0x71, 0xc4,
0xc7, 0xd1, 0xf4, 0xc7, 0x33, 0xc0, 0x68, 0x03,
0x04, 0x22, 0xaa, 0x9a, 0xc3, 0xd4, 0x6c, 0x4e,
0xd2, 0x82, 0x64, 0x46, 0x07, 0x9f, 0xaa, 0x09,
0x14, 0xc2, 0xd7, 0x05, 0xd9, 0x8b, 0x02, 0xa2,
0xb5, 0x12, 0x9c, 0xd1, 0xde, 0x16, 0x4e, 0xb9,
0xcb, 0xd0, 0x83, 0xe8, 0xa2, 0x50, 0x3c, 0x4e ]
rfctest01 = encrypt zero zero zero zero
== [ 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90, 0x40, 0x5d,
0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28, 0xbd, 0xd2, 0x19, 0xb8,
0xa0, 0x8d, 0xed, 0x1a, 0xa8, 0x36, 0xef, 0xcc, 0x8b, 0x77,
0x0d, 0xc7, 0xda, 0x41, 0x59, 0x7c, 0x51, 0x57, 0x48, 0x8d,
0x77, 0x24, 0xe0, 0x3f, 0xb8, 0xd8, 0x4a, 0x37, 0x6a, 0x43,
0xb8, 0xf4, 0x15, 0x18, 0xa1, 0x1c, 0xc3, 0x87, 0xb6, 0x69,
0xb2, 0xee, 0x65, 0x86 ]
rfctest02 = encrypt (zero # [1]) 1 (zero # [2]) msg == out
where
out = [ 0xa3, 0xfb, 0xf0, 0x7d, 0xf3, 0xfa, 0x2f, 0xde, 0x4f, 0x37,
0x6c, 0xa2, 0x3e, 0x82, 0x73, 0x70, 0x41, 0x60, 0x5d, 0x9f,
0x4f, 0x4f, 0x57, 0xbd, 0x8c, 0xff, 0x2c, 0x1d, 0x4b, 0x79,
0x55, 0xec, 0x2a, 0x97, 0x94, 0x8b, 0xd3, 0x72, 0x29, 0x15,
0xc8, 0xf3, 0xd3, 0x37, 0xf7, 0xd3, 0x70, 0x05, 0x0e, 0x9e,
0x96, 0xd6, 0x47, 0xb7, 0xc3, 0x9f, 0x56, 0xe0, 0x31, 0xca,
0x5e, 0xb6, 0x25, 0x0d, 0x40, 0x42, 0xe0, 0x27, 0x85, 0xec,
0xec, 0xfa, 0x4b, 0x4b, 0xb5, 0xe8, 0xea, 0xd0, 0x44, 0x0e,
0x20, 0xb6, 0xe8, 0xdb, 0x09, 0xd8, 0x81, 0xa7, 0xc6, 0x13,
0x2f, 0x42, 0x0e, 0x52, 0x79, 0x50, 0x42, 0xbd, 0xfa, 0x77,
0x73, 0xd8, 0xa9, 0x05, 0x14, 0x47, 0xb3, 0x29, 0x1c, 0xe1,
0x41, 0x1c, 0x68, 0x04, 0x65, 0x55, 0x2a, 0xa6, 0xc4, 0x05,
0xb7, 0x76, 0x4d, 0x5e, 0x87, 0xbe, 0xa8, 0x5a, 0xd0, 0x0f,
0x84, 0x49, 0xed, 0x8f, 0x72, 0xd0, 0xd6, 0x62, 0xab, 0x05,
0x26, 0x91, 0xca, 0x66, 0x42, 0x4b, 0xc8, 0x6d, 0x2d, 0xf8,
0x0e, 0xa4, 0x1f, 0x43, 0xab, 0xf9, 0x37, 0xd3, 0x25, 0x9d,
0xc4, 0xb2, 0xd0, 0xdf, 0xb4, 0x8a, 0x6c, 0x91, 0x39, 0xdd,
0xd7, 0xf7, 0x69, 0x66, 0xe9, 0x28, 0xe6, 0x35, 0x55, 0x3b,
0xa7, 0x6c, 0x5c, 0x87, 0x9d, 0x7b, 0x35, 0xd4, 0x9e, 0xb2,
0xe6, 0x2b, 0x08, 0x71, 0xcd, 0xac, 0x63, 0x89, 0x39, 0xe2,
0x5e, 0x8a, 0x1e, 0x0e, 0xf9, 0xd5, 0x28, 0x0f, 0xa8, 0xca,
0x32, 0x8b, 0x35, 0x1c, 0x3c, 0x76, 0x59, 0x89, 0xcb, 0xcf,
0x3d, 0xaa, 0x8b, 0x6c, 0xcc, 0x3a, 0xaf, 0x9f, 0x39, 0x79,
0xc9, 0x2b, 0x37, 0x20, 0xfc, 0x88, 0xdc, 0x95, 0xed, 0x84,
0xa1, 0xbe, 0x05, 0x9c, 0x64, 0x99, 0xb9, 0xfd, 0xa2, 0x36,
0xe7, 0xe8, 0x18, 0xb0, 0x4b, 0x0b, 0xc3, 0x9c, 0x1e, 0x87,
0x6b, 0x19, 0x3b, 0xfe, 0x55, 0x69, 0x75, 0x3f, 0x88, 0x12,
0x8c, 0xc0, 0x8a, 0xaa, 0x9b, 0x63, 0xd1, 0xa1, 0x6f, 0x80,
0xef, 0x25, 0x54, 0xd7, 0x18, 0x9c, 0x41, 0x1f, 0x58, 0x69,
0xca, 0x52, 0xc5, 0xb8, 0x3f, 0xa3, 0x6f, 0xf2, 0x16, 0xb9,
0xc1, 0xd3, 0x00, 0x62, 0xbe, 0xbc, 0xfd, 0x2d, 0xc5, 0xbc,
0xe0, 0x91, 0x19, 0x34, 0xfd, 0xa7, 0x9a, 0x86, 0xf6, 0xe6,
0x98, 0xce, 0xd7, 0x59, 0xc3, 0xff, 0x9b, 0x64, 0x77, 0x33,
0x8f, 0x3d, 0xa4, 0xf9, 0xcd, 0x85, 0x14, 0xea, 0x99, 0x82,
0xcc, 0xaf, 0xb3, 0x41, 0xb2, 0x38, 0x4d, 0xd9, 0x02, 0xf3,
0xd1, 0xab, 0x7a, 0xc6, 0x1d, 0xd2, 0x9c, 0x6f, 0x21, 0xba,
0x5b, 0x86, 0x2f, 0x37, 0x30, 0xe3, 0x7c, 0xfd, 0xc4, 0xfd,
0x80, 0x6c, 0x22, 0xf2, 0x21 ]
msg = [ 0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
0x65, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x69, 0x6e, 0x74,
0x65, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x6f, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x20, 0x61, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61,
0x6e, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x49, 0x6e, 0x74,
0x65, 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72, 0x61, 0x66,
0x74, 0x20, 0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x74, 0x61,
0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x61, 0x64,
0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x74,
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54,
0x46, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
0x20, 0x69, 0x73, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64,
0x65, 0x72, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x69,
0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2e, 0x20, 0x53,
0x75, 0x63, 0x68, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d,
0x65, 0x6e, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20, 0x73, 0x74,
0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x69,
0x6e, 0x20, 0x49, 0x45, 0x54, 0x46, 0x20, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20, 0x77, 0x72,
0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20,
0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63,
0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61, 0x64, 0x65,
0x20, 0x61, 0x74, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x74, 0x69,
0x6d, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x6c, 0x61, 0x63,
0x65, 0x2c, 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
0x65, 0x64, 0x20, 0x74, 0x6f ]
rfctest03 = encrypt key 42 (zero # [2]) msg == out
where
key = [ 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a, 0xf3, 0x33,
0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0, 0x47, 0x39, 0x17, 0xc1,
0x40, 0x2b, 0x80, 0x09, 0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70,
0x75, 0xc0 ]
out = [ 0x27, 0x54, 0x77, 0x61, 0x73, 0x20, 0x62, 0x72, 0x69, 0x6c,
0x6c, 0x69, 0x67, 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74,
0x68, 0x65, 0x20, 0x73, 0x6c, 0x69, 0x74, 0x68, 0x79, 0x20,
0x74, 0x6f, 0x76, 0x65, 0x73, 0x0a, 0x44, 0x69, 0x64, 0x20,
0x67, 0x79, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x67,
0x69, 0x6d, 0x62, 0x6c, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x74,
0x68, 0x65, 0x20, 0x77, 0x61, 0x62, 0x65, 0x3a, 0x0a, 0x41,
0x6c, 0x6c, 0x20, 0x6d, 0x69, 0x6d, 0x73, 0x79, 0x20, 0x77,
0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x6f,
0x72, 0x6f, 0x67, 0x6f, 0x76, 0x65, 0x73, 0x2c, 0x0a, 0x41,
0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x6f, 0x6d,
0x65, 0x20, 0x72, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6f, 0x75,
0x74, 0x67, 0x72, 0x61, 0x62, 0x65, 0x2e ]
msg = [ 0x62, 0xe6, 0x34, 0x7f, 0x95, 0xed, 0x87, 0xa4, 0x5f, 0xfa,
0xe7, 0x42, 0x6f, 0x27, 0xa1, 0xdf, 0x5f, 0xb6, 0x91, 0x10,
0x04, 0x4c, 0x0d, 0x73, 0x11, 0x8e, 0xff, 0xa9, 0x5b, 0x01,
0xe5, 0xcf, 0x16, 0x6d, 0x3d, 0xf2, 0xd7, 0x21, 0xca, 0xf9,
0xb2, 0x1e, 0x5f, 0xb1, 0x4c, 0x61, 0x68, 0x71, 0xfd, 0x84,
0xc5, 0x4f, 0x9d, 0x65, 0xb2, 0x83, 0x19, 0x6c, 0x7f, 0xe4,
0xf6, 0x05, 0x53, 0xeb, 0xf3, 0x9c, 0x64, 0x02, 0xc4, 0x22,
0x34, 0xe3, 0x2a, 0x35, 0x6b, 0x3e, 0x76, 0x43, 0x12, 0xa6,
0x1a, 0x55, 0x32, 0x05, 0x57, 0x16, 0xea, 0xd6, 0x96, 0x25,
0x68, 0xf8, 0x7d, 0x3f, 0x3f, 0x77, 0x04, 0xc6, 0xa8, 0xd1,
0xbc, 0xd1, 0xbf, 0x4d, 0x50, 0xd6, 0x15, 0x4b, 0x6d, 0xa7,
0x31, 0xb1, 0x87, 0xb5, 0x8d, 0xfd, 0x72, 0x8a, 0xfa, 0x36,
0x75, 0x7a, 0x79, 0x7a, 0xc1, 0x88, 0xd1 ]
property allTestsPass =
([ // Basic tests
qround01, core01, core02
// Full RFC test vectors
, rfctest01, rfctest02, rfctest03
] : [_]Bit) == ~zero // All test bits should equal one
/* -------------------------------------------------------------------------- */
/* -- Private utilities ----------------------------------------------------- */
private
// Convert a round into a block, by splitting every 32-bit round entry
// into 4 bytes, and then serialize those values into a full block.
blocked : Round -> Block
blocked x = join (map toBytes x)
where
// This essentially splits a 32-bit number into 4-byte
// little-endian form, where 'rjoin' is the inverse and would merge
// 4 bytes as a 32-bit little endian number.
toBytes : [32] -> [4][8]
toBytes v = reverse (groupBy`{8} v)
// Map a function over a finite list.
map : { a, b, c }
(a -> b) -> [c]a -> [c]b
map f xs = [ f x | x <- xs ]
// Map a function iteratively over a seed value, producing an infinite
// list of successive function applications:
//
// iterate f 0 == [ 0, f 0, f (f 0), f (f (f 0)), ... ]
iterate : { a } (a -> a) -> a -> [inf]a
iterate f x = [x] # [ f v | v <- iterate f x ]
where
// NB: Needs a binded name in order to tie the recursive knot.
xs = [x] # [ f v | v <- xs ]
// rjoin = join . reverse
// This encodes a sequence of values as a little endian number
// e.g. [ 0xaa, 0xbb, 0xcc, 0xdd ] is serialized as \xdd\xcc\xbb\xaa
rjoin : {a, b, c}
( fin a, fin c
) => [c][a]b -> [a * c]b
rjoin x = join (reverse x)

View file

@ -1,40 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import "chacha20.cry" as chacha20;
print "Proving ChaCha20 spec...";
prove_print abc {{ chacha20::allTestsPass }};
print "Loading LLVM bitcode...";
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
let SpecChaCha20 n = do {
llvm_ptr "output" (llvm_array n (llvm_int 8));
output <- llvm_var "*output" (llvm_array n (llvm_int 8));
llvm_ptr "plain" (llvm_array n (llvm_int 8));
plain <- llvm_var "*plain" (llvm_array n (llvm_int 8));
len <- llvm_var "len" (llvm_int 32);
llvm_assert_eq "len" {{ `n : [32] }};
llvm_ptr "k" (llvm_array 32 (llvm_int 8));
k <- llvm_var "*k" (llvm_array 32 (llvm_int 8));
llvm_ptr "n1" (llvm_array 12 (llvm_int 8));
n1 <- llvm_var "*n1" (llvm_array 12 (llvm_int 8));
ctr <- llvm_var "ctr" (llvm_int 32);
llvm_ensure_eq "*output" {{ chacha20::encrypt k ctr n1 plain }};
llvm_verify_tactic abc;
};
print "Proving equality for a single block...";
time (llvm_verify m "Hacl_Chacha20_chacha20" [] (SpecChaCha20 64));
print "Proving equality for multiple blocks...";
time (llvm_verify m "Hacl_Chacha20_chacha20" [] (SpecChaCha20 256));

View file

@ -1,38 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import "poly1305.cry" as poly1305;
print "Proving Poly1305 spec...";
prove_print abc {{ poly1305::allTestsPass }};
print "Loading LLVM bitcode...";
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
let SpecPoly1305 n = do {
llvm_ptr "output" (llvm_array 16 (llvm_int 8));
output <- llvm_var "*output" (llvm_array 16 (llvm_int 8));
llvm_ptr "input" (llvm_array n (llvm_int 8));
input <- llvm_var "*input" (llvm_array n (llvm_int 8));
llvm_var "len1" (llvm_int 64);
llvm_ptr "k1" (llvm_array 32 (llvm_int 8));
k1 <- llvm_var "*k1" (llvm_array 32 (llvm_int 8));
llvm_assert_eq "*input" {{ zero : [n][8] }};
llvm_assert_eq "len1" {{ `n : [64] }};
llvm_assert_eq "*k1" {{ zero : [32][8] }};
let res = {{ poly1305::Poly1305 input (take`{16} k1) (drop`{16} k1) }};
llvm_ensure_eq "*output" {{ res }};
llvm_verify_tactic abc;
};
print "Proving equality for a single block...";
// This is currently disabled as it takes way too long. We need to help Z3
// prove this before we can enable it on Taskcluster.
//time (llvm_verify m "Hacl_Poly1305_64_crypto_onetimeauth" [] (SpecPoly1305 16));

View file

@ -1,336 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This file provides a spec of the Poly1305 one-time authenticator.
* See <https://tools.ietf.org/html/rfc7539> for details. */
module poly1305 where
P : [136]
P = 2^^130 - 5
Poly1305 : {n} (fin n) => [n][8] -> [16][8] -> [16][8] -> [16][8]
Poly1305 msg r s = reverse (groupBy (drop ((rounds ! 0) + s')))
where
rounds = [zero] # [ Poly1305_block acc r' b | b <- blocks | acc <- rounds ]
r' = zero # (Poly1305_clamp (join (reverse r)))
s' = zero # (join (reverse s))
blocks = Poly1305_split msg
private
// 0x0f - for r[3], r[7], r[11], r[15]
// 0xfc - for r[4], r[8], r[12]
Poly1305_clamp r = r && 0x0ffffffc0ffffffc0ffffffc0fffffff
// Poly1305_block : ((acc + msg) * r) % P
Poly1305_block : [136] -> [136] -> [136] -> [136]
Poly1305_block acc r msg = drop (prod % (zero # P))
where
acc' : [137]
// Add the current block to the accumulator.
acc' = (zero # acc) + (zero # msg)
prod : [273]
// Multiply the new accumulator value by r.
prod = ((zero : [137]) # r) * ((zero : [136]) # acc')
Poly1305_split : {n, nb, nf} (fin n, nf == n / 16, nb == (n + 15) / 16) => [n][8] -> [nb][136]
Poly1305_split msg = take ((h1 : [nf][136]) # h2)
where
// Split all full 16-byte blocks and append 0x01, then convert to LE.
h1 = [ join (reverse (b # [0x01])) | b <- groupBy`{16} (take msg)]
// Pad the remaining bytes (if any) and convert to LE.
h2 = [join (reverse ((drop`{nf * 16} msg) # [0x01] # zero))]
/* -------------------------------------------------------------------------- */
/* -- Tests ----------------------------------------------------------------- */
private
// https://tools.ietf.org/html/rfc7539#section-2.5.2
rval1 = [0x85, 0xd6, 0xbe, 0x78, 0x57, 0x55, 0x6d, 0x33,
0x7f, 0x44, 0x52, 0xfe, 0x42, 0xd5, 0x06, 0xa8]
sval1 = [0x01, 0x03, 0x80, 0x8a, 0xfb, 0x0d, 0xb2, 0xfd,
0x4a, 0xbf, 0xf6, 0xaf, 0x41, 0x49, 0xf5, 0x1b]
text1 = [0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x67, 0x72,
0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x46, 0x6f,
0x72, 0x75, 0x6d, 0x20, 0x52, 0x65, 0x73, 0x65,
0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6f,
0x75, 0x70]
rfctest01 = Poly1305 text1 rval1 sval1
== [0xa8, 0x06, 0x1d, 0xc1, 0x30, 0x51, 0x36, 0xc6,
0xc2, 0x2b, 0x8b, 0xaf, 0x0c, 0x01, 0x27, 0xa9]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #1
rval2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text2 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
rfctest02 = Poly1305 text2 rval2 sval2
== [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #2
rval3 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval3 = [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
text3 = [0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d,
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74,
0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x49, 0x45,
0x54, 0x46, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e,
0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x66,
0x6f, 0x72, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66,
0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54, 0x46,
0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
0x74, 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x20,
0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73,
0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x77, 0x69,
0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49,
0x45, 0x54, 0x46, 0x20, 0x61, 0x63, 0x74, 0x69,
0x76, 0x69, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72,
0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x2e, 0x20, 0x53, 0x75, 0x63, 0x68, 0x20,
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20,
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
0x54, 0x46, 0x20, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20,
0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20,
0x61, 0x6e, 0x64, 0x20, 0x65, 0x6c, 0x65, 0x63,
0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x20, 0x63,
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61,
0x64, 0x65, 0x20, 0x61, 0x74, 0x20, 0x61, 0x6e,
0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x6f,
0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2c,
0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f]
rfctest03 = Poly1305 text3 rval3 sval3
== [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #3
rval4 = [0x36, 0xe5, 0xf6, 0xb5, 0xc5, 0xe0, 0x60, 0x70,
0xf0, 0xef, 0xca, 0x96, 0x22, 0x7a, 0x86, 0x3e]
sval4 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text4 = [0x41, 0x6e, 0x79, 0x20, 0x73, 0x75, 0x62, 0x6d,
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74,
0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x49, 0x45,
0x54, 0x46, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x6e,
0x64, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
0x68, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x66,
0x6f, 0x72, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x72,
0x20, 0x70, 0x61, 0x72, 0x74, 0x20, 0x6f, 0x66,
0x20, 0x61, 0x6e, 0x20, 0x49, 0x45, 0x54, 0x46,
0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
0x74, 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x20,
0x6f, 0x72, 0x20, 0x52, 0x46, 0x43, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73,
0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x77, 0x69,
0x74, 0x68, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
0x20, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x49,
0x45, 0x54, 0x46, 0x20, 0x61, 0x63, 0x74, 0x69,
0x76, 0x69, 0x74, 0x79, 0x20, 0x69, 0x73, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x69, 0x64, 0x65, 0x72,
0x65, 0x64, 0x20, 0x61, 0x6e, 0x20, 0x22, 0x49,
0x45, 0x54, 0x46, 0x20, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x22, 0x2e, 0x20, 0x53, 0x75, 0x63, 0x68, 0x20,
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x73, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75,
0x64, 0x65, 0x20, 0x6f, 0x72, 0x61, 0x6c, 0x20,
0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
0x54, 0x46, 0x20, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x73, 0x2c, 0x20, 0x61, 0x73, 0x20,
0x77, 0x65, 0x6c, 0x6c, 0x20, 0x61, 0x73, 0x20,
0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20,
0x61, 0x6e, 0x64, 0x20, 0x65, 0x6c, 0x65, 0x63,
0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x20, 0x63,
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6d, 0x61,
0x64, 0x65, 0x20, 0x61, 0x74, 0x20, 0x61, 0x6e,
0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x6f,
0x72, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2c,
0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x61,
0x72, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f]
rfctest04 = Poly1305 text4 rval4 sval4
== [0xf3, 0x47, 0x7e, 0x7c, 0xd9, 0x54, 0x17, 0xaf,
0x89, 0xa6, 0xb8, 0x79, 0x4c, 0x31, 0x0c, 0xf0]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #4
rval5 = [0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a,
0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0]
sval5 = [0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, 0x09,
0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0]
text5 = [0x27, 0x54, 0x77, 0x61, 0x73, 0x20, 0x62, 0x72,
0x69, 0x6c, 0x6c, 0x69, 0x67, 0x2c, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73,
0x6c, 0x69, 0x74, 0x68, 0x79, 0x20, 0x74, 0x6f,
0x76, 0x65, 0x73, 0x0a, 0x44, 0x69, 0x64, 0x20,
0x67, 0x79, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64,
0x20, 0x67, 0x69, 0x6d, 0x62, 0x6c, 0x65, 0x20,
0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77,
0x61, 0x62, 0x65, 0x3a, 0x0a, 0x41, 0x6c, 0x6c,
0x20, 0x6d, 0x69, 0x6d, 0x73, 0x79, 0x20, 0x77,
0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
0x62, 0x6f, 0x72, 0x6f, 0x67, 0x6f, 0x76, 0x65,
0x73, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x74,
0x68, 0x65, 0x20, 0x6d, 0x6f, 0x6d, 0x65, 0x20,
0x72, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6f, 0x75,
0x74, 0x67, 0x72, 0x61, 0x62, 0x65, 0x2e]
rfctest05 = Poly1305 text5 rval5 sval5
== [0x45, 0x41, 0x66, 0x9a, 0x7e, 0xaa, 0xee, 0x61,
0xe7, 0x08, 0xdc, 0x7c, 0xbc, 0xc5, 0xeb, 0x62]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #5
rval6 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval6 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text6 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
rfctest06 = Poly1305 text6 rval6 sval6
== [0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #6
rval7 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval7 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
text7 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
rfctest07 = Poly1305 text7 rval7 sval7
== [0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #7
rval8 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval8 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text8 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
rfctest08 = Poly1305 text8 rval8 sval8
== [0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #8
rval9 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval9 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text9 = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfb, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01]
rfctest09 = Poly1305 text9 rval9 sval9
== [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #9
rval10 = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval10 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text10 = [0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
rfctest10 = Poly1305 text10 rval10 sval10
== [0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #10
rval11 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval11 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text11 = [0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
rfctest11 = Poly1305 text11 rval11 sval11
== [0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
// https://tools.ietf.org/html/rfc7539#appendix-A.3
// Test Vector #11
rval12 = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
sval12 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
text12 = [0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
rfctest12 = Poly1305 text12 rval12 sval12
== [0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
property allTestsPass =
([ // Full RFC test vectors
rfctest01, rfctest02, rfctest03, rfctest04,
rfctest05, rfctest06, rfctest07, rfctest08,
rfctest09, rfctest10, rfctest11, rfctest12
] : [_]Bit) == ~zero // All test bits should equal one

View file

@ -1,47 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import "poly1305.cry" as poly1305;
print "Proving Poly1305 spec...";
prove_print abc {{ poly1305::allTestsPass }};
print "Loading LLVM bitcode...";
m <- llvm_load_module "../../../dist/Debug/lib/libfreeblpriv3.so.bc";
let SpecPoly1305 n = do {
llvm_ptr "out" (llvm_array 16 (llvm_int 8));
out <- llvm_var "*out" (llvm_array 16 (llvm_int 8));
llvm_ptr "ad" (llvm_array 16 (llvm_int 8));
ad <- llvm_var "*ad" (llvm_array 16 (llvm_int 8));
adLen <- llvm_var "adLen" (llvm_int 32);
llvm_ptr "ciphertext" (llvm_array n (llvm_int 8));
ciphertext <- llvm_var "*ciphertext" (llvm_array n (llvm_int 8));
ciphertextLen <- llvm_var "ciphertextLen" (llvm_int 32);
llvm_ptr "key" (llvm_array 32 (llvm_int 8));
key <- llvm_var "*key" (llvm_array 32 (llvm_int 8));
llvm_assert_eq "*ad" {{ zero : [16][8] }};
llvm_assert_eq "adLen" {{ 16 : [32] }};
llvm_assert_eq "*ciphertext" {{ zero : [n][8] }};
llvm_assert_eq "ciphertextLen" {{ `n : [32] }};
llvm_assert_eq "*key" {{ zero : [32][8] }};
let res = {{ poly1305::Poly1305 (ad # ciphertext # [16, 0, 0, 0, 0, 0, 0, 0] # [`n, 0, 0, 0, 0, 0, 0, 0]) (take`{16} key) (drop`{16} key) }};
llvm_ensure_eq "*out" {{ res }};
llvm_verify_tactic abc;
};
print "Proving equality for a single block...";
// This is currently disabled as it takes way too long. We need to help Z3
// prove this before we can enable it on Taskcluster.
//time (llvm_verify m "Poly1305Do" [] (SpecPoly1305 16));

View file

View file

View file

@ -0,0 +1,50 @@
# Minimal image with clang-format 3.9.
FROM rust:1.64
LABEL maintainer="iaroslav.gridin@tuni.fi"
# for new clang/llvm
RUN echo "deb http://ftp.debian.org/debian/ sid main" > /etc/apt/sources.list.d/sid.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
locales \
python-dev-is-python3 \
mercurial \
python3-pip \
python-setuptools \
build-essential \
cargo \
rustc \
git \
gyp \
clang-15 \
libclang-rt-15-dev \
llvm-15 \
ninja-build \
binutils \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME $USER
ENV HOME /home/$USER
ENV HOSTNAME taskcluster-worker
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
ENV HOST localhost
ENV DOMSUF localdomain
RUN locale-gen $LANG \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
RUN useradd -d $HOME -s $SHELL -m $USER
WORKDIR $HOME
ADD bin $HOME/bin
RUN chmod +x $HOME/bin/*
USER $USER
# Set a default command for debugging.
CMD ["/bin/bash", "--login"]

View file

@ -12,9 +12,14 @@ REVISION=${NSS_HEAD_REVISION:-default}
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss} REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
# Clone NSS. # Clone NSS.
for i in 0 2 5; do hg clone -r $REVISION $REPOSITORY nss
sleep $i
hg clone -r $REVISION $REPOSITORY nss && exit 0 # Clone NSPR if needed.
rm -rf nss hg clone -r default https://hg.mozilla.org/projects/nspr
done
exit 1 if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
pushd nspr
cat ../nss/nspr.patch | patch -p1
popd
fi

View file

@ -0,0 +1,26 @@
#!/bin/bash -eu
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
################################################################################
export NSS_PATH=$PWD NSS_SOURCES_PATH=$PWD/nss
export LD_LIBRARY_PATH=$PWD/dist/Debug/lib/
export RUST_LOG=warn
export RUSTFLAGS="-C instrument-coverage"
cd nss
CC=clang-15 CXX=clang++-15 ./build.sh -g -v --sourcecov --static --disable-tests
git clone --depth=1 https://gitlab.com/nisec/nss-project/acvp-rust.git
cd acvp-rust
cargo build
TESTRUN="cargo run --bin test -- --profdata-command llvm-profdata-15"
echo "AES-GCM:"
$TESTRUN acvp-rust/samples/aes-gcm.json symmetric nss
echo "ECDSA:"
$TESTRUN acvp-rust/samples/ecdsa.json ecdsa nss
echo "RSA:"
$TESTRUN acvp-rust/samples/rsa.json rsa nss
echo "SHA-256:"
$TESTRUN acvp-rust/samples/sha256.json sha nss

View file

View file

View file

View file

@ -2,7 +2,7 @@
# default image, so it's a fair bit bigger. Only use this for builds where # default image, so it's a fair bit bigger. Only use this for builds where
# the smaller docker image is missing something. These builds will run on # the smaller docker image is missing something. These builds will run on
# the leaner configuration. # the leaner configuration.
FROM ubuntu:18.04 FROM ubuntu:bionic-20221215
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN dpkg --add-architecture i386 RUN dpkg --add-architecture i386
@ -11,12 +11,12 @@ RUN apt-get update \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
clang-4.0 \ clang-4.0 \
clang-10 \
clang \ clang \
cmake \ cmake \
curl \ curl \
g++-4.8-multilib \ g++-4.8-multilib \
g++-5-multilib \ g++-5-multilib \
g++-6-multilib \
g++-multilib \ g++-multilib \
git \ git \
gyp \ gyp \
@ -34,21 +34,21 @@ RUN apt-get update \
pkg-config \ pkg-config \
valgrind \ valgrind \
zlib1g-dev \ zlib1g-dev \
clang-format-10 \
sqlite3 \
libabigail-dev \
abigail-tools \
software-properties-common \
&& add-apt-repository ppa:ubuntu-toolchain-r/test -y \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
gcc-11-multilib \
g++-11-multilib \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y && apt-get autoremove -y && apt-get clean -y
# Latest version of abigail-tools RUN update-alternatives --install /usr/bin/clang-format \
RUN apt-get update \ clang-format $(which clang-format-10) 10
&& apt-get install -y --no-install-recommends automake libtool libxml2-dev \
&& git clone git://sourceware.org/git/libabigail.git /tmp/libabigail \
&& cd /tmp/libabigail \
&& autoreconf -fi \
&& ./configure --prefix=/usr --disable-static --disable-apidoc --disable-manual \
&& make && make install \
&& rm -rf /tmp/libabigail \
&& apt-get remove -y automake libtool libxml2-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y
ENV SHELL /bin/bash ENV SHELL /bin/bash
ENV USER worker ENV USER worker

View file

View file

@ -1,18 +1,18 @@
# Minimal image with clang-format 3.9. # Minimal image with clang-format 10
FROM ubuntu:18.04 FROM ubuntu:bionic-20221215
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
clang-format-3.9 \ clang-format-10 \
locales \ locales \
mercurial \ mercurial \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y && apt-get autoremove -y && apt-get clean -y
RUN update-alternatives --install /usr/bin/clang-format \ RUN update-alternatives --install /usr/bin/clang-format \
clang-format $(which clang-format-3.9) 10 clang-format $(which clang-format-10) 10
ENV SHELL /bin/bash ENV SHELL /bin/bash
ENV USER worker ENV USER worker

View file

@ -1,5 +1,5 @@
# Minimal image for running the decision task. # Minimal image for running the decision task.
FROM ubuntu:18.04 FROM ubuntu:bionic-20221215
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN apt-get update \ RUN apt-get update \

View file

View file

@ -0,0 +1,50 @@
# Minimal image with clang-format 3.9.
FROM ubuntu:bionic-20221215
LABEL maintainer="iaroslav.gridin@tuni.fi"
# for new clang/llvm
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
locales \
cmake \
build-essential \
git \
clang-10 \
mercurial \
unifdef \
python3-mako \
libgmp-dev \
jq \
python3-setuptools \
python3-pip \
python3-dev \
clang-format-10 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y
RUN pip3 install fastecdsa
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME $USER
ENV HOME /home/$USER
ENV HOSTNAME taskcluster-worker
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
ENV HOST localhost
ENV DOMSUF localdomain
RUN locale-gen $LANG \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
RUN useradd -d $HOME -s $SHELL -m $USER
WORKDIR $HOME
ADD bin $HOME/bin
RUN chmod +x $HOME/bin/*
USER $USER
# Set a default command for debugging.
CMD ["/bin/bash", "--login"]

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -v -e -x
if [ $(id -u) = 0 ]; then
# Drop privileges by re-running this script.
exec su worker $0
fi
# Default values for testing.
REVISION=${NSS_HEAD_REVISION:-default}
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
# Clone NSS.
hg clone -r $REVISION $REPOSITORY nss
# Clone NSPR if needed.
hg clone -r default https://hg.mozilla.org/projects/nspr
if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
pushd nspr
cat ../nss/nspr.patch | patch -p1
popd
fi

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -v -e -x
if [ $(id -u) = 0 ]; then
# Drop privileges by re-running this script.
exec su worker $0
fi
git clone --depth=1 https://gitlab.com/nisec/ecckiila.git

View file

@ -0,0 +1,14 @@
#!/bin/bash -eu
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
################################################################################
set -e -x -v
cd $HOME/ecckiila
cp $HOME/nss/.clang-format ./
for c in secp384r1 secp521r1; do (cd ecp/$c && cmake . && make && unifdef ecp_$c.c -URIG_NULL -DRIG_NSS -URIG_GOST -UOPENSSL_BUILDING_OPENSSL -UKIILA_OPENSSL_EMIT_CURVEDEF -UKIILA_UNUSED -UOPENSSL_NO_ASM -ULIB_TEST -x2 > tmp_ecp_$c.c && clang-format-10 -i tmp_ecp_$c.c && diff $HOME/nss/lib/freebl/ecl/ecp_$c.c tmp_ecp_$c.c); done;

View file

@ -1,10 +1,10 @@
# Dockerfile for running fuzzing tests. # Dockerfile for running fuzzing tests.
# Used for ASAN and Coverity based static-analysis. # Used for ASAN.
# Note that when running this, you need to add `--cap-add SYS_PTRACE` to the # Note that when running this, you need to add `--cap-add SYS_PTRACE` to the
# docker invocation or ASAN won't work. # docker invocation or ASAN won't work.
# On taskcluster for ASAN use `features: ["allowPtrace"]`. # On taskcluster for ASAN use `features: ["allowPtrace"]`.
# See https://github.com/google/sanitizers/issues/764#issuecomment-276700920 # See https://github.com/google/sanitizers/issues/764#issuecomment-276700920
FROM ubuntu:18.04 FROM ubuntu:bionic-20221215
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN dpkg --add-architecture i386 RUN dpkg --add-architecture i386

View file

View file

@ -10,6 +10,8 @@ LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN dpkg --add-architecture i386 RUN dpkg --add-architecture i386
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
curl \ curl \

View file

View file

@ -11,6 +11,7 @@ RUN apt-get update \
make \ make \
patch \ patch \
mercurial \ mercurial \
sqlite3 \
zlib1g-dev \ zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y && apt-get autoremove -y && apt-get clean -y

View file

View file

@ -1,143 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
67H2IH//2sf8dw==
=fTDu
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -1,31 +0,0 @@
FROM ubuntu:xenial
MAINTAINER Franziskus Kiefer <franziskuskiefer@gmail.com>
# Based on the HACL* image from Benjamin Beurdouche and
# the original F* formula with Daniel Fabian
# Pinned versions of HACL* (F* and KreMLin are pinned as submodules)
ENV haclrepo https://github.com/mitls/hacl-star.git
# Define versions of dependencies
ENV opamv 4.05.0
ENV haclversion 1442c015dab97cdf203ae238b1f3aeccf511bd1e
# Install required packages and set versions
ADD B6C8F98282B944E3B0D5C2530FC3042E345AD05D.asc /tmp/B6C8F98282B944E3B0D5C2530FC3042E345AD05D.asc
ADD setup.sh /tmp/setup.sh
RUN bash /tmp/setup.sh
# Create user, add scripts.
RUN useradd -ms /bin/bash worker
WORKDIR /home/worker
ADD bin /home/worker/bin
RUN chmod +x /home/worker/bin/*
USER worker
# Build F*, HACL*, verify. Install a few more dependencies.
ENV OPAMYES true
ENV PATH "/home/worker/hacl-star/dependencies/z3/bin:$PATH"
ADD setup-user.sh /tmp/setup-user.sh
ADD license.txt /tmp/license.txt
RUN bash /tmp/setup-user.sh

View file

@ -1,15 +0,0 @@
/* Copyright 2016-2017 INRIA and Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View file

@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -v -e -x
# Prepare build (OCaml packages)
opam init
echo ". /home/worker/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true" >> .bashrc
opam switch -v ${opamv}
opam install ocamlfind batteries sqlite3 fileutils yojson ppx_deriving_yojson zarith pprint menhir ulex process fix wasm stdint
# Get the HACL* code
git clone ${haclrepo} hacl-star
git -C hacl-star checkout ${haclversion}
# Prepare submodules, and build, verify, test, and extract c code
# This caches the extracted c code (pins the HACL* version). All we need to do
# on CI now is comparing the code in this docker image with the one in NSS.
opam config exec -- make -C hacl-star prepare -j$(nproc)
make -C hacl-star -f Makefile.build snapshots/nss -j$(nproc)
KOPTS="-funroll-loops 5" make -C hacl-star/code/curve25519 test -j$(nproc)
make -C hacl-star/code/salsa-family test -j$(nproc)
make -C hacl-star/code/poly1305 test -j$(nproc)
# Cleanup.
rm -rf ~/.ccache ~/.cache

View file

@ -1,34 +0,0 @@
#!/usr/bin/env bash
set -v -e -x
# Update packages.
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get install --yes libssl-dev libsqlite3-dev g++-5 gcc-5 m4 make opam pkg-config python libgmp3-dev cmake curl libtool-bin autoconf wget locales
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 200
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 200
# Get clang-format-3.9
curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
# Verify the signature. The key used for verification was fetched via:
# gpg --keyserver pgp.key-server.io --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
# Use a local copy to workaround bug 1565013.
gpg --no-default-keyring --keyring tmp.keyring --import /tmp/B6C8F98282B944E3B0D5C2530FC3042E345AD05D.asc
gpg --no-default-keyring --keyring tmp.keyring --verify clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
# Install into /usr/local/.
tar xJvf *.tar.xz -C /usr/local --strip-components=1
# Cleanup.
rm *.tar.xz*
locale-gen en_US.UTF-8
dpkg-reconfigure locales
# Cleanup.
rm -rf ~/.ccache ~/.cache
apt-get autoremove -y
apt-get clean
apt-get autoclean

View file

@ -1,11 +1,12 @@
# Dockerfile for running interop tests. # Dockerfile for running interop tests.
# This includes Rust, golang, and nodejs. # This includes Rust, golang, and nodejs.
FROM ubuntu:18.04 FROM ubuntu:focal-20221130
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN dpkg --add-architecture i386 RUN dpkg --add-architecture i386
RUN apt-get update \ RUN apt-get update && \
&& apt-get install -y --no-install-recommends \ DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
clang \ clang \

View file

View file

@ -1,46 +0,0 @@
FROM ubuntu:16.04
MAINTAINER Tim Taubert <ttaubert@mozilla.com>
RUN useradd -d /home/worker -s /bin/bash -m worker
WORKDIR /home/worker
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
binutils \
build-essential \
bzip2 \
clang-3.8 \
curl \
gcc-multilib \
g++-multilib \
gyp \
lib32z1-dev \
mercurial \
ninja-build \
unzip \
zlib1g-dev
# Add missing LLVM plugin for gold linker.
ADD LLVMgold.so.zip /usr/lib/llvm-3.8/lib/LLVMgold.so.zip
RUN unzip /usr/lib/llvm-3.8/lib/LLVMgold.so.zip -d /usr/lib/llvm-3.8/lib/
# Install SAW/Cryptol.
RUN curl -LO https://saw.galois.com/builds/nightly/saw-0.2-2018-01-14-Ubuntu14.04-64.tar.gz && \
tar xzvf saw-*.tar.gz -C /usr/local --strip-components=1 && \
rm saw-*.tar.gz
# Install Z3.
RUN curl -LO https://github.com/Z3Prover/z3/releases/download/z3-4.6.0/z3-4.6.0-x64-ubuntu-16.04.zip && \
unzip z3*.zip && \
cp -r z3*/* /usr/local/ && \
rm -fr z3*
ADD bin /home/worker/bin
RUN chmod +x /home/worker/bin/*
# Change user.
USER worker
# Set a default command useful for debugging
CMD ["/bin/bash", "--login"]

View file

@ -1,15 +0,0 @@
#!/usr/bin/env bash
set -v -e -x
# Default values for testing.
REVISION=${NSS_HEAD_REVISION:-default}
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
# Clone NSS.
for i in 0 2 5; do
sleep $i
hg clone -r $REVISION $REPOSITORY nss && exit 0
rm -rf nss
done
exit 1

View file

@ -1,5 +1,5 @@
# Lean image for running the bulk of the NSS CI tests on taskcluster. # Lean image for running the bulk of the NSS CI tests on taskcluster.
FROM ubuntu:18.04 FROM ubuntu:bionic-20221215
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>" LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
RUN dpkg --add-architecture i386 RUN dpkg --add-architecture i386
@ -20,6 +20,7 @@ RUN apt-get update \
mercurial \ mercurial \
ninja-build \ ninja-build \
pkg-config \ pkg-config \
sqlite3 \
zlib1g-dev \ zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y && apt-get clean -y && apt-get autoremove -y && apt-get clean -y

View file

View file

@ -20,6 +20,16 @@ const LINUX_INTEROP_IMAGE = {
path: "automation/taskcluster/docker-interop" path: "automation/taskcluster/docker-interop"
}; };
const ACVP_IMAGE = {
name: "acvp",
path: "automation/taskcluster/docker-acvp"
};
const ECCKIILA_IMAGE = {
name: "ecckiila",
path: "automation/taskcluster/docker-ecckiila"
};
const CLANG_FORMAT_IMAGE = { const CLANG_FORMAT_IMAGE = {
name: "clang-format", name: "clang-format",
path: "automation/taskcluster/docker-clang-format" path: "automation/taskcluster/docker-clang-format"
@ -41,16 +51,6 @@ const FUZZ_IMAGE_32 = {
path: "automation/taskcluster/docker-fuzz32" path: "automation/taskcluster/docker-fuzz32"
}; };
const HACL_GEN_IMAGE = {
name: "hacl",
path: "automation/taskcluster/docker-hacl"
};
const SAW_IMAGE = {
name: "saw",
path: "automation/taskcluster/docker-saw"
};
const WINDOWS_CHECKOUT_CMD = const WINDOWS_CHECKOUT_CMD =
"bash -c \"hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss || " + "bash -c \"hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss || " +
"(sleep 2; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss) || " + "(sleep 2; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss) || " +
@ -105,8 +105,20 @@ queue.filter(task => {
// Don't run all additional hardware tests on ARM. // Don't run all additional hardware tests on ARM.
if (task.group == "Cipher" && task.platform == "aarch64" && task.env && if (task.group == "Cipher" && task.platform == "aarch64" && task.env &&
(task.env.NSS_DISABLE_PCLMUL == "1" || task.env.NSS_DISABLE_HW_AES == "1" (task.env.NSS_DISABLE_PCLMUL == "1" || task.env.NSS_DISABLE_SSE4_1 == "1"
|| task.env.NSS_DISABLE_AVX == "1")) { || task.env.NSS_DISABLE_AVX == "1" || task.env.NSS_DISABLE_AVX2 == "1")) {
return false;
}
// Don't run ARM specific hardware tests on non-ARM.
// TODO: our server that runs task cluster doesn't support Intel SHA extensions.
if (task.group == "Cipher" && task.platform != "aarch64" && task.env &&
(task.env.NSS_DISABLE_HW_SHA1 == "1" || task.env.NSS_DISABLE_HW_SHA2 == "1")) {
return false;
}
// Don't run DBM builds on aarch64.
if (task.group == "DBM" && task.platform == "aarch64") {
return false; return false;
} }
@ -255,6 +267,11 @@ export default async function main() {
collection: "debug" collection: "debug"
}, "build_gyp.sh"); }, "build_gyp.sh");
await scheduleWindows("Windows 2012 64 Static (opt)", {
platform: "windows2012-64",
collection: "opt-static"
}, "build_gyp.sh --opt --static");
await scheduleWindows("Windows 2012 32 (opt)", { await scheduleWindows("Windows 2012 32 (opt)", {
platform: "windows2012-32", platform: "windows2012-32",
}, "build_gyp.sh --opt -t ia32"); }, "build_gyp.sh --opt -t ia32");
@ -312,6 +329,7 @@ export default async function main() {
); );
await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt"); await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt");
await scheduleMac("Mac Static (opt)", {collection: "opt-static"}, "--opt --static -Ddisable_libpkix=1");
await scheduleMac("Mac (debug)", {collection: "debug"}); await scheduleMac("Mac (debug)", {collection: "debug"});
// Must be executed after all other tasks are scheduled // Must be executed after all other tasks are scheduled
@ -500,7 +518,7 @@ async function scheduleLinux(name, overrides, args = "") {
} }
// The task that generates certificates. // The task that generates certificates.
let task_cert = queue.scheduleTask(merge(build_base, { let cert_base = merge(build_base, {
name: "Certificates", name: "Certificates",
command: [ command: [
"/bin/bash", "/bin/bash",
@ -509,7 +527,8 @@ async function scheduleLinux(name, overrides, args = "") {
], ],
parent: task_build, parent: task_build,
symbol: "Certs" symbol: "Certs"
})); });
let task_cert = queue.scheduleTask(cert_base);
// Schedule tests. // Schedule tests.
scheduleTests(task_build, task_cert, merge(base, { scheduleTests(task_build, task_cert, merge(base, {
@ -517,7 +536,9 @@ async function scheduleLinux(name, overrides, args = "") {
"/bin/bash", "/bin/bash",
"-c", "-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh" "bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
] ],
provisioner: "nss-t",
workerType: "t-linux-xlarge-gcp"
})); }));
// Extra builds. // Extra builds.
@ -533,6 +554,14 @@ async function scheduleLinux(name, overrides, args = "") {
}, },
symbol: "clang-4" symbol: "clang-4"
})); }));
queue.scheduleTask(merge(extra_base, {
name: `${name} w/ clang-10`,
env: {
CC: "clang-10",
CCC: "clang++-10",
},
symbol: "clang-10"
}));
queue.scheduleTask(merge(extra_base, { queue.scheduleTask(merge(extra_base, {
name: `${name} w/ gcc-4.4`, name: `${name} w/ gcc-4.4`,
image: LINUX_GCC44_IMAGE, image: LINUX_GCC44_IMAGE,
@ -557,8 +586,17 @@ async function scheduleLinux(name, overrides, args = "") {
name: `${name} w/ gcc-4.8`, name: `${name} w/ gcc-4.8`,
env: { env: {
CC: "gcc-4.8", CC: "gcc-4.8",
CCC: "g++-4.8" CCC: "g++-4.8",
// gcc-4.8 has incomplete c++11 support
NSS_DISABLE_GTESTS: "1",
}, },
// Use -Ddisable-intelhw_sha=1, GYP doesn't have a proper GCC version
// check for Intel SHA support.
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/build.sh",
],
symbol: "gcc-4.8" symbol: "gcc-4.8"
})); }));
@ -572,12 +610,12 @@ async function scheduleLinux(name, overrides, args = "") {
})); }));
queue.scheduleTask(merge(extra_base, { queue.scheduleTask(merge(extra_base, {
name: `${name} w/ gcc-6`, name: `${name} w/ gcc-11`,
env: { env: {
CC: "gcc-6", CC: "gcc-11",
CCC: "g++-6" CCC: "g++-11",
}, },
symbol: "gcc-6" symbol: "gcc-11"
})); }));
queue.scheduleTask(merge(extra_base, { queue.scheduleTask(merge(extra_base, {
@ -592,6 +630,25 @@ async function scheduleLinux(name, overrides, args = "") {
symbol: "modular" symbol: "modular"
})); }));
if (base.collection != "make") {
let task_build_dbm = queue.scheduleTask(merge(extra_base, {
name: `${name} w/ legacy-db`,
command: [
"/bin/bash",
"-c",
checkout_and_gyp + "--enable-legacy-db"
],
symbol: "B",
group: "DBM",
}));
let task_cert_dbm = queue.scheduleTask(merge(cert_base, {
parent: task_build_dbm,
group: "DBM",
symbol: "Certs"
}));
}
return queue.submit(); return queue.submit();
} }
@ -610,6 +667,8 @@ function scheduleFuzzingRun(base, name, target, max_len, symbol = null, corpus =
`-max_total_time=${MAX_FUZZ_TIME} ` + `-max_total_time=${MAX_FUZZ_TIME} ` +
`-max_len=${max_len}` `-max_len=${max_len}`
], ],
provisioner: "nss-t",
workerType: "t-linux-xlarge-gcp",
symbol: symbol || name symbol: symbol || name
})); }));
} }
@ -827,14 +886,14 @@ async function scheduleFuzzing32() {
async function scheduleWindows(name, base, build_script) { async function scheduleWindows(name, base, build_script) {
base = merge(base, { base = merge(base, {
workerType: "win2012r2", workerType: "b-win2012-azure",
env: { env: {
PATH: "c:\\mozilla-build\\bin;c:\\mozilla-build\\python;" + PATH: "c:\\mozilla-build\\bin;c:\\mozilla-build\\python;" +
"c:\\mozilla-build\\msys\\local\\bin;c:\\mozilla-build\\7zip;" + "c:\\mozilla-build\\msys\\local\\bin;c:\\mozilla-build\\7zip;" +
"c:\\mozilla-build\\info-zip;c:\\mozilla-build\\python\\Scripts;" + "c:\\mozilla-build\\info-zip;c:\\mozilla-build\\python\\Scripts;" +
"c:\\mozilla-build\\yasm;c:\\mozilla-build\\msys\\bin;" + "c:\\mozilla-build\\yasm;c:\\mozilla-build\\msys\\bin;" +
"c:\\Windows\\system32;c:\\mozilla-build\\upx391w;" + "c:\\Windows\\system32;c:\\mozilla-build\\upx391w;" +
"c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget", "c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget;c:\\Program Files\\Mercurial",
DOMSUF: "localdomain", DOMSUF: "localdomain",
HOST: "localhost", HOST: "localhost",
}, },
@ -983,9 +1042,16 @@ function scheduleTests(task_build, task_cert, test_base) {
name: "Cipher tests", symbol: "Default", tests: "cipher", group: "Cipher" name: "Cipher tests", symbol: "Default", tests: "cipher", group: "Cipher"
})); }));
queue.scheduleTask(merge(cert_base_long, { queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoAESNI", tests: "cipher", name: "Cipher tests", symbol: "NoAES", tests: "cipher",
env: {NSS_DISABLE_HW_AES: "1"}, group: "Cipher" env: {NSS_DISABLE_HW_AES: "1"}, group: "Cipher"
})); }));
queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoSHA", tests: "cipher",
env: {
NSS_DISABLE_HW_SHA1: "1",
NSS_DISABLE_HW_SHA2: "1"
}, group: "Cipher"
}));
queue.scheduleTask(merge(cert_base_long, { queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoPCLMUL", tests: "cipher", name: "Cipher tests", symbol: "NoPCLMUL", tests: "cipher",
env: {NSS_DISABLE_PCLMUL: "1"}, group: "Cipher" env: {NSS_DISABLE_PCLMUL: "1"}, group: "Cipher"
@ -994,6 +1060,10 @@ function scheduleTests(task_build, task_cert, test_base) {
name: "Cipher tests", symbol: "NoAVX", tests: "cipher", name: "Cipher tests", symbol: "NoAVX", tests: "cipher",
env: {NSS_DISABLE_AVX: "1"}, group: "Cipher" env: {NSS_DISABLE_AVX: "1"}, group: "Cipher"
})); }));
queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoAVX2", tests: "cipher",
env: {NSS_DISABLE_AVX2: "1"}, group: "Cipher"
}));
queue.scheduleTask(merge(cert_base_long, { queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoSSSE3|NEON", tests: "cipher", name: "Cipher tests", symbol: "NoSSSE3|NEON", tests: "cipher",
env: { env: {
@ -1001,6 +1071,10 @@ function scheduleTests(task_build, task_cert, test_base) {
NSS_DISABLE_SSSE3: "1" NSS_DISABLE_SSSE3: "1"
}, group: "Cipher" }, group: "Cipher"
})); }));
queue.scheduleTask(merge(cert_base_long, {
name: "Cipher tests", symbol: "NoSSE4.1", tests: "cipher",
env: {NSS_DISABLE_SSE4_1: "1"}, group: "Cipher"
}));
queue.scheduleTask(merge(cert_base, { queue.scheduleTask(merge(cert_base, {
name: "EC tests", symbol: "EC", tests: "ec" name: "EC tests", symbol: "EC", tests: "ec"
})); }));
@ -1039,12 +1113,6 @@ function scheduleTests(task_build, task_cert, test_base) {
queue.scheduleTask(merge(ssl_base, { queue.scheduleTask(merge(ssl_base, {
name: "SSL tests (pkix)", symbol: "pkix", cycle: "pkix" name: "SSL tests (pkix)", symbol: "pkix", cycle: "pkix"
})); }));
queue.scheduleTask(merge(ssl_base, {
name: "SSL tests (sharedb)", symbol: "sharedb", cycle: "sharedb"
}));
queue.scheduleTask(merge(ssl_base, {
name: "SSL tests (upgradedb)", symbol: "upgradedb", cycle: "upgradedb"
}));
queue.scheduleTask(merge(ssl_base, { queue.scheduleTask(merge(ssl_base, {
name: "SSL tests (stress)", symbol: "stress", cycle: "sharedb", name: "SSL tests (stress)", symbol: "stress", cycle: "sharedb",
env: {NSS_SSL_RUN: "stress"} env: {NSS_SSL_RUN: "stress"}
@ -1082,6 +1150,18 @@ async function scheduleTools() {
] ]
})); }));
queue.scheduleTask(merge(base, {
symbol: "acvp",
name: "acvp",
image: ACVP_IMAGE,
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && bin/run.sh"
]
}));
queue.scheduleTask(merge(base, { queue.scheduleTask(merge(base, {
symbol: "scan-build", symbol: "scan-build",
name: "scan-build", name: "scan-build",
@ -1105,37 +1185,10 @@ async function scheduleTools() {
] ]
})); }));
queue.scheduleTask(merge(base, {
symbol: "coverity",
name: "coverity",
image: FUZZ_IMAGE,
tags: ['code-review'],
env: {
USE_64: "1",
CC: "clang",
CCC: "clang++",
NSS_AUTOMATION: "1"
},
features: ["taskclusterProxy"],
scopes: ["secrets:get:project/relman/coverity-nss"],
artifacts: {
"public/code-review/coverity.json": {
expires: 24 * 7,
type: "file",
path: "/home/worker/nss/coverity/coverity.json"
}
},
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_coverity.sh"
]
}));
queue.scheduleTask(merge(base, { queue.scheduleTask(merge(base, {
symbol: "hacl", symbol: "hacl",
name: "hacl", name: "hacl",
image: HACL_GEN_IMAGE, image: LINUX_BUILDS_IMAGE,
command: [ command: [
"/bin/bash", "/bin/bash",
"-c", "-c",
@ -1143,67 +1196,14 @@ async function scheduleTools() {
] ]
})); }));
let task_saw = queue.scheduleTask(merge(base, {
symbol: "B",
group: "SAW",
name: "LLVM bitcode build (32 bit)",
image: SAW_IMAGE,
kind: "build",
env: {
AR: "llvm-ar-3.8",
CC: "clang-3.8",
CCC: "clang++-3.8"
},
artifacts: {
public: {
expires: 24 * 7,
type: "directory",
path: "/home/worker/artifacts"
}
},
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh --disable-tests --emit-llvm -t ia32"
]
}));
queue.scheduleTask(merge(base, { queue.scheduleTask(merge(base, {
parent: task_saw, symbol: "ecckiila",
symbol: "bmul", name: "ecckiila",
group: "SAW", image: ECCKIILA_IMAGE,
name: "bmul.saw",
image: SAW_IMAGE,
command: [ command: [
"/bin/bash", "/bin/bash",
"-c", "-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh bmul" "bin/checkout.sh && bin/ecckiila.sh && bin/run.sh"
]
}));
queue.scheduleTask(merge(base, {
parent: task_saw,
symbol: "ChaCha20",
group: "SAW",
name: "chacha20.saw",
image: SAW_IMAGE,
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh chacha20"
]
}));
queue.scheduleTask(merge(base, {
parent: task_saw,
symbol: "Poly1305",
group: "SAW",
name: "poly1305.saw",
image: SAW_IMAGE,
command: [
"/bin/bash",
"-c",
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_saw.sh poly1305"
] ]
})); }));
@ -1211,7 +1211,15 @@ async function scheduleTools() {
symbol: "Coverage", symbol: "Coverage",
name: "Coverage", name: "Coverage",
image: FUZZ_IMAGE, image: FUZZ_IMAGE,
type: "other",
features: ["allowPtrace"], features: ["allowPtrace"],
artifacts: {
public: {
expires: 24 * 7,
type: "directory",
path: "/home/worker/artifacts"
}
},
command: [ command: [
"/bin/bash", "/bin/bash",
"-c", "-c",

View file

@ -9,7 +9,7 @@ import taskcluster from "taskcluster-client";
async function taskHasImageArtifact(taskId) { async function taskHasImageArtifact(taskId) {
let queue = new taskcluster.Queue(taskcluster.fromEnvVars()); let queue = new taskcluster.Queue(taskcluster.fromEnvVars());
let {artifacts} = await queue.listLatestArtifacts(taskId); let {artifacts} = await queue.listLatestArtifacts(taskId);
return artifacts.some(artifact => artifact.name == "public/image.tar"); return artifacts.some(artifact => artifact.name == "public/image.tar.zst");
} }
async function findTaskWithImageArtifact(ns) { async function findTaskWithImageArtifact(ns) {
@ -41,10 +41,10 @@ export async function buildTask({name, path}) {
HASH: hash HASH: hash
}, },
artifacts: { artifacts: {
"public/image.tar": { "public/image.tar.zst": {
type: "file", type: "file",
expires: 24 * 90, expires: 24 * 90,
path: "/artifacts/image.tar" path: "/artifacts/image.tar.zst"
} }
}, },
command: [ command: [
@ -56,6 +56,6 @@ export async function buildTask({name, path}) {
features: ["dind"], features: ["dind"],
maxRunTime: 7200, maxRunTime: 7200,
kind: "build", kind: "build",
symbol: "I" symbol: `I(${name})`
}; };
} }

View file

@ -10,12 +10,6 @@ const main = async () => {
// Init try syntax filter. // Init try syntax filter.
if (process.env.TC_PROJECT == "nss-try") { if (process.env.TC_PROJECT == "nss-try") {
await try_syntax.initFilter(); await try_syntax.initFilter();
} else {
// Coverity should not be run on landings, only by request (typically
// by Phabricator).
queue.filter(task => {
return task.symbol != "coverity";
});
} }
// Extend the task graph. // Extend the task graph.

View file

@ -157,7 +157,7 @@ function convertTask(def) {
return { return {
provisionerId: def.provisioner || `nss-${process.env.MOZ_SCM_LEVEL}`, provisionerId: def.provisioner || `nss-${process.env.MOZ_SCM_LEVEL}`,
workerType: def.workerType || "linux", workerType: def.workerType || "linux-gcp",
schedulerId: process.env.TC_SCHEDULER_ID, schedulerId: process.env.TC_SCHEDULER_ID,
taskGroupId: process.env.TASK_ID, taskGroupId: process.env.TASK_ID,
@ -220,6 +220,9 @@ export async function submit() {
maps.forEach(map => { task = map(merge({}, task)) }); maps.forEach(map => { task = map(merge({}, task)) });
let log_id = `${task.name} @ ${task.platform}[${task.collection || "opt"}]`; let log_id = `${task.name} @ ${task.platform}[${task.collection || "opt"}]`;
if (task.group) {
log_id = `${task.group}::${log_id}`;
}
console.log(`+ Submitting ${log_id}.`); console.log(`+ Submitting ${log_id}.`);
// Index that task for each tag specified // Index that task for each tag specified
@ -274,7 +277,7 @@ export async function submit() {
} }
task.payload.image = { task.payload.image = {
path: "public/image.tar", path: "public/image.tar.zst",
taskId: data.taskId, taskId: data.taskId,
type: "task-image" type: "task-image"
}; };

View file

@ -31,7 +31,7 @@ function parseOptions(opts) {
let allPlatforms = ["linux", "linux64", "linux64-asan", "linux64-fips", let allPlatforms = ["linux", "linux64", "linux64-asan", "linux64-fips",
"win", "win64", "win-make", "win64-make", "win", "win64", "win-make", "win64-make",
"linux64-make", "linux-make", "linux-fuzz", "linux64-make", "linux-make", "linux-fuzz",
"linux64-fuzz", "aarch64", "mac"]; "linux64-fuzz", "aarch64", "aarch64-make", "mac"];
let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms); let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms);
// If the given value is nonsense or "none" default to all platforms. // If the given value is nonsense or "none" default to all platforms.
@ -57,7 +57,7 @@ function parseOptions(opts) {
} }
// Parse tools. // Parse tools.
let allTools = ["clang-format", "scan-build", "coverity", "hacl", "saw", "abi", "coverage"]; let allTools = ["clang-format", "scan-build", "hacl", "ecckiila", "saw", "abi", "coverage"];
let tools = intersect(opts.tools.split(/\s*,\s*/), allTools); let tools = intersect(opts.tools.split(/\s*,\s*/), allTools);
// If the given value is "all" run all tools. // If the given value is "all" run all tools.
@ -115,6 +115,7 @@ function filter(opts) {
// Filter by platform. // Filter by platform.
let found = opts.platforms.some(platform => { let found = opts.platforms.some(platform => {
let aliases = { let aliases = {
"aarch64-make": "aarch64",
"linux": "linux32", "linux": "linux32",
"linux-fuzz": "linux32", "linux-fuzz": "linux32",
"linux64-asan": "linux64", "linux64-asan": "linux64",
@ -137,7 +138,8 @@ function filter(opts) {
} else if (platform == "linux64-fips") { } else if (platform == "linux64-fips") {
keep &= coll("fips"); keep &= coll("fips");
} else if (platform == "linux64-make" || platform == "linux-make" || } else if (platform == "linux64-make" || platform == "linux-make" ||
platform == "win64-make" || platform == "win-make") { platform == "win64-make" || platform == "win-make" ||
platform == "aarch64-make") {
keep &= coll("make"); keep &= coll("make");
} else if (platform == "linux64-fuzz" || platform == "linux-fuzz") { } else if (platform == "linux64-fuzz" || platform == "linux-fuzz") {
keep &= coll("fuzz"); keep &= coll("fuzz");

View file

0
security/nss/automation/taskcluster/scripts/build.sh Normal file → Executable file
View file

View file

@ -12,7 +12,7 @@ if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
fi fi
# Build. # Build.
nss/build.sh -g -v --enable-libpkix "$@" nss/build.sh -g -v --enable-libpkix -Denable_draft_hpke=1 "$@"
# Package. # Package.
if [[ $(uname) = "Darwin" ]]; then if [[ $(uname) = "Darwin" ]]; then

View file

@ -18,7 +18,10 @@ CONTEXT_PATH="/home/worker/nss/$CONTEXT_PATH"
test -d "$CONTEXT_PATH" || raise_error "Context Path $CONTEXT_PATH does not exist." test -d "$CONTEXT_PATH" || raise_error "Context Path $CONTEXT_PATH does not exist."
test -f "$CONTEXT_PATH/Dockerfile" || raise_error "Dockerfile must be present in $CONTEXT_PATH." test -f "$CONTEXT_PATH/Dockerfile" || raise_error "Dockerfile must be present in $CONTEXT_PATH."
apt-get update
apt-get -y install zstd
docker build -t "$PROJECT:$HASH" "$CONTEXT_PATH" docker build -t "$PROJECT:$HASH" "$CONTEXT_PATH"
mkdir /artifacts mkdir /artifacts
docker save "$PROJECT:$HASH" > /artifacts/image.tar docker save "$PROJECT:$HASH" | zstd > /artifacts/image.tar.zst

View file

View file

View file

View file

View file

@ -89,7 +89,7 @@ check_abi()
abi_diff abi_diff
} }
#Slightly modified from builbot-slave/build.sh #Slightly modified from build.sh in this directory
abi_diff() abi_diff()
{ {
ABI_PROBLEM_FOUND=0 ABI_PROBLEM_FOUND=0
@ -97,7 +97,8 @@ abi_diff()
rm -f ${ABI_REPORT} rm -f ${ABI_REPORT}
PREVDIST=${HGDIR}/baseline/dist PREVDIST=${HGDIR}/baseline/dist
NEWDIST=${HGDIR}/dist NEWDIST=${HGDIR}/dist
ALL_SOs="libfreebl3.so libfreeblpriv3.so libnspr4.so libnss3.so libnssckbi.so libnssdbm3.so libnsssysinit.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so" # libnssdbm3.so isn't built by default anymore, skip it.
ALL_SOs="libfreebl3.so libfreeblpriv3.so libnspr4.so libnss3.so libnssckbi.so libnsssysinit.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so"
for SO in ${ALL_SOs}; do for SO in ${ALL_SOs}; do
if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
touch ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt touch ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt
@ -122,7 +123,7 @@ abi_diff()
# If abidiff reports an error, or a usage error, or if it sets a result # If abidiff reports an error, or a usage error, or if it sets a result
# bit value this script doesn't know yet about, we'll report failure. # bit value this script doesn't know yet about, we'll report failure.
# For ABI changes, we don't yet report an error. We'll compare the # For ABI changes, we don't yet report an error. We'll compare the
# result report with our whitelist. This allows us to silence changes # result report with our allowlist. This allows us to silence changes
# that we're already aware of and have been declared acceptable. # that we're already aware of and have been declared acceptable.
REPORT_RET_AS_FAILURE=0 REPORT_RET_AS_FAILURE=0
@ -140,10 +141,10 @@ abi_diff()
fi fi
if [ $ABIDIFF_ABI_CHANGE -ne 0 ]; then if [ $ABIDIFF_ABI_CHANGE -ne 0 ]; then
echo "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-whitelisted differences." echo "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-allowlisted differences."
fi fi
if [ $ABIDIFF_ABI_INCOMPATIBLE_CHANGE -ne 0 ]; then if [ $ABIDIFF_ABI_INCOMPATIBLE_CHANGE -ne 0 ]; then
echo "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-whitelisted differences." echo "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-allowlisted differences."
fi fi
if [ $REPORT_RET_AS_FAILURE -ne 0 ]; then if [ $REPORT_RET_AS_FAILURE -ne 0 ]; then

View file

0
security/nss/automation/taskcluster/scripts/fuzz.sh Normal file → Executable file
View file

View file

View file

View file

@ -1,21 +0,0 @@
#!/usr/bin/env bash
source $(dirname "$0")/tools.sh
# Clone NSPR if needed.
if [ ! -d "nspr" ]; then
hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
pushd nspr
cat ../nss/nspr.patch | patch -p1
popd
fi
fi
# Build and run Coverity
cd nss
./mach static-analysis
# Return the exit code of the Coverity Analysis
exit $?

44
security/nss/automation/taskcluster/scripts/run_hacl.sh Normal file → Executable file
View file

@ -8,33 +8,37 @@ fi
set -e -x -v set -e -x -v
# The docker image this is running in has the HACL* and NSS sources. # The docker image this is running in has NSS sources.
# The extracted C code from HACL* is already generated and the HACL* tests were # Get the HACL* source, containing a snapshot of the C code, extracted on the
# successfully executed. # HACL CI.
git clone -q "https://github.com/hacl-star/hacl-star" ~/hacl-star
git -C ~/hacl-star checkout -q 51a72a953a4ee6f91e63b2816ae5c4e62edf35d6
# Verify HACL*. Taskcluster fails when we do this in the image build. # Format the C snapshot.
make -C hacl-star verify-nss -j$(nproc) cd ~/hacl-star/dist/mozilla
cp ~/nss/.clang-format .
# Add license header to specs find . -type f -name '*.[ch]' -exec clang-format -i {} \+
spec_files=($(find ~/hacl-star/specs -type f -name '*.fst')) cd ~/hacl-star/dist/karamel
for f in "${spec_files[@]}"; do
cat /tmp/license.txt "$f" > /tmp/tmpfile && mv /tmp/tmpfile "$f"
done
# Format the extracted C code.
cd ~/hacl-star/snapshots/nss
cp ~/nss/.clang-format . cp ~/nss/.clang-format .
find . -type f -name '*.[ch]' -exec clang-format -i {} \+ find . -type f -name '*.[ch]' -exec clang-format -i {} \+
# These diff commands will return 1 if there are differences and stop the script. # These diff commands will return 1 if there are differences and stop the script.
files=($(find ~/nss/lib/freebl/verified/ -type f -name '*.[ch]'))
# We have two checks in the script.
# The first one only checks the files in the verified/internal folder; the second one does for all the rest
# It was implemented like this due to not uniqueness of the names in the verified folders
# For instance, the files Hacl_Chacha20.h are present in both directories, but the content differs.
files=($(find ~/nss/lib/freebl/verified/internal -type f -name '*.[ch]'))
for f in "${files[@]}"; do for f in "${files[@]}"; do
diff $f $(basename "$f") file_name=$(basename "$f")
hacl_file=($(find ~/hacl-star/dist/mozilla/internal/ -type f -name $file_name))
diff $hacl_file $f
done done
# Check that the specs didn't change either. files=($(find ~/nss/lib/freebl/verified/ -type f -name '*.[ch]' -not -path "*/freebl/verified/internal/*" -not -path "*/freebl/verified/config.h"))
cd ~/hacl-star/specs
files=($(find ~/nss/lib/freebl/verified/specs -type f))
for f in "${files[@]}"; do for f in "${files[@]}"; do
diff $f $(basename "$f") file_name=$(basename "$f")
hacl_file=($(find ~/hacl-star/dist/mozilla/ ~/hacl-star/dist/karamel/ -type f -name $file_name -not -path "*/hacl-star/dist/mozilla/internal/*"))
diff $hacl_file $f
done done

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
source $(dirname "$0")/tools.sh
# Fetch artifact if needed.
fetch_dist
# Run SAW.
saw "nss/automation/saw/$1.saw"

View file

View file

1
security/nss/automation/taskcluster/scripts/split.sh Normal file → Executable file
View file

@ -39,7 +39,6 @@ split_util() {
# Copy some files at the top and the util subdirectory recursively. # Copy some files at the top and the util subdirectory recursively.
mkdir $dstdir/lib mkdir $dstdir/lib
cp $nssdir/lib/Makefile $dstdir/lib cp $nssdir/lib/Makefile $dstdir/lib
cp $nssdir/lib/manifest.mn $dstdir/lib
cp -R $nssdir/lib/util $dstdir/lib/util cp -R $nssdir/lib/util $dstdir/lib/util
} }

0
security/nss/automation/taskcluster/scripts/tools.sh Normal file → Executable file
View file

0
security/nss/automation/taskcluster/windows/build.sh Normal file → Executable file
View file

View file

@ -38,7 +38,7 @@ if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
fi fi
# Build with gyp. # Build with gyp.
./nss/build.sh -g -v --enable-libpkix "$@" ./nss/build.sh -g -v --enable-libpkix -Denable_draft_hpke=1 "$@"
# Package. # Package.
7z a public/build/dist.7z dist 7z a public/build/dist.7z dist

View file

View file

0
security/nss/automation/taskcluster/windows/setup.sh Normal file → Executable file
View file

31
security/nss/build.sh Normal file → Executable file
View file

@ -30,11 +30,11 @@ run_verbose()
if [ "$verbose" = 1 ]; then if [ "$verbose" = 1 ]; then
echo "$@" echo "$@"
exec 3>&1 exec 3>&1
"$@" 1>&3 2>&3
exec 3>&-
else else
exec 3>/dev/null "$@" >/dev/null
fi fi
"$@" 1>&3 2>&3
exec 3>&-
} }
# The prehistoric bash on Mac doesn't support @Q quoting. # The prehistoric bash on Mac doesn't support @Q quoting.
@ -68,10 +68,6 @@ sslkeylogfile=1
gyp_params=(--depth="$cwd" --generator-output=".") gyp_params=(--depth="$cwd" --generator-output=".")
ninja_params=() ninja_params=()
# Assume that the target architecture is the same as the host by default.
host_arch=$(python "$cwd/coreconf/detect_host_arch.py")
target_arch=$host_arch
# Assume that MSVC is wanted if this is running on windows. # Assume that MSVC is wanted if this is running on windows.
platform=$(uname -s) platform=$(uname -s)
if [ "${platform%-*}" = "MINGW32_NT" -o "${platform%-*}" = "MINGW64_NT" ]; then if [ "${platform%-*}" = "MINGW32_NT" -o "${platform%-*}" = "MINGW64_NT" ]; then
@ -108,13 +104,14 @@ while [ $# -gt 0 ]; do
--pprof) gyp_params+=(-Duse_pprof=1) ;; --pprof) gyp_params+=(-Duse_pprof=1) ;;
--asan) enable_sanitizer asan ;; --asan) enable_sanitizer asan ;;
--msan) enable_sanitizer msan ;; --msan) enable_sanitizer msan ;;
--sourcecov) enable_sourcecov ;;
--ubsan) enable_ubsan ;; --ubsan) enable_ubsan ;;
--ubsan=?*) enable_ubsan "${1#*=}" ;; --ubsan=?*) enable_ubsan "${1#*=}" ;;
--fuzz) fuzz=1 ;; --fuzz) fuzz=1 ;;
--fuzz=oss) fuzz=1; fuzz_oss=1 ;; --fuzz=oss) fuzz=1; fuzz_oss=1 ;;
--fuzz=tls) fuzz=1; fuzz_tls=1 ;; --fuzz=tls) fuzz=1; fuzz_tls=1 ;;
--sancov) enable_sancov ;; --sancov) enable_sancov; gyp_params+=(-Dcoverage=1) ;;
--sancov=?*) enable_sancov "${1#*=}" ;; --sancov=?*) enable_sancov "${1#*=}"; gyp_params+=(-Dcoverage=1) ;;
--emit-llvm) gyp_params+=(-Demit_llvm=1 -Dsign_libs=0) ;; --emit-llvm) gyp_params+=(-Demit_llvm=1 -Dsign_libs=0) ;;
--no-zdefs) gyp_params+=(-Dno_zdefs=1) ;; --no-zdefs) gyp_params+=(-Dno_zdefs=1) ;;
--static) gyp_params+=(-Dstatic_libs=1) ;; --static) gyp_params+=(-Dstatic_libs=1) ;;
@ -130,12 +127,26 @@ while [ $# -gt 0 ]; do
--enable-libpkix) gyp_params+=(-Ddisable_libpkix=0) ;; --enable-libpkix) gyp_params+=(-Ddisable_libpkix=0) ;;
--mozpkix-only) gyp_params+=(-Dmozpkix_only=1 -Ddisable_tests=1 -Dsign_libs=0) ;; --mozpkix-only) gyp_params+=(-Dmozpkix_only=1 -Ddisable_tests=1 -Dsign_libs=0) ;;
--disable-keylog) sslkeylogfile=0 ;; --disable-keylog) sslkeylogfile=0 ;;
--enable-legacy-db) gyp_params+=(-Ddisable_dbm=0) ;;
--mozilla-central) gyp_params+=(-Dmozilla_central=1) ;;
--python) python="$2"; shift ;;
--python=*) python="${1#*=}" ;;
-D*) gyp_params+=("$1") ;; -D*) gyp_params+=("$1") ;;
*) show_help; exit 2 ;; *) show_help; exit 2 ;;
esac esac
shift shift
done done
if [ -n "$python" ]; then
gyp_params+=(-Dpython="$python")
fi
if [ -z "$target_arch" ]; then
# Assume that the target architecture is the same as the host by default.
host_arch=$(${python:-python} "$cwd/coreconf/detect_host_arch.py")
target_arch=$host_arch
fi
# Set the target architecture and build type. # Set the target architecture and build type.
gyp_params+=(-Dtarget_arch="$target_arch") gyp_params+=(-Dtarget_arch="$target_arch")
if [ "$opt_build" = 1 ]; then if [ "$opt_build" = 1 ]; then
@ -144,7 +155,7 @@ else
target=Debug target=Debug
fi fi
#gyp_params+=(-Denable_sslkeylogfile="$sslkeylogfile") gyp_params+=(-Denable_sslkeylogfile="$sslkeylogfile")
# Do special setup. # Do special setup.
if [ "$fuzz" = 1 ]; then if [ "$fuzz" = 1 ]; then

View file

@ -38,7 +38,9 @@ INCLUDES += \
-I./include \ -I./include \
$(NULL) $(NULL)
$(SOFTOKEN_SRCDIRS) $(NSS_SRCDIRS): $(LIB_SRCDIRS)
include $(CORE_DEPTH)/coreconf/rules.mk include $(CORE_DEPTH)/coreconf/rules.mk
symbols:: symbols:
@echo "TARGETS = $(TARGETS)" @echo "TARGETS = $(TARGETS)"

View file

@ -74,7 +74,6 @@ getTrustString(unsigned int trust)
return "CKT_NSS_MUST_VERIFY_TRUST"; return "CKT_NSS_MUST_VERIFY_TRUST";
} }
} }
return "CKT_NSS_TRUST_UNKNOWN"; /* not reached */
} }
static const SEC_ASN1Template serialTemplate[] = { static const SEC_ASN1Template serialTemplate[] = {
@ -552,7 +551,9 @@ main(int argc, char **argv)
nickname = strdup(addbuiltin.options[opt_Nickname].arg); nickname = strdup(addbuiltin.options[opt_Nickname].arg);
NSS_NoDB_Init(NULL); if (NSS_NoDB_Init(NULL) != SECSuccess) {
exit(1);
}
if (addbuiltin.options[opt_Distrust].activated || if (addbuiltin.options[opt_Distrust].activated ||
addbuiltin.options[opt_DistrustCRL].activated) { addbuiltin.options[opt_DistrustCRL].activated) {

View file

@ -21,6 +21,7 @@
#include "secoid.h" #include "secoid.h"
#include "nssutil.h" #include "nssutil.h"
#include "ecl-curve.h" #include "ecl-curve.h"
#include "chacha20poly1305.h"
#include "pkcs1_vectors.h" #include "pkcs1_vectors.h"
@ -392,88 +393,87 @@ typedef struct curveNameTagPairStr {
SECOidTag curveOidTag; SECOidTag curveOidTag;
} CurveNameTagPair; } CurveNameTagPair;
static CurveNameTagPair nameTagPair[] = static CurveNameTagPair nameTagPair[] = {
{ { "sect163k1", SEC_OID_SECG_EC_SECT163K1 },
{ "sect163k1", SEC_OID_SECG_EC_SECT163K1 }, { "nistk163", SEC_OID_SECG_EC_SECT163K1 },
{ "nistk163", SEC_OID_SECG_EC_SECT163K1 }, { "sect163r1", SEC_OID_SECG_EC_SECT163R1 },
{ "sect163r1", SEC_OID_SECG_EC_SECT163R1 }, { "sect163r2", SEC_OID_SECG_EC_SECT163R2 },
{ "sect163r2", SEC_OID_SECG_EC_SECT163R2 }, { "nistb163", SEC_OID_SECG_EC_SECT163R2 },
{ "nistb163", SEC_OID_SECG_EC_SECT163R2 }, { "sect193r1", SEC_OID_SECG_EC_SECT193R1 },
{ "sect193r1", SEC_OID_SECG_EC_SECT193R1 }, { "sect193r2", SEC_OID_SECG_EC_SECT193R2 },
{ "sect193r2", SEC_OID_SECG_EC_SECT193R2 }, { "sect233k1", SEC_OID_SECG_EC_SECT233K1 },
{ "sect233k1", SEC_OID_SECG_EC_SECT233K1 }, { "nistk233", SEC_OID_SECG_EC_SECT233K1 },
{ "nistk233", SEC_OID_SECG_EC_SECT233K1 }, { "sect233r1", SEC_OID_SECG_EC_SECT233R1 },
{ "sect233r1", SEC_OID_SECG_EC_SECT233R1 }, { "nistb233", SEC_OID_SECG_EC_SECT233R1 },
{ "nistb233", SEC_OID_SECG_EC_SECT233R1 }, { "sect239k1", SEC_OID_SECG_EC_SECT239K1 },
{ "sect239k1", SEC_OID_SECG_EC_SECT239K1 }, { "sect283k1", SEC_OID_SECG_EC_SECT283K1 },
{ "sect283k1", SEC_OID_SECG_EC_SECT283K1 }, { "nistk283", SEC_OID_SECG_EC_SECT283K1 },
{ "nistk283", SEC_OID_SECG_EC_SECT283K1 }, { "sect283r1", SEC_OID_SECG_EC_SECT283R1 },
{ "sect283r1", SEC_OID_SECG_EC_SECT283R1 }, { "nistb283", SEC_OID_SECG_EC_SECT283R1 },
{ "nistb283", SEC_OID_SECG_EC_SECT283R1 }, { "sect409k1", SEC_OID_SECG_EC_SECT409K1 },
{ "sect409k1", SEC_OID_SECG_EC_SECT409K1 }, { "nistk409", SEC_OID_SECG_EC_SECT409K1 },
{ "nistk409", SEC_OID_SECG_EC_SECT409K1 }, { "sect409r1", SEC_OID_SECG_EC_SECT409R1 },
{ "sect409r1", SEC_OID_SECG_EC_SECT409R1 }, { "nistb409", SEC_OID_SECG_EC_SECT409R1 },
{ "nistb409", SEC_OID_SECG_EC_SECT409R1 }, { "sect571k1", SEC_OID_SECG_EC_SECT571K1 },
{ "sect571k1", SEC_OID_SECG_EC_SECT571K1 }, { "nistk571", SEC_OID_SECG_EC_SECT571K1 },
{ "nistk571", SEC_OID_SECG_EC_SECT571K1 }, { "sect571r1", SEC_OID_SECG_EC_SECT571R1 },
{ "sect571r1", SEC_OID_SECG_EC_SECT571R1 }, { "nistb571", SEC_OID_SECG_EC_SECT571R1 },
{ "nistb571", SEC_OID_SECG_EC_SECT571R1 }, { "secp160k1", SEC_OID_SECG_EC_SECP160K1 },
{ "secp160k1", SEC_OID_SECG_EC_SECP160K1 }, { "secp160r1", SEC_OID_SECG_EC_SECP160R1 },
{ "secp160r1", SEC_OID_SECG_EC_SECP160R1 }, { "secp160r2", SEC_OID_SECG_EC_SECP160R2 },
{ "secp160r2", SEC_OID_SECG_EC_SECP160R2 }, { "secp192k1", SEC_OID_SECG_EC_SECP192K1 },
{ "secp192k1", SEC_OID_SECG_EC_SECP192K1 }, { "secp192r1", SEC_OID_SECG_EC_SECP192R1 },
{ "secp192r1", SEC_OID_SECG_EC_SECP192R1 }, { "nistp192", SEC_OID_SECG_EC_SECP192R1 },
{ "nistp192", SEC_OID_SECG_EC_SECP192R1 }, { "secp224k1", SEC_OID_SECG_EC_SECP224K1 },
{ "secp224k1", SEC_OID_SECG_EC_SECP224K1 }, { "secp224r1", SEC_OID_SECG_EC_SECP224R1 },
{ "secp224r1", SEC_OID_SECG_EC_SECP224R1 }, { "nistp224", SEC_OID_SECG_EC_SECP224R1 },
{ "nistp224", SEC_OID_SECG_EC_SECP224R1 }, { "secp256k1", SEC_OID_SECG_EC_SECP256K1 },
{ "secp256k1", SEC_OID_SECG_EC_SECP256K1 }, { "secp256r1", SEC_OID_SECG_EC_SECP256R1 },
{ "secp256r1", SEC_OID_SECG_EC_SECP256R1 }, { "nistp256", SEC_OID_SECG_EC_SECP256R1 },
{ "nistp256", SEC_OID_SECG_EC_SECP256R1 }, { "secp384r1", SEC_OID_SECG_EC_SECP384R1 },
{ "secp384r1", SEC_OID_SECG_EC_SECP384R1 }, { "nistp384", SEC_OID_SECG_EC_SECP384R1 },
{ "nistp384", SEC_OID_SECG_EC_SECP384R1 }, { "secp521r1", SEC_OID_SECG_EC_SECP521R1 },
{ "secp521r1", SEC_OID_SECG_EC_SECP521R1 }, { "nistp521", SEC_OID_SECG_EC_SECP521R1 },
{ "nistp521", SEC_OID_SECG_EC_SECP521R1 },
{ "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 }, { "prime192v1", SEC_OID_ANSIX962_EC_PRIME192V1 },
{ "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 }, { "prime192v2", SEC_OID_ANSIX962_EC_PRIME192V2 },
{ "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 }, { "prime192v3", SEC_OID_ANSIX962_EC_PRIME192V3 },
{ "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 }, { "prime239v1", SEC_OID_ANSIX962_EC_PRIME239V1 },
{ "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 }, { "prime239v2", SEC_OID_ANSIX962_EC_PRIME239V2 },
{ "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 }, { "prime239v3", SEC_OID_ANSIX962_EC_PRIME239V3 },
{ "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 }, { "c2pnb163v1", SEC_OID_ANSIX962_EC_C2PNB163V1 },
{ "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 }, { "c2pnb163v2", SEC_OID_ANSIX962_EC_C2PNB163V2 },
{ "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 }, { "c2pnb163v3", SEC_OID_ANSIX962_EC_C2PNB163V3 },
{ "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 }, { "c2pnb176v1", SEC_OID_ANSIX962_EC_C2PNB176V1 },
{ "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 }, { "c2tnb191v1", SEC_OID_ANSIX962_EC_C2TNB191V1 },
{ "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 }, { "c2tnb191v2", SEC_OID_ANSIX962_EC_C2TNB191V2 },
{ "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 }, { "c2tnb191v3", SEC_OID_ANSIX962_EC_C2TNB191V3 },
{ "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 }, { "c2onb191v4", SEC_OID_ANSIX962_EC_C2ONB191V4 },
{ "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 }, { "c2onb191v5", SEC_OID_ANSIX962_EC_C2ONB191V5 },
{ "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 }, { "c2pnb208w1", SEC_OID_ANSIX962_EC_C2PNB208W1 },
{ "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 }, { "c2tnb239v1", SEC_OID_ANSIX962_EC_C2TNB239V1 },
{ "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 }, { "c2tnb239v2", SEC_OID_ANSIX962_EC_C2TNB239V2 },
{ "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 }, { "c2tnb239v3", SEC_OID_ANSIX962_EC_C2TNB239V3 },
{ "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 }, { "c2onb239v4", SEC_OID_ANSIX962_EC_C2ONB239V4 },
{ "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 }, { "c2onb239v5", SEC_OID_ANSIX962_EC_C2ONB239V5 },
{ "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 }, { "c2pnb272w1", SEC_OID_ANSIX962_EC_C2PNB272W1 },
{ "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 }, { "c2pnb304w1", SEC_OID_ANSIX962_EC_C2PNB304W1 },
{ "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 }, { "c2tnb359v1", SEC_OID_ANSIX962_EC_C2TNB359V1 },
{ "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 }, { "c2pnb368w1", SEC_OID_ANSIX962_EC_C2PNB368W1 },
{ "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 }, { "c2tnb431r1", SEC_OID_ANSIX962_EC_C2TNB431R1 },
{ "secp112r1", SEC_OID_SECG_EC_SECP112R1 }, { "secp112r1", SEC_OID_SECG_EC_SECP112R1 },
{ "secp112r2", SEC_OID_SECG_EC_SECP112R2 }, { "secp112r2", SEC_OID_SECG_EC_SECP112R2 },
{ "secp128r1", SEC_OID_SECG_EC_SECP128R1 }, { "secp128r1", SEC_OID_SECG_EC_SECP128R1 },
{ "secp128r2", SEC_OID_SECG_EC_SECP128R2 }, { "secp128r2", SEC_OID_SECG_EC_SECP128R2 },
{ "sect113r1", SEC_OID_SECG_EC_SECT113R1 }, { "sect113r1", SEC_OID_SECG_EC_SECT113R1 },
{ "sect113r2", SEC_OID_SECG_EC_SECT113R2 }, { "sect113r2", SEC_OID_SECG_EC_SECT113R2 },
{ "sect131r1", SEC_OID_SECG_EC_SECT131R1 }, { "sect131r1", SEC_OID_SECG_EC_SECT131R1 },
{ "sect131r2", SEC_OID_SECG_EC_SECT131R2 }, { "sect131r2", SEC_OID_SECG_EC_SECT131R2 },
{ "curve25519", SEC_OID_CURVE25519 }, { "curve25519", SEC_OID_CURVE25519 },
}; };
static SECItem * static SECItem *
getECParams(const char *curve) getECParams(const char *curve)
@ -608,9 +608,11 @@ typedef enum {
bltestDES_CBC, /* . */ bltestDES_CBC, /* . */
bltestDES_EDE_ECB, /* . */ bltestDES_EDE_ECB, /* . */
bltestDES_EDE_CBC, /* . */ bltestDES_EDE_CBC, /* . */
bltestRC2_ECB, /* . */ #ifndef NSS_DISABLE_DEPRECATED_RC2
bltestRC2_CBC, /* . */ bltestRC2_ECB, /* . */
bltestRC4, /* . */ bltestRC2_CBC, /* . */
#endif
bltestRC4, /* . */
#ifdef NSS_SOFTOKEN_DOES_RC5 #ifdef NSS_SOFTOKEN_DOES_RC5
bltestRC5_ECB, /* . */ bltestRC5_ECB, /* . */
bltestRC5_CBC, /* . */ bltestRC5_CBC, /* . */
@ -622,8 +624,11 @@ typedef enum {
bltestAES_GCM, /* . */ bltestAES_GCM, /* . */
bltestCAMELLIA_ECB, /* . */ bltestCAMELLIA_ECB, /* . */
bltestCAMELLIA_CBC, /* . */ bltestCAMELLIA_CBC, /* . */
bltestSEED_ECB, /* SEED algorithm */ #ifndef NSS_DISABLE_DEPRECATED_SEED
bltestSEED_CBC, /* SEED algorithm */ bltestSEED_ECB, /* SEED algorithm */
bltestSEED_CBC, /* SEED algorithm */
#endif
bltestCHACHA20_CTR, /* ChaCha20 block cipher */
bltestCHACHA20, /* ChaCha20 + Poly1305 */ bltestCHACHA20, /* ChaCha20 + Poly1305 */
bltestRSA, /* Public Key Ciphers */ bltestRSA, /* Public Key Ciphers */
bltestRSA_OAEP, /* . (Public Key Enc.) */ bltestRSA_OAEP, /* . (Public Key Enc.) */
@ -640,43 +645,47 @@ typedef enum {
NUMMODES NUMMODES
} bltestCipherMode; } bltestCipherMode;
static char *mode_strings[] = static char *mode_strings[] = {
{ "des_ecb",
"des_ecb", "des_cbc",
"des_cbc", "des3_ecb",
"des3_ecb", "des3_cbc",
"des3_cbc", #ifndef NSS_DISABLE_DEPRECATED_RC2
"rc2_ecb", "rc2_ecb",
"rc2_cbc", "rc2_cbc",
"rc4",
#ifdef NSS_SOFTOKEN_DOES_RC5
"rc5_ecb",
"rc5_cbc",
#endif #endif
"aes_ecb", "rc4",
"aes_cbc", #ifdef NSS_SOFTOKEN_DOES_RC5
"aes_cts", "rc5_ecb",
"aes_ctr", "rc5_cbc",
"aes_gcm", #endif
"camellia_ecb", "aes_ecb",
"camellia_cbc", "aes_cbc",
"seed_ecb", "aes_cts",
"seed_cbc", "aes_ctr",
"chacha20_poly1305", "aes_gcm",
"rsa", "camellia_ecb",
"rsa_oaep", "camellia_cbc",
"rsa_pss", #ifndef NSS_DISABLE_DEPRECATED_SEED
"ecdsa", "seed_ecb",
/*"pqg",*/ "seed_cbc",
"dsa", #endif
"md2", "chacha20_ctr",
"md5", "chacha20_poly1305",
"sha1", "rsa",
"sha224", "rsa_oaep",
"sha256", "rsa_pss",
"sha384", "ecdsa",
"sha512", /*"pqg",*/
}; "dsa",
"md2",
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512",
};
typedef struct typedef struct
{ {
@ -793,7 +802,7 @@ PRBool
is_symmkeyCipher(bltestCipherMode mode) is_symmkeyCipher(bltestCipherMode mode)
{ {
/* change as needed! */ /* change as needed! */
if (mode >= bltestDES_ECB && mode <= bltestSEED_CBC) if (mode >= bltestDES_ECB && mode <= bltestCHACHA20_CTR)
return PR_TRUE; return PR_TRUE;
return PR_FALSE; return PR_FALSE;
} }
@ -830,6 +839,7 @@ is_singleShotCipher(bltestCipherMode mode)
switch (mode) { switch (mode) {
case bltestAES_GCM: case bltestAES_GCM:
case bltestAES_CTS: case bltestAES_CTS:
case bltestCHACHA20_CTR:
case bltestCHACHA20: case bltestCHACHA20:
return PR_TRUE; return PR_TRUE;
default: default:
@ -871,7 +881,9 @@ cipher_requires_IV(bltestCipherMode mode)
switch (mode) { switch (mode) {
case bltestDES_CBC: case bltestDES_CBC:
case bltestDES_EDE_CBC: case bltestDES_EDE_CBC:
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_CBC: case bltestRC2_CBC:
#endif
#ifdef NSS_SOFTOKEN_DOES_RC5 #ifdef NSS_SOFTOKEN_DOES_RC5
case bltestRC5_CBC: case bltestRC5_CBC:
#endif #endif
@ -880,7 +892,10 @@ cipher_requires_IV(bltestCipherMode mode)
case bltestAES_CTR: case bltestAES_CTR:
case bltestAES_GCM: case bltestAES_GCM:
case bltestCAMELLIA_CBC: case bltestCAMELLIA_CBC:
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_CBC: case bltestSEED_CBC:
#endif
case bltestCHACHA20_CTR:
case bltestCHACHA20: case bltestCHACHA20:
return PR_TRUE; return PR_TRUE;
default: default:
@ -1078,6 +1093,7 @@ des_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen,
input, inputLen); input, inputLen);
} }
#ifndef NSS_DISABLE_DEPRECATED_RC2
SECStatus SECStatus
rc2_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, rc2_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen,
unsigned int maxOutputLen, const unsigned char *input, unsigned int maxOutputLen, const unsigned char *input,
@ -1095,6 +1111,7 @@ rc2_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen,
return RC2_Decrypt((RC2Context *)cx, output, outputLen, maxOutputLen, return RC2_Decrypt((RC2Context *)cx, output, outputLen, maxOutputLen,
input, inputLen); input, inputLen);
} }
#endif /* NSS_DISABLE_DEPRECATED_RC2 */
SECStatus SECStatus
rc4_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, rc4_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen,
@ -1132,6 +1149,21 @@ aes_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen,
input, inputLen); input, inputLen);
} }
SECStatus
chacha20_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen,
unsigned int maxOutputLen, const unsigned char *input,
unsigned int inputLen)
{
if (maxOutputLen < inputLen) {
PORT_SetError(SEC_ERROR_OUTPUT_LEN);
return SECFailure;
}
ChaCha20Context *ctx = cx;
*outputLen = inputLen;
return ChaCha20_Xor(output, input, inputLen, ctx->key, ctx->nonce,
ctx->counter);
}
SECStatus SECStatus
chacha20_poly1305_Encrypt(void *cx, unsigned char *output, chacha20_poly1305_Encrypt(void *cx, unsigned char *output,
unsigned int *outputLen, unsigned int maxOutputLen, unsigned int *outputLen, unsigned int maxOutputLen,
@ -1176,6 +1208,7 @@ camellia_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen,
input, inputLen); input, inputLen);
} }
#ifndef NSS_DISABLE_DEPRECATED_SEED
SECStatus SECStatus
seed_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen, seed_Encrypt(void *cx, unsigned char *output, unsigned int *outputLen,
unsigned int maxOutputLen, const unsigned char *input, unsigned int maxOutputLen, const unsigned char *input,
@ -1193,6 +1226,7 @@ seed_Decrypt(void *cx, unsigned char *output, unsigned int *outputLen,
return SEED_Decrypt((SEEDContext *)cx, output, outputLen, maxOutputLen, return SEED_Decrypt((SEEDContext *)cx, output, outputLen, maxOutputLen,
input, inputLen); input, inputLen);
} }
#endif /* NSS_DISABLE_DEPRECATED_SEED */
SECStatus SECStatus
rsa_PublicKeyOp(void *cx, SECItem *output, const SECItem *input) rsa_PublicKeyOp(void *cx, SECItem *output, const SECItem *input)
@ -1361,6 +1395,7 @@ bltest_des_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
return SECSuccess; return SECSuccess;
} }
#ifndef NSS_DISABLE_DEPRECATED_RC2
SECStatus SECStatus
bltest_rc2_init(bltestCipherInfo *cipherInfo, PRBool encrypt) bltest_rc2_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
{ {
@ -1406,6 +1441,7 @@ bltest_rc2_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
cipherInfo->cipher.symmkeyCipher = rc2_Decrypt; cipherInfo->cipher.symmkeyCipher = rc2_Decrypt;
return SECSuccess; return SECSuccess;
} }
#endif /* NSS_DISABLE_DEPRECATED_RC2 */
SECStatus SECStatus
bltest_rc4_init(bltestCipherInfo *cipherInfo, PRBool encrypt) bltest_rc4_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
@ -1481,7 +1517,7 @@ bltest_aes_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
unsigned char *params; unsigned char *params;
int len; int len;
CK_AES_CTR_PARAMS ctrParams; CK_AES_CTR_PARAMS ctrParams;
CK_GCM_PARAMS gcmParams; CK_NSS_GCM_PARAMS gcmParams;
params = aesp->iv.buf.data; params = aesp->iv.buf.data;
switch (cipherInfo->mode) { switch (cipherInfo->mode) {
@ -1587,6 +1623,7 @@ bltest_camellia_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
return SECSuccess; return SECSuccess;
} }
#ifndef NSS_DISABLE_DEPRECATED_SEED
SECStatus SECStatus
bltest_seed_init(bltestCipherInfo *cipherInfo, PRBool encrypt) bltest_seed_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
{ {
@ -1630,6 +1667,25 @@ bltest_seed_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
return SECSuccess; return SECSuccess;
} }
#endif /* NSS_DISABLE_DEPRECATED_SEED */
SECStatus
bltest_chacha20_ctr_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
{
const PRUint32 counter = 1;
bltestSymmKeyParams *sk = &cipherInfo->params.sk;
cipherInfo->cx = ChaCha20_CreateContext(sk->key.buf.data, sk->key.buf.len,
sk->iv.buf.data, sk->iv.buf.len,
counter);
if (cipherInfo->cx == NULL) {
PR_fprintf(PR_STDERR, "ChaCha20_CreateContext() returned NULL\n"
"key must be 32 bytes, iv must be 12 bytes\n");
return SECFailure;
}
cipherInfo->cipher.symmkeyCipher = chacha20_Encrypt;
return SECSuccess;
}
SECStatus SECStatus
bltest_chacha20_init(bltestCipherInfo *cipherInfo, PRBool encrypt) bltest_chacha20_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
@ -2245,12 +2301,14 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
return bltest_des_init(cipherInfo, encrypt); return bltest_des_init(cipherInfo, encrypt);
break; break;
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_ECB: case bltestRC2_ECB:
case bltestRC2_CBC: case bltestRC2_CBC:
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
return bltest_rc2_init(cipherInfo, encrypt); return bltest_rc2_init(cipherInfo, encrypt);
break; break;
#endif /* NSS_DISABLE_DEPRECATED_RC2 */
case bltestRC4: case bltestRC4:
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
@ -2261,9 +2319,9 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
case bltestRC5_CBC: case bltestRC5_CBC:
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
#endif
return bltest_rc5_init(cipherInfo, encrypt); return bltest_rc5_init(cipherInfo, encrypt);
break; break;
#endif
case bltestAES_ECB: case bltestAES_ECB:
case bltestAES_CBC: case bltestAES_CBC:
case bltestAES_CTS: case bltestAES_CTS:
@ -2282,12 +2340,19 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
return bltest_camellia_init(cipherInfo, encrypt); return bltest_camellia_init(cipherInfo, encrypt);
break; break;
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_ECB: case bltestSEED_ECB:
case bltestSEED_CBC: case bltestSEED_CBC:
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
cipherInfo->input.pBuf.len); cipherInfo->input.pBuf.len);
return bltest_seed_init(cipherInfo, encrypt); return bltest_seed_init(cipherInfo, encrypt);
break; break;
#endif /* NSS_DISABLE_DEPRECATED_SEED */
case bltestCHACHA20_CTR:
outlen = cipherInfo->input.pBuf.len;
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, outlen);
return bltest_chacha20_ctr_init(cipherInfo, encrypt);
break;
case bltestCHACHA20: case bltestCHACHA20:
outlen = cipherInfo->input.pBuf.len + (encrypt ? 16 : 0); outlen = cipherInfo->input.pBuf.len + (encrypt ? 16 : 0);
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, outlen); SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf, outlen);
@ -2586,19 +2651,26 @@ cipherFinish(bltestCipherInfo *cipherInfo)
case bltestCAMELLIA_CBC: case bltestCAMELLIA_CBC:
Camellia_DestroyContext((CamelliaContext *)cipherInfo->cx, PR_TRUE); Camellia_DestroyContext((CamelliaContext *)cipherInfo->cx, PR_TRUE);
break; break;
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_ECB: case bltestSEED_ECB:
case bltestSEED_CBC: case bltestSEED_CBC:
SEED_DestroyContext((SEEDContext *)cipherInfo->cx, PR_TRUE); SEED_DestroyContext((SEEDContext *)cipherInfo->cx, PR_TRUE);
break; break;
#endif /* NSS_DISABLE_DEPRECATED_SEED */
case bltestCHACHA20_CTR:
ChaCha20_DestroyContext((ChaCha20Context *)cipherInfo->cx, PR_TRUE);
break;
case bltestCHACHA20: case bltestCHACHA20:
ChaCha20Poly1305_DestroyContext((ChaCha20Poly1305Context *) ChaCha20Poly1305_DestroyContext((ChaCha20Poly1305Context *)
cipherInfo->cx, cipherInfo->cx,
PR_TRUE); PR_TRUE);
break; break;
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_ECB: case bltestRC2_ECB:
case bltestRC2_CBC: case bltestRC2_CBC:
RC2_DestroyContext((RC2Context *)cipherInfo->cx, PR_TRUE); RC2_DestroyContext((RC2Context *)cipherInfo->cx, PR_TRUE);
break; break;
#endif /* NSS_DISABLE_DEPRECATED_RC2 */
case bltestRC4: case bltestRC4:
RC4_DestroyContext((RC4Context *)cipherInfo->cx, PR_TRUE); RC4_DestroyContext((RC4Context *)cipherInfo->cx, PR_TRUE);
break; break;
@ -2674,7 +2746,10 @@ getHighUnitBytes(PRInt64 res)
} }
} }
return PR_smprintf("%d%s", spl[i], marks[i]); if (i == 0)
return PR_smprintf("%d%s", spl[i], marks[i]);
else
return PR_smprintf("%d%s %d%s", spl[i], marks[i], spl[i - 1], marks[i - 1]);
} }
static void static void
@ -2747,10 +2822,14 @@ print_td:
case bltestAES_GCM: case bltestAES_GCM:
case bltestCAMELLIA_ECB: case bltestCAMELLIA_ECB:
case bltestCAMELLIA_CBC: case bltestCAMELLIA_CBC:
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_ECB: case bltestSEED_ECB:
case bltestSEED_CBC: case bltestSEED_CBC:
#endif
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_ECB: case bltestRC2_ECB:
case bltestRC2_CBC: case bltestRC2_CBC:
#endif
case bltestRC4: case bltestRC4:
if (td) if (td)
fprintf(stdout, "%8s", "symmkey"); fprintf(stdout, "%8s", "symmkey");
@ -2930,37 +3009,45 @@ get_params(PLArenaPool *arena, bltestParams *params,
switch (mode) { switch (mode) {
case bltestAES_GCM: case bltestAES_GCM:
case bltestCHACHA20: case bltestCHACHA20:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "aad", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "aad", j);
load_file_data(arena, &params->ask.aad, filename, bltestBinary); load_file_data(arena, &params->ask.aad, filename, bltestBinary);
case bltestDES_CBC: case bltestDES_CBC:
case bltestDES_EDE_CBC: case bltestDES_EDE_CBC:
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_CBC: case bltestRC2_CBC:
#endif
case bltestAES_CBC: case bltestAES_CBC:
case bltestAES_CTS: case bltestAES_CTS:
case bltestAES_CTR: case bltestAES_CTR:
case bltestCAMELLIA_CBC: case bltestCAMELLIA_CBC:
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_CBC: case bltestSEED_CBC:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j); #endif
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
load_file_data(arena, &params->sk.iv, filename, bltestBinary); load_file_data(arena, &params->sk.iv, filename, bltestBinary);
case bltestDES_ECB: case bltestDES_ECB:
case bltestDES_EDE_ECB: case bltestDES_EDE_ECB:
#ifndef NSS_DISABLE_DEPRECATED_RC2
case bltestRC2_ECB: case bltestRC2_ECB:
#endif
case bltestRC4: case bltestRC4:
case bltestAES_ECB: case bltestAES_ECB:
case bltestCAMELLIA_ECB: case bltestCAMELLIA_ECB:
#ifndef NSS_DISABLE_DEPRECATED_SEED
case bltestSEED_ECB: case bltestSEED_ECB:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); #endif
snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->sk.key, filename, bltestBinary); load_file_data(arena, &params->sk.key, filename, bltestBinary);
break; break;
#ifdef NSS_SOFTOKEN_DOES_RC5 #ifdef NSS_SOFTOKEN_DOES_RC5
case bltestRC5_ECB: case bltestRC5_ECB:
case bltestRC5_CBC: case bltestRC5_CBC:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "iv", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "iv", j);
load_file_data(arena, &params->sk.iv, filename, bltestBinary); load_file_data(arena, &params->sk.iv, filename, bltestBinary);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->sk.key, filename, bltestBinary); load_file_data(arena, &params->sk.key, filename, bltestBinary);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
"params", j); "params", j);
file = fopen(filename, "r"); file = fopen(filename, "r");
if (!file) if (!file)
return; return;
@ -2983,59 +3070,59 @@ get_params(PLArenaPool *arena, bltestParams *params,
break; break;
#endif #endif
case bltestRSA_PSS: case bltestRSA_PSS:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded); load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded);
/* fall through */ /* fall through */
case bltestRSA_OAEP: case bltestRSA_OAEP:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "seed", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "seed", j);
load_file_data(arena, &params->asymk.cipherParams.rsa.seed, load_file_data(arena, &params->asymk.cipherParams.rsa.seed,
filename, bltestBase64Encoded); filename, bltestBase64Encoded);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "hash", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "hash", j);
load_file_data(arena, &tempIO, filename, bltestBinary); load_file_data(arena, &tempIO, filename, bltestBinary);
params->asymk.cipherParams.rsa.hashAlg = params->asymk.cipherParams.rsa.hashAlg =
mode_str_to_hash_alg(&tempIO.buf); mode_str_to_hash_alg(&tempIO.buf);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "maskhash", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "maskhash", j);
load_file_data(arena, &tempIO, filename, bltestBinary); load_file_data(arena, &tempIO, filename, bltestBinary);
params->asymk.cipherParams.rsa.maskHashAlg = params->asymk.cipherParams.rsa.maskHashAlg =
mode_str_to_hash_alg(&tempIO.buf); mode_str_to_hash_alg(&tempIO.buf);
/* fall through */ /* fall through */
case bltestRSA: case bltestRSA:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->asymk.key, filename, load_file_data(arena, &params->asymk.key, filename,
bltestBase64Encoded); bltestBase64Encoded);
params->asymk.privKey = params->asymk.privKey =
(void *)rsakey_from_filedata(arena, &params->asymk.key.buf); (void *)rsakey_from_filedata(arena, &params->asymk.key.buf);
break; break;
case bltestDSA: case bltestDSA:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->asymk.key, filename, bltestBase64Encoded); load_file_data(arena, &params->asymk.key, filename, bltestBase64Encoded);
params->asymk.privKey = params->asymk.privKey =
(void *)dsakey_from_filedata(arena, &params->asymk.key.buf); (void *)dsakey_from_filedata(arena, &params->asymk.key.buf);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "pqg", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "pqg", j);
load_file_data(arena, &params->asymk.cipherParams.dsa.pqgdata, filename, load_file_data(arena, &params->asymk.cipherParams.dsa.pqgdata, filename,
bltestBase64Encoded); bltestBase64Encoded);
params->asymk.cipherParams.dsa.pqg = params->asymk.cipherParams.dsa.pqg =
pqg_from_filedata(arena, &params->asymk.cipherParams.dsa.pqgdata.buf); pqg_from_filedata(arena, &params->asymk.cipherParams.dsa.pqgdata.buf);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "keyseed", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "keyseed", j);
load_file_data(arena, &params->asymk.cipherParams.dsa.keyseed, filename, load_file_data(arena, &params->asymk.cipherParams.dsa.keyseed, filename,
bltestBase64Encoded); bltestBase64Encoded);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
load_file_data(arena, &params->asymk.cipherParams.dsa.sigseed, filename, load_file_data(arena, &params->asymk.cipherParams.dsa.sigseed, filename,
bltestBase64Encoded); bltestBase64Encoded);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded); load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded);
break; break;
case bltestECDSA: case bltestECDSA:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->asymk.key, filename, bltestBase64Encoded); load_file_data(arena, &params->asymk.key, filename, bltestBase64Encoded);
params->asymk.privKey = params->asymk.privKey =
(void *)eckey_from_filedata(arena, &params->asymk.key.buf); (void *)eckey_from_filedata(arena, &params->asymk.key.buf);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "sigseed", j);
load_file_data(arena, &params->asymk.cipherParams.ecdsa.sigseed, load_file_data(arena, &params->asymk.cipherParams.ecdsa.sigseed,
filename, bltestBase64Encoded); filename, bltestBase64Encoded);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j); snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded); load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded);
break; break;
case bltestMD2: case bltestMD2:
@ -3151,7 +3238,7 @@ blapi_selftest(bltestCipherMode *modes, int numModes, int inoff, int outoff,
cipherInfo.mode = mode; cipherInfo.mode = mode;
params = &cipherInfo.params; params = &cipherInfo.params;
/* get the number of tests in the directory */ /* get the number of tests in the directory */
sprintf(filename, "%s/tests/%s/%s", testdir, modestr, "numtests"); snprintf(filename, sizeof(filename), "%s/tests/%s/%s", testdir, modestr, "numtests");
if (ReadFileToItem(arena, &item, filename) != SECSuccess) { if (ReadFileToItem(arena, &item, filename) != SECSuccess) {
fprintf(stderr, "%s: Cannot read file %s.\n", progName, filename); fprintf(stderr, "%s: Cannot read file %s.\n", progName, filename);
rv = SECFailure; rv = SECFailure;
@ -3167,13 +3254,13 @@ blapi_selftest(bltestCipherMode *modes, int numModes, int inoff, int outoff,
numtests += (int)(item.data[j] - '0'); numtests += (int)(item.data[j] - '0');
} }
for (j = 0; j < numtests; j++) { for (j = 0; j < numtests; j++) {
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
"plaintext", j); "plaintext", j);
load_file_data(arena, &pt, filename, load_file_data(arena, &pt, filename,
is_sigCipher(mode) ? bltestBase64Encoded is_sigCipher(mode) ? bltestBase64Encoded
: bltestBinary); : bltestBinary);
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, snprintf(filename, sizeof(filename), "%s/tests/%s/%s%d", testdir, modestr,
"ciphertext", j); "ciphertext", j);
load_file_data(arena, &ct, filename, bltestBase64Encoded); load_file_data(arena, &ct, filename, bltestBase64Encoded);
get_params(arena, params, mode, j); get_params(arena, params, mode, j);
@ -3572,57 +3659,55 @@ enum {
opt_CmdLine opt_CmdLine
}; };
static secuCommandFlag bltest_commands[] = static secuCommandFlag bltest_commands[] = {
{ { /* cmd_Decrypt */ 'D', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Decrypt */ 'D', PR_FALSE, 0, PR_FALSE }, { /* cmd_Encrypt */ 'E', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Encrypt */ 'E', PR_FALSE, 0, PR_FALSE }, { /* cmd_FIPS */ 'F', PR_FALSE, 0, PR_FALSE },
{ /* cmd_FIPS */ 'F', PR_FALSE, 0, PR_FALSE }, { /* cmd_Hash */ 'H', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Hash */ 'H', PR_FALSE, 0, PR_FALSE }, { /* cmd_Nonce */ 'N', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Nonce */ 'N', PR_FALSE, 0, PR_FALSE }, { /* cmd_Dump */ 'P', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Dump */ 'P', PR_FALSE, 0, PR_FALSE }, { /* cmd_RSAPopulate */ 'R', PR_FALSE, 0, PR_FALSE },
{ /* cmd_RSAPopulate */ 'R', PR_FALSE, 0, PR_FALSE }, { /* cmd_RSAPopulateKV */ 'K', PR_FALSE, 0, PR_FALSE },
{ /* cmd_RSAPopulateKV */ 'K', PR_FALSE, 0, PR_FALSE }, { /* cmd_Sign */ 'S', PR_FALSE, 0, PR_FALSE },
{ /* cmd_Sign */ 'S', PR_FALSE, 0, PR_FALSE }, { /* cmd_SelfTest */ 'T', PR_FALSE, 0, PR_FALSE },
{ /* cmd_SelfTest */ 'T', PR_FALSE, 0, PR_FALSE }, { /* cmd_Verify */ 'V', PR_FALSE, 0, PR_FALSE }
{ /* cmd_Verify */ 'V', PR_FALSE, 0, PR_FALSE } };
};
static secuCommandFlag bltest_options[] = static secuCommandFlag bltest_options[] = {
{ { /* opt_B64 */ 'a', PR_FALSE, 0, PR_FALSE },
{ /* opt_B64 */ 'a', PR_FALSE, 0, PR_FALSE }, { /* opt_BufSize */ 'b', PR_TRUE, 0, PR_FALSE },
{ /* opt_BufSize */ 'b', PR_TRUE, 0, PR_FALSE }, { /* opt_Restart */ 'c', PR_FALSE, 0, PR_FALSE },
{ /* opt_Restart */ 'c', PR_FALSE, 0, PR_FALSE }, { /* opt_SelfTestDir */ 'd', PR_TRUE, 0, PR_FALSE },
{ /* opt_SelfTestDir */ 'd', PR_TRUE, 0, PR_FALSE }, { /* opt_Exponent */ 'e', PR_TRUE, 0, PR_FALSE },
{ /* opt_Exponent */ 'e', PR_TRUE, 0, PR_FALSE }, { /* opt_SigFile */ 'f', PR_TRUE, 0, PR_FALSE },
{ /* opt_SigFile */ 'f', PR_TRUE, 0, PR_FALSE }, { /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE },
{ /* opt_KeySize */ 'g', PR_TRUE, 0, PR_FALSE }, { /* opt_Hex */ 'h', PR_FALSE, 0, PR_FALSE },
{ /* opt_Hex */ 'h', PR_FALSE, 0, PR_FALSE }, { /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE },
{ /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE }, { /* opt_PQGFile */ 'j', PR_TRUE, 0, PR_FALSE },
{ /* opt_PQGFile */ 'j', PR_TRUE, 0, PR_FALSE }, { /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE },
{ /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE }, { /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE },
{ /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE }, { /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE },
{ /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE }, { /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE },
{ /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE }, { /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE },
{ /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE }, { /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE },
{ /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE }, { /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE },
{ /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE }, { /* opt_Rounds */ 'r', PR_TRUE, 0, PR_FALSE },
{ /* opt_Rounds */ 'r', PR_TRUE, 0, PR_FALSE }, { /* opt_Seed */ 's', PR_TRUE, 0, PR_FALSE },
{ /* opt_Seed */ 's', PR_TRUE, 0, PR_FALSE }, { /* opt_SigSeedFile */ 't', PR_TRUE, 0, PR_FALSE },
{ /* opt_SigSeedFile */ 't', PR_TRUE, 0, PR_FALSE }, { /* opt_CXReps */ 'u', PR_TRUE, 0, PR_FALSE },
{ /* opt_CXReps */ 'u', PR_TRUE, 0, PR_FALSE }, { /* opt_IV */ 'v', PR_TRUE, 0, PR_FALSE },
{ /* opt_IV */ 'v', PR_TRUE, 0, PR_FALSE }, { /* opt_WordSize */ 'w', PR_TRUE, 0, PR_FALSE },
{ /* opt_WordSize */ 'w', PR_TRUE, 0, PR_FALSE }, { /* opt_UseSeed */ 'x', PR_FALSE, 0, PR_FALSE },
{ /* opt_UseSeed */ 'x', PR_FALSE, 0, PR_FALSE }, { /* opt_UseSigSeed */ 'y', PR_FALSE, 0, PR_FALSE },
{ /* opt_UseSigSeed */ 'y', PR_FALSE, 0, PR_FALSE }, { /* opt_SeedFile */ 'z', PR_FALSE, 0, PR_FALSE },
{ /* opt_SeedFile */ 'z', PR_FALSE, 0, PR_FALSE }, { /* opt_AAD */ 0, PR_TRUE, 0, PR_FALSE, "aad" },
{ /* opt_AAD */ 0, PR_TRUE, 0, PR_FALSE, "aad" }, { /* opt_InputOffset */ '1', PR_TRUE, 0, PR_FALSE },
{ /* opt_InputOffset */ '1', PR_TRUE, 0, PR_FALSE }, { /* opt_OutputOffset */ '2', PR_TRUE, 0, PR_FALSE },
{ /* opt_OutputOffset */ '2', PR_TRUE, 0, PR_FALSE }, { /* opt_MonteCarlo */ '3', PR_FALSE, 0, PR_FALSE },
{ /* opt_MonteCarlo */ '3', PR_FALSE, 0, PR_FALSE }, { /* opt_ThreadNum */ '4', PR_TRUE, 0, PR_FALSE },
{ /* opt_ThreadNum */ '4', PR_TRUE, 0, PR_FALSE }, { /* opt_SecondsToRun */ '5', PR_TRUE, 0, PR_FALSE },
{ /* opt_SecondsToRun */ '5', PR_TRUE, 0, PR_FALSE }, { /* opt_CmdLine */ '-', PR_FALSE, 0, PR_FALSE }
{ /* opt_CmdLine */ '-', PR_FALSE, 0, PR_FALSE } };
};
int int
main(int argc, char **argv) main(int argc, char **argv)
@ -3786,12 +3871,19 @@ main(int argc, char **argv)
/* Do FIPS self-test */ /* Do FIPS self-test */
if (bltest.commands[cmd_FIPS].activated) { if (bltest.commands[cmd_FIPS].activated) {
CK_RV ckrv = sftk_FIPSEntryOK();
fprintf(stdout, "CK_RV: %ld.\n", ckrv);
PORT_Free(cipherInfo); PORT_Free(cipherInfo);
if (ckrv == CKR_OK) #ifdef NSS_FIPS_DISABLED
return SECSuccess; fprintf(stdout, "FIPS self-test failed with: NSS_FIPS_DISABLED\n");
return SECFailure; return SECFailure;
#else
CK_RV ckrv = sftk_FIPSEntryOK(PR_FALSE);
if (ckrv == CKR_OK) {
fprintf(stdout, "FIPS self-test was successful.\n");
return SECSuccess;
}
fprintf(stdout, "FIPS self-test failed with the CK_RV: %ld.\n", ckrv);
return SECFailure;
#endif
} }
/* /*

View file

@ -12,13 +12,7 @@ INCLUDES += -I$(CORE_DEPTH)/nss/lib/softoken
PROGRAM = bltest PROGRAM = bltest
USE_STATIC_LIBS = 1 USE_STATIC_LIBS = 1
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
CSRCS = \ CSRCS = \
blapitest.c \ blapitest.c \

View file

@ -34,7 +34,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -85,7 +86,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -136,7 +138,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -187,7 +190,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -238,7 +242,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -289,7 +294,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -340,7 +346,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -394,7 +401,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -445,7 +453,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -496,7 +505,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -547,7 +557,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -598,7 +609,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -649,7 +661,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -700,7 +713,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,
@ -751,7 +765,8 @@ struct pkcs1_test_vector PKCS1_VECTORS[15] = {
0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0x64, 0xc4, 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8,
0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 }, 0xcf, 0xfb, 0x22, 0x49, 0xbd, 0x9a, 0x21, 0x37 },
128, 128,
(unsigned char[]){ 0x01, 0x00, 0x01 }, 3, (unsigned char[]){ 0x01, 0x00, 0x01 },
3,
(unsigned char[]){ (unsigned char[]){
0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51,
0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf, 0xca, 0x9b, 0xbb, 0xd0, 0xb4, 0x47, 0x71, 0xa1, 0x01, 0xaf,

0
security/nss/cmd/bltest/tests/aes_cbc/mktst.sh Normal file → Executable file
View file

0
security/nss/cmd/bltest/tests/aes_ctr/mktst.sh Normal file → Executable file
View file

0
security/nss/cmd/bltest/tests/aes_cts/mktst.sh Normal file → Executable file
View file

0
security/nss/cmd/bltest/tests/aes_ecb/mktst.sh Normal file → Executable file
View file

0
security/nss/cmd/bltest/tests/aes_gcm/mktst.sh Normal file → Executable file
View file

View file

@ -1,4 +1,5 @@
0 nistp256 The files in this directory contain test-vectors for ECDSA using NIST P-256 Curve (the test-vectors from 0 to 6 included), using NIST P-384 Curve (the test-vectors from 7 to 13 included) and using NIST P-521 Curve (the test-vectors from 14 to 20 included).
1 nistp384
# the following tests are not yet implemented The key files used for the signature contain a curve, a private key and a public key. Each key is represented as follows: Base64(len (curveID), curveID, len(privateKey), privateKey, len(publicKey), publicKey). The length is 4 bytes long. The curveID is a DER encoded OID (as stated in http://www.secg.org/sec2-v2.pdf). A public key (a point) is encoded as 0x4 || x coordinate || y coordinate, where (x, y) computed using the base point. The private key is generated randomly. To generate the test-vectors we were using Sage Math system.
2 nistp521
The random nonces (sigseed) and the plaintexts (already as hashes) are generated randomly and encoded using Base64 encoding. The resulted ciphertexts are presented in the ciphertext files and encoded using Base64 encoding.

Some files were not shown because too many files have changed in this diff Show more