Граф коммитов

68 Коммитов

Автор SHA1 Сообщение Дата
Kagami Sascha Rosylight 6abe98f452 Bug 1769290 - Part 8: Apply mozilla-js-handle-rooted-typedef against dom/canvas,crypto,fetch,gamepad,geolocation,indexedDB,ipc r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148281
2022-06-05 20:54:59 +00:00
Emilio Cobos Álvarez 7352e67df7 Bug 1770885 - Avoid key copy + re-verification in CreateECPublicKey. r=keeler
This avoids the key copy, and should prevent further verification when
using the returned key.

Differential Revision: https://phabricator.services.mozilla.com/D147650
2022-06-02 12:13:43 +00:00
Emilio Cobos Álvarez e69fb37b6c Bug 1770885 - Don't verify the origin-trials public key. r=smaug
This takes half the time of the signature validation process, and we
trust the key we're providing, so we shouldn't need to do this.

Plus, PK11_VerifyWithMechanism verifies the key again
(see bug 1770921).

Differential Revision: https://phabricator.services.mozilla.com/D147171
2022-06-02 09:38:57 +00:00
Emilio Cobos Álvarez 6ea61a050a Bug 1756500 - Implement key verification for origin trials. r=keeler,nkulatova
Somewhat straight-forward. Add a test key so that we can add some tests
for this.

Differential Revision: https://phabricator.services.mozilla.com/D139402
2022-03-08 15:24:16 +00:00
Simon Giesecke 9093e5e1bf Bug 1673424 - Fix includes around JS/StructuredClone.h.
Differential Revision: https://phabricator.services.mozilla.com/D94762

Depends on D93568
2020-11-23 16:06:52 +00:00
Sylvestre Ledru fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila 964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru 5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Simon Giesecke 1cd5c68592 Bug 1652002 - Remove some unnecessary includes from BindingUtils.h. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D83098
2020-07-15 15:34:49 +00:00
R. Martinho Fernandes fb3abbefc6 Bug 1270634 - check usages when generating WebCrypto keys r=keeler,jcj
Differential Revision: https://phabricator.services.mozilla.com/D81146
2020-07-08 16:32:19 +00:00
Razvan Maries d3c3f47e4f Backed out 6 changesets (bug 1286059, bug 1270599, bug 1286250, bug 1286880, bug 1270634, bug 1286878) for multiple perma failures. CLOSED TREE
Backed out changeset 888968797a46 (bug 1270634)
Backed out changeset 73f73d6d927f (bug 1286059)
Backed out changeset de7c4515c92e (bug 1286880)
Backed out changeset a5fe48949cec (bug 1286878)
Backed out changeset 2ae604119d7b (bug 1270599)
Backed out changeset 68692026dcb1 (bug 1286250)
2020-07-06 21:20:23 +03:00
R. Martinho Fernandes 13a3b3527f Bug 1270634 - check usages when generating WebCrypto keys r=keeler,jcj
Differential Revision: https://phabricator.services.mozilla.com/D81146
2020-07-06 16:46:51 +00:00
Simon Giesecke e3c223da3e Bug 1648010 - Fix uses of NS_LITERAL_STRING with C string literals. r=geckoview-reviewers,agi,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80861
2020-07-01 08:34:12 +00:00
J.C. Jones 529346ab71 Bug 1410403 - Use id-ecPublicKey for ECDH key export from WebCrypto r=keeler
id-ecPublicKey is defined as the OID {iso(1) member-body(2) us(840)
ansi-x962(10045) keyType(2) ecPublicKey(1)}, and is the NSS default, so
remove the override code from CryptoKey.cpp that forced it to the legacy
id-ecDH code.

Differential Revision: https://phabricator.services.mozilla.com/D52570

--HG--
extra : moz-landing-system : lando
2019-11-11 21:25:40 +00:00
J.C. Jones 9c614370ec Bug 1564509 - Remove DH from WebCrypto r=kjacobs,bzbarsky,keeler
Bug 1034856 added support for DH algorithms to WebCrypto, however the final
specification did not choose to include them, making Firefox the only browser
with support.

Bug 1539578 added telemetry to show usage, and it is extremely low (not
appearing on the graphs), which could be expected as Firefox is the only
supporting browser.

Since DH is an ongoing maintenance burden -- and overall cryptanalysis of DH
is progressing -- let's remove it.

Notice to unship went to dev-platform on 29 March 2019 with no objections. [0]

[0] https://groups.google.com/d/msg/mozilla.dev.platform/Ut3-eQmUdWg/O9w1et1aBgAJ

Differential Revision: https://phabricator.services.mozilla.com/D50865

--HG--
extra : moz-landing-system : lando
2019-11-11 21:17:47 +00:00
Boris Zbarsky 4b183f77b2 Bug 1350254 part 8. Switch CryptoKey to [Serializable]. r=baku
The spec doesn't say to do this, but I think we should.  See
https://github.com/w3c/webcrypto/issues/222

Differential Revision: https://phabricator.services.mozilla.com/D35722

--HG--
extra : moz-landing-system : lando
2019-06-25 06:48:41 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Jeff Gilbert 5b753da289 Bug 1470325 - s/FooBinding/Foo_Binding/g - r=qdot
MozReview-Commit-ID: JtTcLL5OPF0
2018-06-26 17:05:01 -07:00
David Keeler ad5cec4768 bug 1421084 - part 3/4 - remove nsNSSShutDownObject::shutdown and virtualDestroyNSSReference r=mt,ttaubert
MozReview-Commit-ID: ErL7ZjAGVVC

--HG--
extra : rebase_source : 2869aafaef729f0ad190f957919e8b9c40700477
2018-01-24 14:29:08 -08:00
David Keeler a0e34baf27 bug 1421084 - part 2/4 - remove nsNSSShutDownObject::isAlreadyShutDown() r=mt,ttaubert
MozReview-Commit-ID: DlS16pHE0Ik

--HG--
extra : rebase_source : d7596a3571478adefae4ffa5d446ff5234ba9ed7
2018-01-23 12:22:56 -08:00
David Keeler e8cc0ba1ce bug 1421084 - part 1/4 - remove now-unnecessary nsNSSShutDownPreventionLock r=mt,ttaubert
As of bug 1417680, the NSS shutdown tracking infrastructure is unnecessary (and
does nothing anyway). This series of changesets removes the remaining pieces in
a way that is hopefully easy to confirm is correct.

MozReview-Commit-ID: 8Y5wpsyNlGc

--HG--
extra : rebase_source : ef6b481510d949e404a4ef5615097d66e566c947
2018-01-23 10:37:47 -08:00
Cykesiopka 28a88f8f35 Bug 1329238 - Make public CryptoKey.h methods return UniqueX NSS types instead of raw pointers. r=ttaubert
The std::unique_ptr based UniqueX types provide better safety over managing raw
pointers.

MozReview-Commit-ID: EwwOfs6RHqy

--HG--
extra : rebase_source : 7fbfca837c09b641bfffcba854d46b3f79645c0d
2017-01-25 00:27:39 +08:00
Cykesiopka 6ad50df726 Bug 1325104 - Stop using Scoped.h NSS types in CryptoKey.(cpp|h). r=ttaubert
Scoped.h is deprecated.

MozReview-Commit-ID: HVfrjM2haQf

--HG--
extra : rebase_source : acde1fb5db128db63cdb630d1e3c54175e69a768
2017-01-02 14:02:50 +08:00
Cykesiopka 79f483a3ad Bug 1308890 - Make use of ScopedAutoSECItem in CryptoKey.cpp. r=rbarnes
ScopedAutoSECItem is useful for getting rid of this pattern:
> ScopedSECItem item(SECITEM_AllocItem(nullptr, nullptr, 0));

While this pattern works, ScopedAutoSECItem is slightly superior in that it
doesn't unnecessarily cause a SECItem to be allocated from the heap. Moreover,
this moves us further away from Scoped.h, which is deprecated.

MozReview-Commit-ID: B30MNTHzzTc

--HG--
extra : rebase_source : 8d6dea205fc8800a46104b48c670eff250a4731a
2016-10-14 10:36:54 +08:00
Igor 60cd1e3bb7 Bug 1296180 - Replace more uses of PR_ARRAY_SIZE with mozilla::ArrayLength. r=keeler,mt 2016-09-09 13:17:52 -07:00
Phil Ringnalda 4b1303cc59 Back out 1eb6e4e4060f (bug 1296180) for Windows warning-as-error bustage
CLOSED TREE
2016-09-08 23:30:12 -07:00
Igor d42cc2cb4e Bug 1296180 - Replace more uses of PR_ARRAY_SIZE with mozilla::ArrayLengh. r=mt 2016-09-08 22:35:12 -07:00
Cykesiopka a16f7b0f6a Bug 1296316 - Convert nsNSSShutDownObject::CalledFromType to an enum class. r=mgoodwin
enum classes are in general safer than plain enums, and as such should be
preferred.

MozReview-Commit-ID: 1FK89SNhdk4

--HG--
extra : rebase_source : 764c4855026c02d8c9e33ca33637fec54ea5ca31
2016-08-20 23:00:19 +08:00
Tim Taubert 77edbd02e0 Bug 1289330 - Check for success when calling ToKeyAlgorithm() r=bz 2016-07-28 10:21:23 +02:00
David Keeler 905443cc71 bug 1264771 - randomize key IDs in WebCrypto r=ttaubert
To import private keys, WebCrypto creates a generic PKCS#11 object with a chosen
key ID with PK11_CreateGenericObject and then looks up that object as a
SECKEYPrivateKey using PK11_FindKeyByKeyID. It turns out that this is only safe
to do as long as the ID is unique. If another SECKEYPrivateKey exists that has
the same key ID (realistically this will only happen if an identical key is
imported again), PK11_FindKeyByKeyID may return the other key. Since
SECKEYPrivateKey objects are unique and not meant to be shared, this causes
problems in that when one key is destroyed, the resources backing the other key
are no longer valid, and any cryptographic operations using that key will fail.
The solution is to use random IDs and check for preexisting keys. NSS doesn't
yet expose an elegant API for this, but this patch implements a workaround.

MozReview-Commit-ID: EvYMZxnBxTv

--HG--
extra : rebase_source : 50408e1af9eb3934b51a0f01e02aa4890e57ed03
2016-05-04 12:48:37 -07:00
Tim Taubert b89ffb551c Bug 842818 - Enable structured cloning for CryptoKeys across threads r=baku,keeler 2016-01-20 23:22:41 +01:00
Tim Taubert 21dee167a8 Bug 1257325 - Silence VS2015 compiler warnings in CryptoKey.cpp f=gps r=rbarnes 2016-03-18 11:24:57 +01:00
David Keeler f386d7b91c bug 1234417 - fix a leak in CreateECPublicKey r=rbarnes
Before this patch, CreateECPublicKey would create a SECKEYPublicKey allocated on
a scoped arena. It would then call CryptoKey::PublicKeyValid, which has the
side-effect of importing the key to the internal PKCS#11 slot. When the arena
went out of scope, the memory for the key would be released, but the reference
to the slot wouldn't, causing a leak.

This patch fixes the leak by making the SECKEYPublicKey a ScopedSECKEYPublicKey
(which ensures that the type-specific "destructor" SECKEY_DestroyPublicKey is
called, which releases the reference to the PKCS#11 slot).

--HG--
extra : rebase_source : 10ef3c0e6ade78ab8ec4c95464224ba2e38aa17b
2015-12-21 17:14:41 -08:00
Tim Taubert 7f51dcc335 Bug 1204155 - Check if we're OOM when calling SECKEY_CopyPrivateKey() and SECKEY_CopyPublicKey() r=mt 2015-09-14 11:53:02 +02:00
Tim Taubert 786b045726 Bug 1204155 - Account for OOM in CryptoKey::SetSymKey() r=mt 2015-09-14 11:19:16 +02:00
Tim Taubert 3f5a17ca46 Bug 1188750 - CryptoKey::ReadStructuredClone() needs to ensure NSS is initialized before trying to deserialize a key r=keeler 2015-09-01 11:03:02 +02:00
Tim Taubert 3b0521bff7 Bug 1169890 - Check return values for CryptoBuffer.Assign() calls r=rbarnes 2015-05-30 08:28:45 +02:00
Tim Taubert 9a87f6a0e5 Bug 1050175 - Add raw import/export for EC public keys to the WebCrypto API r=rbarnes,smaug 2015-04-28 09:13:16 +02:00
Tim Taubert 43bc9aed8d Bug 1106087 - Recreate newly generated ECDH private keys with an CKA_EC_POINT attribute to support JWK and PKCS8 export r=rbarnes 2015-04-25 14:53:43 +02:00
Tim Taubert fb46a95e93 Bug 1158927 - Calls to CryptoKey::PrivateKeyToPkcs8() and ::PublicKeyToSpki() should check return values r=rbarnes 2015-04-27 20:47:12 +02:00
Andrew McCreight 9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Boris Zbarsky dc24477d79 Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp.  The
rest of this diff was generated by running the following commands:

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'

  find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 10:13:33 -04:00
Tim Taubert d83330ae57 Bug 1034856 - Follow-up to fix small SECItem leak in PublicKeyToSpki() on a CLOSED TREE r=bustage 2014-10-17 15:14:18 +02:00
Tim Taubert bea4fe0653 Bug 1034856 - Follow-up to fix small SECItem leak in PublicKeyToSpki() on a CLOSED TREE r=bustage 2014-10-17 15:05:59 +02:00
Tim Taubert 1e4378782a Backed out changeset ace6aa02d442 (bug 1034856) 2014-10-17 14:58:33 +02:00
Tim Taubert b0acb565de Bug 1034856 - Follow-up to fix small SECItem leak in PublicKeyToSpki() r=bustage 2014-10-17 13:30:41 +02:00
Tim Taubert 5fa60d8646 Bug 1034856 - Remove CryptoBuffer::ToSECItem() using moz_malloc() r=rbarnes 2014-09-03 09:40:21 -04:00
Tim Taubert 96e8ed9b9a Bug 1034856 - Implement SPKI public key import/export for DH r=rbarnes 2014-08-22 15:32:15 +02:00
Tim Taubert c1d2b2fa82 Bug 1034856 - Implement raw public key import/export for DH r=rbarnes,smaug 2014-08-22 12:02:14 +02:00
Tim Taubert 0f9e65c0e8 Bug 1034856 - Introduce DhKeyAlgorithm r=rbarnes,smaug 2014-07-20 05:51:10 +02:00