Commit Graph

295 Commits

Author SHA1 Message Date
David Keeler
af0ce9fbd6 bug 1357226 - work around a library inefficiency with EC keys when verifying ECDSA signatures r=fkiefer,jcj
Calling VFY_VerifyDigestDirect causes the provided SECKEYPublicKey to be
reimported to the softoken regardless of if it already exists on it. EC keys
must be verified upon import (to see if the point is on the curve to avoid some
small subgroup attacks), and so repeatedly doing this with a static key (say,
for example, a key corresponding to a built-in certificate transparency log) is
inefficient. This patch alters the certificate transparency implementation to
import these keys each once and then use PK11_Verify for ECDSA signature
verification, which doesn't have the same drawback.

Since this change causes CertVerifier to hold an NSS resource (via its
MultiLogCTVerifier having a list of CTLogVerifier, each of which now has a
SECKEYPublicKey), nsNSSComponent has to make sure it goes away before shutting
down NSS. This patch ensures this happens in nsNSSComponent::ShutdownNSS().

MozReview-Commit-ID: 6VSmz7S53y2

--HG--
extra : rebase_source : 4994db9de80a6c1aec3d7e322ff30d040140ce92
2017-04-11 14:11:28 -07:00
David Keeler
07f34ebd2f bug 1352262 - make OCSP timeout values configurable r=Cykesiopka,jcj
The default OCSP timeout for soft-fail DV is still 2 seconds. This patch makes
it configurable on the interval (0, 5] seconds.

The default OCSP timeout for EV and hard-fail DV is still 10 seconds. This patch
makes it configurable on the interval (0, 20] seconds.

MozReview-Commit-ID: CPd8pwYrJhj

--HG--
extra : rebase_source : 45bd7d06ea013f0a776ea18be9408dedb18271d8
2017-03-31 15:21:40 -07:00
Adam Velebil
69da80395b Bug 1308100 - Replace PL_strlen/PL_strnlen with strlen/strnlen;r=erahm
MozReview-Commit-ID: CGnzomkIsi5
***
Bug 1308100 - Replace PL_strlen/PL_strnlen with strlen/strnlen;r?erahm

--HG--
extra : rebase_source : a14b1538ed91848ecd02fb4607bce4cb9b2ab7c4
2017-04-13 20:47:00 +02:00
David Keeler
47263aefb3 bug 1349762 - handle two GlobalSign EV root transfers r=Cykesiopka,jcj
(adapted from bug 1349762 comment 0)
Google Trust Services (GTS) recently purchased two roots from GlobalSign that
are both enabled for EV treatment: "GlobalSign Root CA - R2" and "GlobalSign ECC
Root CA - R4".

However, GTS does not have an EV audit, so we are going to turn off EV treatment
for both of those root certificates.

But "GlobalSign Root CA - R2" has intermediate cert "GlobalSign Extended
Validation CA - SHA256 - G2" that continues to be controlled by GlobalSign, to
be used to migrate their customers off dependence on that root.

This patch removes EV treatment for "GlobalSign ECC Root CA - R4". It also
removes EV treatment for all chains rooted in "GlobalSign Root CA - R2" unless
the "GlobalSign Extended Validation CA - SHA256 - G2" intermediate is in the
chain.

MozReview-Commit-ID: Ej9L9zTwoPN

--HG--
extra : rebase_source : 575f1a48646cf728d879d0cf53c888654e4a32ad
2017-04-03 17:17:38 -07:00
Cykesiopka
7995951109 Bug 1338897 - Avoid using NSS Base64 functions in PSM. r=keeler
The NSS Base64 functions are less safe and convenient to use than the XPCOM ones.
They're also an unnecessary dependency on NSS.

The NSS Base64 functions behave slightly differently than the XPCOM ones:
1. ATOB_ConvertAsciiToItem() / NSSBase64_DecodeBuffer() silently ignore invalid
   characters like CRLF, space and so on. Base64Decode() will return an error
   if these characters are encountered.
2. BTOA_DataToAscii() will produce output that has CRLF inserted every 64
   characters. Base64Encode() doesn't do this.

For the reasons listed below, no unexpected compatibility issues should arise:
1. AppSignatureVerification.cpp already filters out CRLF and spaces for Manifest
   and Signature values before decoding.
2. ExtendedValidation.cpp is only given what should be valid hard-coded input to
   decode.
3. ContentSignatureVerifier.cpp already splits on CRLF for when it needs to
   decode PEM certs. Spaces shouldn't be likely.
   For Content-Signature header verification, examination of real input to a
   running instance of Firefox suggests CRLF and spaces will not be present in
   the header to decode.
4. nsCryptoHash.cpp encode is affected, but we actually don't want the CRLF
   behaviour.
5. nsDataSignatureVerifier.cpp decode is affected, but we add whitespace
   stripping to maintain backwards compatibility.
6. nsKeygenHandler.cpp encode is affected, but the previous CRLF behaviour was
   arguably a bug, since neither WHATWG or W3C specs specified this.

MozReview-Commit-ID: IWMFxqVZMeX

--HG--
extra : rebase_source : 4863b2e5eabef0555e8e1ebe39216d0d9393f3e9
2017-03-17 23:31:40 +08:00
David Major
ed12ea611f Bug 1346078: Remove nsAString_internal and just use the nsAString name directly. r=bsmedberg
MozReview-Commit-ID: DWDEDMIVKm7

--HG--
extra : rebase_source : 7fe8dc07c816dca234c67761e61cdee372a87e97
2017-03-10 15:17:23 +13:00
Joel Maher
41e6060a92 Bug 1344829 - add BUG_COMPONENT to security/* files. r=keeler
MozReview-Commit-ID: AS6e14FOqsb
2017-03-09 05:33:30 -05:00
Cykesiopka
0aa3a82f68 Bug 1310127 - Part 10: Handle netwerk/protocol/http MOZ_MUST_USE functions in PSM. r=wcpan
The only unhandled call updates nsHTTPListener::mHttpResponseContentType, but
nothing actually uses the value of mHttpResponseContentType.

MozReview-Commit-ID: FQXESvoO2ZN

--HG--
extra : rebase_source : 547158311de136054acff2539ea6a8bdbfb8227b
2016-12-28 16:25:22 +08:00
David Keeler
8fa9a9c682 bug 1294580 - prevent end-entity certificates from being their own trust anchors r=Cykesiopka
MozReview-Commit-ID: KaZaFG8AWwl

--HG--
extra : rebase_source : 8cba6d29febc73e65ff54bc754ab9d016e140d6f
2017-02-24 12:32:41 -08:00
Cykesiopka
90e8bc1b28 Bug 1026589 - Enable more GCC/Clang compiler warnings (-Wextra) for security/certverifier. r=keeler
Original patch by Camilo Viecco.

MozReview-Commit-ID: 4LWpueoyQHL

--HG--
extra : rebase_source : 85563711287ad851019c4031d97c1d309f066139
2017-02-23 23:19:55 +08:00
David Keeler
fca1830f46 bug 1341905 - double-check that uses of CERT_LIST_* are safe in PSM r=jcj
MozReview-Commit-ID: BhGHd9xUUbP

--HG--
extra : amend_source : b7f8260719a3d918867a8ed7cf092e2909193bb5
2017-02-22 15:07:05 -08:00
Jeff Walden
d5deea2a4f Bug 1338374 - Make Vector not use AlignedStorage for its inline element storage. r=froydnj, r=keeler
--HG--
extra : rebase_source : 81eb5278404b4843ed5a59819f6000f74200aa41
2017-01-30 15:56:05 -08:00
Kai Engert
fb7e5cbb5d Bug 1324096, PSM should check the roots module for a flag, that allows to distinguish between Mozilla-CA-Policy CAs and other CAs, r=dkeeler 2017-02-22 18:02:48 +01:00
Jonathan Hao
4489e44dc2 Bug 1323644 - Isolate the HSTS and HPKP storage by first party domain (PSM) r=Cykesiopka,keeler
MozReview-Commit-ID: HhFFqtpBNjO

--HG--
extra : rebase_source : 980dfd035efc4886a7ca393923c2c2783cc76a7d
2017-02-14 10:29:10 +08:00
Wes Kocher
8c4ce17711 Merge inbound to m-c a=merge
MozReview-Commit-ID: DCUf7VEDrTt
2017-02-17 13:38:51 -08:00
Vedant Sareen
7d4bd52fae Bug 1330907 - Rename Telemetry::ID to Telemetry::HistogramID. r=dexter
Changed |print("enum ID : uint32_t {", file=output)| to |print("enum HistogramID : uint32_t {", file=output)| at line 53 of the file |toolkit/components/telemetry/gen-histogram-enum.py|, and then replaced all the textual occurrences of |Telemetry::ID| to |Telemetry::HistogramID| and |ID| to |HistogramID| in 43 other files.
2017-02-16 00:45:15 +05:30
David Major
fff91cf0bf Bug 1335632 - Split out the const and mutable parts of myTrustedEVInfos. r=keeler
.rdata:    5536 bytes change
 .data:   -5760 bytes change

--HG--
extra : rebase_source : 2aa718f0744760cab5f5146d73139dace24a3225
2017-02-17 15:31:05 +13:00
David Keeler
2950b86660 bug 1339010 - ensure pinning and CT telemetry info has been initialized r=jcj
MozReview-Commit-ID: F7pOqCK145n

--HG--
extra : rebase_source : 7138aca9769f6719e35073f16b835159c7929684
2017-02-13 16:47:43 -08:00
Tom Tromey
5f8f360823 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs

--HG--
extra : rebase_source : 2f1f0aa12493c44f352d9a7e8683e7bb72d2d75b
2016-12-15 20:16:31 -07:00
Tom Tromey
f8ab4ddf02 Bug 1060419 - remove unneeded includes of prprf.h, r=froydnj
MozReview-Commit-ID: JifhpA3oOeH

--HG--
extra : rebase_source : 08460997dc3fd91f3065c718e17b41bb4acf8bae
2016-12-09 10:00:01 -10:00
David Major
66f98480ef Bug 1335294: Remove const from data tables under security/ for better codegen on Windows. r=keeler
MozReview-Commit-ID: 3k1Gpm0ugY2
2017-02-13 09:41:20 +13:00
David Keeler
31150dd09f bug 1335904 - disable EV treatment for TurkTrust H6 root certificate r=jcj
MozReview-Commit-ID: FzQsKAuuVcX

--HG--
extra : rebase_source : 424699fa3a680939ee047037b4f37fc48af1b680
2017-02-02 14:37:49 -08:00
David Keeler
9f9d96b6c8 bug 1307984 - enable "LuxTrust Global Root 2" for EV r=jcj
MozReview-Commit-ID: FVFHvydyb39

--HG--
extra : rebase_source : 4f12a04548b40bfac46bf97061108f5e1a978e74
2017-01-31 15:55:02 -08:00
Phil Ringnalda
0efec638f3 Merge m-c to a CLOSED TREE autoland 2017-02-01 20:42:06 -08:00
Phil Ringnalda
d20e4431d0 Backed out changeset b03c9f4ac1b0 (bug 1335294) for Windows PGO bustage
CLOSED TREE
2017-02-01 19:17:21 -08:00
David Major
369d1056a8 Bug 1335294: Add constexpr to data tables under security/ for better codegen on Windows. r=keeler
MozReview-Commit-ID: 3OMBGfLKP9I

--HG--
extra : rebase_source : 9422b385ce03ddef674167df41665224e4f9b6f3
2017-02-01 14:59:57 +13:00
Sergei Chernov
b3b80907d0 Bug 1320566 - Certificate Transparency - implement CT Policy. r=Dolske,keeler
MozReview-Commit-ID: LcMdKcgBStG

--HG--
extra : rebase_source : 38b2531e9abb8a84d32c437d13fab881f2c49f18
2017-01-09 08:22:28 +02:00
David Keeler
04becd07e6 bug 1303383 - enable 5 Amazon root CAs for EV r=jcj
MozReview-Commit-ID: JRs7CWwafSK

--HG--
extra : rebase_source : 710439bbd2814b8eddd04149172495adf0408131
2017-01-31 16:05:35 -08:00
Cykesiopka
df8dcae128 Bug 1330365 - Use mozilla::TimeStamp instead of NSPR's PRIntervalTime for OCSP timeout code. r=keeler
mozilla::TimeStamp is generally superior to PRIntervalTime, and switching lets
us get rid of yet another NSPR dependency.

This patch also:
 1. Gets rid of code in nsNSSHttpRequestSession::createFcn() that limits the
    max OCSP timeout. This is a relic from when NSS was used for OCSP requests,
    and is no longer necessary.
 2. Converts all uses of PR_NOT_REACHED() to MFBT asserts while we're nearby.

MozReview-Commit-ID: KvgOWWhP8Km

--HG--
extra : rebase_source : ea832a1acc4423cf6cfc98862af6b1c29a83ce56
2017-01-14 13:12:43 +08:00
Andrea Marchesini
359ae91eac Bug 1328653 - Merging all the various *OriginAttributes to just one, r=huseby 2017-01-12 17:38:48 +01:00
David Keeler
472b6a4be3 bug 1330043 - disable SHA-1 in signatures on certificates issued by publicly-trusted roots r=jcj
Unfortunately, this doesn't cover delegated OCSP responder certificates. While
gathering telemetry on the use of SHA-1, we encountered bug 1183822 (basically,
that the method of gathering telemetry was causing OCSP verification failures
due to delegated responders signed with SHA-1). As a temporary solution, we
changed the verifier to always allow SHA-1 for OCSP certificates when verifying
an OCSP response. Consequently, we now have no idea what the compatibility
impact of disabling SHA-1 in OCSP responder certificates will be, so it's
probably not a good idea to do that right now.

Even if someone does manage to forge an OCSP responder certificate using a SHA-1
collision, they will have about as much power as an active network attacker
blocking OCSP requests or injecting bad stapled OCSP responses, so this isn't a
disaster.

MozReview-Commit-ID: 10r23W1APiR

--HG--
extra : rebase_source : dc003c4812677c40882506b1b6b1e1f68d7e6e92
2017-01-10 14:48:30 -08:00
Cykesiopka
56c6899d8e Bug 1325107 - Stop using PR_ASSERT() in PSM. r=mgoodwin
PR_ASSERT() is an unnecessary dependency on NSPR.
We can use MOZ_ASSERT() instead, which accomplishes the same task but doesn't
depend on NSPR.

MozReview-Commit-ID: 9gyWUkv3KxQ

--HG--
extra : rebase_source : 313ce6c8de3db3ce72635e37f09d28316ae02c51
2017-01-02 14:11:30 +08:00
David Keeler
d339ca2730 bug 1312827 - make the certificate blocklist only apply to TLS server certificates r=jcj,mgoodwin
(Note that content signature verification does not use the unified certificate
verifier and thus will still consult OneCRL.)

MozReview-Commit-ID: 6KvHOngpabT

--HG--
extra : rebase_source : 601f4d8d1c66befb77d0c07a2d84f3f04416f996
2016-12-22 16:57:20 -08:00
David Keeler
0e8a35a56d Backed out changeset 68d6f69e0837 (bug 1301407) for not being necessary any longer r=dragana
MozReview-Commit-ID: EcoJ3BEpRlQ

--HG--
extra : histedit_source : 98c0f5cf8f3f00afc581b746aca93e16c5997795
2016-12-21 16:22:04 -08:00
Cykesiopka
e8b35af2ec Bug 1313715 - Avoid unnecessary uses of PR_SetError() under security/apps/ and security/certverifier/. r=keeler
The PR_SetError() + PR_GetError() pattern is error prone and unnecessary.

Also fixes Bug 1254403.

MozReview-Commit-ID: DRI69xY4vxC

--HG--
extra : rebase_source : aa07c0dfb5cc2a203e772b415b7a75b27d9bad3c
2016-12-14 20:10:25 +08:00
Wes Kocher
d360bdebf5 Merge inbound to central, a=merge 2016-12-01 15:31:47 -08:00
Sergei Chernov
19e9f4d7ed Bug 1317951, part 2 - Certificate Transparency - basic support for disqualified logs. r=keeler
MozReview-Commit-ID: 4y2JYFnO9Xm

--HG--
extra : rebase_source : 3d6dbfa4d0a6a24dbd8907f42071943895ba068a
2016-11-29 22:51:46 +02:00
Sergei Chernov
08a30eac51 Bug 1317951, part 1 - Certificate Transparency - extracted verification related fields from SCT to a separate struct. r=keeler
MozReview-Commit-ID: 3iHUdZrzyXB

--HG--
extra : rebase_source : d5590733c87c3a8a525eb29dabfdb9be2822a0a6
2016-11-23 15:37:31 +02:00
Ms2ger
b4ff4ad7ea Bug 1319831 - Clarify some code with explicit casts; r=Waldo 2016-12-01 09:23:21 +01:00
Ms2ger
53af63d8fa Bug 1319831 - Remove an unbalanced pragma from Vector.h; r=Waldo 2016-12-01 09:23:21 +01:00
Jonathan Hao
6fe3399188 Bug 1315143 - Disable warnings caused by including BasePrincipal.h r=Cykesiopka,keeler
--HG--
extra : rebase_source : 79e9d80eada5e4c0450852da4d0bbc42e5e9f1bf
2016-11-23 14:56:20 +08:00
Jonathan Hao
88a5aac5aa Bug 1315143 - Make OCSP use Origin Attribute framework (PSM). r=Cykesiopka,keeler
--HG--
extra : rebase_source : 6ee53f5f4ce6a0cc842eb27c6890bdfde9563237
2016-11-14 18:26:15 +08:00
Carsten "Tomcat" Book
e7ca75286b Merge mozilla-central to inbound 2016-11-16 14:53:15 +01:00
Sergei Chernov
fd387b2ec7 Bug 1308787 - Certificate Transparency - script for generating the static list of known logs. r=Cykesiopka,keeler
MozReview-Commit-ID: 9z7Ac5OQqOP

--HG--
extra : rebase_source : 99db3caf90f0cb109727787a24dd80022d9bb25e
2016-11-08 13:54:39 +02:00
Carsten "Tomcat" Book
788a6efc4c Backed out changeset 81a11a25d25d (bug 1315143) 2016-11-14 12:52:16 +01:00
Jonathan Hao
06ffb1f775 Bug 1315143 - Make OCSP use Origin Attribute framework (PSM). r=mayhemer
--HG--
extra : rebase_source : 5047ebd0245729109635ba5ad99dc3f6a18b57ae
2016-11-14 18:26:15 +08:00
David Keeler
8c2f5cbb94 bug 1301407 - add annotated crashes to find out why PSM initialization is failing r=dragana
Crash reports indicate LoadExtendedValidationInfo is failing. This adds
annotated crashes that should point us at exactly what is failing. (Note that
because Nightly builds aren't built with DEBUG defined, the majority of
LoadExtendedValidationInfo isn't even run, so we can ignore that code.)

--HG--
extra : amend_source : 0940efc65bb706b572f0699ab5c66b82d6591d30
2016-11-14 12:44:53 -08:00
Jonathan Hao
736db2051a Bug 1312794 - Annotate OCSP requests by first party domain. (adapted from Tor Browser patch #13670) r=keeler
--HG--
extra : rebase_source : 1ba4d78756f9170c1ba05738dda06b9ad00a3231
2016-11-03 17:53:52 +08:00
Jan de Mooij
31df59e394 Bug 1311996 - Fix code using pkix::Result to not conflict with the new mozilla::Result type. r=keeler 2016-10-31 10:05:13 +01:00
David Keeler
544761d217 bug 1309707 - revoke StartCom and WoSign certificates issued after 21 October 2016 r=Cykesiopka,jcj
MozReview-Commit-ID: 1itMZuWY9HO

--HG--
extra : rebase_source : 5e46c04d959ab1b6e7c961e0b5d4fff7ad6417bc
2016-10-12 17:02:33 -07:00