Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary commands when querying the retry counts #200

Open
robinkrahl opened this issue May 2, 2021 · 1 comment
Open

Avoid unnecessary commands when querying the retry counts #200

robinkrahl opened this issue May 2, 2021 · 1 comment
Labels
Milestone

Comments

@robinkrahl
Copy link
Contributor

uint8_t NitrokeyManager::get_user_retry_count() {
if(device->get_device_model() == DeviceModel::STORAGE){
stick20::GetDeviceStatus::CommandTransaction::run(device);
}
auto response = GetUserPasswordRetryCount::CommandTransaction::run(device);
return response.data().password_retry_count;
}
uint8_t NitrokeyManager::get_admin_retry_count() {
if(device->get_device_model() == DeviceModel::STORAGE){
stick20::GetDeviceStatus::CommandTransaction::run(device);
}
auto response = GetPasswordRetryCount::CommandTransaction::run(device);
return response.data().password_retry_count;
}

Isn’t it possible to directly use the response of GetDeviceStatus for Storage devices?

@szszszsz szszszsz added the bug label May 3, 2021
@szszszsz
Copy link
Member

szszszsz commented May 3, 2021

Good catch! Indeed, on the firmware side the status call refreshes the smart card counters, and seems to return the correct values. I guess this was supposed to be an early return for the Nitrokey Storage, but somehow was not implemented.

Firmware side implementation: https://github.com/Nitrokey/nitrokey-storage-firmware/blob/f376b081d5900f9e494f74230f79df7552ae8e1f/src/USER_INTERFACE/html_io.c#L575-L588

@szszszsz szszszsz added this to the v3.7 milestone May 3, 2021
@szszszsz szszszsz modified the milestones: v3.7, v3.8 Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants