Commit 827cb575 authored by Martin Kreichgauer's avatar Martin Kreichgauer Committed by Commit Bot

Revert "device/fido: add a cache for authenticator ECDH keys."

This reverts commit 5640f6c5.

Reason for revert: breaks PIN entry in some cases (crbug.com/1129713)

Original change's description:
> device/fido: add a cache for authenticator ECDH keys.
>
> While, at the moment, I don't believe we will end up asking for the
> authenticator's ECDH key twice, when we support the PRF extension we
> could. Thus add a cache and skip asking an authenticator for it twice.
>
> Change-Id: I73ecaa38447cbbe04f34c12d83f9c79bca553c90
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2255208
> Commit-Queue: Adam Langley <agl@chromium.org>
> Auto-Submit: Adam Langley <agl@chromium.org>
> Reviewed-by: Martin Kreichgauer <martinkr@google.com>
> Cr-Commit-Position: refs/heads/master@{#781110}

Change-Id: Ief5dd139f1221b8bfbe58a6edf2390a022971538
Bug: 1129713
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418852Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#808430}
parent 2486dcb0
......@@ -208,12 +208,6 @@ void FidoDeviceAuthenticator::GetPinRetries(GetRetriesCallback callback) {
void FidoDeviceAuthenticator::GetEphemeralKey(
GetEphemeralKeyCallback callback) {
if (cached_ephemeral_key_.has_value()) {
std::move(callback).Run(CtapDeviceResponseCode::kSuccess,
cached_ephemeral_key_);
return;
}
DCHECK(Options());
DCHECK(
Options()->client_pin_availability !=
......@@ -221,27 +215,10 @@ void FidoDeviceAuthenticator::GetEphemeralKey(
Options()->supports_pin_uv_auth_token || SupportsHMACSecretExtension());
RunOperation<pin::KeyAgreementRequest, pin::KeyAgreementResponse>(
pin::KeyAgreementRequest(),
base::BindOnce(&FidoDeviceAuthenticator::OnHaveEphemeralKey,
weak_factory_.GetWeakPtr(), std::move(callback)),
pin::KeyAgreementRequest(), std::move(callback),
base::BindOnce(&pin::KeyAgreementResponse::Parse));
}
void FidoDeviceAuthenticator::OnHaveEphemeralKey(
GetEphemeralKeyCallback callback,
CtapDeviceResponseCode status,
base::Optional<pin::KeyAgreementResponse> key) {
if (status != CtapDeviceResponseCode::kSuccess) {
std::move(callback).Run(status, base::nullopt);
return;
}
DCHECK(key.has_value());
cached_ephemeral_key_.emplace(std::move(key.value()));
std::move(callback).Run(CtapDeviceResponseCode::kSuccess,
cached_ephemeral_key_);
}
void FidoDeviceAuthenticator::GetPINToken(
std::string pin,
const std::vector<pin::Permissions>& permissions,
......
......@@ -146,9 +146,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoDeviceAuthenticator
base::Optional<pin::KeyAgreementResponse>)>;
void InitializeAuthenticatorDone(base::OnceClosure callback);
void GetEphemeralKey(GetEphemeralKeyCallback callback);
void OnHaveEphemeralKey(GetEphemeralKeyCallback callback,
CtapDeviceResponseCode status,
base::Optional<pin::KeyAgreementResponse> key);
void DoGetAssertion(CtapGetAssertionRequest request,
CtapGetAssertionOptions options,
GetAssertionCallback callback);
......@@ -251,7 +248,6 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoDeviceAuthenticator
base::Optional<AuthenticatorSupportedOptions> options_;
std::unique_ptr<FidoTask> task_;
std::unique_ptr<GenericDeviceOperation> operation_;
base::Optional<pin::KeyAgreementResponse> cached_ephemeral_key_;
base::WeakPtrFactory<FidoDeviceAuthenticator> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FidoDeviceAuthenticator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment