Commit eed85ab5 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Rename ChallengeAttestationOnlyKeystoreResult to KeystoreStringResult.

This CL is a refactor with no intended behavior change. This is in
preparation for adding future methods to KeystoreService that return the
same type.

Bug: 1127505
Change-Id: Ia96d37301533cde335a38771d067c6054c164535
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485347Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819478}
parent 19640abf
...@@ -31,8 +31,8 @@ void KeystoreServiceAsh::ChallengeAttestationOnlyKeystore( ...@@ -31,8 +31,8 @@ void KeystoreServiceAsh::ChallengeAttestationOnlyKeystore(
ChallengeAttestationOnlyKeystoreCallback callback) { ChallengeAttestationOnlyKeystoreCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!crosapi::mojom::IsKnownEnumValue(type)) { if (!crosapi::mojom::IsKnownEnumValue(type)) {
mojom::ChallengeAttestationOnlyKeystoreResultPtr result_ptr = crosapi::mojom::KeystoreStringResultPtr result_ptr =
mojom::ChallengeAttestationOnlyKeystoreResult::New(); mojom::KeystoreStringResult::New();
result_ptr->set_error_message("unsupported keystore type"); result_ptr->set_error_message("unsupported keystore type");
std::move(callback).Run(std::move(result_ptr)); std::move(callback).Run(std::move(result_ptr));
return; return;
...@@ -110,8 +110,8 @@ void KeystoreServiceAsh::DidChallengeAttestationOnlyKeystore( ...@@ -110,8 +110,8 @@ void KeystoreServiceAsh::DidChallengeAttestationOnlyKeystore(
void* challenge_key_ptr, void* challenge_key_ptr,
const chromeos::attestation::TpmChallengeKeyResult& result) { const chromeos::attestation::TpmChallengeKeyResult& result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
mojom::ChallengeAttestationOnlyKeystoreResultPtr result_ptr = crosapi::mojom::KeystoreStringResultPtr result_ptr =
mojom::ChallengeAttestationOnlyKeystoreResult::New(); mojom::KeystoreStringResult::New();
if (result.IsSuccess()) { if (result.IsSuccess()) {
result_ptr->set_challenge_response(result.challenge_response); result_ptr->set_challenge_response(result.challenge_response);
} else { } else {
......
...@@ -106,7 +106,7 @@ EnterprisePlatformKeysChallengeMachineKeyFunction::Run() { ...@@ -106,7 +106,7 @@ EnterprisePlatformKeysChallengeMachineKeyFunction::Run() {
void EnterprisePlatformKeysChallengeMachineKeyFunction:: void EnterprisePlatformKeysChallengeMachineKeyFunction::
OnChallengeAttestationOnlyKeystore(ResultPtr result) { OnChallengeAttestationOnlyKeystore(ResultPtr result) {
using Result = crosapi::mojom::ChallengeAttestationOnlyKeystoreResult; using Result = crosapi::mojom::KeystoreStringResult;
switch (result->which()) { switch (result->which()) {
case Result::Tag::ERROR_MESSAGE: case Result::Tag::ERROR_MESSAGE:
Respond(Error(result->get_error_message())); Respond(Error(result->get_error_message()));
...@@ -148,7 +148,7 @@ EnterprisePlatformKeysChallengeUserKeyFunction::Run() { ...@@ -148,7 +148,7 @@ EnterprisePlatformKeysChallengeUserKeyFunction::Run() {
void EnterprisePlatformKeysChallengeUserKeyFunction:: void EnterprisePlatformKeysChallengeUserKeyFunction::
OnChallengeAttestationOnlyKeystore(ResultPtr result) { OnChallengeAttestationOnlyKeystore(ResultPtr result) {
using Result = crosapi::mojom::ChallengeAttestationOnlyKeystoreResult; using Result = crosapi::mojom::KeystoreStringResult;
switch (result->which()) { switch (result->which()) {
case Result::Tag::ERROR_MESSAGE: case Result::Tag::ERROR_MESSAGE:
Respond(Error(result->get_error_message())); Respond(Error(result->get_error_message()));
......
...@@ -68,7 +68,7 @@ class EnterprisePlatformKeysChallengeMachineKeyFunction ...@@ -68,7 +68,7 @@ class EnterprisePlatformKeysChallengeMachineKeyFunction
~EnterprisePlatformKeysChallengeMachineKeyFunction() override = default; ~EnterprisePlatformKeysChallengeMachineKeyFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
using ResultPtr = crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr; using ResultPtr = crosapi::mojom::KeystoreStringResultPtr;
void OnChallengeAttestationOnlyKeystore(ResultPtr result); void OnChallengeAttestationOnlyKeystore(ResultPtr result);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey", DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY) ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY)
...@@ -80,7 +80,7 @@ class EnterprisePlatformKeysChallengeUserKeyFunction ...@@ -80,7 +80,7 @@ class EnterprisePlatformKeysChallengeUserKeyFunction
~EnterprisePlatformKeysChallengeUserKeyFunction() override = default; ~EnterprisePlatformKeysChallengeUserKeyFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
using ResultPtr = crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr; using ResultPtr = crosapi::mojom::KeystoreStringResultPtr;
void OnChallengeAttestationOnlyKeystore(ResultPtr result); void OnChallengeAttestationOnlyKeystore(ResultPtr result);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey", DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY) ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY)
......
...@@ -33,7 +33,7 @@ class KeystoreServiceLacrosBrowserTest : public InProcessBrowserTest { ...@@ -33,7 +33,7 @@ class KeystoreServiceLacrosBrowserTest : public InProcessBrowserTest {
// Tests that providing an incorrectly formatted user keystore challenge returns // Tests that providing an incorrectly formatted user keystore challenge returns
// failure. // failure.
IN_PROC_BROWSER_TEST_F(KeystoreServiceLacrosBrowserTest, WrongFormattingUser) { IN_PROC_BROWSER_TEST_F(KeystoreServiceLacrosBrowserTest, WrongFormattingUser) {
crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr result; crosapi::mojom::KeystoreStringResultPtr result;
std::string challenge = "asdf"; std::string challenge = "asdf";
crosapi::mojom::KeystoreServiceAsyncWaiter async_waiter( crosapi::mojom::KeystoreServiceAsyncWaiter async_waiter(
keystore_service_remote().get()); keystore_service_remote().get());
......
...@@ -24,9 +24,9 @@ enum KeystoreType { ...@@ -24,9 +24,9 @@ enum KeystoreType {
kDevice = 1, kDevice = 1,
}; };
// Returned by ChallengeAttestationOnlyKeystore(). // Returned by methods that either return a string, or an error.
[Stable] [Stable, RenamedFrom="crosapi.mojom.ChallengeAttestationOnlyKeystoreResult"]
union ChallengeAttestationOnlyKeystoreResult { union KeystoreStringResult {
// Implies failure. // Implies failure.
string error_message; string error_message;
...@@ -60,7 +60,7 @@ interface KeystoreService { ...@@ -60,7 +60,7 @@ interface KeystoreService {
// certificate with the migrated key. // certificate with the migrated key.
ChallengeAttestationOnlyKeystore@0( ChallengeAttestationOnlyKeystore@0(
string challenge, KeystoreType type, bool migrate) => string challenge, KeystoreType type, bool migrate) =>
(ChallengeAttestationOnlyKeystoreResult result); (KeystoreStringResult result);
// Returns the key stores available to the client. These are used as inputs to // Returns the key stores available to the client. These are used as inputs to
// the other methods on this interface. // the other methods on this interface.
......
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