mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-09 16:57:30 +09:00
Update NSS to 3.48 while keeping vc2013 hackfix and no-sslkeylogfile intact.
This commit is contained in:
parent
0b9855b841
commit
171849c8e5
351 changed files with 115185 additions and 57946 deletions
4
config/external/nss/nss.symbols
vendored
4
config/external/nss/nss.symbols
vendored
|
|
@ -111,6 +111,7 @@ CERT_FreeNicknames
|
||||||
CERT_GenTime2FormattedAscii_Util
|
CERT_GenTime2FormattedAscii_Util
|
||||||
CERT_GetCertChainFromCert
|
CERT_GetCertChainFromCert
|
||||||
CERT_GetCertEmailAddress
|
CERT_GetCertEmailAddress
|
||||||
|
CERT_GetCertificateDer
|
||||||
CERT_GetCertificateRequestExtensions
|
CERT_GetCertificateRequestExtensions
|
||||||
CERT_GetCertTimes
|
CERT_GetCertTimes
|
||||||
CERT_GetCertTrust
|
CERT_GetCertTrust
|
||||||
|
|
@ -176,6 +177,7 @@ HASH_Create
|
||||||
HASH_Destroy
|
HASH_Destroy
|
||||||
HASH_End
|
HASH_End
|
||||||
HASH_GetHashObject
|
HASH_GetHashObject
|
||||||
|
HASH_GetHashOidTagByHashType
|
||||||
HASH_GetType
|
HASH_GetType
|
||||||
HASH_HashBuf
|
HASH_HashBuf
|
||||||
HASH_ResultLenByOidTag
|
HASH_ResultLenByOidTag
|
||||||
|
|
@ -344,6 +346,7 @@ PK11_FindCertsFromNickname
|
||||||
PK11_FindKeyByAnyCert
|
PK11_FindKeyByAnyCert
|
||||||
PK11_FindKeyByDERCert
|
PK11_FindKeyByDERCert
|
||||||
PK11_FindKeyByKeyID
|
PK11_FindKeyByKeyID
|
||||||
|
PK11_FindRawCertsWithSubject
|
||||||
PK11_FindSlotByName
|
PK11_FindSlotByName
|
||||||
PK11_FindSlotsByNames
|
PK11_FindSlotsByNames
|
||||||
PK11_FreeSlot
|
PK11_FreeSlot
|
||||||
|
|
@ -361,6 +364,7 @@ PK11_GetBestSlot
|
||||||
PK11_GetBestSlotMultiple
|
PK11_GetBestSlotMultiple
|
||||||
PK11_GetBlockSize
|
PK11_GetBlockSize
|
||||||
PK11_GetCertFromPrivateKey
|
PK11_GetCertFromPrivateKey
|
||||||
|
PK11_GetCertsMatchingPrivateKey
|
||||||
PK11_GetDefaultArray
|
PK11_GetDefaultArray
|
||||||
PK11_GetDefaultFlags
|
PK11_GetDefaultFlags
|
||||||
PK11_GetDisabledReason
|
PK11_GetDisabledReason
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ 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: "hg-worker"
|
workerType: "linux"
|
||||||
provisionerId: "aws-provisioner-v1"
|
provisionerId: "nss-${repository.level}"
|
||||||
|
|
||||||
scopes:
|
scopes:
|
||||||
- 'assume:repo:${repoUrl[8:]}:branch:default'
|
- 'assume:repo:${repoUrl[8:]}:branch:default'
|
||||||
|
|
@ -55,10 +55,11 @@ tasks:
|
||||||
image: djmitche/nss-decision:0.0.3
|
image: djmitche/nss-decision:0.0.3
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TC_OWNER: "${push.owner}"
|
TC_OWNER: "${ownerEmail}"
|
||||||
TC_SOURCE: "${repository.url}"
|
TC_SOURCE: "${repository.url}"
|
||||||
TC_PROJECT: ${repository.project}
|
TC_PROJECT: ${repository.project}
|
||||||
TC_SCHEDULER_ID: "${schedulerId}"
|
TC_SCHEDULER_ID: "${schedulerId}"
|
||||||
|
MOZ_SCM_LEVEL: "${repository.level}"
|
||||||
NSS_PUSHLOG_ID: '${push.pushlog_id}'
|
NSS_PUSHLOG_ID: '${push.pushlog_id}'
|
||||||
NSS_HEAD_REPOSITORY: '${repository.url}'
|
NSS_HEAD_REPOSITORY: '${repository.url}'
|
||||||
NSS_HEAD_REVISION: '${push.revision}'
|
NSS_HEAD_REVISION: '${push.revision}'
|
||||||
|
|
|
||||||
|
|
@ -86,16 +86,14 @@ endif
|
||||||
ifdef NS_USE_GCC
|
ifdef NS_USE_GCC
|
||||||
NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
|
NSPR_CONFIGURE_ENV = CC=gcc CXX=g++
|
||||||
endif
|
endif
|
||||||
|
# Make sure to remove -arch arguments. NSPR can't handle that.
|
||||||
|
remove_arch = $(filter-out __REMOVEME%,$(subst $(NULL) -arch , __REMOVEME,$(1)))
|
||||||
ifdef CC
|
ifdef CC
|
||||||
NSPR_CONFIGURE_ENV = CC="$(CC)"
|
NSPR_CONFIGURE_ENV = CC="$(call remove_arch,$(CC))"
|
||||||
endif
|
endif
|
||||||
ifdef CCC
|
ifdef CCC
|
||||||
NSPR_CONFIGURE_ENV += CXX="$(CCC)"
|
NSPR_CONFIGURE_ENV += CXX="$(call remove_arch,$(CCC))"
|
||||||
endif
|
endif
|
||||||
# Remove -arch definitions. NSPR can't handle that.
|
|
||||||
NSPR_CONFIGURE_ENV := $(filter-out -arch x86_64,$(NSPR_CONFIGURE_ENV))
|
|
||||||
NSPR_CONFIGURE_ENV := $(filter-out -arch i386,$(NSPR_CONFIGURE_ENV))
|
|
||||||
NSPR_CONFIGURE_ENV := $(filter-out -arch ppc,$(NSPR_CONFIGURE_ENV))
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Some pwd commands on Windows (for example, the pwd
|
# Some pwd commands on Windows (for example, the pwd
|
||||||
|
|
@ -137,6 +135,7 @@ endif
|
||||||
|
|
||||||
build_nspr: $(NSPR_CONFIG_STATUS)
|
build_nspr: $(NSPR_CONFIG_STATUS)
|
||||||
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
|
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)
|
||||||
|
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME)/pr/tests
|
||||||
|
|
||||||
install_nspr: build_nspr
|
install_nspr: build_nspr
|
||||||
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
|
$(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install
|
||||||
|
|
@ -157,4 +156,3 @@ package:
|
||||||
|
|
||||||
latest:
|
latest:
|
||||||
echo $(OBJDIR_NAME) > $(CORE_DEPTH)/../dist/latest
|
echo $(OBJDIR_NAME) > $(CORE_DEPTH)/../dist/latest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
1 Added function:
|
|
||||||
|
|
||||||
'function SECStatus CERT_GetCertificateDer(const CERTCertificate*, SECItem*)' {CERT_GetCertificateDer@@NSS_3.44}
|
|
||||||
|
|
||||||
1 function with some indirect sub-type change:
|
|
||||||
|
|
||||||
[C]'function SECStatus CERT_AddOCSPAcceptableResponses(CERTOCSPRequest*, SECOidTag, ...)' at ocsp.c:2203:1 has some indirect sub-type changes:
|
|
||||||
parameter 2 of type 'typedef SECOidTag' has sub-type changes:
|
|
||||||
underlying type 'enum __anonymous_enum__' at secoidt.h:34:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
3 enumerator insertions:
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_END' value '361'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_TUNNEL' value '362'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_USER' value '363'
|
|
||||||
|
|
||||||
1 enumerator change:
|
|
||||||
'__anonymous_enum__::SEC_OID_TOTAL' from value '361' to '364' at secoidt.h:34:1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
1 function with some indirect sub-type change:
|
|
||||||
|
|
||||||
[C]'function SECStatus NSS_GetAlgorithmPolicy(SECOidTag, PRUint32*)' at secoid.c:2234:1 has some indirect sub-type changes:
|
|
||||||
parameter 1 of type 'typedef SECOidTag' has sub-type changes:
|
|
||||||
underlying type 'enum __anonymous_enum__' at secoidt.h:34:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
3 enumerator insertions:
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_END' value '361'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_TUNNEL' value '362'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_USER' value '363'
|
|
||||||
|
|
||||||
1 enumerator change:
|
|
||||||
'__anonymous_enum__::SEC_OID_TOTAL' from value '361' to '364' at secoidt.h:34:1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
|
|
||||||
1 function with some indirect sub-type change:
|
|
||||||
|
|
||||||
[C]'function PK11SymKey* NSS_CMSContentInfo_GetBulkKey(NSSCMSContentInfo*)' at cmscinfo.c:426:1 has some indirect sub-type changes:
|
|
||||||
parameter 1 of type 'NSSCMSContentInfo*' has sub-type changes:
|
|
||||||
in pointed to type 'typedef NSSCMSContentInfo' at cmst.h:54:1:
|
|
||||||
underlying type 'struct NSSCMSContentInfoStr' at cmst.h:126:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
1 data member changes (2 filtered):
|
|
||||||
type of 'NSSCMSContent NSSCMSContentInfoStr::content' changed:
|
|
||||||
underlying type 'union NSSCMSContentUnion' at cmst.h:113:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
1 data member changes (3 filtered):
|
|
||||||
type of 'NSSCMSEncryptedData* NSSCMSContentUnion::encryptedData' changed:
|
|
||||||
in pointed to type 'typedef NSSCMSEncryptedData' at cmst.h:65:1:
|
|
||||||
underlying type 'struct NSSCMSEncryptedDataStr' at cmst.h:463:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
1 data member changes (1 filtered):
|
|
||||||
type of 'NSSCMSAttribute** NSSCMSEncryptedDataStr::unprotectedAttr' changed:
|
|
||||||
in pointed to type 'NSSCMSAttribute*':
|
|
||||||
in pointed to type 'typedef NSSCMSAttribute' at cmst.h:69:1:
|
|
||||||
underlying type 'struct NSSCMSAttributeStr' at cmst.h:482:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
1 data member change:
|
|
||||||
type of 'SECOidData* NSSCMSAttributeStr::typeTag' changed:
|
|
||||||
in pointed to type 'typedef SECOidData' at secoidt.h:16:1:
|
|
||||||
underlying type 'struct SECOidDataStr' at secoidt.h:518:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
1 data member change:
|
|
||||||
type of 'SECOidTag SECOidDataStr::offset' changed:
|
|
||||||
underlying type 'enum __anonymous_enum__' at secoidt.h:34:1 changed:
|
|
||||||
type size hasn't changed
|
|
||||||
3 enumerator insertions:
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_END' value '361'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_TUNNEL' value '362'
|
|
||||||
'__anonymous_enum__::SEC_OID_EXT_KEY_USAGE_IPSEC_USER' value '363'
|
|
||||||
|
|
||||||
1 enumerator change:
|
|
||||||
'__anonymous_enum__::SEC_OID_TOTAL' from value '361' to '364' at secoidt.h:34:1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
NSS_3_43_BRANCH
|
NSS_3_47_BRANCH
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
4.21
|
4.24
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# Dockerfile for running fuzzing tests.
|
# Dockerfile for running fuzzing tests.
|
||||||
#
|
# Used for ASAN and Coverity based static-analysis.
|
||||||
# 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 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:18.04
|
||||||
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
LABEL maintainer="Martin Thomson <martin.thomson@gmail.com>"
|
||||||
|
|
@ -28,10 +28,12 @@ RUN apt-get update \
|
||||||
mercurial \
|
mercurial \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
|
python-pip \
|
||||||
valgrind \
|
valgrind \
|
||||||
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 \
|
||||||
|
&& pip install requests
|
||||||
|
|
||||||
ENV SHELL /bin/bash
|
ENV SHELL /bin/bash
|
||||||
ENV USER worker
|
ENV USER worker
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ RUN apt-get update \
|
||||||
gcc-4.4 \
|
gcc-4.4 \
|
||||||
locales \
|
locales \
|
||||||
make \
|
make \
|
||||||
|
patch \
|
||||||
mercurial \
|
mercurial \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mQINBFS+1SABEACnmkESkY7eZq0GhDjbkWpKmURGk9+ycsfAhA44NqUvf4tk1GPM
|
||||||
|
5SkJ/fYedYZJaDVhIp98fHgucD0O+vjOzghtgwtITusYjiPHPFBd/MN+MQqSEAP+
|
||||||
|
LUa/kjHLjgyXxKhFUIDGVaDWL5tKOA7/AQKl1TyJ8lz89NHQoUHFsF/hu10+qhJe
|
||||||
|
V65d32MXFehIUSvegh8DrPuExrliSiORO4HOhuc6151dWA4YBWVg4rX5kfKrGMMT
|
||||||
|
pTWnSSZtgoRhkKW2Ey8cmZUqPuUJIfWyeNVu1e4SFtAivLvu/Ymz2WBJcNA1ZlTr
|
||||||
|
RCOR5SIRgZ453pQnI/Bzna2nnJ/TV1gGJIGRahj/ini0cs2x1CILfS/YJQ3rWGGo
|
||||||
|
OxwG0BVmPk0cmLVtyTq8gUPwxcPUd6WcBKhot3TDMlrffZACnQwQjlVjk5S1dEEz
|
||||||
|
atUfpEuNitU9WOM4jr/gjv36ZNCOWm95YwLhsuci/NddBN8HXhyvs+zYTVZEXa2W
|
||||||
|
l/FqOdQsQqZBcJjjWckGKhESdd7934+cesGD3O8KaeSGxww7slJrS0+6QJ8oBoAB
|
||||||
|
P/WCn/y2AiY2syEKp3wYIGJyAbsm542zMZ4nc7pYfSu49mcyhQQICmqN5QvOyYUx
|
||||||
|
OSqwbAOUNtlOyeRLZNIKoXtTqWDEu5aEiDROTw6Rkq+dIcxPNgOLdeQ3HwARAQAB
|
||||||
|
tCFIYW5zIFdlbm5ib3JnIDxoYW5zQGNocm9taXVtLm9yZz6JARwEEAECAAYFAlT2
|
||||||
|
MQAACgkQVfXNcLtaBWnDKgf/fjusXk+kh1zuyn5eOCe16+2vV1lmXZrDIGdJtXDW
|
||||||
|
ZtHKele1Yv1BA3kUi5tKQi+VOOrvHL0+TMjFWFiCy1sYJS9qgkS08kReI2nAnhZ7
|
||||||
|
INdqEVxtVk1TTOhtYjOPy6txwujoICuPv5F4rHVhn1LPKGTLtYD2LOwf/8eKYQox
|
||||||
|
51gaJ8dNxpcHE/iFOIDXdebJPufo3EhqDRihchxb8AVLhrNss7pGGG/tVfichmHK
|
||||||
|
djPT2KfSh14pq1ahFOz0zH4nmTu7CCLnLAdRBHuhL8HVDbi0vKBtCiSmQggdxvoj
|
||||||
|
u+hpXiiDFQoCjLh0zVCwtFqWDZbnKMTBNNF26aTmQ+2fiYkBMwQQAQgAHRYhBB/m
|
||||||
|
NI7eqCWiKXDlxI3TBA8SPMP0BQJbcLU1AAoJEI3TBA8SPMP021sH/jD1m7azNCN6
|
||||||
|
DVL1iDJT6uIIYCTylygH5XI46CRoWaz/LwdFnUqWHHTcQxJ5pIkWV9KF+SIgMT42
|
||||||
|
brdZZmNvvSdX0odjFKqj5UR6w+wDN+uZ6Q40zu4pNoNzbk7pRpbFf1XIfGB1liyu
|
||||||
|
m28EJ58IXu/0AV7FiDAHGGBqppK/cwQN8pGLwmz1n6YELtXeFmtOGnusO6iLYOE7
|
||||||
|
3ByFCCqJB6twT5+7dDqFYqqQJgQ6jDTy19dDZ1vDhDttL+2Rn0OYXqPw7gy/1D2p
|
||||||
|
Y1cM9PgPBsR4EXhbtV0uKUNomk8tM/HnGMFT0KirI/tSwEP3v9g5YH992mrvNuIV
|
||||||
|
TkyQn0jGeMeJATMEEAEIAB0WIQRswFHTwdmkr54mDFjT45SsdE4uuwUCW3haCQAK
|
||||||
|
CRDT45SsdE4uu4JjCACppkreiMrpJSREKbUscdOvFxFRYzkTFeSCwX9Ih7r5ENpa
|
||||||
|
zjczfIqCCfWzioV6y4K0V04y8CXt/5S5a9vfW801pBUdF9nG4X8YbUn/xSe+8A9m
|
||||||
|
MsfDjMNcF7Cp5czVoSS4/4oHm9mQUMYQsn3AwwCPDKFORRRv5Eb0om9JawKtt++7
|
||||||
|
ZW0fOgDkvOCm14SN0UtVc4mxTx6iyxdMDgrKinBZVjxEh5oeqUyXh5TYM+XyWFVh
|
||||||
|
/gDUvUWwLI0GUWNTyOyUQU1oPVp+sWqrEe1BXLVCKFVWaSTtgJtJ5FyP+z2uzRcv
|
||||||
|
aanPOj/ohHAo8VBq9QbefYVAkShNBEuJkATnXhcGiQEzBBABCAAdFiEEvlzFWRM6
|
||||||
|
4JjNAb2a+j2ZL9Cqr7wFAlkBCcIACgkQ+j2ZL9Cqr7yB9AgArj+0+i0DCo1nm4MF
|
||||||
|
TLnW1Y9GF/Hq/mBva1MhkT0j3BzENK3xgqrqac8KqupsporNEmJ0ZbZzilJdZImb
|
||||||
|
o4X5BFdmmnjMiGaH6GAiPqRBBHGvLV2r2pG467J4tOMWO3XipFRf7FibbfhAU1lV
|
||||||
|
/GLWYTSwLqwWwBE8u5rriEvDngWUJw2Yd4Yqwduef7O6F+JfsGPRXFomR3387II0
|
||||||
|
8AXo/C+P5cl64llaxV6BmkJhQ6ydL0/KwSkHVdlXugk1sPtV/qOyPQ5L1Ibqbsvh
|
||||||
|
lLq/jhHlUUNLFjlQ2lrS9bhHGw9OIHTMJvS8RDrk0yAmoHAyRWNgbFN7aA62vBhq
|
||||||
|
pcUVzokBMwQQAQgAHRYhBPZ+fW6ADyQOg+vIZ/9qyaZGTfCcBQJa+ZAwAAoJEP9q
|
||||||
|
yaZGTfCcKMgH/jRxGfYhhGnlMnDLAEpYC+TGSDLMgmg9cOZbonqyMv+7Kts+pV03
|
||||||
|
KUr9SPV+VtGtOxRNiqwFt6V2MHcwPJfTXuH/bBW/HCCpr6UlOVWqIiCNK0Gnpcj5
|
||||||
|
rRt5unjG9CwsgyaK9QPI8bGin/c6m8BjwmEdfJ01ATLiUb8WuDHQy9OCyrEAnzSq
|
||||||
|
FD5ZtFmAFxvzm2x1nwb5HPuqkOqbRatp8aRJzTxIeSJPpgLw0PawHKGN3Ckp7REc
|
||||||
|
g26P1spkPe7SIVRsobH3al4uw7mgs7wiDWN3t8CdmuHAzmB2UrsR84JMTb45GboO
|
||||||
|
Bc1CX8xZcHyNaDEpyWHav+P8nZqwfBm+cLiJAjMEEAEIAB0WIQSawVDb4dGOtiX0
|
||||||
|
+gWyD0lU8+/LPwUCW/4O9QAKCRCyD0lU8+/LPyI7EACWtj0GEb1VT02gKwtKwgFn
|
||||||
|
RJ2pz8vYm188wgJwCJaL04d2D/VwE0jMvmfH80hSKgSLPAVMG06RIOb/tGhHsQKU
|
||||||
|
zBlHiAFmfjlJo1FC/Mp44RrERRsFAWBg0/URIs4vP8+5Vl+5m70sZrQpKeq+6TLM
|
||||||
|
1dQ0Ohz+QkQ04Z+DTroChWU8/7Uw0E3CqGGKYqPvDh54T1q4s8FoN0no8ZUlt/O+
|
||||||
|
r/3c7awr85ZnxqtnHIcuMbVyIZ+gOqXdrLa85yZITsh4zQrjYuyTEg7dpziReyiZ
|
||||||
|
+rkpdIdFKl8YeD+d0JWzVm7kq9D4K3+x9C509z0IgJUT3bhsX/N0Yf/QUtUW5oxI
|
||||||
|
T7fod86B/Q2M7zBTttFhd1vAjiSjEalK48SjTzWqTDYVIkea1+f1kZK5A0QlthqG
|
||||||
|
P2zy5GUjZVzOiCSOhyEOvAorU3zKD2s84VFKlayZEqlHJh8u5U59TWBdkW3qZUJd
|
||||||
|
ewW31xt0s8IovYSgOwX3wbsClQs6eVwNuCZT2yQAgAyXA5iFztBvDRQ0qmetvzV2
|
||||||
|
Ay9SrjvkQ3qr/eZmbMErEwEUxIO4b1rctCQ6jcbyVxMTAZAfaDoVKWEMXNiF2KSw
|
||||||
|
F9SSzGPIZDgiEXUlgaJBlUIYSFxrPuE+da0CM5RixyYIinU6AER6crl9C4C9XL6a
|
||||||
|
u3jf+5MTGxviRGn2oQzSCYkCMwQQAQgAHRYhBKeHFU4z7cw4HFbYuaxFYRTTj42I
|
||||||
|
BQJboq6kAAoJEKxFYRTTj42IWIAP/3rc9GjDTM4nI6Oi4OzLkwm/I2Vr7LUKG8oX
|
||||||
|
8E4Nj3amvNGupzGySjB+vrM6APrMSScXunvM0f19LV84EnNrUQ3KFZcSC6r5WC0B
|
||||||
|
2+TVRYGpY+6R9AQpqnuxicW0sa/AlV9WSEb4fDavCel2nW0arH4wkkCzTThUxoBB
|
||||||
|
X4I9nf4ZzGoUnnDAwTD9rN0gpI6Td/7faa3t99dRLb6AHJ1KhvyiiV3lr0xtTssD
|
||||||
|
xVHo0SpzQTnOcRJnYf/2rTny8bVfROPWieh6HuEiP7SxT1HyeTr4WSAjSCoG95O2
|
||||||
|
b3OgSMl0Z82FRMoJYmxID/V5YqH7015SjCxKdYhEZVp9YwWruEJIH8r6MGbWYNAl
|
||||||
|
REnyDvfGzAF0L0+gAUymDRmtp1jeXLo+HmLgVEUWegafs1TPfCWS/H9n10Upjmuq
|
||||||
|
akituzacz6Kjleq9qbnl81Xmh4AKmOILRwE7Pmcbl8HATOrmi5EaKffjMdWFzOWh
|
||||||
|
3U4/VsNDujqSTXD88EjGcpLiIiYefGy0sURJbIMTkfXVt3ruHLyuvhsRE/2QEAi7
|
||||||
|
gWB0zuBV8iGBaag+6RQkxGdpemPiogzuDijqZHoUXlp7Q6IYLanXeweyivdrSyTB
|
||||||
|
4HOECDbWEPZwk6tCxnuklW5iJndxBmxjSxefIMGU7G2JS9quppCVFCrKUjIWnf7b
|
||||||
|
gXnNji5JiQIzBBABCAAdFiEExZuSbLy7rtFhdiOuHt8NuZ2LeoQFAluirpUACgkQ
|
||||||
|
Ht8NuZ2LeoR/gQ/6A71JxUavzyBlCXlMy2Hx2+gOfy68b8UWl7DwKTOBSoZOzPC7
|
||||||
|
dVCSTzoK8dRELqsp7CkFImWcEwLJWMptuH2I1nK+Ua8bvxJSMJnOlPxYE8Wz5EK3
|
||||||
|
SQ2mQvifRezQTe8zjdpxEDSR6xocSiigvJow4X+Mivrxxj8sMgu1KA1ud2VGX/IR
|
||||||
|
wMbwuBTH9YydgvzmFzTxdlJHEYmsI8koHrVWPHm//QqqPBn+qz2z9uAzDmGAiDYg
|
||||||
|
qtQijo5IJC8ZjxgdcTfCkN6he+GhHtOhyP/KF/FcRHY83DoNCtqexQZWGuKtbd8o
|
||||||
|
nQYtmemRFob5kR7GxuNdAqF74oQfXcvXZNtHSuN3VtLqkB4fzW+21JBJCsP3XCzd
|
||||||
|
nKjR4erXNrQycmp3shSoJbnVvdbDwaVlWhDen1DvJb0Lj2sO3PQPcwVQbf5XHWR/
|
||||||
|
ZCf2OQTfVgwFEB4/0Twv70XwYIui2Ry9hmTPbD4Nn+UXbMQ3SOp90tj/e2yY/MFt
|
||||||
|
FvcIYcJTk9LM5IsnKgh+fSWDmdS3HD5Kjv2EPUHTNalruwwfmhS+ScJwM4XqHTJY
|
||||||
|
JkB16j/Xv2FTF+6KlbA1zdOVycPzoFKjAENYccQBVo2B+WQac7dFDqGEVNal9z66
|
||||||
|
DyU4ciAHl6PsbuN7DWeuScLoqq5jwx61bZgn71mUOYC1/47ypat2BKCOXZ2JAjME
|
||||||
|
EgEIAB0WIQSm5op4O95BdGcqQkHwXKpE5VGK/wUCWie53AAKCRDwXKpE5VGK/3rM
|
||||||
|
D/9jcYKOjYaPJh3Q7wNC1HjjUa73eo5GvJqyXbsXufIh/RAYgQkD08P5JgzfXvQ0
|
||||||
|
zOQTtDlDTVG8VMFoBYeMJVDd0k9LBbaljxcttMPfOll+AlQGAL7iQIqTAndknkJL
|
||||||
|
CFdl0ypa5GVsl1tzqmNC5fuMJ3vBoRtYbMitlHQkO0vLjZ7yl9fz+7YkREpEo/d5
|
||||||
|
Ya8t4+L6el6lrETYaiGCTxHcbYD7VdiJxpxFQlpgl+XKtobrj70RocGQ5JwUNilC
|
||||||
|
nRJKUb33lbmntwDwQ1y1AjCnhB++3GHjJDXBPgYFDCSZPCndKeOXhxmB2psFf41i
|
||||||
|
8foJPJXuh1vWOqArdwseFCRM6W2deF1utZmROMSkUo6IC8dYlucO/hjpjhG+C8Zv
|
||||||
|
QiM5uLylD3IPMX9wCz1tAhMNs3v4pEPo/4A//1cdLkor9cQVLFj3+TkS888EWZdj
|
||||||
|
Y8mUTIXU6yL1DXcj8CfDPS29fMpDorDpK1swl4pN5qgGfsL5BSAXUf1AZDWbxnEY
|
||||||
|
xf5rakfHDzrfbtbTSSfrBxS8gdW2vBKM+3nL21BeP8hQ0tkLA7bn2fNGz3aCOw46
|
||||||
|
XeVJdBk1gVTwazspylqrh1ljr0hQEN4gs/8kM645BRdD0IyAFFcI44VmuVwd8+2g
|
||||||
|
5miAGmVKSqN77w2cgMRnF7xpUsanv+3zKzaTnG+2liTeCokCPgQTAQIAKAUCVL7V
|
||||||
|
IAIbAwUJBaOagAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQD8MELjRa0F1m
|
||||||
|
RhAAj9X+/4iiQsN888dNW/H1wEFFTd/1vqb2j0sHP3t02LkEPN5Ii9u71TSD2gSD
|
||||||
|
WTu1Eb46nRDcapFNv5M0vXcWrEt7PK9b51Kuj4KpP5IjJHpTl2g7umaYQWC8fqcY
|
||||||
|
TJTH0guMSCzZlsP0xGLbAj3cG6X5OPzCO+IxEafXmE//SfS9w46n1OC57ca1Y0Fp
|
||||||
|
WXfjA0sJrcozgNchsptu3jg/oEteYJoxDAzNO45O4geNONq5D9PUQPb+H5Vv5zpy
|
||||||
|
MI7iUJhVnTOFvnoUgRS7v6pWiA3flh5FelK8tYPCzEfvxfe7EB5GO7MaJEO3ZLni
|
||||||
|
COaAZ3Nfn6Tt28tCOgd052W4FeGWow7iYCS1Wgd30bq/FNgnl+tKv2woxmWt4jJv
|
||||||
|
ioBHQ4PbUnap2RCmBFaG7llRkrKP8nhWSUdwSS3OmDwAfxTTXjPaESK9EX9OV9Xo
|
||||||
|
or07thq+7OMs+2cyiy2jSfIau0SELy/tVioZBhoB7hzAJUB8sGHOxMPlVDFdUr3x
|
||||||
|
F/cgCclWANhw2xvgPim1wQ0XpeZe6w9RpmjZR7ReMYwxn8APBDP/e9R5aLDUQAep
|
||||||
|
2hrJUPK38D0L69RnpWQsR9hZ2hEOrMV2M6ChlvhwHbGSdJ2CcqG5Jx4ZAP23DK3A
|
||||||
|
N26TB88H9F7IMrM0REZeu7KzvYwCWlpg0zMXXKQ/2vovoe2JAlUEEwECAD8CGwMG
|
||||||
|
CwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAFiEEtsj5goK5ROOw1cJTD8MELjRa0F0F
|
||||||
|
Alpd+i0FCQ8FJo0ACgkQD8MELjRa0F3X3A//dBQLm6GmXlQFjxZbukTw0lZsevFR
|
||||||
|
M/6ljZTxp7bsC+HFzYoaCKv6rikaWzytxk//SOaLKrB4Z9HjAlpBMtyLl2Hk7tcZ
|
||||||
|
bPpFafNmQ+4KgWNjLXCvt9se8BGrQvGQUrbE6YowbXa2YIgxIVEncFzIECAsp/+N
|
||||||
|
xbMcZN5/X1PJxKi/N22gP4nn47muN6L3pKez3CXgWnhGYSc7BuD5ALWYH7yMYUem
|
||||||
|
d4jlXfu5xkBIqirj1arIYC9wmF4ldbLNDPuracc8LmXcSqa5Rpao0s4iVzAD+tkX
|
||||||
|
vE/73m3rhepwBXxrfk0McXuI9aucf5h4/KkIBzZsaJ6JM1tzlrJzzjaBKJF9OI5T
|
||||||
|
jA0qTxdGzdPztS8gPaPcMkRFfh9ti0ZDx4VeF3s8sOtmMRHeGEWfxqUAbBUbwFsa
|
||||||
|
JDu/+8/VO4KijfcuUi8tqJ/JHeosCuGE7TM93LwJu6ZcqMYOPDROE/hsnGm0ZU92
|
||||||
|
xedu+07/X1ESHkSFPoaSHD5/DCNa/tXIyJZ8X7gF3eoDP5mSmrJqIqsOBR9WOVYv
|
||||||
|
dI8i0GHTXbrZj8WXdoS+N8wlyMLLbAS2jvTe7M5RoqbLz4ABOUUnLVoEE0CiccVZ
|
||||||
|
bW75BPxOfaD0szbinAeX6HDPI7St0MbKrRPjuDXjD0JVkLqFINtZfYLGMLss4tgn
|
||||||
|
suefr0Bo9ISwG3u5Ag0EVL7VIAEQAOxBxrQesChjrCqKjY5PnSsSYpeb4froucrC
|
||||||
|
898AFw2DgN/Zz+W7wtSTbtz/GRcCurjzZvN7o2rCuNk0j0+s1sgZZm2BdldlabLy
|
||||||
|
+UF/kSW1rb5qhfXcGGubu48OMdtSfok9lOc0Q1L4HNlGE4lUBkZzmI7Ykqfl+Bwr
|
||||||
|
m9rpi54g4ua9PIiiHIAmMoZIcbtOG1KaDr6CoXRk/3g2ZiGUwhq3jFGroiBsKEap
|
||||||
|
2FJ1bh5NJk2Eg8pV7fMOF7hUQKBZrNOtIPu8hA5WEgku3U3VYjRSI3SDi6QXnDL+
|
||||||
|
xHxajiWpKtF3JjZh8y/CCTD8PyP34YjfZuFmkdske5cdx6H0V2UCiH453ncgFVdQ
|
||||||
|
DXkY4n+0MTzhy2xu0IVVnBxYDYNhi+3MjTHJd9C4xMi9t+5IuEvDAPhgfZjDpQak
|
||||||
|
EPz6hVmgj0mlKIgRilBRK9/kOxky9utBpGk3jEJGru/hKNloFNspoYtY6zATAr8E
|
||||||
|
cOgoCFQE0nIktcg3wF9+OCEnV28/a7XZwUZ7Gl/qfOHtdr374wo8kd8R3V8d2G9q
|
||||||
|
5w0/uCV9NNQ0fGWZDPDoYt6wnPL6gZv/nJM8oZY+u0rC24WwScZIniaryC4JHDas
|
||||||
|
Ahr2S2CtgCvBgslK6f3gD16KHxPZMBpX73TzOYIhMEP/vXgVJbUD6dYht+U9c4Oh
|
||||||
|
EDJown0dABEBAAGJAjwEGAECACYCGwwWIQS2yPmCgrlE47DVwlMPwwQuNFrQXQUC
|
||||||
|
Wl36SwUJDwUmqwAKCRAPwwQuNFrQXT1/D/9YpRDNgaJl3YVDtVZoeQwh7BQ6ULZT
|
||||||
|
eXFPogYkF2j3VWg8s9UmAs4sg/4a+9KLSantXjX+JFsRv0lQe5Gr/Vl8VQ4LKEXB
|
||||||
|
fiGmSivjIZ7eopdd3YP2w6G5T3SA4d2CQfsg4rnJPnXIjzKNiSOi368ybnt9fL0Y
|
||||||
|
2r2aqLTmP6Y7issDUO+J1TW1XHm349JPR0Hl4cTuNnWm4JuX2m2CJEc5XBlDAha9
|
||||||
|
pUVs+J5C2D0UFFkyeOzeJPwy6x5ApWHm84n8AjhQSpu1qRKxKXdwei6tkQWWMHui
|
||||||
|
+TgSY/zCkmD9/oY15Ei5avJ4WgIbTLJUoZMi70riPmU8ThjpzA7S+Nk0g7rMPq+X
|
||||||
|
l1whjKU/u0udlsrIJjzkh6ftqKUmIkbxYTpjhnEujNrEr5m2S6Z6x3y9E5QagBMR
|
||||||
|
dxRhfk+HbyACcP/p9rXOzl4M291DoKeAAH70GHniGxyNs9rAoMr/hD5XW/Wrz3dc
|
||||||
|
KMc2s555E6MZILE2ZiolcRn+bYOMPZtWlbx98t8uqMf49gY4FGQBZAwPglMrx7mr
|
||||||
|
m7HTIiXahThQGOJg6izJDAD5RwSEGlAcL28T8KAuM6CLLkhlBfQwiKsUBNnh9r8w
|
||||||
|
V3lB+pV0GhL+3i077gTYfZBRwLzjFdhm9xUKEaZ6rN1BX9lzix4eSNK5nln0jUq1
|
||||||
|
67H2IH//2sf8dw==
|
||||||
|
=fTDu
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
@ -9,9 +9,10 @@ ENV haclrepo https://github.com/mitls/hacl-star.git
|
||||||
|
|
||||||
# Define versions of dependencies
|
# Define versions of dependencies
|
||||||
ENV opamv 4.05.0
|
ENV opamv 4.05.0
|
||||||
ENV haclversion 1da331f9ef30e13269e45ae73bbe4a4bca679ae6
|
ENV haclversion 1442c015dab97cdf203ae238b1f3aeccf511bd1e
|
||||||
|
|
||||||
# Install required packages and set versions
|
# Install required packages and set versions
|
||||||
|
ADD B6C8F98282B944E3B0D5C2530FC3042E345AD05D.asc /tmp/B6C8F98282B944E3B0D5C2530FC3042E345AD05D.asc
|
||||||
ADD setup.sh /tmp/setup.sh
|
ADD setup.sh /tmp/setup.sh
|
||||||
RUN bash /tmp/setup.sh
|
RUN bash /tmp/setup.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,13 @@ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 200
|
||||||
# Get clang-format-3.9
|
# 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
|
||||||
curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
|
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.
|
|
||||||
gpg --keyserver pool.sks-keyservers.net --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
|
# Verify the signature. The key used for verification was fetched via:
|
||||||
gpg --verify *.tar.xz.sig
|
# 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/.
|
# Install into /usr/local/.
|
||||||
tar xJvf *.tar.xz -C /usr/local --strip-components=1
|
tar xJvf *.tar.xz -C /usr/local --strip-components=1
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -19,6 +19,6 @@
|
||||||
"merge": "^1.2.0",
|
"merge": "^1.2.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"slugid": "^1.1.0",
|
"slugid": "^1.1.0",
|
||||||
"taskcluster-client": "^1.2.1"
|
"taskcluster-client": "^22.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,15 +103,6 @@ queue.filter(task => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (task.group == "Test") {
|
|
||||||
// Don't run test builds on old make platforms, and not for fips gyp.
|
|
||||||
// Disable on aarch64, see bug 1488331.
|
|
||||||
if (task.collection == "make" || task.collection == "fips"
|
|
||||||
|| task.platform == "aarch64") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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_HW_AES == "1"
|
||||||
|
|
@ -130,12 +121,26 @@ queue.map(task => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't run FIPS SSL tests
|
|
||||||
if (task.tests == "ssl") {
|
if (task.tests == "ssl") {
|
||||||
if (!task.env) {
|
if (!task.env) {
|
||||||
task.env = {};
|
task.env = {};
|
||||||
}
|
}
|
||||||
task.env.NSS_SSL_TESTS = "crl iopr policy";
|
|
||||||
|
// Stress tests to not include other SSL tests
|
||||||
|
if (task.symbol == "stress") {
|
||||||
|
task.env.NSS_SSL_TESTS = "normal_normal";
|
||||||
|
} else {
|
||||||
|
task.env.NSS_SSL_TESTS = "crl iopr policy normal_normal";
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIPS runs
|
||||||
|
if (task.collection == "fips") {
|
||||||
|
task.env.NSS_SSL_TESTS += " fips_fips fips_normal normal_fips";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.platform == "mac") {
|
||||||
|
task.maxRunTime = 7200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows is slow.
|
// Windows is slow.
|
||||||
|
|
@ -144,6 +149,9 @@ queue.map(task => {
|
||||||
task.maxRunTime = 7200;
|
task.maxRunTime = 7200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (task.platform == "mac" && task.tests == "tools") {
|
||||||
|
task.maxRunTime = 7200;
|
||||||
|
}
|
||||||
return task;
|
return task;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -305,6 +313,10 @@ export default async function main() {
|
||||||
|
|
||||||
await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt");
|
await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt");
|
||||||
await scheduleMac("Mac (debug)", {collection: "debug"});
|
await scheduleMac("Mac (debug)", {collection: "debug"});
|
||||||
|
|
||||||
|
// Must be executed after all other tasks are scheduled
|
||||||
|
queue.clearFilters();
|
||||||
|
await scheduleCodeReview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -322,12 +334,7 @@ async function scheduleMac(name, base, args = "") {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build base definition.
|
// Build base definition.
|
||||||
let build_base = merge(mac_base, {
|
let build_base_without_command_symbol = merge(mac_base, {
|
||||||
command: [
|
|
||||||
MAC_CHECKOUT_CMD,
|
|
||||||
["bash", "-c",
|
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh", args]
|
|
||||||
],
|
|
||||||
provisioner: "localprovisioner",
|
provisioner: "localprovisioner",
|
||||||
workerType: "nss-macos-10-12",
|
workerType: "nss-macos-10-12",
|
||||||
platform: "mac",
|
platform: "mac",
|
||||||
|
|
@ -338,6 +345,34 @@ async function scheduleMac(name, base, args = "") {
|
||||||
path: "public"
|
path: "public"
|
||||||
}],
|
}],
|
||||||
kind: "build",
|
kind: "build",
|
||||||
|
});
|
||||||
|
|
||||||
|
let gyp_cmd = "nss/automation/taskcluster/scripts/build_gyp.sh ";
|
||||||
|
|
||||||
|
if (!("collection" in base) ||
|
||||||
|
(base.collection != "make" &&
|
||||||
|
base.collection != "asan" &&
|
||||||
|
base.collection != "fips" &&
|
||||||
|
base.collection != "fuzz")) {
|
||||||
|
let nspr_gyp = gyp_cmd + "--nspr-only --nspr-test-build --nspr-test-run ";
|
||||||
|
let nspr_build = merge(build_base_without_command_symbol, {
|
||||||
|
command: [
|
||||||
|
MAC_CHECKOUT_CMD,
|
||||||
|
["bash", "-c",
|
||||||
|
nspr_gyp + args]
|
||||||
|
],
|
||||||
|
symbol: "NSPR"
|
||||||
|
});
|
||||||
|
// The task that tests NSPR.
|
||||||
|
let nspr_task_build = queue.scheduleTask(merge(nspr_build, {name}));
|
||||||
|
}
|
||||||
|
|
||||||
|
let build_base = merge(build_base_without_command_symbol, {
|
||||||
|
command: [
|
||||||
|
MAC_CHECKOUT_CMD,
|
||||||
|
["bash", "-c",
|
||||||
|
gyp_cmd + args]
|
||||||
|
],
|
||||||
symbol: "B"
|
symbol: "B"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -371,17 +406,8 @@ async function scheduleMac(name, base, args = "") {
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
async function scheduleLinux(name, overrides, args = "") {
|
async function scheduleLinux(name, overrides, args = "") {
|
||||||
// Construct a base definition. This takes |overrides| second because
|
let checkout_and_gyp = "bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh ";
|
||||||
// callers expect to be able to overwrite the |command| key.
|
let artifacts_and_kind = {
|
||||||
let base = merge({
|
|
||||||
command: [
|
|
||||||
"/bin/bash",
|
|
||||||
"-c",
|
|
||||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh " + args
|
|
||||||
],
|
|
||||||
}, overrides);
|
|
||||||
// The base for building.
|
|
||||||
let build_base = merge(base, {
|
|
||||||
artifacts: {
|
artifacts: {
|
||||||
public: {
|
public: {
|
||||||
expires: 24 * 7,
|
expires: 24 * 7,
|
||||||
|
|
@ -390,6 +416,44 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
kind: "build",
|
kind: "build",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!("collection" in overrides) ||
|
||||||
|
(overrides.collection != "make" &&
|
||||||
|
overrides.collection != "asan" &&
|
||||||
|
overrides.collection != "fips" &&
|
||||||
|
overrides.collection != "fuzz")) {
|
||||||
|
let nspr_gyp = checkout_and_gyp + "--nspr-only --nspr-test-build --nspr-test-run ";
|
||||||
|
|
||||||
|
let nspr_base = merge({
|
||||||
|
command: [
|
||||||
|
"/bin/bash",
|
||||||
|
"-c",
|
||||||
|
nspr_gyp + args
|
||||||
|
],
|
||||||
|
}, overrides);
|
||||||
|
let nspr_without_symbol = merge(nspr_base, artifacts_and_kind);
|
||||||
|
let nspr_build = merge(nspr_without_symbol, {
|
||||||
|
symbol: "NSPR",
|
||||||
|
});
|
||||||
|
// The task that tests NSPR.
|
||||||
|
let nspr_task_build = queue.scheduleTask(merge(nspr_build, {name}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct a base definition. This takes |overrides| second because
|
||||||
|
// callers expect to be able to overwrite the |command| key.
|
||||||
|
let base = merge({
|
||||||
|
command: [
|
||||||
|
"/bin/bash",
|
||||||
|
"-c",
|
||||||
|
checkout_and_gyp + args
|
||||||
|
],
|
||||||
|
}, overrides);
|
||||||
|
|
||||||
|
let base_without_symbol = merge(base, artifacts_and_kind);
|
||||||
|
|
||||||
|
// The base for building.
|
||||||
|
let build_base = merge(base_without_symbol, {
|
||||||
symbol: "B",
|
symbol: "B",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -469,7 +533,6 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||||
},
|
},
|
||||||
symbol: "clang-4"
|
symbol: "clang-4"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -529,8 +592,6 @@ async function scheduleLinux(name, overrides, args = "") {
|
||||||
symbol: "modular"
|
symbol: "modular"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await scheduleTestBuilds(name + " Test", merge(base, {group: "Test"}), args);
|
|
||||||
|
|
||||||
return queue.submit();
|
return queue.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -575,7 +636,7 @@ async function scheduleFuzzing() {
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"-c",
|
"-c",
|
||||||
"bin/checkout.sh && " +
|
"bin/checkout.sh && " +
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz"
|
"nss/automation/taskcluster/scripts/build_gyp.sh --fuzz"
|
||||||
],
|
],
|
||||||
artifacts: {
|
artifacts: {
|
||||||
public: {
|
public: {
|
||||||
|
|
@ -602,7 +663,7 @@ async function scheduleFuzzing() {
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"-c",
|
"-c",
|
||||||
"bin/checkout.sh && " +
|
"bin/checkout.sh && " +
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz=tls"
|
"nss/automation/taskcluster/scripts/build_gyp.sh --fuzz=tls"
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -680,7 +741,7 @@ async function scheduleFuzzing32() {
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"-c",
|
"-c",
|
||||||
"bin/checkout.sh && " +
|
"bin/checkout.sh && " +
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz -t ia32"
|
"nss/automation/taskcluster/scripts/build_gyp.sh --fuzz -t ia32"
|
||||||
],
|
],
|
||||||
artifacts: {
|
artifacts: {
|
||||||
public: {
|
public: {
|
||||||
|
|
@ -707,7 +768,7 @@ async function scheduleFuzzing32() {
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"-c",
|
"-c",
|
||||||
"bin/checkout.sh && " +
|
"bin/checkout.sh && " +
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz=tls -t ia32"
|
"nss/automation/taskcluster/scripts/build_gyp.sh --fuzz=tls -t ia32"
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -762,76 +823,11 @@ async function scheduleFuzzing32() {
|
||||||
return queue.submit();
|
return queue.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
async function scheduleTestBuilds(name, base, args = "") {
|
|
||||||
// Build base definition.
|
|
||||||
let build = merge(base, {
|
|
||||||
command: [
|
|
||||||
"/bin/bash",
|
|
||||||
"-c",
|
|
||||||
"bin/checkout.sh && " +
|
|
||||||
"nss/automation/taskcluster/scripts/build_gyp.sh -g -v --test --ct-verif " + args
|
|
||||||
],
|
|
||||||
artifacts: {
|
|
||||||
public: {
|
|
||||||
expires: 24 * 7,
|
|
||||||
type: "directory",
|
|
||||||
path: "/home/worker/artifacts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
kind: "build",
|
|
||||||
symbol: "B",
|
|
||||||
name: `${name} build`,
|
|
||||||
});
|
|
||||||
|
|
||||||
// On linux we have a specialized build image for building.
|
|
||||||
if (build.platform === "linux32" || build.platform === "linux64") {
|
|
||||||
build = merge(build, {
|
|
||||||
image: LINUX_BUILDS_IMAGE,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// The task that builds NSPR+NSS.
|
|
||||||
let task_build = queue.scheduleTask(build);
|
|
||||||
|
|
||||||
// Schedule tests.
|
|
||||||
queue.scheduleTask(merge(base, {
|
|
||||||
parent: task_build,
|
|
||||||
name: `${name} mpi tests`,
|
|
||||||
command: [
|
|
||||||
"/bin/bash",
|
|
||||||
"-c",
|
|
||||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
|
|
||||||
],
|
|
||||||
tests: "mpi",
|
|
||||||
cycle: "standard",
|
|
||||||
symbol: "mpi",
|
|
||||||
kind: "test"
|
|
||||||
}));
|
|
||||||
queue.scheduleTask(merge(base, {
|
|
||||||
parent: task_build,
|
|
||||||
command: [
|
|
||||||
"/bin/bash",
|
|
||||||
"-c",
|
|
||||||
"bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
|
|
||||||
],
|
|
||||||
name: `${name} gtests`,
|
|
||||||
symbol: "Gtest",
|
|
||||||
tests: "gtests",
|
|
||||||
cycle: "standard",
|
|
||||||
kind: "test"
|
|
||||||
}));
|
|
||||||
|
|
||||||
return queue.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
async function scheduleWindows(name, base, build_script) {
|
async function scheduleWindows(name, base, build_script) {
|
||||||
base = merge(base, {
|
base = merge(base, {
|
||||||
workerType: "nss-win2012r2",
|
workerType: "win2012r2",
|
||||||
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;" +
|
||||||
|
|
@ -841,24 +837,49 @@ async function scheduleWindows(name, base, build_script) {
|
||||||
"c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget",
|
"c:\\mozilla-build\\moztools-x64\\bin;c:\\mozilla-build\\wget",
|
||||||
DOMSUF: "localdomain",
|
DOMSUF: "localdomain",
|
||||||
HOST: "localhost",
|
HOST: "localhost",
|
||||||
}
|
},
|
||||||
|
features: ["taskclusterProxy"],
|
||||||
|
scopes: ["project:releng:services/tooltool/api/download/internal"],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build base definition.
|
let artifacts_and_kind = {
|
||||||
let build_base = merge(base, {
|
|
||||||
command: [
|
|
||||||
WINDOWS_CHECKOUT_CMD,
|
|
||||||
`bash -c 'nss/automation/taskcluster/windows/${build_script}'`
|
|
||||||
],
|
|
||||||
artifacts: [{
|
artifacts: [{
|
||||||
expires: 24 * 7,
|
expires: 24 * 7,
|
||||||
type: "directory",
|
type: "directory",
|
||||||
path: "public\\build"
|
path: "public\\build"
|
||||||
}],
|
}],
|
||||||
kind: "build",
|
kind: "build",
|
||||||
|
};
|
||||||
|
|
||||||
|
let build_without_command_symbol = merge(base, artifacts_and_kind);
|
||||||
|
|
||||||
|
// Build base definition.
|
||||||
|
let build_base = merge(build_without_command_symbol, {
|
||||||
|
command: [
|
||||||
|
WINDOWS_CHECKOUT_CMD,
|
||||||
|
`bash -c 'nss/automation/taskcluster/windows/${build_script}'`
|
||||||
|
],
|
||||||
symbol: "B"
|
symbol: "B"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!("collection" in base) ||
|
||||||
|
(base.collection != "make" &&
|
||||||
|
base.collection != "asan" &&
|
||||||
|
base.collection != "fips" &&
|
||||||
|
base.collection != "fuzz")) {
|
||||||
|
let nspr_gyp =
|
||||||
|
`bash -c 'nss/automation/taskcluster/windows/${build_script} --nspr-only --nspr-test-build --nspr-test-run'`;
|
||||||
|
let nspr_build = merge(build_without_command_symbol, {
|
||||||
|
command: [
|
||||||
|
WINDOWS_CHECKOUT_CMD,
|
||||||
|
nspr_gyp
|
||||||
|
],
|
||||||
|
symbol: "NSPR"
|
||||||
|
});
|
||||||
|
// The task that tests NSPR.
|
||||||
|
let task_build = queue.scheduleTask(merge(nspr_build, {name}));
|
||||||
|
}
|
||||||
|
|
||||||
// Make builds run FIPS tests, which need an extra FIPS build.
|
// Make builds run FIPS tests, which need an extra FIPS build.
|
||||||
if (base.collection == "make") {
|
if (base.collection == "make") {
|
||||||
let extra_build = queue.scheduleTask(merge(build_base, {
|
let extra_build = queue.scheduleTask(merge(build_base, {
|
||||||
|
|
@ -952,6 +973,9 @@ function scheduleTests(task_build, task_cert, test_base) {
|
||||||
queue.scheduleTask(merge(no_cert_base, {
|
queue.scheduleTask(merge(no_cert_base, {
|
||||||
name: "tlsfuzzer tests", symbol: "tlsfuzzer", tests: "tlsfuzzer", cycle: "standard"
|
name: "tlsfuzzer tests", symbol: "tlsfuzzer", tests: "tlsfuzzer", cycle: "standard"
|
||||||
}));
|
}));
|
||||||
|
queue.scheduleTask(merge(no_cert_base, {
|
||||||
|
name: "MPI tests", symbol: "MPI", tests: "mpi", cycle: "standard"
|
||||||
|
}));
|
||||||
queue.scheduleTask(merge(cert_base, {
|
queue.scheduleTask(merge(cert_base, {
|
||||||
name: "Chains tests", symbol: "Chains", tests: "chains"
|
name: "Chains tests", symbol: "Chains", tests: "chains"
|
||||||
}));
|
}));
|
||||||
|
|
@ -1021,6 +1045,10 @@ function scheduleTests(task_build, task_cert, test_base) {
|
||||||
queue.scheduleTask(merge(ssl_base, {
|
queue.scheduleTask(merge(ssl_base, {
|
||||||
name: "SSL tests (upgradedb)", symbol: "upgradedb", cycle: "upgradedb"
|
name: "SSL tests (upgradedb)", symbol: "upgradedb", cycle: "upgradedb"
|
||||||
}));
|
}));
|
||||||
|
queue.scheduleTask(merge(ssl_base, {
|
||||||
|
name: "SSL tests (stress)", symbol: "stress", cycle: "sharedb",
|
||||||
|
env: {NSS_SSL_RUN: "stress"}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
@ -1077,6 +1105,33 @@ 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",
|
||||||
|
|
@ -1166,3 +1221,38 @@ async function scheduleTools() {
|
||||||
|
|
||||||
return queue.submit();
|
return queue.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function scheduleCodeReview() {
|
||||||
|
let tasks = queue.taggedTasks("code-review");
|
||||||
|
if(! tasks) {
|
||||||
|
console.debug("No code review tasks, skipping ending task");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// From https://hg.mozilla.org/mozilla-central/file/tip/taskcluster/ci/code-review/kind.yml
|
||||||
|
queue.scheduleTask({
|
||||||
|
platform: "nss-tools",
|
||||||
|
name: "code-review-issues",
|
||||||
|
description: "List all issues found in static analysis and linting tasks",
|
||||||
|
|
||||||
|
// No logic on that task
|
||||||
|
image: LINUX_IMAGE,
|
||||||
|
command: ["/bin/true"],
|
||||||
|
|
||||||
|
// This task must run after all analyzer tasks are completed
|
||||||
|
parents: tasks,
|
||||||
|
|
||||||
|
// This option permits to run the task
|
||||||
|
// regardless of the analyzers tasks exit status
|
||||||
|
// as we are interested in the task failures
|
||||||
|
requires: "all-resolved",
|
||||||
|
|
||||||
|
// Publish code review trigger on pulse
|
||||||
|
routes: ["project.relman.codereview.v1.try_ending"],
|
||||||
|
|
||||||
|
kind: "code-review",
|
||||||
|
symbol: "E"
|
||||||
|
});
|
||||||
|
|
||||||
|
return queue.submit();
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ import context_hash from "./context_hash";
|
||||||
import taskcluster from "taskcluster-client";
|
import taskcluster from "taskcluster-client";
|
||||||
|
|
||||||
async function taskHasImageArtifact(taskId) {
|
async function taskHasImageArtifact(taskId) {
|
||||||
let queue = new taskcluster.Queue();
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findTaskWithImageArtifact(ns) {
|
async function findTaskWithImageArtifact(ns) {
|
||||||
let index = new taskcluster.Index();
|
let index = new taskcluster.Index(taskcluster.fromEnvVars());
|
||||||
let {taskId} = await index.findTask(ns);
|
let {taskId} = await index.findTask(ns);
|
||||||
let has_image = await taskHasImageArtifact(taskId);
|
let has_image = await taskHasImageArtifact(taskId);
|
||||||
return has_image ? taskId : null;
|
return has_image ? taskId : null;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,19 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import * as try_syntax from "./try_syntax";
|
import * as try_syntax from "./try_syntax";
|
||||||
|
import * as queue from "./queue";
|
||||||
import extend from "./extend";
|
import extend from "./extend";
|
||||||
|
|
||||||
const main = async () => {
|
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.
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ let maps = [];
|
||||||
let filters = [];
|
let filters = [];
|
||||||
|
|
||||||
let tasks = new Map();
|
let tasks = new Map();
|
||||||
|
let tags = new Map();
|
||||||
let image_tasks = new Map();
|
let image_tasks = new Map();
|
||||||
|
let parameters = {};
|
||||||
|
|
||||||
let queue = new taskcluster.Queue({
|
let queue = new taskcluster.Queue({
|
||||||
baseUrl: "http://taskcluster/queue/v1"
|
rootUrl: process.env.TASKCLUSTER_PROXY_URL,
|
||||||
});
|
});
|
||||||
|
|
||||||
function fromNow(hours) {
|
function fromNow(hours) {
|
||||||
|
|
@ -94,13 +96,17 @@ function convertTask(def) {
|
||||||
|
|
||||||
let env = merge({
|
let env = merge({
|
||||||
NSS_HEAD_REPOSITORY: process.env.NSS_HEAD_REPOSITORY,
|
NSS_HEAD_REPOSITORY: process.env.NSS_HEAD_REPOSITORY,
|
||||||
NSS_HEAD_REVISION: process.env.NSS_HEAD_REVISION
|
NSS_HEAD_REVISION: process.env.NSS_HEAD_REVISION,
|
||||||
|
NSS_MAX_MP_PBE_ITERATION_COUNT: "100",
|
||||||
}, def.env || {});
|
}, def.env || {});
|
||||||
|
|
||||||
if (def.parent) {
|
if (def.parent) {
|
||||||
dependencies.push(def.parent);
|
dependencies.push(def.parent);
|
||||||
env.TC_PARENT_TASK_ID = def.parent;
|
env.TC_PARENT_TASK_ID = def.parent;
|
||||||
}
|
}
|
||||||
|
if (def.parents) {
|
||||||
|
dependencies = dependencies.concat(def.parents);
|
||||||
|
}
|
||||||
|
|
||||||
if (def.tests) {
|
if (def.tests) {
|
||||||
env.NSS_TESTS = def.tests;
|
env.NSS_TESTS = def.tests;
|
||||||
|
|
@ -109,6 +115,14 @@ function convertTask(def) {
|
||||||
if (def.cycle) {
|
if (def.cycle) {
|
||||||
env.NSS_CYCLES = def.cycle;
|
env.NSS_CYCLES = def.cycle;
|
||||||
}
|
}
|
||||||
|
if (def.kind === "build") {
|
||||||
|
// Disable leak checking during builds (bug 1579290).
|
||||||
|
if (env.ASAN_OPTIONS) {
|
||||||
|
env.ASAN_OPTIONS += ":detect_leaks=0";
|
||||||
|
} else {
|
||||||
|
env.ASAN_OPTIONS = "detect_leaks=0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let payload = {
|
let payload = {
|
||||||
env,
|
env,
|
||||||
|
|
@ -132,9 +146,18 @@ function convertTask(def) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def.scopes) {
|
||||||
|
// Need to add existing scopes in the task definition
|
||||||
|
scopes.push.apply(scopes, def.scopes)
|
||||||
|
}
|
||||||
|
|
||||||
|
let extra = Object.assign({
|
||||||
|
treeherder: parseTreeherder(def)
|
||||||
|
}, parameters);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
provisionerId: def.provisioner || "aws-provisioner-v1",
|
provisionerId: def.provisioner || `nss-${process.env.MOZ_SCM_LEVEL}`,
|
||||||
workerType: def.workerType || "hg-worker",
|
workerType: def.workerType || "linux",
|
||||||
schedulerId: process.env.TC_SCHEDULER_ID,
|
schedulerId: process.env.TC_SCHEDULER_ID,
|
||||||
taskGroupId: process.env.TASK_ID,
|
taskGroupId: process.env.TASK_ID,
|
||||||
|
|
||||||
|
|
@ -143,6 +166,7 @@ function convertTask(def) {
|
||||||
deadline: fromNow(24),
|
deadline: fromNow(24),
|
||||||
|
|
||||||
dependencies,
|
dependencies,
|
||||||
|
requires: def.requires || "all-completed",
|
||||||
routes: parseRoutes(def.routes || []),
|
routes: parseRoutes(def.routes || []),
|
||||||
|
|
||||||
metadata: {
|
metadata: {
|
||||||
|
|
@ -153,10 +177,7 @@ function convertTask(def) {
|
||||||
},
|
},
|
||||||
|
|
||||||
payload,
|
payload,
|
||||||
|
extra,
|
||||||
extra: {
|
|
||||||
treeherder: parseTreeherder(def)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,6 +189,18 @@ export function filter(fun) {
|
||||||
filters.push(fun);
|
filters.push(fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addParameters(params) {
|
||||||
|
parameters = Object.assign(parameters, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearFilters(fun) {
|
||||||
|
filters = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function taggedTasks(tag) {
|
||||||
|
return tags[tag];
|
||||||
|
}
|
||||||
|
|
||||||
export function scheduleTask(def) {
|
export function scheduleTask(def) {
|
||||||
let taskId = slugid.v4();
|
let taskId = slugid.v4();
|
||||||
tasks.set(taskId, merge({}, def));
|
tasks.set(taskId, merge({}, def));
|
||||||
|
|
@ -189,6 +222,16 @@ export async function submit() {
|
||||||
let log_id = `${task.name} @ ${task.platform}[${task.collection || "opt"}]`;
|
let log_id = `${task.name} @ ${task.platform}[${task.collection || "opt"}]`;
|
||||||
console.log(`+ Submitting ${log_id}.`);
|
console.log(`+ Submitting ${log_id}.`);
|
||||||
|
|
||||||
|
// Index that task for each tag specified
|
||||||
|
if(task.tags) {
|
||||||
|
task.tags.map(tag => {
|
||||||
|
if(!tags[tag]) {
|
||||||
|
tags[tag] = [];
|
||||||
|
}
|
||||||
|
tags[tag].push(taskId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let parent = task.parent;
|
let parent = task.parent;
|
||||||
|
|
||||||
// Convert the task definition.
|
// Convert the task definition.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import * as queue from "./queue";
|
import * as queue from "./queue";
|
||||||
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
import intersect from "intersect";
|
import intersect from "intersect";
|
||||||
import parse_args from "minimist";
|
import parse_args from "minimist";
|
||||||
import util from "util";
|
import util from "util";
|
||||||
|
|
@ -55,7 +57,7 @@ function parseOptions(opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse tools.
|
// Parse tools.
|
||||||
let allTools = ["clang-format", "scan-build", "hacl", "saw", "abi", "coverage"];
|
let allTools = ["clang-format", "scan-build", "coverity", "hacl", "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.
|
||||||
|
|
@ -166,11 +168,32 @@ async function getCommitComment() {
|
||||||
export async function initFilter() {
|
export async function initFilter() {
|
||||||
let comment = await getCommitComment();
|
let comment = await getCommitComment();
|
||||||
|
|
||||||
|
// Load try_task_config.json
|
||||||
|
// Add parameters to queue for created tasks
|
||||||
|
let config_path = path.normalize(path.join(__dirname, '../../../../try_task_config.json'))
|
||||||
|
if (fs.existsSync(config_path)) {
|
||||||
|
var payload = JSON.parse(fs.readFileSync(config_path));
|
||||||
|
if (payload['version'] == 2) {
|
||||||
|
queue.addParameters(payload['parameters']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for try syntax in changeset comment.
|
// Check for try syntax in changeset comment.
|
||||||
let match = comment.match(/\btry:\s*(.*)\s*$/m);
|
let match = comment.match(/\btry:\s*(.*)\s*$/m);
|
||||||
|
|
||||||
// Add try syntax filter.
|
// Add try syntax filter.
|
||||||
if (match) {
|
if (match) {
|
||||||
queue.filter(filter(parseOptions(match[1])));
|
let match1 = match[1];
|
||||||
|
queue.filter(filter(parseOptions(match1)));
|
||||||
|
|
||||||
|
if (match1.includes("--nspr-patch")) {
|
||||||
|
queue.map(task => {
|
||||||
|
if (!task.env) {
|
||||||
|
task.env = {};
|
||||||
|
}
|
||||||
|
task.env.ALLOW_NSPR_PATCH = "1";
|
||||||
|
return task;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,12 @@ fi
|
||||||
# Clone NSPR if needed.
|
# Clone NSPR if needed.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
|
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
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
make -C nss nss_build_all
|
make -C nss nss_build_all
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ source $(dirname "$0")/tools.sh
|
||||||
# Clone NSPR if needed.
|
# Clone NSPR if needed.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
|
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
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
nss/build.sh -g -v "$@"
|
nss/build.sh -g -v --enable-libpkix "$@"
|
||||||
|
|
||||||
# Package.
|
# Package.
|
||||||
if [[ $(uname) = "Darwin" ]]; then
|
if [[ $(uname) = "Darwin" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,12 @@ source $(dirname $0)/tools.sh
|
||||||
# Clone NSPR if needed.
|
# Clone NSPR if needed.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr nspr default
|
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
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
make -C nss build_nspr
|
make -C nss build_nspr
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@ export NSS_BUILD_SOFTOKEN_ONLY=1
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
make -C nss-softoken nss_build_all
|
make -C nss-softoken nss_build_all
|
||||||
|
|
||||||
mv dist/private/nss/blapi.h dist/public/nss
|
for i in blapi alghmac cmac; do
|
||||||
mv dist/private/nss/alghmac.h dist/public/nss
|
mv "dist/private/nss/${i}.h" dist/public/nss
|
||||||
|
done
|
||||||
|
|
||||||
# Package.
|
# Package.
|
||||||
test -d artifacts || mkdir artifacts
|
test -d artifacts || mkdir artifacts
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@ set_env()
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f nss/nspr.patch && "$ALLOW_NSPR_PATCH" == "1" ]]; then
|
||||||
|
pushd nspr
|
||||||
|
cat ../nss/nspr.patch | patch -p1
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
cd nss
|
cd nss
|
||||||
./build.sh -v -c
|
./build.sh -v -c
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ source $(dirname "$0")/tools.sh
|
||||||
# Clone NSPR.
|
# Clone NSPR.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
|
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
|
||||||
|
|
||||||
out=/home/worker/artifacts
|
out=/home/worker/artifacts
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
|
|
|
||||||
21
security/nss/automation/taskcluster/scripts/run_coverity.sh
Normal file
21
security/nss/automation/taskcluster/scripts/run_coverity.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/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 $?
|
||||||
|
|
@ -5,6 +5,12 @@ source $(dirname "$0")/tools.sh
|
||||||
# Clone NSPR if needed.
|
# Clone NSPR if needed.
|
||||||
if [ ! -d "nspr" ]; then
|
if [ ! -d "nspr" ]; then
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
|
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
|
fi
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@ hg_clone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_dist() {
|
fetch_dist() {
|
||||||
url=https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/dist.tar.bz2
|
if [ "$TASKCLUSTER_ROOT_URL" = "https://taskcluster.net" ] || [ -z "$TASKCLUSTER_ROOT_URL" ]; then
|
||||||
|
url=https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/dist.tar.bz2
|
||||||
|
else
|
||||||
|
url=$TASKCLUSTER_ROOT_URL/api/queue/v1/task/$TC_PARENT_TASK_ID/artifacts/public/dist.tar.bz2
|
||||||
|
fi
|
||||||
if [ ! -d "dist" ]; then
|
if [ ! -d "dist" ]; then
|
||||||
for i in 0 2 5; do
|
for i in 0 2 5; do
|
||||||
sleep $i
|
sleep $i
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ source "$(dirname "$0")/setup.sh"
|
||||||
# Clone NSPR.
|
# Clone NSPR.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr nspr default
|
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
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
make -C nss nss_build_all
|
make -C nss nss_build_all
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,14 @@ export PATH="${PATH}:${PWD}/ninja/bin:${PWD}/gyp/test-env/Scripts"
|
||||||
# Clone NSPR.
|
# Clone NSPR.
|
||||||
hg_clone https://hg.mozilla.org/projects/nspr nspr default
|
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
|
||||||
|
|
||||||
# Build with gyp.
|
# Build with gyp.
|
||||||
./nss/build.sh -g -v "$@"
|
./nss/build.sh -g -v --enable-libpkix "$@"
|
||||||
|
|
||||||
# Package.
|
# Package.
|
||||||
7z a public/build/dist.7z dist
|
7z a public/build/dist.7z dist
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,13 @@ set -v -e -x
|
||||||
source $(dirname $0)/setup.sh
|
source $(dirname $0)/setup.sh
|
||||||
|
|
||||||
# Fetch artifact.
|
# Fetch artifact.
|
||||||
wget -t 3 --retry-connrefused -w 5 --random-wait https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z -O dist.7z
|
if [ "$TASKCLUSTER_ROOT_URL" = "https://taskcluster.net" ] || [ -z "$TASKCLUSTER_ROOT_URL" ]; then
|
||||||
|
url=https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z
|
||||||
|
else
|
||||||
|
url=$TASKCLUSTER_ROOT_URL/api/queue/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -t 3 --retry-connrefused -w 5 --random-wait $url -O dist.7z
|
||||||
7z x dist.7z
|
7z x dist.7z
|
||||||
|
|
||||||
# Generate certificates.
|
# Generate certificates.
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,13 @@ set -v -e -x
|
||||||
source $(dirname $0)/setup.sh
|
source $(dirname $0)/setup.sh
|
||||||
|
|
||||||
# Fetch artifact.
|
# Fetch artifact.
|
||||||
wget -t 3 --retry-connrefused -w 5 --random-wait https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z -O dist.7z
|
if [ "$TASKCLUSTER_ROOT_URL" = "https://taskcluster.net" ] || [ -z "$TASKCLUSTER_ROOT_URL" ]; then
|
||||||
|
url=https://queue.taskcluster.net/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z
|
||||||
|
else
|
||||||
|
url=$TASKCLUSTER_ROOT_URL/api/queue/v1/task/$TC_PARENT_TASK_ID/artifacts/public/build/dist.7z
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -t 3 --retry-connrefused -w 5 --random-wait $url -O dist.7z
|
||||||
7z x dist.7z
|
7z x dist.7z
|
||||||
|
|
||||||
# Run tests.
|
# Run tests.
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ hg_clone() {
|
||||||
|
|
||||||
hg_clone https://hg.mozilla.org/build/tools tools b8d7c263dfc3
|
hg_clone https://hg.mozilla.org/build/tools tools b8d7c263dfc3
|
||||||
tools/scripts/tooltool/tooltool_wrapper.sh \
|
tools/scripts/tooltool/tooltool_wrapper.sh \
|
||||||
$(dirname $0)/releng.manifest https://tooltool.mozilla-releng.net/ \
|
$(dirname $0)/releng.manifest http://taskcluster/tooltool.mozilla-releng.net/ \
|
||||||
non-existant-file.sh /c/mozilla-build/python/python.exe \
|
non-existant-file.sh /c/mozilla-build/python/python.exe \
|
||||||
/c/builds/tooltool.py --authentication-file /c/builds/relengapi.tok \
|
/c/builds/tooltool.py \
|
||||||
-c /c/builds/tooltool_cache
|
-c /c/builds/tooltool_cache
|
||||||
|
|
||||||
# This needs $m to be set.
|
# This needs $m to be set.
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,16 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cwd=$(cd $(dirname $0); pwd -P)
|
cwd=$(cd $(dirname $0); pwd -P)
|
||||||
source "$cwd"/coreconf/nspr.sh
|
dist_dir="$cwd/../dist"
|
||||||
source "$cwd"/coreconf/sanitizers.sh
|
argsfile="$dist_dir/build_args"
|
||||||
|
source "$cwd/coreconf/nspr.sh"
|
||||||
|
source "$cwd/coreconf/sanitizers.sh"
|
||||||
GYP=${GYP:-gyp}
|
GYP=${GYP:-gyp}
|
||||||
|
|
||||||
# Usage info
|
# Usage info
|
||||||
show_help()
|
show_help()
|
||||||
{
|
{
|
||||||
cat "$cwd"/help.txt
|
cat "$cwd/help.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_verbose()
|
run_verbose()
|
||||||
|
|
@ -35,6 +37,14 @@ run_verbose()
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The prehistoric bash on Mac doesn't support @Q quoting.
|
||||||
|
# The consequences aren't that serious, unless there are odd arrangements of spaces.
|
||||||
|
if /usr/bin/env bash -c 'x=1;echo "${x@Q}"' >/dev/null 2>&1; then
|
||||||
|
Q() { echo "${@@Q}"; }
|
||||||
|
else
|
||||||
|
Q() { echo "$@"; }
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$CCC" ] && [ -z "$CXX" ]; then
|
if [ -n "$CCC" ] && [ -z "$CXX" ]; then
|
||||||
export CXX="$CCC"
|
export CXX="$CCC"
|
||||||
fi
|
fi
|
||||||
|
|
@ -44,6 +54,9 @@ build_64=0
|
||||||
clean=0
|
clean=0
|
||||||
rebuild_gyp=0
|
rebuild_gyp=0
|
||||||
rebuild_nspr=0
|
rebuild_nspr=0
|
||||||
|
build_nspr_tests=0
|
||||||
|
run_nspr_tests=0
|
||||||
|
exit_after_nspr=0
|
||||||
target=Debug
|
target=Debug
|
||||||
verbose=0
|
verbose=0
|
||||||
fuzz=0
|
fuzz=0
|
||||||
|
|
@ -56,7 +69,7 @@ gyp_params=(--depth="$cwd" --generator-output=".")
|
||||||
ninja_params=()
|
ninja_params=()
|
||||||
|
|
||||||
# Assume that the target architecture is the same as the host by default.
|
# Assume that the target architecture is the same as the host by default.
|
||||||
host_arch=$(python "$cwd"/coreconf/detect_host_arch.py)
|
host_arch=$(python "$cwd/coreconf/detect_host_arch.py")
|
||||||
target_arch=$host_arch
|
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.
|
||||||
|
|
@ -66,8 +79,17 @@ if [ "${platform%-*}" = "MINGW32_NT" -o "${platform%-*}" = "MINGW64_NT" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse command line arguments.
|
# Parse command line arguments.
|
||||||
|
all_args=("$@")
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--rebuild)
|
||||||
|
if [[ ! -e "$argsfile" ]]; then
|
||||||
|
echo "Unable to rebuild" 1>&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
IFS=$'\r\n' GLOBIGNORE='*' command eval 'previous_args=($(<"$argsfile"))'
|
||||||
|
exec /usr/bin/env bash -c "$(Q "$0")"' "$@"' "$0" "${previous_args[@]}"
|
||||||
|
;;
|
||||||
-c) clean=1 ;;
|
-c) clean=1 ;;
|
||||||
-cc) clean_only=1 ;;
|
-cc) clean_only=1 ;;
|
||||||
-v) ninja_params+=(-v); verbose=1 ;;
|
-v) ninja_params+=(-v); verbose=1 ;;
|
||||||
|
|
@ -95,10 +117,12 @@ while [ $# -gt 0 ]; do
|
||||||
--sancov=?*) enable_sancov "${1#*=}" ;;
|
--sancov=?*) enable_sancov "${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) ;;
|
||||||
--test) gyp_params+=(-Dtest_build=1 -Dstatic_libs=1) ;;
|
|
||||||
--static) gyp_params+=(-Dstatic_libs=1) ;;
|
--static) gyp_params+=(-Dstatic_libs=1) ;;
|
||||||
--ct-verif) gyp_params+=(-Dct_verif=1) ;;
|
--ct-verif) gyp_params+=(-Dct_verif=1) ;;
|
||||||
--nspr) nspr_clean; rebuild_nspr=1 ;;
|
--nspr) nspr_clean; rebuild_nspr=1 ;;
|
||||||
|
--nspr-test-build) build_nspr_tests=1 ;;
|
||||||
|
--nspr-test-run) run_nspr_tests=1 ;;
|
||||||
|
--nspr-only) exit_after_nspr=1 ;;
|
||||||
--with-nspr=?*) set_nspr_path "${1#*=}"; no_local_nspr=1 ;;
|
--with-nspr=?*) set_nspr_path "${1#*=}"; no_local_nspr=1 ;;
|
||||||
--system-nspr) set_nspr_path "/usr/include/nspr/:"; no_local_nspr=1 ;;
|
--system-nspr) set_nspr_path "/usr/include/nspr/:"; no_local_nspr=1 ;;
|
||||||
--system-sqlite) gyp_params+=(-Duse_system_sqlite=1) ;;
|
--system-sqlite) gyp_params+=(-Duse_system_sqlite=1) ;;
|
||||||
|
|
@ -106,7 +130,7 @@ 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 ;;
|
||||||
-D*) gyp_params+=("$1") ;;
|
-D*) gyp_params+=("$1") ;;
|
||||||
*) show_help; exit 2 ;;
|
*) show_help; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
@ -124,7 +148,7 @@ fi
|
||||||
|
|
||||||
# Do special setup.
|
# Do special setup.
|
||||||
if [ "$fuzz" = 1 ]; then
|
if [ "$fuzz" = 1 ]; then
|
||||||
source "$cwd"/coreconf/fuzz.sh
|
source "$cwd/coreconf/fuzz.sh"
|
||||||
fi
|
fi
|
||||||
nspr_set_flags $sanitizer_flags
|
nspr_set_flags $sanitizer_flags
|
||||||
if [ ! -z "$sanitizer_flags" ]; then
|
if [ ! -z "$sanitizer_flags" ]; then
|
||||||
|
|
@ -132,20 +156,13 @@ if [ ! -z "$sanitizer_flags" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$msvc" = 1 ]; then
|
if [ "$msvc" = 1 ]; then
|
||||||
source "$cwd"/coreconf/msvc.sh
|
source "$cwd/coreconf/msvc.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup build paths.
|
|
||||||
target_dir="$cwd"/out/$target
|
|
||||||
mkdir -p "$target_dir"
|
|
||||||
dist_dir="$cwd"/../dist
|
|
||||||
dist_dir=$(mkdir -p "$dist_dir"; cd "$dist_dir"; pwd -P)
|
|
||||||
gyp_params+=(-Dnss_dist_dir="$dist_dir")
|
|
||||||
|
|
||||||
# -c = clean first
|
# -c = clean first
|
||||||
if [ "$clean" = 1 -o "$clean_only" = 1 ]; then
|
if [ "$clean" = 1 -o "$clean_only" = 1 ]; then
|
||||||
nspr_clean
|
nspr_clean
|
||||||
rm -rf "$cwd"/out
|
rm -rf "$cwd/out"
|
||||||
rm -rf "$dist_dir"
|
rm -rf "$dist_dir"
|
||||||
# -cc = only clean, don't build
|
# -cc = only clean, don't build
|
||||||
if [ "$clean_only" = 1 ]; then
|
if [ "$clean_only" = 1 ]; then
|
||||||
|
|
@ -154,6 +171,12 @@ if [ "$clean" = 1 -o "$clean_only" = 1 ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup build paths.
|
||||||
|
target_dir="$cwd/out/$target"
|
||||||
|
mkdir -p "$target_dir"
|
||||||
|
dist_dir=$(mkdir -p "$dist_dir"; cd "$dist_dir"; pwd -P)
|
||||||
|
gyp_params+=(-Dnss_dist_dir="$dist_dir")
|
||||||
|
|
||||||
# This saves a canonical representation of arguments that we are passing to gyp
|
# This saves a canonical representation of arguments that we are passing to gyp
|
||||||
# or the NSPR build so that we can work out if a rebuild is needed.
|
# or the NSPR build so that we can work out if a rebuild is needed.
|
||||||
# Caveat: This can fail for arguments that are position-dependent.
|
# Caveat: This can fail for arguments that are position-dependent.
|
||||||
|
|
@ -163,66 +186,72 @@ check_config()
|
||||||
local newconf="$1".new oldconf="$1"
|
local newconf="$1".new oldconf="$1"
|
||||||
shift
|
shift
|
||||||
mkdir -p $(dirname "$newconf")
|
mkdir -p $(dirname "$newconf")
|
||||||
echo CC="$CC" >"$newconf"
|
echo CC="$(Q "$CC")" >"$newconf"
|
||||||
echo CCC="$CCC" >>"$newconf"
|
echo CCC="$(Q "$CCC")" >>"$newconf"
|
||||||
echo CXX="$CXX" >>"$newconf"
|
echo CXX="$(Q "$CXX")" >>"$newconf"
|
||||||
echo target_arch="$target_arch" >>"$newconf"
|
echo target_arch="$(Q "$target_arch")" >>"$newconf"
|
||||||
for i in "$@"; do echo $i; done | sort >>"$newconf"
|
for i in "$@"; do echo "$i"; done | sort >>"$newconf"
|
||||||
|
|
||||||
# Note: The following diff fails if $oldconf isn't there as well, which
|
# Note: The following diff fails if $oldconf isn't there as well, which
|
||||||
# happens if we don't have a previous successful build.
|
# happens if we don't have a previous successful build.
|
||||||
! diff -q "$newconf" "$oldconf" >/dev/null 2>&1
|
! diff -q "$newconf" "$oldconf" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
gyp_config="$cwd"/out/gyp_config
|
gyp_config="$cwd/out/gyp_config"
|
||||||
nspr_config="$cwd"/out/$target/nspr_config
|
nspr_config="$cwd/out/$target/nspr_config"
|
||||||
|
|
||||||
# Now check what needs to be rebuilt.
|
# Now check what needs to be rebuilt.
|
||||||
# If we don't have a build directory make sure that we rebuild.
|
# If we don't have a build directory make sure that we rebuild.
|
||||||
if [ ! -d "$target_dir" ]; then
|
if [ ! -d "$target_dir" ]; then
|
||||||
rebuild_nspr=1
|
rebuild_nspr=1
|
||||||
rebuild_gyp=1
|
rebuild_gyp=1
|
||||||
elif [ ! -d "$dist_dir"/$target ]; then
|
elif [ ! -d "$dist_dir/$target" ]; then
|
||||||
rebuild_nspr=1
|
rebuild_nspr=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_config "$nspr_config" \
|
if check_config "$nspr_config" \
|
||||||
nspr_cflags="$nspr_cflags" \
|
nspr_cflags="$(Q "$nspr_cflags")" \
|
||||||
nspr_cxxflags="$nspr_cxxflags" \
|
nspr_cxxflags="$(Q "$nspr_cxxflags")" \
|
||||||
nspr_ldflags="$nspr_ldflags"; then
|
nspr_ldflags="$(Q "$nspr_ldflags")"; then
|
||||||
rebuild_nspr=1
|
rebuild_nspr=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_config "$gyp_config" "${gyp_params[@]}"; then
|
if check_config "$gyp_config" "$(Q "${gyp_params[@]}")"; then
|
||||||
rebuild_gyp=1
|
rebuild_gyp=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save the chosen target.
|
# Save the chosen target.
|
||||||
mkdir -p "$dist_dir"
|
echo "$target" > "$dist_dir/latest"
|
||||||
echo $target > "$dist_dir"/latest
|
for i in "${all_args[@]}"; do echo "$i"; done > "$argsfile"
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
# NSPR.
|
# NSPR.
|
||||||
if [[ "$rebuild_nspr" = 1 && "$no_local_nspr" = 0 ]]; then
|
if [[ "$rebuild_nspr" = 1 && "$no_local_nspr" = 0 ]]; then
|
||||||
|
nspr_clean
|
||||||
nspr_build
|
nspr_build
|
||||||
mv -f "$nspr_config".new "$nspr_config"
|
mv -f "$nspr_config.new" "$nspr_config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$exit_after_nspr" = 1 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# gyp.
|
# gyp.
|
||||||
if [ "$rebuild_gyp" = 1 ]; then
|
if [ "$rebuild_gyp" = 1 ]; then
|
||||||
if ! hash ${GYP} 2> /dev/null; then
|
if ! hash "$GYP" 2> /dev/null; then
|
||||||
echo "Please install gyp" 1>&2
|
echo "Building NSS requires an installation of gyp: https://gyp.gsrc.io/" 1>&2
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
# These extra arguments aren't used in determining whether to rebuild.
|
# These extra arguments aren't used in determining whether to rebuild.
|
||||||
obj_dir="$dist_dir"/$target
|
obj_dir="$dist_dir/$target"
|
||||||
gyp_params+=(-Dnss_dist_obj_dir=$obj_dir)
|
gyp_params+=(-Dnss_dist_obj_dir="$obj_dir")
|
||||||
if [ "$no_local_nspr" = 0 ]; then
|
if [ "$no_local_nspr" = 0 ]; then
|
||||||
set_nspr_path "$obj_dir/include/nspr:$obj_dir/lib"
|
set_nspr_path "$obj_dir/include/nspr:$obj_dir/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_verbose run_scanbuild ${GYP} -f ninja "${gyp_params[@]}" "$cwd"/nss.gyp
|
run_verbose run_scanbuild ${GYP} -f ninja "${gyp_params[@]}" "$cwd/nss.gyp"
|
||||||
|
|
||||||
mv -f "$gyp_config".new "$gyp_config"
|
mv -f "$gyp_config.new" "$gyp_config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ninja.
|
# ninja.
|
||||||
|
|
@ -231,7 +260,7 @@ if hash ninja-build 2>/dev/null; then
|
||||||
elif hash ninja 2>/dev/null; then
|
elif hash ninja 2>/dev/null; then
|
||||||
ninja=ninja
|
ninja=ninja
|
||||||
else
|
else
|
||||||
echo "Please install ninja" 1>&2
|
echo "Building NSS requires an installation of ninja: https://ninja-build.org/" 1>&2
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
run_scanbuild $ninja -C "$target_dir" "${ninja_params[@]}"
|
run_scanbuild "$ninja" -C "$target_dir" "${ninja_params[@]}"
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,8 @@ ConvertCertificate(SECItem *sdder, char *nickname, CERTCertTrust *trust,
|
||||||
hasPositiveTrust(trust->objectSigningFlags)) {
|
hasPositiveTrust(trust->objectSigningFlags)) {
|
||||||
printf("CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE\n");
|
printf("CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE\n");
|
||||||
}
|
}
|
||||||
|
printf("CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE\n");
|
||||||
|
printf("CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trust->sslFlags | trust->emailFlags | trust->objectSigningFlags) ==
|
if ((trust->sslFlags | trust->emailFlags | trust->objectSigningFlags) ==
|
||||||
|
|
@ -306,19 +308,21 @@ printheader()
|
||||||
"#\n"
|
"#\n"
|
||||||
"# Certificates\n"
|
"# Certificates\n"
|
||||||
"#\n"
|
"#\n"
|
||||||
"# -- Attribute -- -- type -- -- value --\n"
|
"# -- Attribute -- -- type -- -- value --\n"
|
||||||
"# CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE\n"
|
"# CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE\n"
|
||||||
"# CKA_TOKEN CK_BBOOL CK_TRUE\n"
|
"# CKA_TOKEN CK_BBOOL CK_TRUE\n"
|
||||||
"# CKA_PRIVATE CK_BBOOL CK_FALSE\n"
|
"# CKA_PRIVATE CK_BBOOL CK_FALSE\n"
|
||||||
"# CKA_MODIFIABLE CK_BBOOL CK_FALSE\n"
|
"# CKA_MODIFIABLE CK_BBOOL CK_FALSE\n"
|
||||||
"# CKA_LABEL UTF8 (varies)\n"
|
"# CKA_LABEL UTF8 (varies)\n"
|
||||||
"# CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509\n"
|
"# CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509\n"
|
||||||
"# CKA_SUBJECT DER+base64 (varies)\n"
|
"# CKA_SUBJECT DER+base64 (varies)\n"
|
||||||
"# CKA_ID byte array (varies)\n"
|
"# CKA_ID byte array (varies)\n"
|
||||||
"# CKA_ISSUER DER+base64 (varies)\n"
|
"# CKA_ISSUER DER+base64 (varies)\n"
|
||||||
"# CKA_SERIAL_NUMBER DER+base64 (varies)\n"
|
"# CKA_SERIAL_NUMBER DER+base64 (varies)\n"
|
||||||
"# CKA_VALUE DER+base64 (varies)\n"
|
"# CKA_VALUE DER+base64 (varies)\n"
|
||||||
"# CKA_NSS_EMAIL ASCII7 (unused here)\n"
|
"# CKA_NSS_EMAIL ASCII7 (unused here)\n"
|
||||||
|
"# CKA_NSS_SERVER_DISTRUST_AFTER DER+base64 (varies)\n"
|
||||||
|
"# CKA_NSS_EMAIL_DISTRUST_AFTER DER+base64 (varies)\n"
|
||||||
"#\n"
|
"#\n"
|
||||||
"# Trust\n"
|
"# Trust\n"
|
||||||
"#\n"
|
"#\n"
|
||||||
|
|
@ -392,6 +396,12 @@ Usage(char *progName)
|
||||||
fprintf(stderr, "%-15s a CRL entry number, as shown by \"crlutil -S\"\n", "-e");
|
fprintf(stderr, "%-15s a CRL entry number, as shown by \"crlutil -S\"\n", "-e");
|
||||||
fprintf(stderr, "%-15s input file to read (default stdin)\n", "-i file");
|
fprintf(stderr, "%-15s input file to read (default stdin)\n", "-i file");
|
||||||
fprintf(stderr, "%-15s (pipe through atob if the cert is b64-encoded)\n", "");
|
fprintf(stderr, "%-15s (pipe through atob if the cert is b64-encoded)\n", "");
|
||||||
|
fprintf(stderr, "%-15s convert a timestamp to DER, and output.\n", "-d timestamp");
|
||||||
|
fprintf(stderr, "%-15s useful to fill server and email distrust fields\n", "");
|
||||||
|
fprintf(stderr, "%-15s Example: %s -d 1561939200\n", "", progName);
|
||||||
|
fprintf(stderr, "%-15s NOTE: The informed timestamp are interpreted as seconds\n", "");
|
||||||
|
fprintf(stderr, "%-15s since unix epoch.\n", "");
|
||||||
|
fprintf(stderr, "%-15s TIP: date -d \"2019-07-01 00:00:00 UTC\" +%%s\n", "");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,20 +413,21 @@ enum {
|
||||||
opt_ExcludeCert,
|
opt_ExcludeCert,
|
||||||
opt_ExcludeHash,
|
opt_ExcludeHash,
|
||||||
opt_DistrustCRL,
|
opt_DistrustCRL,
|
||||||
opt_CRLEnry
|
opt_CRLEntry,
|
||||||
|
opt_ConvertDate
|
||||||
};
|
};
|
||||||
|
|
||||||
static secuCommandFlag addbuiltin_options[] =
|
static secuCommandFlag addbuiltin_options[] = {
|
||||||
{
|
{ /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE },
|
||||||
{ /* opt_Input */ 'i', PR_TRUE, 0, PR_FALSE },
|
{ /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE },
|
||||||
{ /* opt_Nickname */ 'n', PR_TRUE, 0, PR_FALSE },
|
{ /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE },
|
||||||
{ /* opt_Trust */ 't', PR_TRUE, 0, PR_FALSE },
|
{ /* opt_Distrust */ 'D', PR_FALSE, 0, PR_FALSE },
|
||||||
{ /* opt_Distrust */ 'D', PR_FALSE, 0, PR_FALSE },
|
{ /* opt_ExcludeCert */ 'c', PR_FALSE, 0, PR_FALSE },
|
||||||
{ /* opt_ExcludeCert */ 'c', PR_FALSE, 0, PR_FALSE },
|
{ /* opt_ExcludeHash */ 'h', PR_FALSE, 0, PR_FALSE },
|
||||||
{ /* opt_ExcludeHash */ 'h', PR_FALSE, 0, PR_FALSE },
|
{ /* opt_DistrustCRL */ 'C', PR_FALSE, 0, PR_FALSE },
|
||||||
{ /* opt_DistrustCRL */ 'C', PR_FALSE, 0, PR_FALSE },
|
{ /* opt_CRLEntry */ 'e', PR_TRUE, 0, PR_FALSE },
|
||||||
{ /* opt_CRLEnry */ 'e', PR_TRUE, 0, PR_FALSE },
|
{ /* opt_ConvertDate */ 'd', PR_TRUE, 0, PR_FALSE },
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
|
|
@ -444,6 +455,30 @@ main(int argc, char **argv)
|
||||||
if (rv != SECSuccess)
|
if (rv != SECSuccess)
|
||||||
Usage(progName);
|
Usage(progName);
|
||||||
|
|
||||||
|
if (addbuiltin.options[opt_ConvertDate].activated) {
|
||||||
|
char *endPtr;
|
||||||
|
PRTime distrustTimestamp = strtol(addbuiltin.options[opt_ConvertDate].arg, &endPtr, 0) * PR_USEC_PER_SEC;
|
||||||
|
if (*endPtr != '\0' && distrustTimestamp > 0) {
|
||||||
|
Usage(progName);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
SECItem encTime;
|
||||||
|
DER_EncodeTimeChoice(NULL, &encTime, distrustTimestamp);
|
||||||
|
SECU_PrintTimeChoice(stdout, &encTime, "The timestamp represents this date", 0);
|
||||||
|
printf("Locate the entry of the desired certificate in certdata.txt\n"
|
||||||
|
"Erase the CKA_NSS_[SERVER|EMAIL]_DISTRUST_AFTER CK_BBOOL CK_FALSE\n"
|
||||||
|
"And override with the following respective entry:\n\n");
|
||||||
|
SECU_PrintTimeChoice(stdout, &encTime, "# For Server Distrust After", 0);
|
||||||
|
printf("CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL\n");
|
||||||
|
dumpbytes(encTime.data, encTime.len);
|
||||||
|
printf("END\n");
|
||||||
|
SECU_PrintTimeChoice(stdout, &encTime, "# For Email Distrust After", 0);
|
||||||
|
printf("CKA_NSS_EMAIL_DISTRUST_AFTER MULTILINE_OCTAL\n");
|
||||||
|
dumpbytes(encTime.data, encTime.len);
|
||||||
|
printf("END\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (addbuiltin.options[opt_Trust].activated)
|
if (addbuiltin.options[opt_Trust].activated)
|
||||||
++mutuallyExclusiveOpts;
|
++mutuallyExclusiveOpts;
|
||||||
if (addbuiltin.options[opt_Distrust].activated)
|
if (addbuiltin.options[opt_Distrust].activated)
|
||||||
|
|
@ -458,12 +493,12 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addbuiltin.options[opt_DistrustCRL].activated) {
|
if (addbuiltin.options[opt_DistrustCRL].activated) {
|
||||||
if (!addbuiltin.options[opt_CRLEnry].activated) {
|
if (!addbuiltin.options[opt_CRLEntry].activated) {
|
||||||
fprintf(stderr, "%s: you must specify the CRL entry number.\n",
|
fprintf(stderr, "%s: you must specify the CRL entry number.\n",
|
||||||
progName);
|
progName);
|
||||||
Usage(progName);
|
Usage(progName);
|
||||||
} else {
|
} else {
|
||||||
crlentry = atoi(addbuiltin.options[opt_CRLEnry].arg);
|
crlentry = atoi(addbuiltin.options[opt_CRLEntry].arg);
|
||||||
if (crlentry < 1) {
|
if (crlentry < 1) {
|
||||||
fprintf(stderr, "%s: The CRL entry number must be > 0.\n",
|
fprintf(stderr, "%s: The CRL entry number must be > 0.\n",
|
||||||
progName);
|
progName);
|
||||||
|
|
|
||||||
|
|
@ -211,5 +211,8 @@ loser:
|
||||||
if (outFile && closeOut) {
|
if (outFile && closeOut) {
|
||||||
fclose(outFile);
|
fclose(outFile);
|
||||||
}
|
}
|
||||||
|
if (suffix) {
|
||||||
|
PORT_Free(suffix);
|
||||||
|
}
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6669,12 +6669,13 @@ tls(char *reqfn)
|
||||||
|
|
||||||
CK_MECHANISM master_mech = { CKM_TLS_MASTER_KEY_DERIVE, NULL, 0 };
|
CK_MECHANISM master_mech = { CKM_TLS_MASTER_KEY_DERIVE, NULL, 0 };
|
||||||
CK_MECHANISM key_block_mech = { CKM_TLS_KEY_AND_MAC_DERIVE, NULL, 0 };
|
CK_MECHANISM key_block_mech = { CKM_TLS_KEY_AND_MAC_DERIVE, NULL, 0 };
|
||||||
CK_SSL3_MASTER_KEY_DERIVE_PARAMS master_params;
|
CK_TLS12_MASTER_KEY_DERIVE_PARAMS master_params;
|
||||||
CK_SSL3_KEY_MAT_PARAMS key_block_params;
|
CK_TLS12_KEY_MAT_PARAMS key_block_params;
|
||||||
CK_SSL3_KEY_MAT_OUT key_material;
|
CK_SSL3_KEY_MAT_OUT key_material;
|
||||||
CK_RV crv;
|
CK_RV crv;
|
||||||
|
|
||||||
/* set up PKCS #11 parameters */
|
/* set up PKCS #11 parameters */
|
||||||
|
master_params.prfHashMechanism = CKM_SHA256;
|
||||||
master_params.pVersion = NULL;
|
master_params.pVersion = NULL;
|
||||||
master_params.RandomInfo.pClientRandom = clientHello_random;
|
master_params.RandomInfo.pClientRandom = clientHello_random;
|
||||||
master_params.RandomInfo.ulClientRandomLen = sizeof(clientHello_random);
|
master_params.RandomInfo.ulClientRandomLen = sizeof(clientHello_random);
|
||||||
|
|
@ -6682,6 +6683,7 @@ tls(char *reqfn)
|
||||||
master_params.RandomInfo.ulServerRandomLen = sizeof(serverHello_random);
|
master_params.RandomInfo.ulServerRandomLen = sizeof(serverHello_random);
|
||||||
master_mech.pParameter = (void *)&master_params;
|
master_mech.pParameter = (void *)&master_params;
|
||||||
master_mech.ulParameterLen = sizeof(master_params);
|
master_mech.ulParameterLen = sizeof(master_params);
|
||||||
|
key_block_params.prfHashMechanism = CKM_SHA256;
|
||||||
key_block_params.ulMacSizeInBits = 0;
|
key_block_params.ulMacSizeInBits = 0;
|
||||||
key_block_params.ulKeySizeInBits = 0;
|
key_block_params.ulKeySizeInBits = 0;
|
||||||
key_block_params.ulIVSizeInBits = 0;
|
key_block_params.ulIVSizeInBits = 0;
|
||||||
|
|
@ -6724,13 +6726,39 @@ tls(char *reqfn)
|
||||||
if (buf[0] == '[') {
|
if (buf[0] == '[') {
|
||||||
if (strncmp(buf, "[TLS", 4) == 0) {
|
if (strncmp(buf, "[TLS", 4) == 0) {
|
||||||
if (buf[7] == '0') {
|
if (buf[7] == '0') {
|
||||||
|
/* CK_SSL3_MASTER_KEY_DERIVE_PARAMS is a subset of
|
||||||
|
* CK_TLS12_MASTER_KEY_DERIVE_PARAMS and
|
||||||
|
* CK_SSL3_KEY_MAT_PARAMS is a subset of
|
||||||
|
* CK_TLS12_KEY_MAT_PARAMS. The latter params have
|
||||||
|
* an extra prfHashMechanism field at the end. */
|
||||||
master_mech.mechanism = CKM_TLS_MASTER_KEY_DERIVE;
|
master_mech.mechanism = CKM_TLS_MASTER_KEY_DERIVE;
|
||||||
key_block_mech.mechanism = CKM_TLS_KEY_AND_MAC_DERIVE;
|
key_block_mech.mechanism = CKM_TLS_KEY_AND_MAC_DERIVE;
|
||||||
|
master_mech.ulParameterLen = sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS);
|
||||||
|
key_block_mech.ulParameterLen = sizeof(CK_SSL3_KEY_MAT_PARAMS);
|
||||||
} else if (buf[7] == '2') {
|
} else if (buf[7] == '2') {
|
||||||
master_mech.mechanism =
|
if (strncmp(&buf[10], "SHA-1", 5) == 0) {
|
||||||
CKM_NSS_TLS_MASTER_KEY_DERIVE_SHA256;
|
master_params.prfHashMechanism = CKM_SHA_1;
|
||||||
key_block_mech.mechanism =
|
key_block_params.prfHashMechanism = CKM_SHA_1;
|
||||||
CKM_NSS_TLS_KEY_AND_MAC_DERIVE_SHA256;
|
} else if (strncmp(&buf[10], "SHA-224", 7) == 0) {
|
||||||
|
master_params.prfHashMechanism = CKM_SHA224;
|
||||||
|
key_block_params.prfHashMechanism = CKM_SHA224;
|
||||||
|
} else if (strncmp(&buf[10], "SHA-256", 7) == 0) {
|
||||||
|
master_params.prfHashMechanism = CKM_SHA256;
|
||||||
|
key_block_params.prfHashMechanism = CKM_SHA256;
|
||||||
|
} else if (strncmp(&buf[10], "SHA-384", 7) == 0) {
|
||||||
|
master_params.prfHashMechanism = CKM_SHA384;
|
||||||
|
key_block_params.prfHashMechanism = CKM_SHA384;
|
||||||
|
} else if (strncmp(&buf[10], "SHA-512", 7) == 0) {
|
||||||
|
master_params.prfHashMechanism = CKM_SHA512;
|
||||||
|
key_block_params.prfHashMechanism = CKM_SHA512;
|
||||||
|
} else {
|
||||||
|
fprintf(tlsresp, "ERROR: Unable to find prf Hash type");
|
||||||
|
goto loser;
|
||||||
|
}
|
||||||
|
master_mech.mechanism = CKM_TLS12_MASTER_KEY_DERIVE;
|
||||||
|
key_block_mech.mechanism = CKM_TLS12_KEY_AND_MAC_DERIVE;
|
||||||
|
master_mech.ulParameterLen = sizeof(master_params);
|
||||||
|
key_block_mech.ulParameterLen = sizeof(key_block_params);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Unknown TLS type %x\n",
|
fprintf(stderr, "Unknown TLS type %x\n",
|
||||||
(unsigned int)buf[0]);
|
(unsigned int)buf[0]);
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ handle_connection(
|
||||||
char *getData = NULL; /* inplace conversion */
|
char *getData = NULL; /* inplace conversion */
|
||||||
SECItem postData;
|
SECItem postData;
|
||||||
PRBool isOcspRequest = PR_FALSE;
|
PRBool isOcspRequest = PR_FALSE;
|
||||||
PRBool isPost;
|
PRBool isPost = PR_FALSE;
|
||||||
|
|
||||||
postData.data = NULL;
|
postData.data = NULL;
|
||||||
postData.len = 0;
|
postData.len = 0;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ include $(CORE_DEPTH)/coreconf/config.mk
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
include ../platlibs.mk
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# (5) Execute "global" rules. (OPTIONAL) #
|
# (5) Execute "global" rules. (OPTIONAL) #
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
#include "secutil.h"
|
#include "secutil.h"
|
||||||
#include "secoid.h"
|
#include "secoid.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
extern int fprintf(FILE *strm, const char *format, ... /* args */);
|
extern int fprintf(FILE *strm, const char *format, ... /* args */);
|
||||||
extern int fflush(FILE *stream);
|
extern int fflush(FILE *stream);
|
||||||
|
|
@ -509,7 +511,7 @@ prettyPrintItem(FILE *out, const unsigned char *data, const unsigned char *end,
|
||||||
/*
|
/*
|
||||||
* Just quit now if slen more bytes puts us off the end.
|
* Just quit now if slen more bytes puts us off the end.
|
||||||
*/
|
*/
|
||||||
if ((data + slen) > end) {
|
if (data > end || slen > (end - data)) {
|
||||||
PORT_SetError(SEC_ERROR_BAD_DER);
|
PORT_SetError(SEC_ERROR_BAD_DER);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@
|
||||||
],
|
],
|
||||||
'target_defaults': {
|
'target_defaults': {
|
||||||
'defines': [
|
'defines': [
|
||||||
'NSPR20'
|
'NSPR20',
|
||||||
|
'NSS_USE_STATIC_LIBS'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'variables': {
|
'variables': {
|
||||||
|
|
|
||||||
|
|
@ -37,3 +37,5 @@ CSRCS = basicutil.c \
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NO_MD_RELEASE = 1
|
NO_MD_RELEASE = 1
|
||||||
|
|
||||||
|
USE_STATIC_LIBS = 1
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,8 @@ const Constant _consts[] = {
|
||||||
mkEntry(CKM_SHA512, Mechanism),
|
mkEntry(CKM_SHA512, Mechanism),
|
||||||
mkEntry(CKM_SHA512_HMAC_GENERAL, Mechanism),
|
mkEntry(CKM_SHA512_HMAC_GENERAL, Mechanism),
|
||||||
mkEntry(CKM_SHA512_HMAC, Mechanism),
|
mkEntry(CKM_SHA512_HMAC, Mechanism),
|
||||||
|
mkEntry(CKM_AES_CMAC, Mechanism),
|
||||||
|
mkEntry(CKM_AES_CMAC_GENERAL, Mechanism),
|
||||||
mkEntry(CKM_CAST_KEY_GEN, Mechanism),
|
mkEntry(CKM_CAST_KEY_GEN, Mechanism),
|
||||||
mkEntry(CKM_CAST_ECB, Mechanism),
|
mkEntry(CKM_CAST_ECB, Mechanism),
|
||||||
mkEntry(CKM_CAST_CBC, Mechanism),
|
mkEntry(CKM_CAST_CBC, Mechanism),
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ SEC_GetPassword(FILE *input, FILE *output, char *prompt,
|
||||||
int infd = fileno(input);
|
int infd = fileno(input);
|
||||||
int isTTY = isatty(infd);
|
int isTTY = isatty(infd);
|
||||||
#endif
|
#endif
|
||||||
char phrase[200] = { '\0' }; /* ensure EOF doesn't return junk */
|
char phrase[500] = { '\0' }; /* ensure EOF doesn't return junk */
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Prompt for password */
|
/* Prompt for password */
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -1107,36 +1108,33 @@ typedef struct secuPBEParamsStr {
|
||||||
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
|
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
|
||||||
|
|
||||||
/* SECOID_PKCS5_PBKDF2 */
|
/* SECOID_PKCS5_PBKDF2 */
|
||||||
const SEC_ASN1Template secuKDF2Params[] =
|
const SEC_ASN1Template secuKDF2Params[] = {
|
||||||
{
|
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
||||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
{ SEC_ASN1_OCTET_STRING, offsetof(secuPBEParams, salt) },
|
||||||
{ SEC_ASN1_OCTET_STRING, offsetof(secuPBEParams, salt) },
|
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, iterationCount) },
|
||||||
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, iterationCount) },
|
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, keyLength) },
|
||||||
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, keyLength) },
|
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, kdfAlg),
|
||||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, kdfAlg),
|
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
||||||
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
{ 0 }
|
||||||
{ 0 }
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/* PKCS5v1 & PKCS12 */
|
/* PKCS5v1 & PKCS12 */
|
||||||
const SEC_ASN1Template secuPBEParamsTemp[] =
|
const SEC_ASN1Template secuPBEParamsTemp[] = {
|
||||||
{
|
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
||||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
{ SEC_ASN1_OCTET_STRING, offsetof(secuPBEParams, salt) },
|
||||||
{ SEC_ASN1_OCTET_STRING, offsetof(secuPBEParams, salt) },
|
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, iterationCount) },
|
||||||
{ SEC_ASN1_INTEGER, offsetof(secuPBEParams, iterationCount) },
|
{ 0 }
|
||||||
{ 0 }
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/* SEC_OID_PKCS5_PBES2, SEC_OID_PKCS5_PBMAC1 */
|
/* SEC_OID_PKCS5_PBES2, SEC_OID_PKCS5_PBMAC1 */
|
||||||
const SEC_ASN1Template secuPBEV2Params[] =
|
const SEC_ASN1Template secuPBEV2Params[] = {
|
||||||
{
|
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
||||||
{ SEC_ASN1_SEQUENCE, 0, NULL, sizeof(secuPBEParams) },
|
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, kdfAlg),
|
||||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, kdfAlg),
|
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
||||||
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, cipherAlg),
|
||||||
{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(secuPBEParams, cipherAlg),
|
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
||||||
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
|
{ 0 }
|
||||||
{ 0 }
|
};
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
secu_PrintRSAPSSParams(FILE *out, SECItem *value, char *m, int level)
|
secu_PrintRSAPSSParams(FILE *out, SECItem *value, char *m, int level)
|
||||||
|
|
@ -2299,8 +2297,9 @@ SECU_PrintCertAttributes(FILE *out, CERTAttribute **attrs, char *m, int level)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int /* sometimes a PRErrorCode, other times a SECStatus. Sigh. */
|
/* sometimes a PRErrorCode, other times a SECStatus. Sigh. */
|
||||||
SECU_PrintCertificateRequest(FILE *out, SECItem *der, char *m, int level)
|
int
|
||||||
|
SECU_PrintCertificateRequest(FILE *out, SECItem *der, char *m, int level)
|
||||||
{
|
{
|
||||||
PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
|
PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
|
||||||
CERTCertificateRequest *cr;
|
CERTCertificateRequest *cr;
|
||||||
|
|
@ -3250,6 +3249,26 @@ SEC_PrintCertificateAndTrust(CERTCertificate *cert,
|
||||||
"Certificate Trust Flags", 1);
|
"Certificate Trust Flags", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The distrust fields are hard-coded in nssckbi and read-only.
|
||||||
|
* If verifying some cert, with vfychain, for instance, the certificate may
|
||||||
|
* not have a defined slot if not imported. */
|
||||||
|
if (cert->slot != NULL && cert->distrust != NULL) {
|
||||||
|
const unsigned int kDistrustFieldSize = 13;
|
||||||
|
fprintf(stdout, "\n");
|
||||||
|
SECU_Indent(stdout, 1);
|
||||||
|
fprintf(stdout, "%s:\n", "Certificate Distrust Dates");
|
||||||
|
if (cert->distrust->serverDistrustAfter.len == kDistrustFieldSize) {
|
||||||
|
SECU_PrintTimeChoice(stdout,
|
||||||
|
&cert->distrust->serverDistrustAfter,
|
||||||
|
"Server Distrust After", 2);
|
||||||
|
}
|
||||||
|
if (cert->distrust->emailDistrustAfter.len == kDistrustFieldSize) {
|
||||||
|
SECU_PrintTimeChoice(stdout,
|
||||||
|
&cert->distrust->emailDistrustAfter,
|
||||||
|
"E-mail Distrust After", 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (SECSuccess);
|
return (SECSuccess);
|
||||||
|
|
@ -3979,3 +3998,164 @@ done:
|
||||||
*enabledSigSchemes = schemes;
|
*enabledSigSchemes = schemes;
|
||||||
return SECSuccess;
|
return SECSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Parse the exporter spec in the form: LABEL[:OUTPUT-LENGTH[:CONTEXT]] */
|
||||||
|
static SECStatus
|
||||||
|
parseExporter(const char *arg,
|
||||||
|
secuExporter *exporter)
|
||||||
|
{
|
||||||
|
SECStatus rv = SECSuccess;
|
||||||
|
|
||||||
|
char *str = PORT_Strdup(arg);
|
||||||
|
if (!str) {
|
||||||
|
rv = SECFailure;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *labelEnd = strchr(str, ':');
|
||||||
|
if (labelEnd) {
|
||||||
|
*labelEnd = '\0';
|
||||||
|
labelEnd++;
|
||||||
|
|
||||||
|
/* To extract CONTEXT, first skip OUTPUT-LENGTH */
|
||||||
|
char *outputEnd = strchr(labelEnd, ':');
|
||||||
|
if (outputEnd) {
|
||||||
|
*outputEnd = '\0';
|
||||||
|
outputEnd++;
|
||||||
|
|
||||||
|
exporter->hasContext = PR_TRUE;
|
||||||
|
exporter->context.data = (unsigned char *)PORT_Strdup(outputEnd);
|
||||||
|
exporter->context.len = strlen(outputEnd);
|
||||||
|
if (PORT_Strncasecmp((char *)exporter->context.data, "0x", 2) == 0) {
|
||||||
|
rv = SECU_SECItemHexStringToBinary(&exporter->context);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labelEnd && *labelEnd != '\0') {
|
||||||
|
long int outputLength = strtol(labelEnd, NULL, 10);
|
||||||
|
if (!(outputLength > 0 && outputLength <= UINT_MAX)) {
|
||||||
|
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||||
|
rv = SECFailure;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
exporter->outputLength = outputLength;
|
||||||
|
} else {
|
||||||
|
exporter->outputLength = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *label = PORT_Strdup(str);
|
||||||
|
exporter->label.data = (unsigned char *)label;
|
||||||
|
exporter->label.len = strlen(label);
|
||||||
|
if (PORT_Strncasecmp((char *)exporter->label.data, "0x", 2) == 0) {
|
||||||
|
rv = SECU_SECItemHexStringToBinary(&exporter->label);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
PORT_Free(str);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
SECStatus
|
||||||
|
parseExporters(const char *arg,
|
||||||
|
const secuExporter **enabledExporters,
|
||||||
|
unsigned int *enabledExporterCount)
|
||||||
|
{
|
||||||
|
secuExporter *exporters;
|
||||||
|
unsigned int numValues = 0;
|
||||||
|
unsigned int count = 0;
|
||||||
|
|
||||||
|
if (countItems(arg, &numValues) != SECSuccess) {
|
||||||
|
return SECFailure;
|
||||||
|
}
|
||||||
|
exporters = PORT_ZNewArray(secuExporter, numValues);
|
||||||
|
if (!exporters) {
|
||||||
|
return SECFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get exporter definitions. */
|
||||||
|
char *str = PORT_Strdup(arg);
|
||||||
|
if (!str) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
char *p = strtok(str, ",");
|
||||||
|
while (p) {
|
||||||
|
SECStatus rv = parseExporter(p, &exporters[count++]);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
count = 0;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
p = strtok(NULL, ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
PORT_Free(str);
|
||||||
|
if (!count) {
|
||||||
|
PORT_Free(exporters);
|
||||||
|
return SECFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
*enabledExporterCount = count;
|
||||||
|
*enabledExporters = exporters;
|
||||||
|
return SECSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SECStatus
|
||||||
|
exportKeyingMaterial(PRFileDesc *fd, const secuExporter *exporter)
|
||||||
|
{
|
||||||
|
SECStatus rv = SECSuccess;
|
||||||
|
unsigned char *out = PORT_Alloc(exporter->outputLength);
|
||||||
|
|
||||||
|
if (!out) {
|
||||||
|
fprintf(stderr, "Unable to allocate buffer for keying material\n");
|
||||||
|
return SECFailure;
|
||||||
|
}
|
||||||
|
rv = SSL_ExportKeyingMaterial(fd,
|
||||||
|
(char *)exporter->label.data,
|
||||||
|
exporter->label.len,
|
||||||
|
exporter->hasContext,
|
||||||
|
exporter->context.data,
|
||||||
|
exporter->context.len,
|
||||||
|
out,
|
||||||
|
exporter->outputLength);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
fprintf(stdout, "Exported Keying Material:\n");
|
||||||
|
secu_PrintRawString(stdout, (SECItem *)&exporter->label, "Label", 1);
|
||||||
|
if (exporter->hasContext) {
|
||||||
|
SECU_PrintAsHex(stdout, &exporter->context, "Context", 1);
|
||||||
|
}
|
||||||
|
SECU_Indent(stdout, 1);
|
||||||
|
fprintf(stdout, "Length: %u\n", exporter->outputLength);
|
||||||
|
SECItem temp = { siBuffer, out, exporter->outputLength };
|
||||||
|
SECU_PrintAsHex(stdout, &temp, "Keying Material", 1);
|
||||||
|
|
||||||
|
done:
|
||||||
|
PORT_Free(out);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
SECStatus
|
||||||
|
exportKeyingMaterials(PRFileDesc *fd,
|
||||||
|
const secuExporter *exporters,
|
||||||
|
unsigned int exporterCount)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < exporterCount; i++) {
|
||||||
|
SECStatus rv = exportKeyingMaterial(fd, &exporters[i]);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SECSuccess;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,20 @@ SECStatus parseGroupList(const char *arg, SSLNamedGroup **enabledGroups,
|
||||||
SECStatus parseSigSchemeList(const char *arg,
|
SECStatus parseSigSchemeList(const char *arg,
|
||||||
const SSLSignatureScheme **enabledSigSchemes,
|
const SSLSignatureScheme **enabledSigSchemes,
|
||||||
unsigned int *enabledSigSchemeCount);
|
unsigned int *enabledSigSchemeCount);
|
||||||
|
typedef struct {
|
||||||
|
SECItem label;
|
||||||
|
PRBool hasContext;
|
||||||
|
SECItem context;
|
||||||
|
unsigned int outputLength;
|
||||||
|
} secuExporter;
|
||||||
|
|
||||||
|
SECStatus parseExporters(const char *arg,
|
||||||
|
const secuExporter **enabledExporters,
|
||||||
|
unsigned int *enabledExporterCount);
|
||||||
|
|
||||||
|
SECStatus exportKeyingMaterials(PRFileDesc *fd,
|
||||||
|
const secuExporter *exporters,
|
||||||
|
unsigned int exporterCount);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ EncryptFile(FILE *outFile, FILE *inFile, struct recipient *recipients,
|
||||||
SEC_PKCS7ContentInfo *cinfo;
|
SEC_PKCS7ContentInfo *cinfo;
|
||||||
SEC_PKCS7EncoderContext *ecx;
|
SEC_PKCS7EncoderContext *ecx;
|
||||||
struct recipient *rcpt;
|
struct recipient *rcpt;
|
||||||
SECStatus rv;
|
SECStatus rv = SECFailure;
|
||||||
|
|
||||||
if (outFile == NULL || inFile == NULL || recipients == NULL)
|
if (outFile == NULL || inFile == NULL || recipients == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -133,7 +133,7 @@ main(int argc, char **argv)
|
||||||
struct recipient *recipients, *rcpt;
|
struct recipient *recipients, *rcpt;
|
||||||
PLOptState *optstate;
|
PLOptState *optstate;
|
||||||
PLOptStatus status;
|
PLOptStatus status;
|
||||||
SECStatus rv;
|
SECStatus rv = SECFailure;
|
||||||
|
|
||||||
progName = strrchr(argv[0], '/');
|
progName = strrchr(argv[0], '/');
|
||||||
progName = progName ? progName + 1 : argv[0];
|
progName = progName ? progName + 1 : argv[0];
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,9 @@ cleanup:
|
||||||
}
|
}
|
||||||
SECITEM_FreeItem(&pubValue, PR_FALSE);
|
SECITEM_FreeItem(&pubValue, PR_FALSE);
|
||||||
SECITEM_FreeItem(&privID, PR_FALSE);
|
SECITEM_FreeItem(&privID, PR_FALSE);
|
||||||
PORT_FreeArena(epki->arena, PR_TRUE);
|
if (epki && epki->arena) {
|
||||||
|
PORT_FreeArena(epki->arena, PR_TRUE);
|
||||||
|
}
|
||||||
SECKEY_DestroyPublicKey(pubKey);
|
SECKEY_DestroyPublicKey(pubKey);
|
||||||
SECKEY_DestroyPrivateKey(privKey);
|
SECKEY_DestroyPrivateKey(privKey);
|
||||||
fprintf(stderr, "%s PrivateKeyImport %s ***********************\n",
|
fprintf(stderr, "%s PrivateKeyImport %s ***********************\n",
|
||||||
|
|
|
||||||
|
|
@ -5229,7 +5229,7 @@ PKM_Digest(CK_FUNCTION_LIST_PTR pFunctionList,
|
||||||
char *
|
char *
|
||||||
PKM_FilePasswd(char *pwFile)
|
PKM_FilePasswd(char *pwFile)
|
||||||
{
|
{
|
||||||
unsigned char phrase[200];
|
unsigned char phrase[500];
|
||||||
PRFileDesc *fd;
|
PRFileDesc *fd;
|
||||||
PRInt32 nb;
|
PRInt32 nb;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
|
|
@ -644,6 +644,7 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, PK11SlotInfo *inSlot,
|
||||||
}
|
}
|
||||||
certlist = PK11_FindCertsFromNickname(nn, slotPw);
|
certlist = PK11_FindCertsFromNickname(nn, slotPw);
|
||||||
if (!certlist) {
|
if (!certlist) {
|
||||||
|
PORT_SetError(SEC_ERROR_UNKNOWN_CERT);
|
||||||
SECU_PrintError(progName, "find user certs from nickname failed");
|
SECU_PrintError(progName, "find user certs from nickname failed");
|
||||||
pk12uErrno = PK12UERR_FINDCERTBYNN;
|
pk12uErrno = PK12UERR_FINDCERTBYNN;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ endif
|
||||||
ifeq ($(OS_ARCH), WINNT)
|
ifeq ($(OS_ARCH), WINNT)
|
||||||
|
|
||||||
EXTRA_LIBS += \
|
EXTRA_LIBS += \
|
||||||
$(NSS_LIBS_1) \
|
|
||||||
$(SECTOOL_LIB) \
|
$(SECTOOL_LIB) \
|
||||||
|
$(NSS_LIBS_1) \
|
||||||
$(NSS_LIBS_2) \
|
$(NSS_LIBS_2) \
|
||||||
$(SOFTOKENLIB) \
|
$(SOFTOKENLIB) \
|
||||||
$(CRYPTOLIB) \
|
$(CRYPTOLIB) \
|
||||||
|
|
@ -161,8 +161,8 @@ EXTRA_LIBS += \
|
||||||
else
|
else
|
||||||
|
|
||||||
EXTRA_LIBS += \
|
EXTRA_LIBS += \
|
||||||
$(NSS_LIBS_1) \
|
|
||||||
$(SECTOOL_LIB) \
|
$(SECTOOL_LIB) \
|
||||||
|
$(NSS_LIBS_1) \
|
||||||
$(NSS_LIBS_2) \
|
$(NSS_LIBS_2) \
|
||||||
$(SOFTOKENLIB) \
|
$(SOFTOKENLIB) \
|
||||||
$(NSS_LIBS_3) \
|
$(NSS_LIBS_3) \
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,13 @@ PrintParameterUsage()
|
||||||
" rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512,\n"
|
" rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512,\n"
|
||||||
"-Z enable 0-RTT (for TLS 1.3; also use -u)\n"
|
"-Z enable 0-RTT (for TLS 1.3; also use -u)\n"
|
||||||
"-E enable post-handshake authentication\n"
|
"-E enable post-handshake authentication\n"
|
||||||
" (for TLS 1.3; only has an effect with 3 or more -r options)\n",
|
" (for TLS 1.3; only has an effect with 3 or more -r options)\n"
|
||||||
|
"-x Export and print keying material after successful handshake\n"
|
||||||
|
" The argument is a comma separated list of exporters in the form:\n"
|
||||||
|
" LABEL[:OUTPUT-LENGTH[:CONTEXT]]\n"
|
||||||
|
" where LABEL and CONTEXT can be either a free-form string or\n"
|
||||||
|
" a hex string if it is preceded by \"0x\"; OUTPUT-LENGTH\n"
|
||||||
|
" is a decimal integer.\n",
|
||||||
stderr);
|
stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -805,12 +811,15 @@ PRBool enableSessionTickets = PR_FALSE;
|
||||||
PRBool failedToNegotiateName = PR_FALSE;
|
PRBool failedToNegotiateName = PR_FALSE;
|
||||||
PRBool enableExtendedMasterSecret = PR_FALSE;
|
PRBool enableExtendedMasterSecret = PR_FALSE;
|
||||||
PRBool zeroRTT = PR_FALSE;
|
PRBool zeroRTT = PR_FALSE;
|
||||||
|
SSLAntiReplayContext *antiReplay = NULL;
|
||||||
PRBool enableALPN = PR_FALSE;
|
PRBool enableALPN = PR_FALSE;
|
||||||
PRBool enablePostHandshakeAuth = PR_FALSE;
|
PRBool enablePostHandshakeAuth = PR_FALSE;
|
||||||
SSLNamedGroup *enabledGroups = NULL;
|
SSLNamedGroup *enabledGroups = NULL;
|
||||||
unsigned int enabledGroupsCount = 0;
|
unsigned int enabledGroupsCount = 0;
|
||||||
const SSLSignatureScheme *enabledSigSchemes = NULL;
|
const SSLSignatureScheme *enabledSigSchemes = NULL;
|
||||||
unsigned int enabledSigSchemeCount = 0;
|
unsigned int enabledSigSchemeCount = 0;
|
||||||
|
const secuExporter *enabledExporters = NULL;
|
||||||
|
unsigned int enabledExporterCount = 0;
|
||||||
|
|
||||||
static char *virtServerNameArray[MAX_VIRT_SERVER_NAME_ARRAY_INDEX];
|
static char *virtServerNameArray[MAX_VIRT_SERVER_NAME_ARRAY_INDEX];
|
||||||
static int virtServerNameIndex = 1;
|
static int virtServerNameIndex = 1;
|
||||||
|
|
@ -1821,6 +1830,15 @@ handshakeCallback(PRFileDesc *fd, void *client_data)
|
||||||
SECITEM_FreeItem(hostInfo, PR_TRUE);
|
SECITEM_FreeItem(hostInfo, PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (enabledExporters) {
|
||||||
|
SECStatus rv = exportKeyingMaterials(fd, enabledExporters, enabledExporterCount);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
PRErrorCode err = PR_GetError();
|
||||||
|
fprintf(stderr,
|
||||||
|
"couldn't export keying material: %s\n",
|
||||||
|
SECU_Strerror(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1925,7 +1943,7 @@ server_main(
|
||||||
for (i = 0; i < certNicknameIndex; i++) {
|
for (i = 0; i < certNicknameIndex; i++) {
|
||||||
if (cert[i] != NULL) {
|
if (cert[i] != NULL) {
|
||||||
const SSLExtraServerCertData ocspData = {
|
const SSLExtraServerCertData ocspData = {
|
||||||
ssl_auth_null, NULL, certStatus[i], NULL
|
ssl_auth_null, NULL, certStatus[i], NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
secStatus = SSL_ConfigServerCert(model_sock, cert[i],
|
secStatus = SSL_ConfigServerCert(model_sock, cert[i],
|
||||||
|
|
@ -1954,7 +1972,7 @@ server_main(
|
||||||
if (enabledVersions.max < SSL_LIBRARY_VERSION_TLS_1_3) {
|
if (enabledVersions.max < SSL_LIBRARY_VERSION_TLS_1_3) {
|
||||||
errExit("You tried enabling 0RTT without enabling TLS 1.3!");
|
errExit("You tried enabling 0RTT without enabling TLS 1.3!");
|
||||||
}
|
}
|
||||||
rv = SSL_SetupAntiReplay(10 * PR_USEC_PER_SEC, 7, 14);
|
rv = SSL_SetAntiReplayContext(model_sock, antiReplay);
|
||||||
if (rv != SECSuccess) {
|
if (rv != SECSuccess) {
|
||||||
errExit("error configuring anti-replay ");
|
errExit("error configuring anti-replay ");
|
||||||
}
|
}
|
||||||
|
|
@ -2011,7 +2029,7 @@ server_main(
|
||||||
errExit("SSL_CipherPrefSetDefault:TLS_RSA_WITH_NULL_MD5");
|
errExit("SSL_CipherPrefSetDefault:TLS_RSA_WITH_NULL_MD5");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expectedHostNameVal) {
|
if (expectedHostNameVal || enabledExporters) {
|
||||||
SSL_HandshakeCallback(model_sock, handshakeCallback,
|
SSL_HandshakeCallback(model_sock, handshakeCallback,
|
||||||
(void *)expectedHostNameVal);
|
(void *)expectedHostNameVal);
|
||||||
}
|
}
|
||||||
|
|
@ -2245,11 +2263,11 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* please keep this list of options in ASCII collating sequence.
|
/* please keep this list of options in ASCII collating sequence.
|
||||||
** numbers, then capital letters, then lower case, alphabetical.
|
** numbers, then capital letters, then lower case, alphabetical.
|
||||||
** XXX: 'B', 'E', 'q', and 'x' were used in the past but removed
|
** XXX: 'B', and 'q' were used in the past but removed
|
||||||
** in 3.28, please leave some time before resuing those.
|
** in 3.28, please leave some time before resuing those.
|
||||||
** 'z' was removed in 3.39. */
|
** 'z' was removed in 3.39. */
|
||||||
optstate = PL_CreateOptState(argc, argv,
|
optstate = PL_CreateOptState(argc, argv,
|
||||||
"2:A:C:DEGH:I:J:L:M:NP:QRS:T:U:V:W:YZa:bc:d:e:f:g:hi:jk:lmn:op:rst:uvw:y");
|
"2:A:C:DEGH:I:J:L:M:NP:QRS:T:U:V:W:YZa:bc:d:e:f:g:hi:jk:lmn:op:rst:uvw:x:y");
|
||||||
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
||||||
++optionsFound;
|
++optionsFound;
|
||||||
switch (optstate->option) {
|
switch (optstate->option) {
|
||||||
|
|
@ -2495,6 +2513,17 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
rv = parseExporters(optstate->value,
|
||||||
|
&enabledExporters, &enabledExporterCount);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
PL_DestroyOptState(optstate);
|
||||||
|
fprintf(stderr, "Bad exporter specified.\n");
|
||||||
|
fprintf(stderr, "Run '%s -h' for usage information.\n", progName);
|
||||||
|
exit(5);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case '?':
|
case '?':
|
||||||
fprintf(stderr, "Unrecognized or bad option specified.\n");
|
fprintf(stderr, "Unrecognized or bad option specified.\n");
|
||||||
|
|
@ -2684,8 +2713,10 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (cipher > 0) {
|
if (cipher > 0) {
|
||||||
rv = SSL_CipherPrefSetDefault(cipher, SSL_ALLOWED);
|
rv = SSL_CipherPrefSetDefault(cipher, SSL_ALLOWED);
|
||||||
if (rv != SECSuccess)
|
if (rv != SECSuccess) {
|
||||||
SECU_PrintError(progName, "SSL_CipherPrefSet()");
|
SECU_PrintError(progName, "SSL_CipherPrefSetDefault()");
|
||||||
|
exit(9);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Invalid cipher specification (-c arg).\n");
|
"Invalid cipher specification (-c arg).\n");
|
||||||
|
|
@ -2723,6 +2754,12 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
fprintf(stderr, "selfserv: Done creating dynamic weak DH parameters\n");
|
fprintf(stderr, "selfserv: Done creating dynamic weak DH parameters\n");
|
||||||
}
|
}
|
||||||
|
if (zeroRTT) {
|
||||||
|
rv = SSL_CreateAntiReplayContext(PR_Now(), 10L * PR_USEC_PER_SEC, 7, 14, &antiReplay);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
errExit("Unable to create anti-replay context for 0-RTT.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate the array of thread slots, and launch the worker threads. */
|
/* allocate the array of thread slots, and launch the worker threads. */
|
||||||
rv = launch_threads(&jobLoop, 0, 0, useLocalThreads);
|
rv = launch_threads(&jobLoop, 0, 0, useLocalThreads);
|
||||||
|
|
@ -2798,6 +2835,9 @@ cleanup:
|
||||||
if (enabledGroups) {
|
if (enabledGroups) {
|
||||||
PORT_Free(enabledGroups);
|
PORT_Free(enabledGroups);
|
||||||
}
|
}
|
||||||
|
if (antiReplay) {
|
||||||
|
SSL_ReleaseAntiReplayContext(antiReplay);
|
||||||
|
}
|
||||||
if (NSS_Shutdown() != SECSuccess) {
|
if (NSS_Shutdown() != SECSuccess) {
|
||||||
SECU_PrintError(progName, "NSS_Shutdown");
|
SECU_PrintError(progName, "NSS_Shutdown");
|
||||||
if (loggerThread) {
|
if (loggerThread) {
|
||||||
|
|
|
||||||
|
|
@ -614,7 +614,7 @@ cleanup:
|
||||||
static char *
|
static char *
|
||||||
filePasswd(char *pwFile)
|
filePasswd(char *pwFile)
|
||||||
{
|
{
|
||||||
unsigned char phrase[200];
|
unsigned char phrase[500];
|
||||||
PRFileDesc *fd;
|
PRFileDesc *fd;
|
||||||
PRInt32 nb;
|
PRInt32 nb;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,9 @@ Usage(void)
|
||||||
" -u enable TLS Session Ticket extension\n"
|
" -u enable TLS Session Ticket extension\n"
|
||||||
" -z enable compression\n"
|
" -z enable compression\n"
|
||||||
" -g enable false start\n"
|
" -g enable false start\n"
|
||||||
|
" -4 Enforce using an IPv4 destination address\n"
|
||||||
|
" -6 Enforce using an IPv6 destination address\n"
|
||||||
|
" Note: Default behavior is both IPv4 and IPv6 enabled\n"
|
||||||
" -J enable signature schemes\n"
|
" -J enable signature schemes\n"
|
||||||
" This takes a comma separated list of signature schemes in preference\n"
|
" This takes a comma separated list of signature schemes in preference\n"
|
||||||
" order.\n"
|
" order.\n"
|
||||||
|
|
@ -1061,7 +1064,9 @@ client_main(
|
||||||
int connections,
|
int connections,
|
||||||
cert_and_key *Cert_And_Key,
|
cert_and_key *Cert_And_Key,
|
||||||
const char *hostName,
|
const char *hostName,
|
||||||
const char *sniHostName)
|
const char *sniHostName,
|
||||||
|
PRBool allowIPv4,
|
||||||
|
PRBool allowIPv6)
|
||||||
{
|
{
|
||||||
PRFileDesc *model_sock = NULL;
|
PRFileDesc *model_sock = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1083,11 +1088,15 @@ client_main(
|
||||||
SECU_PrintError(progName, "error looking up host");
|
SECU_PrintError(progName, "error looking up host");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
for (;;) {
|
||||||
enumPtr = PR_EnumerateAddrInfo(enumPtr, addrInfo, port, &addr);
|
enumPtr = PR_EnumerateAddrInfo(enumPtr, addrInfo, port, &addr);
|
||||||
} while (enumPtr != NULL &&
|
if (enumPtr == NULL)
|
||||||
addr.raw.family != PR_AF_INET &&
|
break;
|
||||||
addr.raw.family != PR_AF_INET6);
|
if (addr.raw.family == PR_AF_INET && allowIPv4)
|
||||||
|
break;
|
||||||
|
if (addr.raw.family == PR_AF_INET6 && allowIPv6)
|
||||||
|
break;
|
||||||
|
}
|
||||||
PR_FreeAddrInfo(addrInfo);
|
PR_FreeAddrInfo(addrInfo);
|
||||||
if (enumPtr == NULL) {
|
if (enumPtr == NULL) {
|
||||||
SECU_PrintError(progName, "error looking up host address");
|
SECU_PrintError(progName, "error looking up host address");
|
||||||
|
|
@ -1319,6 +1328,8 @@ main(int argc, char **argv)
|
||||||
int connections = 1;
|
int connections = 1;
|
||||||
int exitVal;
|
int exitVal;
|
||||||
int tmpInt;
|
int tmpInt;
|
||||||
|
PRBool allowIPv4 = PR_TRUE;
|
||||||
|
PRBool allowIPv6 = PR_TRUE;
|
||||||
unsigned short port = 443;
|
unsigned short port = 443;
|
||||||
SECStatus rv;
|
SECStatus rv;
|
||||||
PLOptState *optstate;
|
PLOptState *optstate;
|
||||||
|
|
@ -1338,9 +1349,25 @@ main(int argc, char **argv)
|
||||||
/* XXX: 'B' was used in the past but removed in 3.28,
|
/* XXX: 'B' was used in the past but removed in 3.28,
|
||||||
* please leave some time before resuing it. */
|
* please leave some time before resuing it. */
|
||||||
optstate = PL_CreateOptState(argc, argv,
|
optstate = PL_CreateOptState(argc, argv,
|
||||||
"C:DJ:NP:TUV:W:a:c:d:f:gin:op:qst:uvw:z");
|
"46C:DJ:NP:TUV:W:a:c:d:f:gin:op:qst:uvw:z");
|
||||||
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
||||||
switch (optstate->option) {
|
switch (optstate->option) {
|
||||||
|
case '4':
|
||||||
|
if (!allowIPv4) {
|
||||||
|
fprintf(stderr, "Only one of [-4, -6] can be specified.\n");
|
||||||
|
Usage();
|
||||||
|
}
|
||||||
|
allowIPv6 = PR_FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '6':
|
||||||
|
if (!allowIPv6) {
|
||||||
|
fprintf(stderr, "Only one of [-4, -6] can be specified.\n");
|
||||||
|
Usage();
|
||||||
|
}
|
||||||
|
allowIPv4 = PR_FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
cipherString = optstate->value;
|
cipherString = optstate->value;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1523,7 +1550,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
client_main(port, connections, &Cert_And_Key, hostName,
|
client_main(port, connections, &Cert_And_Key, hostName,
|
||||||
sniHostName);
|
sniHostName, allowIPv4, allowIPv6);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
if (Cert_And_Key.cert) {
|
if (Cert_And_Key.cert) {
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ HexToBuf(char *inString, SECItem *outbuf)
|
||||||
int trueLen = 0;
|
int trueLen = 0;
|
||||||
|
|
||||||
outbuf->data = PORT_Alloc(outlen);
|
outbuf->data = PORT_Alloc(outlen);
|
||||||
if (outbuf->data) {
|
if (!outbuf->data) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,9 @@ printSecurityInfo(PRFileDesc *fd)
|
||||||
" %u\n",
|
" %u\n",
|
||||||
scts->len);
|
scts->len);
|
||||||
}
|
}
|
||||||
|
if (channel.peerDelegCred) {
|
||||||
|
fprintf(stderr, "Received a Delegated Credential\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -272,6 +275,7 @@ PrintParameterUsage()
|
||||||
fprintf(stderr, "%-20s Enable false start.\n", "-g");
|
fprintf(stderr, "%-20s Enable false start.\n", "-g");
|
||||||
fprintf(stderr, "%-20s Enable the cert_status extension (OCSP stapling).\n", "-T");
|
fprintf(stderr, "%-20s Enable the cert_status extension (OCSP stapling).\n", "-T");
|
||||||
fprintf(stderr, "%-20s Enable the signed_certificate_timestamp extension.\n", "-U");
|
fprintf(stderr, "%-20s Enable the signed_certificate_timestamp extension.\n", "-U");
|
||||||
|
fprintf(stderr, "%-20s Enable the delegated credentials extension.\n", "-B");
|
||||||
fprintf(stderr, "%-20s Require fresh revocation info from side channel.\n"
|
fprintf(stderr, "%-20s Require fresh revocation info from side channel.\n"
|
||||||
"%-20s -F once means: require for server cert only\n"
|
"%-20s -F once means: require for server cert only\n"
|
||||||
"%-20s -F twice means: require for intermediates, too\n"
|
"%-20s -F twice means: require for intermediates, too\n"
|
||||||
|
|
@ -314,6 +318,13 @@ PrintParameterUsage()
|
||||||
fprintf(stderr, "%-20s Enable post-handshake authentication\n"
|
fprintf(stderr, "%-20s Enable post-handshake authentication\n"
|
||||||
"%-20s for TLS 1.3; need to specify -n\n",
|
"%-20s for TLS 1.3; need to specify -n\n",
|
||||||
"-E", "");
|
"-E", "");
|
||||||
|
fprintf(stderr, "%-20s Export and print keying material after successful handshake.\n"
|
||||||
|
"%-20s The argument is a comma separated list of exporters in the form:\n"
|
||||||
|
"%-20s LABEL[:OUTPUT-LENGTH[:CONTEXT]]\n"
|
||||||
|
"%-20s where LABEL and CONTEXT can be either a free-form string or\n"
|
||||||
|
"%-20s a hex string if it is preceded by \"0x\"; OUTPUT-LENGTH\n"
|
||||||
|
"%-20s is a decimal integer.\n",
|
||||||
|
"-x", "", "", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -920,7 +931,7 @@ restartHandshakeAfterServerCertIfNeeded(PRFileDesc *fd,
|
||||||
PRBool override)
|
PRBool override)
|
||||||
{
|
{
|
||||||
SECStatus rv;
|
SECStatus rv;
|
||||||
PRErrorCode error;
|
PRErrorCode error = 0;
|
||||||
|
|
||||||
if (!serverCertAuth->isPaused)
|
if (!serverCertAuth->isPaused)
|
||||||
return SECSuccess;
|
return SECSuccess;
|
||||||
|
|
@ -993,6 +1004,9 @@ char *versionString = NULL;
|
||||||
PRBool handshakeComplete = PR_FALSE;
|
PRBool handshakeComplete = PR_FALSE;
|
||||||
char *encryptedSNIKeys = NULL;
|
char *encryptedSNIKeys = NULL;
|
||||||
PRBool enablePostHandshakeAuth = PR_FALSE;
|
PRBool enablePostHandshakeAuth = PR_FALSE;
|
||||||
|
PRBool enableDelegatedCredentials = PR_FALSE;
|
||||||
|
const secuExporter *enabledExporters = NULL;
|
||||||
|
unsigned int enabledExporterCount = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
writeBytesToServer(PRFileDesc *s, const PRUint8 *buf, int nb)
|
writeBytesToServer(PRFileDesc *s, const PRUint8 *buf, int nb)
|
||||||
|
|
@ -1088,6 +1102,18 @@ handshakeCallback(PRFileDesc *fd, void *client_data)
|
||||||
requestToExit = PR_TRUE;
|
requestToExit = PR_TRUE;
|
||||||
}
|
}
|
||||||
handshakeComplete = PR_TRUE;
|
handshakeComplete = PR_TRUE;
|
||||||
|
|
||||||
|
if (enabledExporters) {
|
||||||
|
SECStatus rv;
|
||||||
|
|
||||||
|
rv = exportKeyingMaterials(fd, enabledExporters, enabledExporterCount);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
PRErrorCode err = PR_GetError();
|
||||||
|
FPRINTF(stderr,
|
||||||
|
"couldn't export keying material: %s\n",
|
||||||
|
SECU_Strerror(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SECStatus
|
static SECStatus
|
||||||
|
|
@ -1308,8 +1334,11 @@ run()
|
||||||
}
|
}
|
||||||
if (cipher > 0) {
|
if (cipher > 0) {
|
||||||
rv = SSL_CipherPrefSet(s, cipher, SSL_ALLOWED);
|
rv = SSL_CipherPrefSet(s, cipher, SSL_ALLOWED);
|
||||||
if (rv != SECSuccess)
|
if (rv != SECSuccess) {
|
||||||
SECU_PrintError(progName, "SSL_CipherPrefSet()");
|
SECU_PrintError(progName, "SSL_CipherPrefSet()");
|
||||||
|
error = 1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Usage();
|
Usage();
|
||||||
}
|
}
|
||||||
|
|
@ -1365,6 +1394,14 @@ run()
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* enable negotiation of delegated credentials (draft-ietf-tls-subcerts) */
|
||||||
|
rv = SSL_OptionSet(s, SSL_ENABLE_DELEGATED_CREDENTIALS, enableDelegatedCredentials);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
SECU_PrintError(progName, "error enabling delegated credentials");
|
||||||
|
error = 1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* enable extended master secret mode */
|
/* enable extended master secret mode */
|
||||||
if (enableExtendedMasterSecret) {
|
if (enableExtendedMasterSecret) {
|
||||||
rv = SSL_OptionSet(s, SSL_ENABLE_EXTENDED_MASTER_SECRET, PR_TRUE);
|
rv = SSL_OptionSet(s, SSL_ENABLE_EXTENDED_MASTER_SECRET, PR_TRUE);
|
||||||
|
|
@ -1715,12 +1752,11 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: 'B' was used in the past but removed in 3.28
|
/* Note: 'z' was removed in 3.39
|
||||||
* 'z' was removed in 3.39
|
|
||||||
* Please leave some time before reusing these.
|
* Please leave some time before reusing these.
|
||||||
*/
|
*/
|
||||||
optstate = PL_CreateOptState(argc, argv,
|
optstate = PL_CreateOptState(argc, argv,
|
||||||
"46A:CDEFGHI:J:KL:M:N:OP:QR:STUV:W:X:YZa:bc:d:fgh:m:n:op:qr:st:uvw:");
|
"46A:BCDEFGHI:J:KL:M:N:OP:QR:STUV:W:X:YZa:bc:d:fgh:m:n:op:qr:st:uvw:x:");
|
||||||
while ((optstatus = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
while ((optstatus = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
|
||||||
switch (optstate->option) {
|
switch (optstate->option) {
|
||||||
case '?':
|
case '?':
|
||||||
|
|
@ -1743,6 +1779,10 @@ main(int argc, char **argv)
|
||||||
requestFile = PORT_Strdup(optstate->value);
|
requestFile = PORT_Strdup(optstate->value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
enableDelegatedCredentials = PR_TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
++dumpServerChain;
|
++dumpServerChain;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1964,6 +2004,17 @@ main(int argc, char **argv)
|
||||||
Usage();
|
Usage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
rv = parseExporters(optstate->value,
|
||||||
|
&enabledExporters,
|
||||||
|
&enabledExporterCount);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
PL_DestroyOptState(optstate);
|
||||||
|
fprintf(stderr, "Bad exporter specified.\n");
|
||||||
|
Usage();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PL_DestroyOptState(optstate);
|
PL_DestroyOptState(optstate);
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,12 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cipher > 0) {
|
if (cipher > 0) {
|
||||||
SSL_CipherPrefSetDefault(cipher, PR_TRUE);
|
SECStatus rv = SSL_CipherPrefSetDefault(cipher, PR_TRUE);
|
||||||
|
if (rv != SECSuccess) {
|
||||||
|
SECU_PrintError(progName,
|
||||||
|
"error setting cipher default preference");
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Usage(progName);
|
Usage(progName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ ifeq ($(USE_PTHREADS),1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEFAULT_COMPILER = gcc
|
DEFAULT_COMPILER = gcc
|
||||||
|
DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE
|
||||||
|
|
||||||
ifeq ($(OS_TARGET),Android)
|
ifeq ($(OS_TARGET),Android)
|
||||||
ifndef ANDROID_NDK
|
ifndef ANDROID_NDK
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ DSO_CFLAGS = -fPIC -DPIC
|
||||||
DSO_LDOPTS = -shared -fPIC -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
DSO_LDOPTS = -shared -fPIC -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||||
|
|
||||||
MKSHLIB = $(CC) $(DSO_LDOPTS)
|
MKSHLIB = $(CC) $(DSO_LDOPTS)
|
||||||
|
ifdef MAPFILE
|
||||||
|
MKSHLIB += -Wl,--version-script,$(MAPFILE)
|
||||||
|
endif
|
||||||
|
PROCESS_MAP_FILE = grep -v ';-' $< | \
|
||||||
|
sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
|
||||||
|
|
||||||
USE_SYSTEM_ZLIB = 1
|
USE_SYSTEM_ZLIB = 1
|
||||||
ZLIB_LIBS = -lz
|
ZLIB_LIBS = -lz
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ ifdef BUILD_OPT
|
||||||
DEFINES += -UDEBUG -DNDEBUG
|
DEFINES += -UDEBUG -DNDEBUG
|
||||||
else
|
else
|
||||||
OPTIMIZER += -g
|
OPTIMIZER += -g
|
||||||
USERNAME := $(shell whoami)
|
DEFINES += -DDEBUG -UNDEBUG
|
||||||
USERNAME := $(subst -,_,$(USERNAME))
|
|
||||||
DEFINES += -DDEBUG -UNDEBUG -DDEBUG_$(USERNAME)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BUILD_TREE
|
ifdef BUILD_TREE
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ endif
|
||||||
DLL_SUFFIX = dll
|
DLL_SUFFIX = dll
|
||||||
|
|
||||||
ifdef NS_USE_GCC
|
ifdef NS_USE_GCC
|
||||||
OS_CFLAGS += -mwindows -mms-bitfields
|
OS_CFLAGS += -mwindows
|
||||||
_GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
|
_GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
|
||||||
DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
|
DLLFLAGS += -mwindows -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
|
||||||
ifdef BUILD_OPT
|
ifdef BUILD_OPT
|
||||||
|
|
@ -116,11 +116,7 @@ ifdef NS_USE_GCC
|
||||||
DEFINES += -UDEBUG -DNDEBUG
|
DEFINES += -UDEBUG -DNDEBUG
|
||||||
else
|
else
|
||||||
OPTIMIZER += -g
|
OPTIMIZER += -g
|
||||||
NULLSTRING :=
|
DEFINES += -DDEBUG -UNDEBUG
|
||||||
SPACE := $(NULLSTRING) # end of the line
|
|
||||||
USERNAME := $(subst $(SPACE),_,$(USERNAME))
|
|
||||||
USERNAME := $(subst -,_,$(USERNAME))
|
|
||||||
DEFINES += -DDEBUG -UNDEBUG -DDEBUG_$(USERNAME)
|
|
||||||
endif
|
endif
|
||||||
else # !NS_USE_GCC
|
else # !NS_USE_GCC
|
||||||
WARNING_CFLAGS = -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \
|
WARNING_CFLAGS = -W3 -nologo -D_CRT_SECURE_NO_WARNINGS \
|
||||||
|
|
@ -179,10 +175,7 @@ else # !NS_USE_GCC
|
||||||
else
|
else
|
||||||
OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od
|
OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od
|
||||||
NULLSTRING :=
|
NULLSTRING :=
|
||||||
SPACE := $(NULLSTRING) # end of the line
|
DEFINES += -DDEBUG -UNDEBUG
|
||||||
USERNAME := $(subst $(SPACE),_,$(USERNAME))
|
|
||||||
USERNAME := $(subst -,_,$(USERNAME))
|
|
||||||
DEFINES += -DDEBUG -UNDEBUG -DDEBUG_$(USERNAME)
|
|
||||||
DLLFLAGS += -DEBUG -OUT:$@
|
DLLFLAGS += -DEBUG -OUT:$@
|
||||||
LDFLAGS += -DEBUG
|
LDFLAGS += -DEBUG
|
||||||
ifeq ($(_MSC_VER),$(_MSC_VER_6))
|
ifeq ($(_MSC_VER),$(_MSC_VER_6))
|
||||||
|
|
@ -268,6 +261,12 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# clear any CSTD and CXXSTD unless we're using GCC
|
||||||
|
ifndef NS_USE_GCC
|
||||||
|
CSTD =
|
||||||
|
CXXSTD =
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# override the definitions of RELEASE_TREE found in tree.mk
|
# override the definitions of RELEASE_TREE found in tree.mk
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ CCF = $(CC) $(CFLAGS)
|
||||||
LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) $(XLDFLAGS)
|
LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) $(XLDFLAGS)
|
||||||
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(WARNING_CFLAGS) $(XP_DEFINE) \
|
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(WARNING_CFLAGS) $(XP_DEFINE) \
|
||||||
$(DEFINES) $(INCLUDES) $(XCFLAGS)
|
$(DEFINES) $(INCLUDES) $(XCFLAGS)
|
||||||
|
CSTD = -std=c99
|
||||||
|
CXXSTD = -std=c++11
|
||||||
PERL = perl
|
PERL = perl
|
||||||
RANLIB = echo
|
RANLIB = echo
|
||||||
TAR = /bin/tar
|
TAR = /bin/tar
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@
|
||||||
'cc_is_gcc%': '<(cc_is_gcc)',
|
'cc_is_gcc%': '<(cc_is_gcc)',
|
||||||
'cc_use_gnu_ld%': '<(cc_use_gnu_ld)',
|
'cc_use_gnu_ld%': '<(cc_use_gnu_ld)',
|
||||||
# Some defaults
|
# Some defaults
|
||||||
|
'disable_arm_hw_aes%': 0,
|
||||||
'disable_tests%': 0,
|
'disable_tests%': 0,
|
||||||
'disable_chachapoly%': 0,
|
'disable_chachapoly%': 0,
|
||||||
'disable_dbm%': 0,
|
'disable_dbm%': 0,
|
||||||
|
|
@ -106,7 +107,6 @@
|
||||||
'moz_fold_libs%': 0,
|
'moz_fold_libs%': 0,
|
||||||
'moz_folded_library_name%': '',
|
'moz_folded_library_name%': '',
|
||||||
'sanitizer_flags%': 0,
|
'sanitizer_flags%': 0,
|
||||||
'test_build%': 0,
|
|
||||||
'static_libs%': 0,
|
'static_libs%': 0,
|
||||||
'no_zdefs%': 0,
|
'no_zdefs%': 0,
|
||||||
'fuzz%': 0,
|
'fuzz%': 0,
|
||||||
|
|
@ -130,7 +130,6 @@
|
||||||
# This is mostly for linking to libraries.
|
# This is mostly for linking to libraries.
|
||||||
'variables': {
|
'variables': {
|
||||||
'mapfile%': '',
|
'mapfile%': '',
|
||||||
'test_build%': 0,
|
|
||||||
'static_libs%': 0,
|
'static_libs%': 0,
|
||||||
'debug_optimization_level%': '0',
|
'debug_optimization_level%': '0',
|
||||||
'release_optimization_level%': '2',
|
'release_optimization_level%': '2',
|
||||||
|
|
@ -152,11 +151,6 @@
|
||||||
'NSS_NO_INIT_SUPPORT',
|
'NSS_NO_INIT_SUPPORT',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
[ 'static_libs==1', {
|
|
||||||
'variables': {
|
|
||||||
'standalone_static_library': '1',
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
[ 'OS!="android" and OS!="mac" and OS!="ios" and OS!="win"', {
|
[ 'OS!="android" and OS!="mac" and OS!="ios" and OS!="win"', {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'-lpthread',
|
'-lpthread',
|
||||||
|
|
@ -233,7 +227,7 @@
|
||||||
'product_dir': '<(nss_dist_obj_dir)/lib'
|
'product_dir': '<(nss_dist_obj_dir)/lib'
|
||||||
}, '_type=="executable"', {
|
}, '_type=="executable"', {
|
||||||
'product_dir': '<(nss_dist_obj_dir)/bin'
|
'product_dir': '<(nss_dist_obj_dir)/bin'
|
||||||
}, '_standalone_static_library==1', {
|
}, 'static_libs==1 or _standalone_static_library==1', {
|
||||||
'product_dir': '<(nss_dist_obj_dir)/lib'
|
'product_dir': '<(nss_dist_obj_dir)/lib'
|
||||||
}],
|
}],
|
||||||
# mapfile handling
|
# mapfile handling
|
||||||
|
|
@ -324,6 +318,9 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
[ '_type=="static_library" and static_libs==1', {
|
||||||
|
'standalone_static_library': 1,
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
'default_configuration': 'Debug',
|
'default_configuration': 'Debug',
|
||||||
'configurations': {
|
'configurations': {
|
||||||
|
|
@ -358,6 +355,8 @@
|
||||||
'LINUX2_1',
|
'LINUX2_1',
|
||||||
'LINUX',
|
'LINUX',
|
||||||
'linux',
|
'linux',
|
||||||
|
'_DEFAULT_SOURCE', # for <endian.h> functions, strdup, realpath, and getentropy
|
||||||
|
'_BSD_SOURCE', # for the above in glibc <= 2.19
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
[ 'OS=="dragonfly" or OS=="freebsd"', {
|
[ 'OS=="dragonfly" or OS=="freebsd"', {
|
||||||
|
|
@ -394,8 +393,11 @@
|
||||||
'-ffunction-sections',
|
'-ffunction-sections',
|
||||||
'-fdata-sections',
|
'-fdata-sections',
|
||||||
],
|
],
|
||||||
|
'cflags_c': [
|
||||||
|
'-std=c99',
|
||||||
|
],
|
||||||
'cflags_cc': [
|
'cflags_cc': [
|
||||||
'-std=c++0x',
|
'-std=c++11',
|
||||||
],
|
],
|
||||||
'ldflags': [
|
'ldflags': [
|
||||||
'-z', 'noexecstack',
|
'-z', 'noexecstack',
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,3 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#error "Do not include this header file."
|
#error "Do not include this header file."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ if [ -z "$CC" ]; then
|
||||||
export CXX=clang++
|
export CXX=clang++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gyp_params+=(-Dtest_build=1 -Dstatic_libs=1 -Dfuzz=1 -Dsign_libs=0)
|
gyp_params+=(-Dstatic_libs=1 -Dfuzz=1 -Dsign_libs=0)
|
||||||
|
|
||||||
# Add debug symbols even for opt builds.
|
# Add debug symbols even for opt builds.
|
||||||
nspr_params+=(--enable-debug-symbols)
|
nspr_params+=(--enable-debug-symbols)
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,30 @@ nspr_build()
|
||||||
extra_params+=(--enable-64bit)
|
extra_params+=(--enable-64bit)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "NSPR [1/3] configure ..."
|
echo "NSPR [1/5] configure ..."
|
||||||
pushd "$nspr_dir" >/dev/null
|
pushd "$nspr_dir" >/dev/null
|
||||||
CFLAGS="$nspr_cflags" CXXFLAGS="$nspr_cxxflags" \
|
CFLAGS="$nspr_cflags" CXXFLAGS="$nspr_cxxflags" \
|
||||||
LDFLAGS="$nspr_ldflags" CC="$CC" CXX="$CCC" \
|
LDFLAGS="$nspr_ldflags" CC="$CC" CXX="$CCC" \
|
||||||
run_verbose ../configure "${extra_params[@]}" "$@"
|
run_verbose ../configure "${extra_params[@]}" "$@"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
echo "NSPR [2/3] make ..."
|
echo "NSPR [2/5] make ..."
|
||||||
run_verbose make -C "$nspr_dir"
|
run_verbose make -C "$nspr_dir"
|
||||||
echo "NSPR [3/3] install ..."
|
|
||||||
|
if [ "$build_nspr_tests" = 1 ]; then
|
||||||
|
echo "NSPR [3/5] build tests ..."
|
||||||
|
run_verbose make -C "$nspr_dir/pr/tests"
|
||||||
|
else
|
||||||
|
echo "NSPR [3/5] NOT building tests"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$build_nspr_tests" = 1 && "$run_nspr_tests" = 1 ]]; then
|
||||||
|
echo "NSPR [4/5] run tests ..."
|
||||||
|
run_verbose make -C "$nspr_dir/pr/tests" runtests
|
||||||
|
else
|
||||||
|
echo "NSPR [4/5] NOT running tests"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "NSPR [5/5] install ..."
|
||||||
run_verbose make -C "$nspr_dir" install
|
run_verbose make -C "$nspr_dir" install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,23 +391,23 @@ core_abspath = '$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD
|
||||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
||||||
@$(MAKE_OBJDIR)
|
@$(MAKE_OBJDIR)
|
||||||
ifdef USE_NT_C_SYNTAX
|
ifdef USE_NT_C_SYNTAX
|
||||||
$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
|
$(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
ifdef NEED_ABSOLUTE_PATH
|
ifdef NEED_ABSOLUTE_PATH
|
||||||
$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
|
$(CC) -o $@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
$(CC) -o $@ -c $(CFLAGS) $<
|
$(CC) -o $@ -c $(CSTD) $(CFLAGS) $<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
||||||
ifdef USE_NT_C_SYNTAX
|
ifdef USE_NT_C_SYNTAX
|
||||||
$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
|
$(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
ifdef NEED_ABSOLUTE_PATH
|
ifdef NEED_ABSOLUTE_PATH
|
||||||
$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
|
$(CC) -o $@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
$(CC) -o $@ -c $(CFLAGS) $<
|
$(CC) -o $@ -c $(CSTD) $(CFLAGS) $<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -428,12 +428,12 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S
|
||||||
$(OBJDIR)/$(PROG_PREFIX)%: %.cpp
|
$(OBJDIR)/$(PROG_PREFIX)%: %.cpp
|
||||||
@$(MAKE_OBJDIR)
|
@$(MAKE_OBJDIR)
|
||||||
ifdef USE_NT_C_SYNTAX
|
ifdef USE_NT_C_SYNTAX
|
||||||
$(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
ifdef NEED_ABSOLUTE_PATH
|
ifdef NEED_ABSOLUTE_PATH
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -444,16 +444,16 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc
|
||||||
$(MAKE_OBJDIR)
|
$(MAKE_OBJDIR)
|
||||||
ifdef STRICT_CPLUSPLUS_SUFFIX
|
ifdef STRICT_CPLUSPLUS_SUFFIX
|
||||||
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
||||||
rm -f $(OBJDIR)/t_$*.cc
|
rm -f $(OBJDIR)/t_$*.cc
|
||||||
else
|
else
|
||||||
ifdef USE_NT_C_SYNTAX
|
ifdef USE_NT_C_SYNTAX
|
||||||
$(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
ifdef NEED_ABSOLUTE_PATH
|
ifdef NEED_ABSOLUTE_PATH
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif #STRICT_CPLUSPLUS_SUFFIX
|
endif #STRICT_CPLUSPLUS_SUFFIX
|
||||||
|
|
@ -462,16 +462,16 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp
|
||||||
@$(MAKE_OBJDIR)
|
@$(MAKE_OBJDIR)
|
||||||
ifdef STRICT_CPLUSPLUS_SUFFIX
|
ifdef STRICT_CPLUSPLUS_SUFFIX
|
||||||
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
||||||
rm -f $(OBJDIR)/t_$*.cc
|
rm -f $(OBJDIR)/t_$*.cc
|
||||||
else
|
else
|
||||||
ifdef USE_NT_C_SYNTAX
|
ifdef USE_NT_C_SYNTAX
|
||||||
$(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
ifdef NEED_ABSOLUTE_PATH
|
ifdef NEED_ABSOLUTE_PATH
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||||
else
|
else
|
||||||
$(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
|
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif #STRICT_CPLUSPLUS_SUFFIX
|
endif #STRICT_CPLUSPLUS_SUFFIX
|
||||||
|
|
|
||||||
33
security/nss/cpputil/freebl_scoped_ptrs.h
Normal file
33
security/nss/cpputil/freebl_scoped_ptrs.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
#ifndef freebl_scoped_ptrs_h__
|
||||||
|
#define freebl_scoped_ptrs_h__
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include "blapi.h"
|
||||||
|
|
||||||
|
struct ScopedDelete {
|
||||||
|
void operator()(CMACContext* ctx) { CMAC_Destroy(ctx, PR_TRUE); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct ScopedMaybeDelete {
|
||||||
|
void operator()(T* ptr) {
|
||||||
|
if (ptr) {
|
||||||
|
ScopedDelete del;
|
||||||
|
del(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
|
||||||
|
|
||||||
|
SCOPED(CMACContext);
|
||||||
|
|
||||||
|
#undef SCOPED
|
||||||
|
|
||||||
|
#endif // freebl_scoped_ptrs_h__
|
||||||
|
|
@ -14,19 +14,27 @@
|
||||||
#include "pk11pqg.h"
|
#include "pk11pqg.h"
|
||||||
#include "pk11pub.h"
|
#include "pk11pub.h"
|
||||||
#include "pkcs11uri.h"
|
#include "pkcs11uri.h"
|
||||||
|
#include "secmod.h"
|
||||||
|
|
||||||
struct ScopedDelete {
|
struct ScopedDelete {
|
||||||
void operator()(CERTCertificate* cert) { CERT_DestroyCertificate(cert); }
|
void operator()(CERTCertificate* cert) { CERT_DestroyCertificate(cert); }
|
||||||
void operator()(CERTCertificateList* list) {
|
void operator()(CERTCertificateList* list) {
|
||||||
CERT_DestroyCertificateList(list);
|
CERT_DestroyCertificateList(list);
|
||||||
}
|
}
|
||||||
|
void operator()(CERTDistNames* names) { CERT_FreeDistNames(names); }
|
||||||
void operator()(CERTName* name) { CERT_DestroyName(name); }
|
void operator()(CERTName* name) { CERT_DestroyName(name); }
|
||||||
void operator()(CERTCertList* list) { CERT_DestroyCertList(list); }
|
void operator()(CERTCertList* list) { CERT_DestroyCertList(list); }
|
||||||
void operator()(CERTSubjectPublicKeyInfo* spki) {
|
void operator()(CERTSubjectPublicKeyInfo* spki) {
|
||||||
SECKEY_DestroySubjectPublicKeyInfo(spki);
|
SECKEY_DestroySubjectPublicKeyInfo(spki);
|
||||||
}
|
}
|
||||||
|
void operator()(PK11Context* context) { PK11_DestroyContext(context, true); }
|
||||||
|
void operator()(PK11GenericObject* obj) { PK11_DestroyGenericObject(obj); }
|
||||||
void operator()(PK11SlotInfo* slot) { PK11_FreeSlot(slot); }
|
void operator()(PK11SlotInfo* slot) { PK11_FreeSlot(slot); }
|
||||||
|
void operator()(PK11SlotList* slots) { PK11_FreeSlotList(slots); }
|
||||||
void operator()(PK11SymKey* key) { PK11_FreeSymKey(key); }
|
void operator()(PK11SymKey* key) { PK11_FreeSymKey(key); }
|
||||||
|
void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
|
||||||
|
void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
|
||||||
|
void operator()(PQGParams* pqg) { PK11_PQG_DestroyParams(pqg); }
|
||||||
void operator()(PRFileDesc* fd) { PR_Close(fd); }
|
void operator()(PRFileDesc* fd) { PR_Close(fd); }
|
||||||
void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); }
|
void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); }
|
||||||
void operator()(SECKEYEncryptedPrivateKeyInfo* e) {
|
void operator()(SECKEYEncryptedPrivateKeyInfo* e) {
|
||||||
|
|
@ -38,15 +46,10 @@ struct ScopedDelete {
|
||||||
void operator()(SECKEYPrivateKeyList* list) {
|
void operator()(SECKEYPrivateKeyList* list) {
|
||||||
SECKEY_DestroyPrivateKeyList(list);
|
SECKEY_DestroyPrivateKeyList(list);
|
||||||
}
|
}
|
||||||
void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
|
void operator()(SECMODModule* module) { SECMOD_DestroyModule(module); }
|
||||||
void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
|
|
||||||
void operator()(PK11Context* context) { PK11_DestroyContext(context, true); }
|
|
||||||
void operator()(PK11GenericObject* obj) { PK11_DestroyGenericObject(obj); }
|
|
||||||
void operator()(PQGParams* pqg) { PK11_PQG_DestroyParams(pqg); }
|
|
||||||
void operator()(SEC_PKCS12DecoderContext* dcx) {
|
void operator()(SEC_PKCS12DecoderContext* dcx) {
|
||||||
SEC_PKCS12DecoderFinish(dcx);
|
SEC_PKCS12DecoderFinish(dcx);
|
||||||
}
|
}
|
||||||
void operator()(CERTDistNames* names) { CERT_FreeDistNames(names); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
@ -61,33 +64,36 @@ struct ScopedMaybeDelete {
|
||||||
|
|
||||||
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
|
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
|
||||||
|
|
||||||
|
SCOPED(CERTCertList);
|
||||||
SCOPED(CERTCertificate);
|
SCOPED(CERTCertificate);
|
||||||
SCOPED(CERTCertificateList);
|
SCOPED(CERTCertificateList);
|
||||||
SCOPED(CERTCertList);
|
SCOPED(CERTDistNames);
|
||||||
SCOPED(CERTName);
|
SCOPED(CERTName);
|
||||||
SCOPED(CERTSubjectPublicKeyInfo);
|
SCOPED(CERTSubjectPublicKeyInfo);
|
||||||
|
SCOPED(PK11Context);
|
||||||
|
SCOPED(PK11GenericObject);
|
||||||
SCOPED(PK11SlotInfo);
|
SCOPED(PK11SlotInfo);
|
||||||
|
SCOPED(PK11SlotList);
|
||||||
SCOPED(PK11SymKey);
|
SCOPED(PK11SymKey);
|
||||||
|
SCOPED(PK11URI);
|
||||||
|
SCOPED(PLArenaPool);
|
||||||
SCOPED(PQGParams);
|
SCOPED(PQGParams);
|
||||||
SCOPED(PRFileDesc);
|
SCOPED(PRFileDesc);
|
||||||
SCOPED(SECAlgorithmID);
|
SCOPED(SECAlgorithmID);
|
||||||
SCOPED(SECKEYEncryptedPrivateKeyInfo);
|
|
||||||
SCOPED(SECItem);
|
SCOPED(SECItem);
|
||||||
SCOPED(SECKEYPublicKey);
|
SCOPED(SECKEYEncryptedPrivateKeyInfo);
|
||||||
SCOPED(SECKEYPrivateKey);
|
SCOPED(SECKEYPrivateKey);
|
||||||
SCOPED(SECKEYPrivateKeyList);
|
SCOPED(SECKEYPrivateKeyList);
|
||||||
SCOPED(PK11URI);
|
SCOPED(SECKEYPublicKey);
|
||||||
SCOPED(PLArenaPool);
|
SCOPED(SECMODModule);
|
||||||
SCOPED(PK11Context);
|
|
||||||
SCOPED(PK11GenericObject);
|
|
||||||
SCOPED(SEC_PKCS12DecoderContext);
|
SCOPED(SEC_PKCS12DecoderContext);
|
||||||
SCOPED(CERTDistNames);
|
|
||||||
|
|
||||||
#undef SCOPED
|
#undef SCOPED
|
||||||
|
|
||||||
struct StackSECItem : public SECItem {
|
struct StackSECItem : public SECItem {
|
||||||
StackSECItem() : SECItem({siBuffer, nullptr, 0}) {}
|
StackSECItem() : SECItem({siBuffer, nullptr, 0}) {}
|
||||||
~StackSECItem() { SECITEM_FreeItem(this, PR_FALSE); }
|
~StackSECItem() { Reset(); }
|
||||||
|
void Reset() { SECITEM_FreeItem(this, PR_FALSE); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nss_scoped_ptrs_h__
|
#endif // nss_scoped_ptrs_h__
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,13 @@
|
||||||
#include "sslexp.h"
|
#include "sslexp.h"
|
||||||
|
|
||||||
struct ScopedDeleteSSL {
|
struct ScopedDeleteSSL {
|
||||||
|
void operator()(SSLAeadContext* ctx) { SSL_DestroyAead(ctx); }
|
||||||
|
void operator()(SSLAntiReplayContext* ctx) {
|
||||||
|
SSL_ReleaseAntiReplayContext(ctx);
|
||||||
|
}
|
||||||
void operator()(SSLResumptionTokenInfo* token) {
|
void operator()(SSLResumptionTokenInfo* token) {
|
||||||
SSL_DestroyResumptionTokenInfo(token);
|
SSL_DestroyResumptionTokenInfo(token);
|
||||||
}
|
}
|
||||||
void operator()(SSLAeadContext* ctx) { SSL_DestroyAead(ctx); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
@ -29,8 +32,9 @@ struct ScopedMaybeDeleteSSL {
|
||||||
|
|
||||||
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDeleteSSL<x> > Scoped##x
|
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDeleteSSL<x> > Scoped##x
|
||||||
|
|
||||||
SCOPED(SSLResumptionTokenInfo);
|
|
||||||
SCOPED(SSLAeadContext);
|
SCOPED(SSLAeadContext);
|
||||||
|
SCOPED(SSLAntiReplayContext);
|
||||||
|
SCOPED(SSLResumptionTokenInfo);
|
||||||
|
|
||||||
#undef SCOPED
|
#undef SCOPED
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,4 +37,9 @@ SCOPED(PLArenaPool);
|
||||||
|
|
||||||
#undef SCOPED
|
#undef SCOPED
|
||||||
|
|
||||||
|
struct StackSECItem : public SECItem {
|
||||||
|
StackSECItem() : SECItem({siBuffer, nullptr, 0}) {}
|
||||||
|
~StackSECItem() { SECITEM_FreeItem(this, PR_FALSE); }
|
||||||
|
};
|
||||||
|
|
||||||
#endif // scoped_ptrs_util_h__
|
#endif // scoped_ptrs_util_h__
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ const uint8_t kTlsHandshakeCertificateRequest = 13;
|
||||||
const uint8_t kTlsHandshakeCertificateVerify = 15;
|
const uint8_t kTlsHandshakeCertificateVerify = 15;
|
||||||
const uint8_t kTlsHandshakeClientKeyExchange = 16;
|
const uint8_t kTlsHandshakeClientKeyExchange = 16;
|
||||||
const uint8_t kTlsHandshakeFinished = 20;
|
const uint8_t kTlsHandshakeFinished = 20;
|
||||||
|
const uint8_t kTlsHandshakeKeyUpdate = 24;
|
||||||
|
|
||||||
const uint8_t kTlsAlertWarning = 1;
|
const uint8_t kTlsAlertWarning = 1;
|
||||||
const uint8_t kTlsAlertFatal = 2;
|
const uint8_t kTlsAlertFatal = 2;
|
||||||
|
|
@ -47,6 +48,7 @@ const uint8_t kTlsAlertIllegalParameter = 47;
|
||||||
const uint8_t kTlsAlertDecodeError = 50;
|
const uint8_t kTlsAlertDecodeError = 50;
|
||||||
const uint8_t kTlsAlertDecryptError = 51;
|
const uint8_t kTlsAlertDecryptError = 51;
|
||||||
const uint8_t kTlsAlertProtocolVersion = 70;
|
const uint8_t kTlsAlertProtocolVersion = 70;
|
||||||
|
const uint8_t kTlsAlertInsufficientSecurity = 71;
|
||||||
const uint8_t kTlsAlertInternalError = 80;
|
const uint8_t kTlsAlertInternalError = 80;
|
||||||
const uint8_t kTlsAlertInappropriateFallback = 86;
|
const uint8_t kTlsAlertInappropriateFallback = 86;
|
||||||
const uint8_t kTlsAlertMissingExtension = 109;
|
const uint8_t kTlsAlertMissingExtension = 109;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
'<(DEPTH)/lib/pkcs7/pkcs7.gyp:pkcs7',
|
'<(DEPTH)/lib/pkcs7/pkcs7.gyp:pkcs7',
|
||||||
# This is a static build of pk11wrap, softoken, and freebl.
|
# This is a static build of pk11wrap, softoken, and freebl.
|
||||||
'<(DEPTH)/lib/pk11wrap/pk11wrap.gyp:pk11wrap_static',
|
'<(DEPTH)/lib/pk11wrap/pk11wrap.gyp:pk11wrap_static',
|
||||||
|
'<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix',
|
||||||
],
|
],
|
||||||
'cflags_cc': [
|
'cflags_cc': [
|
||||||
'-Wno-error=shadow',
|
'-Wno-error=shadow',
|
||||||
|
|
@ -91,7 +92,7 @@
|
||||||
'-lcrypto',
|
'-lcrypto',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
# For test builds we have to set MPI defines.
|
# For static builds we have to set MPI defines.
|
||||||
[ 'target_arch=="ia32"', {
|
[ 'target_arch=="ia32"', {
|
||||||
'defines': [
|
'defines': [
|
||||||
'MP_USE_UINT_DIGIT',
|
'MP_USE_UINT_DIGIT',
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t len) {
|
||||||
// Probably not too important for clients.
|
// Probably not too important for clients.
|
||||||
SSL_SetURL(ssl_fd, "server");
|
SSL_SetURL(ssl_fd, "server");
|
||||||
|
|
||||||
|
FixTime(ssl_fd);
|
||||||
SetSocketOptions(ssl_fd, config);
|
SetSocketOptions(ssl_fd, config);
|
||||||
EnableAllCipherSuites(ssl_fd);
|
EnableAllCipherSuites(ssl_fd);
|
||||||
SetupCallbacks(ssl_fd, config.get());
|
SetupCallbacks(ssl_fd, config.get());
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,18 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "ssl.h"
|
#include "ssl.h"
|
||||||
|
#include "sslexp.h"
|
||||||
|
|
||||||
#include "tls_common.h"
|
#include "tls_common.h"
|
||||||
|
|
||||||
|
static PRTime FixedTime(void*) { return 1234; }
|
||||||
|
|
||||||
|
// Fix the time input, to avoid any time-based variation.
|
||||||
|
void FixTime(PRFileDesc* fd) {
|
||||||
|
SECStatus rv = SSL_SetTimeFunc(fd, FixedTime, nullptr);
|
||||||
|
assert(rv == SECSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
PRStatus EnableAllProtocolVersions() {
|
PRStatus EnableAllProtocolVersions() {
|
||||||
SSLVersionRange supported;
|
SSLVersionRange supported;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "prinit.h"
|
#include "prinit.h"
|
||||||
|
|
||||||
|
void FixTime(PRFileDesc* fd);
|
||||||
PRStatus EnableAllProtocolVersions();
|
PRStatus EnableAllProtocolVersions();
|
||||||
void EnableAllCipherSuites(PRFileDesc* fd);
|
void EnableAllCipherSuites(PRFileDesc* fd);
|
||||||
void DoHandshake(PRFileDesc* fd, bool isServer);
|
void DoHandshake(PRFileDesc* fd, bool isServer);
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t len) {
|
||||||
PRFileDesc* ssl_fd = ImportFD(model.get(), fd.get());
|
PRFileDesc* ssl_fd = ImportFD(model.get(), fd.get());
|
||||||
assert(ssl_fd == fd.get());
|
assert(ssl_fd == fd.get());
|
||||||
|
|
||||||
|
FixTime(ssl_fd);
|
||||||
SetSocketOptions(ssl_fd, config);
|
SetSocketOptions(ssl_fd, config);
|
||||||
DoHandshake(ssl_fd, true);
|
DoHandshake(ssl_fd, true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,13 @@
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'-lws2_32',
|
'-lws2_32',
|
||||||
],
|
],
|
||||||
|
'conditions': [
|
||||||
|
['static_libs==1', {
|
||||||
|
'libraries': [
|
||||||
|
'-ladvapi32',
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
],
|
||||||
}],
|
}],
|
||||||
['OS=="android"', {
|
['OS=="android"', {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "nspr.h"
|
#include "nspr.h"
|
||||||
#include "nss.h"
|
#include "nss.h"
|
||||||
#include "ssl.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
|
@ -29,9 +28,6 @@ int main(int argc, char **argv) {
|
||||||
if (NSS_Initialize(workdir, "", "", SECMOD_DB, flags) != SECSuccess) {
|
if (NSS_Initialize(workdir, "", "", SECMOD_DB, flags) != SECSuccess) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (NSS_SetDomesticPolicy() != SECSuccess) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
int rv = RUN_ALL_TESTS();
|
int rv = RUN_ALL_TESTS();
|
||||||
|
|
||||||
if (NSS_Shutdown() != SECSuccess) {
|
if (NSS_Shutdown() != SECSuccess) {
|
||||||
|
|
|
||||||
|
|
@ -13,22 +13,22 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef struct chacha_testvector_str {
|
typedef struct chaChaTestVectorStr {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
std::vector<uint8_t> Data;
|
std::vector<uint8_t> Data;
|
||||||
std::vector<uint8_t> AAD;
|
std::vector<uint8_t> AAD;
|
||||||
std::vector<uint8_t> Key;
|
std::vector<uint8_t> Key;
|
||||||
std::vector<uint8_t> IV;
|
std::vector<uint8_t> IV;
|
||||||
std::vector<uint8_t> CT;
|
std::vector<uint8_t> CT;
|
||||||
bool invalid_tag;
|
bool invalidTag;
|
||||||
bool invalid_iv;
|
bool invalidIV;
|
||||||
} chacha_testvector;
|
} chaChaTestVector;
|
||||||
|
|
||||||
// ChaCha20/Poly1305 Test Vector 1, RFC 7539
|
// ChaCha20/Poly1305 Test Vector 1, RFC 7539
|
||||||
// <http://tools.ietf.org/html/rfc7539#section-2.8.2>
|
// <http://tools.ietf.org/html/rfc7539#section-2.8.2>
|
||||||
// ChaCha20/Poly1305 Test Vector 2, RFC 7539
|
// ChaCha20/Poly1305 Test Vector 2, RFC 7539
|
||||||
// <http://tools.ietf.org/html/rfc7539#appendix-A.5>
|
// <http://tools.ietf.org/html/rfc7539#appendix-A.5>
|
||||||
const chacha_testvector kChaCha20Vectors[] = {
|
const chaChaTestVector kChaCha20Vectors[] = {
|
||||||
{0,
|
{0,
|
||||||
{0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47,
|
{0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47,
|
||||||
0x65, 0x6e, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
|
0x65, 0x6e, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
|
||||||
|
|
@ -116,7 +116,7 @@ const chacha_testvector kChaCha20Vectors[] = {
|
||||||
|
|
||||||
// Testvectors from project wycheproof
|
// Testvectors from project wycheproof
|
||||||
// <https://github.com/google/wycheproof>
|
// <https://github.com/google/wycheproof>
|
||||||
const chacha_testvector kChaCha20WycheproofVectors[] = {
|
const chaChaTestVector kChaCha20WycheproofVectors[] = {
|
||||||
|
|
||||||
// Comment: rfc7539
|
// Comment: rfc7539
|
||||||
{0,
|
{0,
|
||||||
|
|
@ -149,6 +149,32 @@ const chacha_testvector kChaCha20WycheproofVectors[] = {
|
||||||
false,
|
false,
|
||||||
false},
|
false},
|
||||||
|
|
||||||
|
// Comment:
|
||||||
|
{1,
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
{0x80, 0xba, 0x31, 0x92, 0xc8, 0x03, 0xce, 0x96, 0x5e, 0xa3, 0x71,
|
||||||
|
0xd5, 0xff, 0x07, 0x3c, 0xf0, 0xf4, 0x3b, 0x6a, 0x2a, 0xb5, 0x76,
|
||||||
|
0xb2, 0x08, 0x42, 0x6e, 0x11, 0x40, 0x9c, 0x09, 0xb9, 0xb0},
|
||||||
|
{0x4d, 0xa5, 0xbf, 0x8d, 0xfd, 0x58, 0x52, 0xc1, 0xea, 0x12, 0x37, 0x9d},
|
||||||
|
{0x76, 0xac, 0xb3, 0x42, 0xcf, 0x31, 0x66, 0xa5, 0xb6, 0x3c, 0x0c, 0x0e,
|
||||||
|
0xa1, 0x38, 0x3c, 0x8d},
|
||||||
|
false,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment:
|
||||||
|
{2,
|
||||||
|
{},
|
||||||
|
{0xbd, 0x50, 0x67, 0x64, 0xf2, 0xd2, 0xc4, 0x10},
|
||||||
|
{0x7a, 0x4c, 0xd7, 0x59, 0x17, 0x2e, 0x02, 0xeb, 0x20, 0x4d, 0xb2,
|
||||||
|
0xc3, 0xf5, 0xc7, 0x46, 0x22, 0x7d, 0xf5, 0x84, 0xfc, 0x13, 0x45,
|
||||||
|
0x19, 0x63, 0x91, 0xdb, 0xb9, 0x57, 0x7a, 0x25, 0x07, 0x42},
|
||||||
|
{0xa9, 0x2e, 0xf0, 0xac, 0x99, 0x1d, 0xd5, 0x16, 0xa3, 0xc6, 0xf6, 0x89},
|
||||||
|
{0x90, 0x6f, 0xa6, 0x28, 0x4b, 0x52, 0xf8, 0x7b, 0x73, 0x59, 0xcb, 0xaa,
|
||||||
|
0x75, 0x63, 0xc7, 0x09},
|
||||||
|
false,
|
||||||
|
false},
|
||||||
|
|
||||||
// Comment:
|
// Comment:
|
||||||
{3,
|
{3,
|
||||||
{0x2a},
|
{0x2a},
|
||||||
|
|
@ -1294,6 +1320,286 @@ const chacha_testvector kChaCha20WycheproofVectors[] = {
|
||||||
false,
|
false,
|
||||||
false},
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 0 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{61,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa2, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 1 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{62,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa1, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 7 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{63,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0x23, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 8 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{64,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe2, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 31 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{65,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0x79, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 32 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{66,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfa, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 33 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{67,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xf9, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 63 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{68,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x9b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 64 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{69,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5b, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 77 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{70,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xf2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 80 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{71,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x61, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 96 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{72,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x41, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 97 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{73,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x42, 0xb7, 0xf4, 0x47},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 120 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{74,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x46},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 121 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{75,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x45},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 126 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{76,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0x07},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 127 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{77,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x1b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0xc7},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Flipped bit 63 and 127 in tag expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{78,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xa3, 0xe3, 0xfd, 0xf9, 0xfb, 0xa6, 0x86, 0x9b, 0x5a, 0xd2, 0x60, 0x7f,
|
||||||
|
0x40, 0xb7, 0xf4, 0xc7},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: Tag changed to all zero expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{79,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
|
// Comment: tag change to all 1 expected
|
||||||
|
// tag:a3e3fdf9fba6861b5ad2607f40b7f447
|
||||||
|
{80,
|
||||||
|
{},
|
||||||
|
{0x61, 0x61, 0x64},
|
||||||
|
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa,
|
||||||
|
0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||||
|
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
|
||||||
|
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b},
|
||||||
|
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff},
|
||||||
|
true,
|
||||||
|
false},
|
||||||
|
|
||||||
// Comment: Flipped bit 0 in tag expected
|
// Comment: Flipped bit 0 in tag expected
|
||||||
// tag:27da374f17b7f1b23844a5490bfc4001
|
// tag:27da374f17b7f1b23844a5490bfc4001
|
||||||
{81,
|
{81,
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ const curve25519_testvector kCurve25519Vectors[] = {
|
||||||
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a},
|
0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a},
|
||||||
{0x30, 0x38, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
|
{0x30, 0x38, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
|
||||||
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
|
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
|
||||||
0x03, 0x20, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b,
|
0x03, 0x20, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
|
||||||
0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
|
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||||
0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
|
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b},
|
||||||
{},
|
{},
|
||||||
false},
|
false},
|
||||||
|
|
||||||
|
|
@ -70,6 +70,66 @@ const curve25519_testvector kCurve25519Vectors[] = {
|
||||||
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||||
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f, 0x34},
|
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f, 0x34},
|
||||||
{},
|
{},
|
||||||
|
false},
|
||||||
|
|
||||||
|
// A private key with leading zeros (they should not be stripped)
|
||||||
|
{{0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48,
|
||||||
|
0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda,
|
||||||
|
0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20,
|
||||||
|
0x00, 0x99, 0xD1, 0x90, 0x60, 0xCF, 0x79, 0xF0, 0x6F, 0x4F, 0x2E, 0x47,
|
||||||
|
0x97, 0x5B, 0x2A, 0x90, 0x01, 0x6C, 0x94, 0xF4, 0x3D, 0x94, 0x02, 0x57,
|
||||||
|
0x13, 0xDB, 0xB2, 0xA3, 0xD9, 0x54, 0x0B, 0xE5, 0xa1, 0x23, 0x03, 0x21,
|
||||||
|
0x05, 0x66, 0xA7, 0x26, 0xE0, 0xFC, 0x83, 0xEF, 0xA2, 0x56, 0xF4, 0xCC,
|
||||||
|
0xEA, 0x71, 0x07, 0x4D, 0xBB, 0x5C, 0x76, 0x0A, 0x9F, 0xF4, 0x7E, 0x5C,
|
||||||
|
0x5D, 0x4C, 0xB8, 0xDA, 0x9E, 0x44, 0x60, 0x52, 0x00},
|
||||||
|
{0x30, 0x39, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
|
||||||
|
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
|
||||||
|
0x03, 0x21, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
|
||||||
|
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||||
|
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
|
||||||
|
{0xB9, 0x4B, 0x92, 0xEA, 0xDA, 0x64, 0x40, 0xD3, 0x08, 0x63, 0x06,
|
||||||
|
0x45, 0xF4, 0x4C, 0xCD, 0x19, 0x7B, 0xE6, 0x0A, 0xBC, 0x6C, 0x9D,
|
||||||
|
0x96, 0x8F, 0x5D, 0x70, 0x44, 0x55, 0xD0, 0x1B, 0xEE, 0x4A},
|
||||||
|
true},
|
||||||
|
|
||||||
|
// A private key that's too short
|
||||||
|
{{0x30, 0x66, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2A, 0x86, 0x48,
|
||||||
|
0xCE, 0x3D, 0x02, 0x01, 0x06, 0x09, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA,
|
||||||
|
0x47, 0x0F, 0x01, 0x04, 0x4B, 0x30, 0x49, 0x02, 0x01, 0x01, 0x04, 0x1F,
|
||||||
|
0x07, 0x6D, 0x0A, 0x73, 0x18, 0xA5, 0x7D, 0x3C, 0x16, 0xC1, 0x72, 0x51,
|
||||||
|
0xB2, 0x66, 0x45, 0xDF, 0x4C, 0x2F, 0x87, 0xEB, 0xC0, 0x99, 0x2A, 0xB1,
|
||||||
|
0x77, 0xFB, 0xA5, 0x1D, 0xB9, 0x2C, 0x2A, 0xA1, 0x23, 0x03, 0x21, 0x00,
|
||||||
|
0x85, 0x20, 0xF0, 0x09, 0x89, 0x30, 0xA7, 0x54, 0x74, 0x8B, 0x7D, 0xDC,
|
||||||
|
0xB4, 0x3E, 0xF7, 0x5A, 0x0D, 0xBF, 0x3A, 0x0D, 0x26, 0x38, 0x1A, 0xF4,
|
||||||
|
0xEB, 0xA4, 0xA9, 0x8E, 0xAA, 0x9B, 0x4E, 0x6A},
|
||||||
|
{0x30, 0x39, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
|
||||||
|
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
|
||||||
|
0x03, 0x21, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
|
||||||
|
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||||
|
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
|
||||||
|
{0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
|
||||||
|
0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
|
||||||
|
0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42},
|
||||||
|
false},
|
||||||
|
|
||||||
|
// A private key that's too long
|
||||||
|
{{0x30, 0x68, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2A, 0x86, 0x48,
|
||||||
|
0xCE, 0x3D, 0x02, 0x01, 0x06, 0x09, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA,
|
||||||
|
0x47, 0x0F, 0x01, 0x04, 0x4D, 0x30, 0x4B, 0x02, 0x01, 0x01, 0x04, 0x21,
|
||||||
|
0x43, 0x77, 0x07, 0x6D, 0x0A, 0x73, 0x18, 0xA5, 0x7D, 0x3C, 0x16, 0xC1,
|
||||||
|
0x72, 0x51, 0xB2, 0x66, 0x45, 0xDF, 0x4C, 0x2F, 0x87, 0xEB, 0xC0, 0x99,
|
||||||
|
0x2A, 0xB1, 0x77, 0xFB, 0xA5, 0x1D, 0xB9, 0x2C, 0x2A, 0xA1, 0x23, 0x03,
|
||||||
|
0x21, 0x00, 0x85, 0x20, 0xF0, 0x09, 0x89, 0x30, 0xA7, 0x54, 0x74, 0x8B,
|
||||||
|
0x7D, 0xDC, 0xB4, 0x3E, 0xF7, 0x5A, 0x0D, 0xBF, 0x3A, 0x0D, 0x26, 0x38,
|
||||||
|
0x1A, 0xF4, 0xEB, 0xA4, 0xA9, 0x8E, 0xAA, 0x9B, 0x4E, 0x6A},
|
||||||
|
{0x30, 0x39, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
|
||||||
|
0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01,
|
||||||
|
0x03, 0x21, 0x00, 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3,
|
||||||
|
0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||||
|
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f},
|
||||||
|
{0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
|
||||||
|
0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
|
||||||
|
0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42},
|
||||||
false}};
|
false}};
|
||||||
|
|
||||||
// Testvectors from project wycheproof
|
// Testvectors from project wycheproof
|
||||||
|
|
|
||||||
1940
security/nss/gtests/common/testvectors/kw-vectors.h
Normal file
1940
security/nss/gtests/common/testvectors/kw-vectors.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -13,22 +13,22 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef struct chacha_testvector_str {
|
typedef struct chaChaTestVectorStr {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
std::vector<uint8_t> Data;
|
std::vector<uint8_t> Data;
|
||||||
std::vector<uint8_t> AAD;
|
std::vector<uint8_t> AAD;
|
||||||
std::vector<uint8_t> Key;
|
std::vector<uint8_t> Key;
|
||||||
std::vector<uint8_t> IV;
|
std::vector<uint8_t> IV;
|
||||||
std::vector<uint8_t> CT;
|
std::vector<uint8_t> CT;
|
||||||
bool invalid_tag;
|
bool invalidTag;
|
||||||
bool invalid_iv;
|
bool invalidIV;
|
||||||
} chacha_testvector;
|
} chaChaTestVector;
|
||||||
|
|
||||||
// ChaCha20/Poly1305 Test Vector 1, RFC 7539
|
// ChaCha20/Poly1305 Test Vector 1, RFC 7539
|
||||||
// <http://tools.ietf.org/html/rfc7539#section-2.8.2>
|
// <http://tools.ietf.org/html/rfc7539#section-2.8.2>
|
||||||
// ChaCha20/Poly1305 Test Vector 2, RFC 7539
|
// ChaCha20/Poly1305 Test Vector 2, RFC 7539
|
||||||
// <http://tools.ietf.org/html/rfc7539#appendix-A.5>
|
// <http://tools.ietf.org/html/rfc7539#appendix-A.5>
|
||||||
const chacha_testvector kChaCha20Vectors[] = {
|
const chaChaTestVector kChaCha20Vectors[] = {
|
||||||
{0,
|
{0,
|
||||||
{0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47,
|
{0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x47,
|
||||||
0x65, 0x6e, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
|
0x65, 0x6e, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,21 @@
|
||||||
#define util_h__
|
#define util_h__
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#include <codecvt>
|
||||||
|
#include <direct.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "nspr.h"
|
||||||
|
|
||||||
static inline std::vector<uint8_t> hex_string_to_bytes(std::string s) {
|
static inline std::vector<uint8_t> hex_string_to_bytes(std::string s) {
|
||||||
std::vector<uint8_t> bytes;
|
std::vector<uint8_t> bytes;
|
||||||
|
|
@ -18,4 +32,81 @@ static inline std::vector<uint8_t> hex_string_to_bytes(std::string s) {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given a prefix, attempts to create a unique directory that the user can do
|
||||||
|
// work in without impacting other tests. For example, if given the prefix
|
||||||
|
// "scratch", a directory like "scratch05c17b25" will be created in the current
|
||||||
|
// working directory (or the location specified by NSS_GTEST_WORKDIR, if
|
||||||
|
// defined).
|
||||||
|
// Upon destruction, the implementation will attempt to delete the directory.
|
||||||
|
// However, no attempt is made to first remove files in the directory - the
|
||||||
|
// user is responsible for this. If the directory is not empty, deleting it will
|
||||||
|
// fail.
|
||||||
|
// Statistically, it is technically possible to fail to create a unique
|
||||||
|
// directory name, but this is extremely unlikely given the expected workload of
|
||||||
|
// this implementation.
|
||||||
|
class ScopedUniqueDirectory {
|
||||||
|
public:
|
||||||
|
explicit ScopedUniqueDirectory(const std::string &prefix) {
|
||||||
|
std::string path;
|
||||||
|
const char *workingDirectory = PR_GetEnvSecure("NSS_GTEST_WORKDIR");
|
||||||
|
if (workingDirectory) {
|
||||||
|
path.assign(workingDirectory);
|
||||||
|
}
|
||||||
|
path.append(prefix);
|
||||||
|
for (int i = 0; i < RETRY_LIMIT; i++) {
|
||||||
|
std::string pathCopy(path);
|
||||||
|
// TryMakingDirectory will modify its input. If it fails, we want to throw
|
||||||
|
// away the modified result.
|
||||||
|
if (TryMakingDirectory(pathCopy)) {
|
||||||
|
mPath.assign(pathCopy);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(mPath.length() > 0);
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// sqldb always uses UTF-8 regardless of the current system locale.
|
||||||
|
DWORD len =
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, mPath.data(), mPath.size(), nullptr, 0);
|
||||||
|
std::vector<wchar_t> buf(len, L'\0');
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, mPath.data(), mPath.size(), buf.data(),
|
||||||
|
buf.size());
|
||||||
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||||
|
mUTF8Path = converter.to_bytes(std::wstring(buf.begin(), buf.end()));
|
||||||
|
#else
|
||||||
|
mUTF8Path = mPath;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// NB: the directory must be empty upon destruction
|
||||||
|
~ScopedUniqueDirectory() { assert(rmdir(mPath.c_str()) == 0); }
|
||||||
|
|
||||||
|
const std::string &GetPath() { return mPath; }
|
||||||
|
const std::string &GetUTF8Path() { return mUTF8Path; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int RETRY_LIMIT = 5;
|
||||||
|
|
||||||
|
static void GenerateRandomName(/*in/out*/ std::string &prefix) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << prefix;
|
||||||
|
// RAND_MAX is at least 32767.
|
||||||
|
ss << std::setfill('0') << std::setw(4) << std::hex << rand() << rand();
|
||||||
|
// This will overwrite the value of prefix. This is a little inefficient,
|
||||||
|
// but at least it makes the code simple.
|
||||||
|
ss >> prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool TryMakingDirectory(/*in/out*/ std::string &prefix) {
|
||||||
|
GenerateRandomName(prefix);
|
||||||
|
#if defined(_WIN32)
|
||||||
|
return _mkdir(prefix.c_str()) == 0;
|
||||||
|
#else
|
||||||
|
return mkdir(prefix.c_str(), 0777) == 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string mPath;
|
||||||
|
std::string mUTF8Path;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // util_h__
|
#endif // util_h__
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,35 @@
|
||||||
#include "secerr.h"
|
#include "secerr.h"
|
||||||
#include "secitem.h"
|
#include "secitem.h"
|
||||||
|
|
||||||
const SEC_ASN1Template mySEC_NullTemplate[] = {
|
|
||||||
{SEC_ASN1_NULL, 0, NULL, sizeof(SECItem)}};
|
|
||||||
|
|
||||||
namespace nss_test {
|
namespace nss_test {
|
||||||
|
|
||||||
class QuickDERTest : public ::testing::Test,
|
struct TemplateAndInput {
|
||||||
public ::testing::WithParamInterface<SECItem> {};
|
const SEC_ASN1Template* t;
|
||||||
|
SECItem input;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QuickDERTest : public ::testing::Test,
|
||||||
|
public ::testing::WithParamInterface<TemplateAndInput> {};
|
||||||
|
|
||||||
|
static const uint8_t kBitstringTag = 0x03;
|
||||||
static const uint8_t kNullTag = 0x05;
|
static const uint8_t kNullTag = 0x05;
|
||||||
static const uint8_t kLongLength = 0x80;
|
static const uint8_t kLongLength = 0x80;
|
||||||
|
|
||||||
|
const SEC_ASN1Template kBitstringTemplate[] = {
|
||||||
|
{SEC_ASN1_BIT_STRING, 0, NULL, sizeof(SECItem)}, {0}};
|
||||||
|
|
||||||
|
// Empty bitstring with unused bits.
|
||||||
|
static uint8_t kEmptyBitstringUnused[] = {kBitstringTag, 1, 1};
|
||||||
|
|
||||||
|
// Bitstring with 8 unused bits.
|
||||||
|
static uint8_t kBitstring8Unused[] = {kBitstringTag, 3, 8, 0xff, 0x00};
|
||||||
|
|
||||||
|
// Bitstring with >8 unused bits.
|
||||||
|
static uint8_t kBitstring9Unused[] = {kBitstringTag, 3, 9, 0xff, 0x80};
|
||||||
|
|
||||||
|
const SEC_ASN1Template kNullTemplate[] = {
|
||||||
|
{SEC_ASN1_NULL, 0, NULL, sizeof(SECItem)}, {0}};
|
||||||
|
|
||||||
// Length of zero wrongly encoded as 0x80 instead of 0x00.
|
// Length of zero wrongly encoded as 0x80 instead of 0x00.
|
||||||
static uint8_t kOverlongLength_0_0[] = {kNullTag, kLongLength | 0};
|
static uint8_t kOverlongLength_0_0[] = {kNullTag, kLongLength | 0};
|
||||||
|
|
||||||
|
|
@ -53,14 +71,22 @@ static uint8_t kOverlongLength_16_0[] = {kNullTag, kLongLength | 0x10,
|
||||||
0x00, 0x00,
|
0x00, 0x00,
|
||||||
0x00, 0x00};
|
0x00, 0x00};
|
||||||
|
|
||||||
static const SECItem kInvalidDER[] = {
|
#define TI(t, x) \
|
||||||
{siBuffer, kOverlongLength_0_0, sizeof(kOverlongLength_0_0)},
|
{ \
|
||||||
{siBuffer, kOverlongLength_1_0, sizeof(kOverlongLength_1_0)},
|
t, { siBuffer, x, sizeof(x) } \
|
||||||
{siBuffer, kOverlongLength_16_0, sizeof(kOverlongLength_16_0)},
|
}
|
||||||
|
static const TemplateAndInput kInvalidDER[] = {
|
||||||
|
TI(kBitstringTemplate, kEmptyBitstringUnused),
|
||||||
|
TI(kBitstringTemplate, kBitstring8Unused),
|
||||||
|
TI(kBitstringTemplate, kBitstring9Unused),
|
||||||
|
TI(kNullTemplate, kOverlongLength_0_0),
|
||||||
|
TI(kNullTemplate, kOverlongLength_1_0),
|
||||||
|
TI(kNullTemplate, kOverlongLength_16_0),
|
||||||
};
|
};
|
||||||
|
#undef TI
|
||||||
|
|
||||||
TEST_P(QuickDERTest, InvalidLengths) {
|
TEST_P(QuickDERTest, InvalidLengths) {
|
||||||
const SECItem& original_input(GetParam());
|
const SECItem& original_input(GetParam().input);
|
||||||
|
|
||||||
ScopedSECItem copy_of_input(SECITEM_AllocItem(nullptr, nullptr, 0U));
|
ScopedSECItem copy_of_input(SECITEM_AllocItem(nullptr, nullptr, 0U));
|
||||||
ASSERT_TRUE(copy_of_input);
|
ASSERT_TRUE(copy_of_input);
|
||||||
|
|
@ -69,11 +95,10 @@ TEST_P(QuickDERTest, InvalidLengths) {
|
||||||
|
|
||||||
PORTCheapArenaPool pool;
|
PORTCheapArenaPool pool;
|
||||||
PORT_InitCheapArena(&pool, DER_DEFAULT_CHUNKSIZE);
|
PORT_InitCheapArena(&pool, DER_DEFAULT_CHUNKSIZE);
|
||||||
ScopedSECItem parsed_value(SECITEM_AllocItem(nullptr, nullptr, 0U));
|
StackSECItem parsed_value;
|
||||||
ASSERT_TRUE(parsed_value);
|
|
||||||
ASSERT_EQ(SECFailure,
|
ASSERT_EQ(SECFailure,
|
||||||
SEC_QuickDERDecodeItem(&pool.arena, parsed_value.get(),
|
SEC_QuickDERDecodeItem(&pool.arena, &parsed_value, GetParam().t,
|
||||||
mySEC_NullTemplate, copy_of_input.get()));
|
copy_of_input.get()));
|
||||||
ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError());
|
ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError());
|
||||||
PORT_DestroyCheapArena(&pool);
|
PORT_DestroyCheapArena(&pool);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
187
security/nss/gtests/freebl_gtest/cmac_unittests.cc
Normal file
187
security/nss/gtests/freebl_gtest/cmac_unittests.cc
Normal file
|
|
@ -0,0 +1,187 @@
|
||||||
|
// 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/.
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "blapi.h"
|
||||||
|
#include "secitem.h"
|
||||||
|
#include "freebl_scoped_ptrs.h"
|
||||||
|
|
||||||
|
class CmacAesTest : public ::testing::Test {
|
||||||
|
protected:
|
||||||
|
bool Compare(const uint8_t *actual, const uint8_t *expected,
|
||||||
|
unsigned int length) {
|
||||||
|
return strncmp((const char *)actual, (const char *)expected, length) == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(CmacAesTest, CreateInvalidSize) {
|
||||||
|
uint8_t key[1] = {0x00};
|
||||||
|
ScopedCMACContext ctx(CMAC_Create(CMAC_AES, key, sizeof(key)));
|
||||||
|
ASSERT_EQ(ctx, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CmacAesTest, CreateRightSize) {
|
||||||
|
uint8_t *key = PORT_NewArray(uint8_t, AES_128_KEY_LENGTH);
|
||||||
|
ScopedCMACContext ctx(CMAC_Create(CMAC_AES, key, AES_128_KEY_LENGTH));
|
||||||
|
|
||||||
|
ASSERT_NE(ctx, nullptr);
|
||||||
|
PORT_Free(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following tests were taken from NIST's Cryptographic Standards and
|
||||||
|
// Guidelines page for AES-CMAC Examples with Intermediate Values. These same
|
||||||
|
// test vectors for AES-128 can be found in RFC 4493, Section 4.
|
||||||
|
|
||||||
|
static const uint8_t kNistKeys[][AES_256_KEY_LENGTH] = {
|
||||||
|
{0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15,
|
||||||
|
0x88, 0x09, 0xCF, 0x4F, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52, 0xC8, 0x10, 0xF3,
|
||||||
|
0x2B, 0x80, 0x90, 0x79, 0xE5, 0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C,
|
||||||
|
0x6B, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
|
{0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE, 0x2B, 0x73, 0xAE,
|
||||||
|
0xF0, 0x85, 0x7D, 0x77, 0x81, 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61,
|
||||||
|
0x08, 0xD7, 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4}};
|
||||||
|
static const size_t kNistKeyLengthsCount = PR_ARRAY_SIZE(kNistKeys);
|
||||||
|
static const unsigned int kNistKeyLengths[kNistKeyLengthsCount] = {
|
||||||
|
AES_128_KEY_LENGTH, AES_192_KEY_LENGTH, AES_256_KEY_LENGTH};
|
||||||
|
|
||||||
|
static const uint8_t kNistPlaintext[64] = {
|
||||||
|
0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, 0xE9, 0x3D, 0x7E,
|
||||||
|
0x11, 0x73, 0x93, 0x17, 0x2A, 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03,
|
||||||
|
0xAC, 0x9C, 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51, 0x30,
|
||||||
|
0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11, 0xE5, 0xFB, 0xC1, 0x19,
|
||||||
|
0x1A, 0x0A, 0x52, 0xEF, 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B,
|
||||||
|
0x17, 0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10};
|
||||||
|
static const unsigned int kNistPlaintextLengths[] = {0, 16, 20, 64};
|
||||||
|
static const size_t kNistPlaintextLengthsCount =
|
||||||
|
PR_ARRAY_SIZE(kNistPlaintextLengths);
|
||||||
|
|
||||||
|
// This table contains the result of a CMAC over kNistPlaintext using keys from
|
||||||
|
// kNistKeys. For each key, there are kNistPlaintextLengthsCount answers, all
|
||||||
|
// listed one after the other as the input is truncated to the different sizes
|
||||||
|
// in kNistPlaintextLengths.
|
||||||
|
static const uint8_t kNistKnown[][AES_BLOCK_SIZE] = {
|
||||||
|
{0xBB, 0x1D, 0x69, 0x29, 0xE9, 0x59, 0x37, 0x28, 0x7F, 0xA3, 0x7D, 0x12,
|
||||||
|
0x9B, 0x75, 0x67, 0x46},
|
||||||
|
{0x07, 0x0A, 0x16, 0xB4, 0x6B, 0x4D, 0x41, 0x44, 0xF7, 0x9B, 0xDD, 0x9D,
|
||||||
|
0xD0, 0x4A, 0x28, 0x7C},
|
||||||
|
{0x7D, 0x85, 0x44, 0x9E, 0xA6, 0xEA, 0x19, 0xC8, 0x23, 0xA7, 0xBF, 0x78,
|
||||||
|
0x83, 0x7D, 0xFA, 0xDE},
|
||||||
|
{0x51, 0xF0, 0xBE, 0xBF, 0x7E, 0x3B, 0x9D, 0x92, 0xFC, 0x49, 0x74, 0x17,
|
||||||
|
0x79, 0x36, 0x3C, 0xFE},
|
||||||
|
{0xD1, 0x7D, 0xDF, 0x46, 0xAD, 0xAA, 0xCD, 0xE5, 0x31, 0xCA, 0xC4, 0x83,
|
||||||
|
0xDE, 0x7A, 0x93, 0x67},
|
||||||
|
{0x9E, 0x99, 0xA7, 0xBF, 0x31, 0xE7, 0x10, 0x90, 0x06, 0x62, 0xF6, 0x5E,
|
||||||
|
0x61, 0x7C, 0x51, 0x84},
|
||||||
|
{0x3D, 0x75, 0xC1, 0x94, 0xED, 0x96, 0x07, 0x04, 0x44, 0xA9, 0xFA, 0x7E,
|
||||||
|
0xC7, 0x40, 0xEC, 0xF8},
|
||||||
|
{0xA1, 0xD5, 0xDF, 0x0E, 0xED, 0x79, 0x0F, 0x79, 0x4D, 0x77, 0x58, 0x96,
|
||||||
|
0x59, 0xF3, 0x9A, 0x11},
|
||||||
|
{0x02, 0x89, 0x62, 0xF6, 0x1B, 0x7B, 0xF8, 0x9E, 0xFC, 0x6B, 0x55, 0x1F,
|
||||||
|
0x46, 0x67, 0xD9, 0x83},
|
||||||
|
{0x28, 0xA7, 0x02, 0x3F, 0x45, 0x2E, 0x8F, 0x82, 0xBD, 0x4B, 0xF2, 0x8D,
|
||||||
|
0x8C, 0x37, 0xC3, 0x5C},
|
||||||
|
{0x15, 0x67, 0x27, 0xDC, 0x08, 0x78, 0x94, 0x4A, 0x02, 0x3C, 0x1F, 0xE0,
|
||||||
|
0x3B, 0xAD, 0x6D, 0x93},
|
||||||
|
{0xE1, 0x99, 0x21, 0x90, 0x54, 0x9F, 0x6E, 0xD5, 0x69, 0x6A, 0x2C, 0x05,
|
||||||
|
0x6C, 0x31, 0x54, 0x10}};
|
||||||
|
PR_STATIC_ASSERT(PR_ARRAY_SIZE(kNistKnown) ==
|
||||||
|
kNistKeyLengthsCount * kNistPlaintextLengthsCount);
|
||||||
|
|
||||||
|
TEST_F(CmacAesTest, AesNistAligned) {
|
||||||
|
for (unsigned int key_index = 0; key_index < kNistKeyLengthsCount;
|
||||||
|
key_index++) {
|
||||||
|
ScopedCMACContext ctx(CMAC_Create(CMAC_AES, kNistKeys[key_index],
|
||||||
|
kNistKeyLengths[key_index]));
|
||||||
|
ASSERT_NE(ctx, nullptr);
|
||||||
|
|
||||||
|
for (unsigned int plaintext_index = 0;
|
||||||
|
plaintext_index < kNistPlaintextLengthsCount; plaintext_index++) {
|
||||||
|
CMAC_Begin(ctx.get());
|
||||||
|
|
||||||
|
unsigned int known_index =
|
||||||
|
(key_index * kNistPlaintextLengthsCount) + plaintext_index;
|
||||||
|
CMAC_Update(ctx.get(), kNistPlaintext,
|
||||||
|
kNistPlaintextLengths[plaintext_index]);
|
||||||
|
|
||||||
|
uint8_t output[AES_BLOCK_SIZE];
|
||||||
|
CMAC_Finish(ctx.get(), output, NULL, AES_BLOCK_SIZE);
|
||||||
|
|
||||||
|
ASSERT_TRUE(Compare(output, kNistKnown[known_index], AES_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CmacAesTest, AesNistUnaligned) {
|
||||||
|
for (unsigned int key_index = 0; key_index < kNistKeyLengthsCount;
|
||||||
|
key_index++) {
|
||||||
|
unsigned int key_length = kNistKeyLengths[key_index];
|
||||||
|
ScopedCMACContext ctx(
|
||||||
|
CMAC_Create(CMAC_AES, kNistKeys[key_index], key_length));
|
||||||
|
ASSERT_NE(ctx, nullptr);
|
||||||
|
|
||||||
|
// Skip the zero-length test.
|
||||||
|
for (unsigned int plaintext_index = 1;
|
||||||
|
plaintext_index < kNistPlaintextLengthsCount; plaintext_index++) {
|
||||||
|
unsigned int known_index =
|
||||||
|
(key_index * kNistPlaintextLengthsCount) + plaintext_index;
|
||||||
|
unsigned int plaintext_length = kNistPlaintextLengths[plaintext_index];
|
||||||
|
|
||||||
|
// Test all possible offsets and make sure that misaligned updates
|
||||||
|
// produce the desired result. That is, do two updates:
|
||||||
|
// 0 ... offset
|
||||||
|
// offset ... len - offset
|
||||||
|
// and ensure the result is the same as doing one update.
|
||||||
|
for (unsigned int offset = 1; offset < plaintext_length; offset++) {
|
||||||
|
CMAC_Begin(ctx.get());
|
||||||
|
|
||||||
|
CMAC_Update(ctx.get(), kNistPlaintext, offset);
|
||||||
|
CMAC_Update(ctx.get(), kNistPlaintext + offset,
|
||||||
|
plaintext_length - offset);
|
||||||
|
|
||||||
|
uint8_t output[AES_BLOCK_SIZE];
|
||||||
|
CMAC_Finish(ctx.get(), output, NULL, AES_BLOCK_SIZE);
|
||||||
|
|
||||||
|
ASSERT_TRUE(Compare(output, kNistKnown[known_index], AES_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(CmacAesTest, AesNistTruncated) {
|
||||||
|
for (unsigned int key_index = 0; key_index < kNistKeyLengthsCount;
|
||||||
|
key_index++) {
|
||||||
|
unsigned int key_length = kNistKeyLengths[key_index];
|
||||||
|
ScopedCMACContext ctx(
|
||||||
|
CMAC_Create(CMAC_AES, kNistKeys[key_index], key_length));
|
||||||
|
ASSERT_TRUE(ctx != nullptr);
|
||||||
|
|
||||||
|
// Skip the zero-length test.
|
||||||
|
for (unsigned int plaintext_index = 1;
|
||||||
|
plaintext_index < kNistPlaintextLengthsCount; plaintext_index++) {
|
||||||
|
unsigned int known_index =
|
||||||
|
(key_index * kNistPlaintextLengthsCount) + plaintext_index;
|
||||||
|
unsigned int plaintext_length = kNistPlaintextLengths[plaintext_index];
|
||||||
|
|
||||||
|
// Test truncated outputs to ensure that we always get the desired values.
|
||||||
|
for (unsigned int out_len = 1; out_len < AES_BLOCK_SIZE; out_len++) {
|
||||||
|
CMAC_Begin(ctx.get());
|
||||||
|
|
||||||
|
CMAC_Update(ctx.get(), kNistPlaintext, plaintext_length);
|
||||||
|
|
||||||
|
unsigned int actual_out_len = 0;
|
||||||
|
uint8_t output[AES_BLOCK_SIZE];
|
||||||
|
CMAC_Finish(ctx.get(), output, &actual_out_len, out_len);
|
||||||
|
|
||||||
|
ASSERT_TRUE(actual_out_len == out_len);
|
||||||
|
ASSERT_TRUE(Compare(output, kNistKnown[known_index], out_len));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
'<(DEPTH)/lib/dev/dev.gyp:nssdev',
|
'<(DEPTH)/lib/dev/dev.gyp:nssdev',
|
||||||
'<(DEPTH)/lib/pki/pki.gyp:nsspki',
|
'<(DEPTH)/lib/pki/pki.gyp:nsspki',
|
||||||
'<(DEPTH)/lib/ssl/ssl.gyp:ssl',
|
'<(DEPTH)/lib/ssl/ssl.gyp:ssl',
|
||||||
|
'<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -34,6 +35,7 @@
|
||||||
'ecl_unittest.cc',
|
'ecl_unittest.cc',
|
||||||
'ghash_unittest.cc',
|
'ghash_unittest.cc',
|
||||||
'rsa_unittest.cc',
|
'rsa_unittest.cc',
|
||||||
|
'cmac_unittests.cc',
|
||||||
'<(DEPTH)/gtests/common/gtests.cc'
|
'<(DEPTH)/gtests/common/gtests.cc'
|
||||||
],
|
],
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
|
|
@ -85,7 +87,7 @@
|
||||||
'defines': [
|
'defines': [
|
||||||
'NSS_USE_STATIC_LIBS',
|
'NSS_USE_STATIC_LIBS',
|
||||||
],
|
],
|
||||||
# For test builds we have to set MPI defines.
|
# For static builds we have to set MPI defines.
|
||||||
'conditions': [
|
'conditions': [
|
||||||
[ 'ct_verif==1', {
|
[ 'ct_verif==1', {
|
||||||
'defines': [
|
'defines': [
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,41 @@ TEST_F(MPITest, MpiCmpUnalignedTest) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The two follow tests ensure very similar mp_set_* functions are ok.
|
||||||
|
TEST_F(MPITest, MpiSetUlong) {
|
||||||
|
mp_int a, b, c;
|
||||||
|
MP_DIGITS(&a) = 0;
|
||||||
|
MP_DIGITS(&b) = 0;
|
||||||
|
MP_DIGITS(&c) = 0;
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&a));
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&b));
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&c));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_ulong(&a, 1));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_ulong(&b, 0));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_ulong(&c, -1));
|
||||||
|
|
||||||
|
mp_clear(&a);
|
||||||
|
mp_clear(&b);
|
||||||
|
mp_clear(&c);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(MPITest, MpiSetInt) {
|
||||||
|
mp_int a, b, c;
|
||||||
|
MP_DIGITS(&a) = 0;
|
||||||
|
MP_DIGITS(&b) = 0;
|
||||||
|
MP_DIGITS(&c) = 0;
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&a));
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&b));
|
||||||
|
ASSERT_EQ(MP_OKAY, mp_init(&c));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_int(&a, 1));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_int(&b, 0));
|
||||||
|
EXPECT_EQ(MP_OKAY, mp_set_int(&c, -1));
|
||||||
|
|
||||||
|
mp_clear(&a);
|
||||||
|
mp_clear(&b);
|
||||||
|
mp_clear(&c);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(MPITest, MpiFixlenOctetsZero) {
|
TEST_F(MPITest, MpiFixlenOctetsZero) {
|
||||||
std::vector<uint8_t> zero = {0};
|
std::vector<uint8_t> zero = {0};
|
||||||
TestToFixedOctets(zero, 1);
|
TestToFixedOctets(zero, 1);
|
||||||
|
|
@ -255,4 +290,4 @@ TEST_F(DISABLED_MPITest, MpiCmpConstTest) {
|
||||||
mp_clear(&c);
|
mp_clear(&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // nss_test
|
} // namespace nss_test
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ NSS_SRCDIRS = \
|
||||||
ssl_gtest \
|
ssl_gtest \
|
||||||
$(SYSINIT_GTEST) \
|
$(SYSINIT_GTEST) \
|
||||||
nss_bogo_shim \
|
nss_bogo_shim \
|
||||||
|
pkcs11testmodule \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
'<(DEPTH)/lib/base/base.gyp:nssb',
|
'<(DEPTH)/lib/base/base.gyp:nssb',
|
||||||
'<(DEPTH)/lib/dev/dev.gyp:nssdev',
|
'<(DEPTH)/lib/dev/dev.gyp:nssdev',
|
||||||
'<(DEPTH)/lib/pki/pki.gyp:nsspki',
|
'<(DEPTH)/lib/pki/pki.gyp:nsspki',
|
||||||
|
'<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix',
|
||||||
'<(DEPTH)/lib/mozpkix/mozpkix.gyp:mozpkix',
|
'<(DEPTH)/lib/mozpkix/mozpkix.gyp:mozpkix',
|
||||||
'<(DEPTH)/lib/mozpkix/mozpkix.gyp:mozpkix-testlib',
|
'<(DEPTH)/lib/mozpkix/mozpkix.gyp:mozpkix-testlib',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -152,10 +152,14 @@ private:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||||
|
Time validityBeginning, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
// All of the certificates in this test for which this is called have a
|
||||||
|
// validity period that begins "one day before now".
|
||||||
|
EXPECT_EQ(TimeFromEpochInSeconds(oneDayBeforeNow), validityBeginning);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,10 +305,14 @@ public:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||||
|
Time validityBeginning, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
// All of the certificates in this test for which this is called have a
|
||||||
|
// validity period that begins "one day before now".
|
||||||
|
EXPECT_EQ(TimeFromEpochInSeconds(oneDayBeforeNow), validityBeginning);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,7 +329,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
|
@ -442,10 +450,14 @@ public:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||||
|
Time validityBeginning, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
// All of the certificates in this test for which this is called have a
|
||||||
|
// validity period that begins "one day before now".
|
||||||
|
EXPECT_EQ(TimeFromEpochInSeconds(oneDayBeforeNow), validityBeginning);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -665,10 +677,14 @@ private:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||||
|
Time validityBeginning, Duration,
|
||||||
/*optional*/ const Input*,
|
/*optional*/ const Input*,
|
||||||
/*optional*/ const Input*) override
|
/*optional*/ const Input*) override
|
||||||
{
|
{
|
||||||
|
// All of the certificates in this test for which this is called have a
|
||||||
|
// validity period that begins "one day before now".
|
||||||
|
EXPECT_EQ(TimeFromEpochInSeconds(oneDayBeforeNow), validityBeginning);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -723,7 +739,7 @@ class RevokedEndEntityTrustDomain final : public MultiplePathTrustDomain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Result CheckRevocation(EndEntityOrCA endEntityOrCA, const CertID&, Time,
|
Result CheckRevocation(EndEntityOrCA endEntityOrCA, const CertID&, Time,
|
||||||
Duration, /*optional*/ const Input*,
|
Time, Duration, /*optional*/ const Input*,
|
||||||
/*optional*/ const Input*) override
|
/*optional*/ const Input*) override
|
||||||
{
|
{
|
||||||
if (endEntityOrCA == EndEntityOrCA::MustBeEndEntity) {
|
if (endEntityOrCA == EndEntityOrCA::MustBeEndEntity) {
|
||||||
|
|
@ -828,10 +844,14 @@ private:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||||
|
Time validityBeginning, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
// All of the certificates in this test for which this is called have a
|
||||||
|
// validity period that begins "one day before now".
|
||||||
|
EXPECT_EQ(TimeFromEpochInSeconds(oneDayBeforeNow), validityBeginning);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ private:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
/*optional*/ const Input*, /*optional*/ const Input*)
|
/*optional*/ const Input*, /*optional*/ const Input*)
|
||||||
override
|
override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
return checker.Check(issuerCert, nullptr, keepGoing);
|
return checker.Check(issuerCert, nullptr, keepGoing);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
const Input*, const Input*) override
|
const Input*, const Input*) override
|
||||||
{
|
{
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
||||||
|
|
@ -558,7 +558,7 @@ private:
|
||||||
return checker.Check(derCert, nullptr, keepGoing);
|
return checker.Check(derCert, nullptr, keepGoing);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
const Input*, const Input*) override
|
const Input*, const Input*) override
|
||||||
{
|
{
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
||||||
|
|
@ -166,8 +166,8 @@ void ASSERT_SimpleCase(uint8_t unusedBits, uint8_t bits, KeyUsage usage)
|
||||||
|
|
||||||
// Test that none of the other non-padding bits are mistaken for the given
|
// Test that none of the other non-padding bits are mistaken for the given
|
||||||
// key usage in the single-byte value case.
|
// key usage in the single-byte value case.
|
||||||
NAMED_SIMPLE_KU(notGood, unusedBits,
|
uint8_t paddingBits = (static_cast<uint8_t>(~bits) >> unusedBits) << unusedBits;
|
||||||
static_cast<uint8_t>((~bits >> unusedBits) << unusedBits));
|
NAMED_SIMPLE_KU(notGood, unusedBits, paddingBits);
|
||||||
ASSERT_BAD(CheckKeyUsage(EndEntityOrCA::MustBeEndEntity, ¬Good, usage));
|
ASSERT_BAD(CheckKeyUsage(EndEntityOrCA::MustBeEndEntity, ¬Good, usage));
|
||||||
ASSERT_BAD(CheckKeyUsage(EndEntityOrCA::MustBeCA, ¬Good, usage));
|
ASSERT_BAD(CheckKeyUsage(EndEntityOrCA::MustBeCA, ¬Good, usage));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ public:
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
/*optional*/ const Input*,
|
/*optional*/ const Input*,
|
||||||
/*optional*/ const Input*) override
|
/*optional*/ const Input*) override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,10 @@ TEST_F(pkixder_input_tests, ReadByteWrapAroundPointer)
|
||||||
// a null pointer is undefined behavior according to the C++ language spec.,
|
// a null pointer is undefined behavior according to the C++ language spec.,
|
||||||
// but this should catch the problem on at least some compilers, if not all of
|
// but this should catch the problem on at least some compilers, if not all of
|
||||||
// them.
|
// them.
|
||||||
const uint8_t* der = nullptr;
|
uintptr_t derint = -1;
|
||||||
--der;
|
auto der = reinterpret_cast<const uint8_t*>(derint);
|
||||||
|
ASSERT_EQ(sizeof(der), sizeof(derint))
|
||||||
|
<< "underflow of pointer might not work";
|
||||||
Input buf;
|
Input buf;
|
||||||
ASSERT_EQ(Success, buf.Init(der, 0));
|
ASSERT_EQ(Success, buf.Init(der, 0));
|
||||||
Reader input(buf);
|
Reader input(buf);
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class EverythingFailsByDefaultTrustDomain : public TrustDomain {
|
||||||
Result::FATAL_ERROR_LIBRARY_FAILURE);
|
Result::FATAL_ERROR_LIBRARY_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Duration,
|
Result CheckRevocation(EndEntityOrCA, const CertID&, Time, Time, Duration,
|
||||||
/*optional*/ const Input*,
|
/*optional*/ const Input*,
|
||||||
/*optional*/ const Input*) override {
|
/*optional*/ const Input*) override {
|
||||||
ADD_FAILURE();
|
ADD_FAILURE();
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue