Commit Graph

128 Commits

Author SHA1 Message Date
David Keeler
afc3e83edd 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).
2015-12-21 17:14:41 -08:00
Lars T Hansen
24ab5fa8d9 Bug 1176214 - Part 11: Changes to DOM, except for WebGL. r=bz, r=clb 2015-11-25 19:04:50 +01:00
Nathan Froyd
e4e2da55c9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi
2015-10-18 01:24:48 -04:00
Tim Taubert
a531eb1fef Bug 1214597 - Ensure that we check the actual result of calling crypto.subtle.verify() in tests r=mt 2015-10-14 13:40:14 +02:00
Tim Taubert
6cded789af Bug 1213203 - AsymmetricSignVerifyTask::DoCrypto() creates unused SGNContext r=mt 2015-10-09 10:56:55 +02:00
Tim Taubert
afd3f454ab Bug 1001691 - Make GenerateAsymmetricKeyTask::mKeyPair a UniquePtr so that we can explicitly release it on the main thread r=mt 2015-09-21 14:52:40 +02:00
Tim Taubert
f09260f927 Bug 1001691 - Use thread pool for WebCrypto operations r=bz 2015-09-11 23:41:58 +02:00
Tim Taubert
5612c000e9 Bug 1001691 - Implement WebCrypto thread pool r=bz 2015-09-11 16:01:20 +02:00
Tim Taubert
ffcee2cec3 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
f6a52df96e Bug 1204155 - Account for OOM in CryptoKey::SetSymKey() r=mt 2015-09-14 11:19:16 +02:00
Tim Taubert
1c2b50c0da Bug 1188750 - Add test to ensure NSS is initialized before the WebCrypto API tries to deserialize a key f=keeler r=khuey 2015-09-01 11:03:27 +02:00
Tim Taubert
08f7ba9712 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
Nicholas Nethercote
69d088e45f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.
2015-08-27 20:44:53 -07:00
Martin Thomson
35c3c246af Bug 1172785 - RTCCertificate implementation, r=rbarnes 2015-07-06 10:40:04 -07:00
Tim Taubert
1d2ff9bb72 Bug 1169890 - Check return values for CryptoBuffer.Assign() calls r=rbarnes 2015-05-30 08:28:45 +02:00
Birunthan Mohanathas
f7fa42cc65 Bug 968520 - Add mozilla::fallible to FallibleTArray::AppendElements calls. r=froydnj 2015-05-28 11:07:43 -07:00
Birunthan Mohanathas
bb87a082bc Bug 968520 - Use FallibleTArray::TruncateLength instead of SetLength where possible. r=froydnj
This preemptively fixes the upcoming -Wunused-result warnings due to unchecked
SetLength calls.
2015-05-28 11:07:43 -07:00
Birunthan Mohanathas
0b0cbe2b3d Bug 968520 - Use FallibleTArray::Clear instead of SetLength(0). r=froydnj
This preemptively fixes the upcoming -Wunused-result warnings due to unchecked
SetLength calls.
2015-05-28 11:07:43 -07:00
Tim Taubert
1eed55a230 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
Birunthan Mohanathas
8ff6132e53 Bug 1164714 - Flatten security/manager/ssl/src/ directory. r=keeler 2015-05-26 10:31:23 -07:00
Tim Taubert
b5f9ed75b6 Bug 1106087 - Add test to ensure we can export newly generated ECDH private keys r=rbarnes 2015-04-24 16:07:56 +02:00
Tim Taubert
a339ca0ee1 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
1d0cc9fe38 Bug 1158927 - Calls to CryptoKey::PrivateKeyToPkcs8() and ::PublicKeyToSpki() should check return values r=rbarnes 2015-04-27 20:47:12 +02:00
Tim Taubert
e9701ff615 Bug 1133747 - Fix intermittent test_WebCrypto_Reject_Generating_Keys_Without_Usages.html failures by requesting a longer timeout r=rbarnes 2015-05-22 01:56:18 -04:00
Tim Taubert
721725b70a Bug 1074139 - Bump test timeout to fix intermittent test_WebCrypto_RSA_OAEP.html timeouts r=rbarnes 2015-04-27 10:02:12 +02:00
Tim Taubert
e373c26ec2 Bug 1158886 - Correct public key argument names for CryptoKey::PublicKeyToSpki() and ::PublicKeyToJwk() r=rbarnes 2015-04-27 18:48:36 +02:00
Andrea Marchesini
99834b34bd Bug 1167423 - patch 6 - Handle return values of FallibleTArray functions in WebCryptTask, r=smaug 2015-05-25 12:50:15 +01:00
Tim Taubert
cda4dcc1ef Bug 1166031 - Use 1024-bit prime for WebCrypto's DH tests. r=mt 2015-05-20 19:51:00 -04:00
Birunthan Mohanathas
5868055033 Bug 968520 - Add mozilla::fallible to Fallible{Auto,}TArray::ReplaceElementsAt calls. r=froydnj 2015-05-18 13:50:35 -07:00
Birunthan Mohanathas
63dbcb194c Bug 968520 - Add mozilla::fallible to Fallible{Auto,}TArray::SetLength calls. r=froydnj 2015-05-18 13:50:35 -07:00
Andrew McCreight
c979f253c0 Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Tim Taubert
ea175eef5b Bug 1157454 - Satisfy TSan by removing the unneeded mEarlyRv read in WebCryptoTask::CalculateResult() r=rbarnes 2015-04-24 12:05:32 +02:00
Martin Thomson
062ace4d96 Bug 1158296 - Allow ECDSA key export in WebCrypto, r=rbarnes 2015-04-24 12:56:46 -07:00
Mark Banner
5e806d2c2e Bug 1147940 - Remove the dom.webcrypto.enabled pref as it is no longer necessary. r=smaug,r=rbarnes 2015-04-08 19:23:05 +01:00
Andrea Marchesini
94545cbb2e Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari
5cccea6f0f Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Boris Zbarsky
988b8e01be 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
e2b840f84b Bug 1142681 - Let CreateECParamsForCurve() assert a non-null arena parameter r=keeler 2015-03-13 22:10:23 +01:00
Tim Taubert
8c16654e0c Bug 1085369 - Move other long-running tests to separate test files r=keeler 2015-01-06 12:03:22 +01:00
Tim Taubert
6ac8dd78eb Bug 1085369 - Move key wrapping/unwrapping tests to their own test file r=rbarnes 2014-10-20 18:08:51 +02:00
Ehsan Akhgari
37c07444a0 Bug 1118803 - Mark virtual overridden functions as MOZ_OVERRIDE in misc DOM code; r=baku 2015-01-08 08:49:54 -05:00
Guilherme Goncalves
cea820f6e0 Bug 1088042 - Fix JsonWebKey object in test_WebCrypto_JWK. r=rbarnes 2014-10-23 09:07:00 +02:00
Tim Taubert
7eb53b6610 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
883a015642 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
9dfd70643f Backed out changeset ace6aa02d442 (bug 1034856) 2014-10-17 14:58:33 +02:00
Tim Taubert
ce0dde6f9e Bug 1034856 - Follow-up to fix small SECItem leak in PublicKeyToSpki() r=bustage 2014-10-17 13:30:41 +02:00
Tim Taubert
581f79e331 Bug 1034856 - Remove CryptoBuffer::ToSECItem() using moz_malloc() r=rbarnes 2014-09-03 09:40:21 -04:00
Tim Taubert
12bd968f93 Bug 1034856 - Implement SPKI public key import/export for DH r=rbarnes 2014-08-22 15:32:15 +02:00
Tim Taubert
a74eacbbbb Bug 1034856 - Implement raw public key import/export for DH r=rbarnes,smaug 2014-08-22 12:02:14 +02:00
Tim Taubert
8089b9999e Bug 1034856 - Implement deriveBits() for DH r=rbarnes,smaug 2014-08-21 17:51:51 +02:00