Skip to content

Commit

Permalink
Bug 1330138 - Divide U2F and WebAuthn into separate directories; r=jcj
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: FCCSL6XWhTf


--HG--
rename : dom/u2f/NSSU2FTokenRemote.cpp => dom/webauthn/NSSU2FTokenRemote.cpp
rename : dom/u2f/NSSU2FTokenRemote.h => dom/webauthn/NSSU2FTokenRemote.h
rename : dom/u2f/ScopedCredential.cpp => dom/webauthn/ScopedCredential.cpp
rename : dom/u2f/ScopedCredential.h => dom/webauthn/ScopedCredential.h
rename : dom/u2f/ScopedCredentialInfo.cpp => dom/webauthn/ScopedCredentialInfo.cpp
rename : dom/u2f/ScopedCredentialInfo.h => dom/webauthn/ScopedCredentialInfo.h
rename : dom/u2f/WebAuthnAssertion.cpp => dom/webauthn/WebAuthnAssertion.cpp
rename : dom/u2f/WebAuthnAssertion.h => dom/webauthn/WebAuthnAssertion.h
rename : dom/u2f/WebAuthnAttestation.cpp => dom/webauthn/WebAuthnAttestation.cpp
rename : dom/u2f/WebAuthnAttestation.h => dom/webauthn/WebAuthnAttestation.h
rename : dom/u2f/tests/test_webauthn_get_assertion.html => dom/webauthn/tests/test_webauthn_get_assertion.html
rename : dom/u2f/tests/test_webauthn_loopback.html => dom/webauthn/tests/test_webauthn_loopback.html
rename : dom/u2f/tests/test_webauthn_make_credential.html => dom/webauthn/tests/test_webauthn_make_credential.html
rename : dom/u2f/tests/test_webauthn_no_token.html => dom/webauthn/tests/test_webauthn_no_token.html
rename : dom/u2f/tests/test_webauthn_sameorigin.html => dom/webauthn/tests/test_webauthn_sameorigin.html
  • Loading branch information
qdot committed Jan 19, 2017
1 parent 4fca259 commit 14bcecc
Show file tree
Hide file tree
Showing 31 changed files with 16,475 additions and 42 deletions.
1 change: 1 addition & 0 deletions dom/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ DIRS += [
'promise',
'smil',
'url',
'webauthn',
'webidl',
'xbl',
'xml',
Expand Down
18 changes: 9 additions & 9 deletions dom/u2f/U2F.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(U2F)

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(U2F, mParent)

static mozilla::LazyLogModule gWebauthLog("webauth_u2f");
static mozilla::LazyLogModule gU2FLog("u2f");

static nsresult
AssembleClientData(const nsAString& aOrigin, const nsAString& aTyp,
Expand Down Expand Up @@ -81,7 +81,7 @@ U2FStatus::WaitGroupAdd()
ReentrantMonitorAutoEnter mon(mReentrantMonitor);

mCount += 1;
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("U2FStatus::WaitGroupAdd, now %d", mCount));
}

Expand All @@ -92,7 +92,7 @@ U2FStatus::WaitGroupDone()

MOZ_ASSERT(mCount > 0);
mCount -= 1;
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("U2FStatus::WaitGroupDone, now %d", mCount));
if (mCount == 0) {
mReentrantMonitor.NotifyAll();
Expand All @@ -103,15 +103,15 @@ void
U2FStatus::WaitGroupWait()
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("U2FStatus::WaitGroupWait, now %d", mCount));

while (mCount > 0) {
mReentrantMonitor.Wait();
}

MOZ_ASSERT(mCount == 0);
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("U2FStatus::Wait completed, now count=%d stopped=%d", mCount,
mIsStopped));
}
Expand Down Expand Up @@ -627,7 +627,7 @@ U2FRegisterRunnable::Run()
U2FPrepPromise::All(AbstractThread::MainThread(), prepPromiseList)
->Then(AbstractThread::MainThread(), __func__,
[status] (const nsTArray<Authenticator>& aTokens) {
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("ALL: None of the RegisteredKeys were recognized. n=%d",
aTokens.Length()));

Expand Down Expand Up @@ -784,7 +784,7 @@ U2FSignRunnable::U2FSignRunnable(const nsAString& aOrigin,
nsresult rv = AssembleClientData(aOrigin, kGetAssertion, aChallenge,
mClientData);
if (NS_WARN_IF(NS_FAILED(rv))) {
MOZ_LOG(gWebauthLog, LogLevel::Warning,
MOZ_LOG(gU2FLog, LogLevel::Warning,
("Failed to AssembleClientData for the U2FSignRunnable."));
return;
}
Expand Down Expand Up @@ -976,15 +976,15 @@ U2F::Init(nsPIDOMWindowInner* aParent, ErrorResult& aRv)
}

if (!EnsureNSSInitializedChromeOrContent()) {
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("Failed to get NSS context for U2F"));
aRv.Throw(NS_ERROR_FAILURE);
return;
}

// This only functions in e10s mode
if (XRE_IsParentProcess()) {
MOZ_LOG(gWebauthLog, LogLevel::Debug,
MOZ_LOG(gU2FLog, LogLevel::Debug,
("Is non-e10s Process, U2F not available"));
aRv.Throw(NS_ERROR_FAILURE);
return;
Expand Down
13 changes: 0 additions & 13 deletions dom/u2f/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

EXPORTS.mozilla.dom += [
'NSSU2FTokenRemote.h',
'ScopedCredential.h',
'ScopedCredentialInfo.h',
'U2F.h',
'U2FAuthenticator.h',
'USBToken.h',
'WebAuthentication.h',
'WebAuthnAssertion.h',
'WebAuthnAttestation.h',
'WebAuthnRequest.h',
]

UNIFIED_SOURCES += [
'NSSU2FTokenRemote.cpp',
'ScopedCredential.cpp',
'ScopedCredentialInfo.cpp',
'U2F.cpp',
'USBToken.cpp',
'WebAuthentication.cpp',
'WebAuthnAssertion.cpp',
'WebAuthnAttestation.cpp',
]

include('/ipc/chromium/chromium-config.mozbuild')
Expand Down
15 changes: 0 additions & 15 deletions dom/u2f/tests/mochitest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,3 @@ skip-if = !e10s
skip-if = !e10s
[test_appid_facet_subdomain.html]
skip-if = !e10s
[test_webauthn_loopback.html]
skip-if = !e10s
scheme = https
[test_webauthn_no_token.html]
skip-if = !e10s
scheme = https
[test_webauthn_make_credential.html]
skip-if = !e10s
scheme = https
[test_webauthn_get_assertion.html]
skip-if = !e10s
scheme = https
[test_webauthn_sameorigin.html]
skip-if = !e10s
scheme = https
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
#include "pkix/Input.h"
#include "pkixutil.h"

#define PREF_U2F_SOFTTOKEN_ENABLED "security.webauth.u2f_enable_softtoken"
#define PREF_U2F_USBTOKEN_ENABLED "security.webauth.u2f_enable_usbtoken"

namespace mozilla {
namespace dom {

extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp
static mozilla::LazyLogModule gWebauthLog("webauthn");

// Only needed for refcounted objects.
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebAuthentication, mParent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef mozilla_dom_WebAuthentication_h
#define mozilla_dom_WebAuthentication_h

#include "hasht.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/BindingDeclarations.h"
Expand All @@ -18,6 +19,7 @@
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/SharedThreadPool.h"
#include "nsCycleCollectionParticipant.h"
#include "nsNetCID.h"
#include "nsWrapperCache.h"

#include "U2FAuthenticator.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions dom/u2f/WebAuthnRequest.h → dom/webauthn/WebAuthnRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace mozilla {
namespace dom {

extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp
//extern mozilla::LazyLogModule gWebauthLog; // defined in U2F.cpp

// WebAuthnRequest tracks the completion of a single WebAuthn request that
// may run on multiple kinds of authenticators, and be subject to a deadline.
Expand All @@ -32,9 +32,9 @@ class WebAuthnRequest {

void AddActiveToken(const char* aCallSite)
{
MOZ_LOG(gWebauthLog, LogLevel::Debug,
("WebAuthnRequest is tracking a new token, called from [%s]",
aCallSite));
// MOZ_LOG(gWebauthLog, LogLevel::Debug,
// ("WebAuthnRequest is tracking a new token, called from [%s]",
// aCallSite));
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
MOZ_ASSERT(!IsComplete());
mCountTokens += 1;
Expand Down
38 changes: 38 additions & 0 deletions dom/webauthn/moz.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

EXPORTS.mozilla.dom += [
'NSSU2FTokenRemote.h',
'ScopedCredential.h',
'ScopedCredentialInfo.h',
'WebAuthentication.h',
'WebAuthnAssertion.h',
'WebAuthnAttestation.h',
'WebAuthnRequest.h',
]

UNIFIED_SOURCES += [
'NSSU2FTokenRemote.cpp',
'ScopedCredential.cpp',
'ScopedCredentialInfo.cpp',
'WebAuthentication.cpp',
'WebAuthnAssertion.cpp',
'WebAuthnAttestation.cpp',
]

include('/ipc/chromium/chromium-config.mozbuild')

FINAL_LIBRARY = 'xul'

LOCAL_INCLUDES += [
'/dom/base',
'/dom/crypto',
'/security/manager/ssl',
'/security/pkix/include',
'/security/pkix/lib',
]

MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
23 changes: 23 additions & 0 deletions dom/webauthn/tests/mochitest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[DEFAULT]
support-files =
pkijs/asn1.js
pkijs/common.js
pkijs/x509_schema.js
pkijs/x509_simpl.js
u2futil.js

[test_webauthn_loopback.html]
skip-if = !e10s
scheme = https
[test_webauthn_no_token.html]
skip-if = !e10s
scheme = https
[test_webauthn_make_credential.html]
skip-if = !e10s
scheme = https
[test_webauthn_get_assertion.html]
skip-if = !e10s
scheme = https
[test_webauthn_sameorigin.html]
skip-if = !e10s
scheme = https
30 changes: 30 additions & 0 deletions dom/webauthn/tests/pkijs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2014, GMO GlobalSign
Copyright (c) 2015, Peculiar Ventures
All rights reserved.

Author 2014-2015, Yury Strozhevsky

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions dom/webauthn/tests/pkijs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKIjs and ASN1js are from https://pkijs.org/ and https://asn1js.org/.
Loading

0 comments on commit 14bcecc

Please sign in to comment.