Commit 863d9fd6 authored by Nina Satragno's avatar Nina Satragno Committed by Commit Bot

[webauthn] Fix virtual ctap2 device linter errors

These are errors that pop up when running `git cl lint`.

Bug: none
Change-Id: I7f105d13ab65ca48a478e4abf3acb4d171cfec15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352528
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Auto-Submit: Nina Satragno <nsatragno@chromium.org>
Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#797751}
parent 59a2e189
...@@ -95,7 +95,7 @@ CtapDeviceResponseCode ExtractPermissions( ...@@ -95,7 +95,7 @@ CtapDeviceResponseCode ExtractPermissions(
return CtapDeviceResponseCode::kCtap1ErrInvalidParameter; return CtapDeviceResponseCode::kCtap1ErrInvalidParameter;
} }
DCHECK((out_permissions.permissions & ~kSupportedPermissionsMask) == 0); DCHECK_EQ(out_permissions.permissions & ~kSupportedPermissionsMask, 0);
const auto permissions_rpid_it = request_map.find( const auto permissions_rpid_it = request_map.find(
cbor::Value(static_cast<int>(pin::RequestKey::kPermissionsRPID))); cbor::Value(static_cast<int>(pin::RequestKey::kPermissionsRPID)));
...@@ -238,7 +238,7 @@ CtapDeviceResponseCode ConfirmPresentedPIN( ...@@ -238,7 +238,7 @@ CtapDeviceResponseCode ConfirmPresentedPIN(
state->pin_retries--; state->pin_retries--;
state->pin_retries_since_insertion++; state->pin_retries_since_insertion++;
DCHECK((encrypted_pin_hash.size() % AES_BLOCK_SIZE) == 0); DCHECK_EQ(encrypted_pin_hash.size() % AES_BLOCK_SIZE, 0ul);
uint8_t pin_hash[AES_BLOCK_SIZE]; uint8_t pin_hash[AES_BLOCK_SIZE];
pin::Decrypt(shared_key, encrypted_pin_hash, pin_hash); pin::Decrypt(shared_key, encrypted_pin_hash, pin_hash);
...@@ -1510,7 +1510,7 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand( ...@@ -1510,7 +1510,7 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand(
SetPIN(mutable_state(), shared_key, *encrypted_pin, *pin_auth); SetPIN(mutable_state(), shared_key, *encrypted_pin, *pin_auth);
if (err != CtapDeviceResponseCode::kSuccess) { if (err != CtapDeviceResponseCode::kSuccess) {
return err; return err;
}; }
AuthenticatorSupportedOptions options = device_info_->options; AuthenticatorSupportedOptions options = device_info_->options;
options.client_pin_availability = AuthenticatorSupportedOptions:: options.client_pin_availability = AuthenticatorSupportedOptions::
...@@ -1550,12 +1550,12 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand( ...@@ -1550,12 +1550,12 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand(
ConfirmPresentedPIN(mutable_state(), shared_key, *encrypted_pin_hash); ConfirmPresentedPIN(mutable_state(), shared_key, *encrypted_pin_hash);
if (err != CtapDeviceResponseCode::kSuccess) { if (err != CtapDeviceResponseCode::kSuccess) {
return err; return err;
}; }
err = SetPIN(mutable_state(), shared_key, *encrypted_new_pin, *pin_auth); err = SetPIN(mutable_state(), shared_key, *encrypted_new_pin, *pin_auth);
if (err != CtapDeviceResponseCode::kSuccess) { if (err != CtapDeviceResponseCode::kSuccess) {
return err; return err;
}; }
break; break;
} }
...@@ -1617,7 +1617,7 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand( ...@@ -1617,7 +1617,7 @@ base::Optional<CtapDeviceResponseCode> VirtualCtap2Device::OnPINCommand(
ConfirmPresentedPIN(mutable_state(), shared_key, *encrypted_pin_hash); ConfirmPresentedPIN(mutable_state(), shared_key, *encrypted_pin_hash);
if (err != CtapDeviceResponseCode::kSuccess) { if (err != CtapDeviceResponseCode::kSuccess) {
return err; return err;
}; }
mutable_state()->pin_retries = kMaxPinRetries; mutable_state()->pin_retries = kMaxPinRetries;
...@@ -1733,7 +1733,7 @@ CtapDeviceResponseCode VirtualCtap2Device::OnCredentialManagement( ...@@ -1733,7 +1733,7 @@ CtapDeviceResponseCode VirtualCtap2Device::OnCredentialManagement(
const size_t num_remaining = const size_t num_remaining =
config_.resident_credential_storage - num_resident; config_.resident_credential_storage - num_resident;
DCHECK(0 <= num_remaining); DCHECK_LE(0ul, num_remaining);
response_map.emplace( response_map.emplace(
static_cast<int>(CredentialManagementResponseKey:: static_cast<int>(CredentialManagementResponseKey::
kMaxPossibleRemainingResidentCredentialsCount), kMaxPossibleRemainingResidentCredentialsCount),
...@@ -1996,7 +1996,7 @@ CtapDeviceResponseCode VirtualCtap2Device::OnBioEnrollment( ...@@ -1996,7 +1996,7 @@ CtapDeviceResponseCode VirtualCtap2Device::OnBioEnrollment(
++(*mutable_state()->bio_current_template_id)) != ++(*mutable_state()->bio_current_template_id)) !=
mutable_state()->bio_templates.end()) { mutable_state()->bio_templates.end()) {
// Check for integer overflow (indicates full) // Check for integer overflow (indicates full)
DCHECK(*mutable_state()->bio_current_template_id < 255); DCHECK_LT(*mutable_state()->bio_current_template_id, 255);
} }
mutable_state()->bio_remaining_samples = mutable_state()->bio_remaining_samples =
config_.bio_enrollment_samples_required; config_.bio_enrollment_samples_required;
......
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