Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: device/u2f/u2f_device.cc

Issue 2821263005: Add U2F request state machines (Closed)
Patch Set: Call Start before adding devices Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/u2f/u2f_device.h ('k') | device/u2f/u2f_register.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/u2f_device.cc
diff --git a/device/u2f/u2f_device.cc b/device/u2f/u2f_device.cc
index dc9e5ec127be1845cb71dc3f1d731cf4cab7caf3..20575cf2ba6c36a9887ddf79b8658a050c886413 100644
--- a/device/u2f/u2f_device.cc
+++ b/device/u2f/u2f_device.cc
@@ -20,7 +20,7 @@ void U2fDevice::Register(const std::vector<uint8_t>& app_param,
std::unique_ptr<U2fApduCommand> register_cmd =
U2fApduCommand::CreateRegister(app_param, challenge_param);
if (!register_cmd) {
- callback.Run(ReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
return;
}
DeviceTransact(std::move(register_cmd),
@@ -35,7 +35,7 @@ void U2fDevice::Sign(const std::vector<uint8_t>& app_param,
std::unique_ptr<U2fApduCommand> sign_cmd =
U2fApduCommand::CreateSign(app_param, challenge_param, key_handle);
if (!sign_cmd) {
- callback.Run(ReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
return;
}
DeviceTransact(std::move(sign_cmd),
@@ -59,22 +59,22 @@ void U2fDevice::OnRegisterComplete(
bool success,
std::unique_ptr<U2fApduResponse> register_response) {
if (!success || !register_response) {
- callback.Run(ReturnCode::FAILURE, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::FAILURE, std::vector<uint8_t>());
return;
}
switch (register_response->status()) {
case U2fApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
- callback.Run(ReturnCode::CONDITIONS_NOT_SATISFIED,
+ callback.Run(U2fReturnCode::CONDITIONS_NOT_SATISFIED,
std::vector<uint8_t>());
break;
case U2fApduResponse::Status::SW_NO_ERROR:
- callback.Run(ReturnCode::SUCCESS, register_response->data());
+ callback.Run(U2fReturnCode::SUCCESS, register_response->data());
break;
case U2fApduResponse::Status::SW_WRONG_DATA:
- callback.Run(ReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
break;
default:
- callback.Run(ReturnCode::FAILURE, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::FAILURE, std::vector<uint8_t>());
break;
}
}
@@ -83,22 +83,21 @@ void U2fDevice::OnSignComplete(const MessageCallback& callback,
bool success,
std::unique_ptr<U2fApduResponse> sign_response) {
if (!success || !sign_response) {
- callback.Run(ReturnCode::FAILURE, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::FAILURE, std::vector<uint8_t>());
return;
}
switch (sign_response->status()) {
case U2fApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
- callback.Run(ReturnCode::CONDITIONS_NOT_SATISFIED,
+ callback.Run(U2fReturnCode::CONDITIONS_NOT_SATISFIED,
std::vector<uint8_t>());
break;
case U2fApduResponse::Status::SW_NO_ERROR:
- callback.Run(ReturnCode::SUCCESS, sign_response->data());
+ callback.Run(U2fReturnCode::SUCCESS, sign_response->data());
break;
case U2fApduResponse::Status::SW_WRONG_DATA:
- callback.Run(ReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
- break;
+ case U2fApduResponse::Status::SW_WRONG_LENGTH:
default:
- callback.Run(ReturnCode::FAILURE, std::vector<uint8_t>());
+ callback.Run(U2fReturnCode::INVALID_PARAMS, std::vector<uint8_t>());
break;
}
}
« no previous file with comments | « device/u2f/u2f_device.h ('k') | device/u2f/u2f_register.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698