Bug 1257405 - Increase auth secret length to 16 octets. r=mt
authorKit Cambridge <kcambridge@mozilla.com>
Wed, 16 Mar 2016 19:53:19 -0700
changeset 289381 5fe5459a786bee7180632dab6e53295646e18dcb
parent 289380 b40d8bae66f1097f3c7cb1833614d9e58e87cd2a
child 289382 f164ff25450e14362813120e1c21937d2f5b1012
push id30102
push userryanvm@gmail.com
push dateSat, 19 Mar 2016 15:23:17 +0000
treeherdermozilla-central@720fb3d55e28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmt
bugs1257405
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1257405 - Increase auth secret length to 16 octets. r=mt MozReview-Commit-ID: 3oiYMgQHckk
dom/push/PushCrypto.jsm
dom/push/test/test_data.html
--- a/dom/push/PushCrypto.jsm
+++ b/dom/push/PushCrypto.jsm
@@ -178,17 +178,17 @@ function generateNonce(base, index) {
     nonce[nonce.byteLength - 1 - i] ^= (index / Math.pow(256, i)) & 0xff;
   }
   return nonce;
 }
 
 this.PushCrypto = {
 
   generateAuthenticationSecret() {
-    return crypto.getRandomValues(new Uint8Array(12));
+    return crypto.getRandomValues(new Uint8Array(16));
   },
 
   generateKeys() {
     return crypto.subtle.generateKey(ECDH_KEY, true, ['deriveBits'])
       .then(cryptoKey =>
          Promise.all([
            crypto.subtle.exportKey('raw', cryptoKey.publicKey),
            crypto.subtle.exportKey('jwk', cryptoKey.privateKey)
--- a/dom/push/test/test_data.html
+++ b/dom/push/test/test_data.html
@@ -98,24 +98,24 @@ http://creativecommons.org/licenses/publ
         "Mismatched Base64-encoded key: " + keyName
       );
     });
   });
 
   add_task(function* comparePublicKey() {
     var data = yield sendRequestToWorker({ type: "publicKey" });
     var p256dhKey = new Uint8Array(pushSubscription.getKey("p256dh"));
-    ok(p256dhKey.length > 0, "Missing key share");
+    is(p256dhKey.length, 65, "Key share should be 65 octets");
     isDeeply(
       p256dhKey,
       new Uint8Array(data.p256dh),
       "Mismatched key share"
     );
     var authSecret = new Uint8Array(pushSubscription.getKey("auth"));
-    ok(authSecret.length > 0, "Missing auth secret");
+    ok(authSecret.length, 16, "Auth secret should be 16 octets");
     isDeeply(
       authSecret,
       new Uint8Array(data.auth),
       "Mismatched auth secret"
     );
   });
 
   var version = 0;