-
Notifications
You must be signed in to change notification settings - Fork 98
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
securechip/optiga: limit unlock to 10 failed attempts #1344
Open
benma
wants to merge
4
commits into
BitBoxSwiss:master
Choose a base branch
from
benma:optiga-lowctr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benma
changed the title
Optiga lowctr
securechip/optiga: limit unlock to 10 failed attempts
Dec 18, 2024
This commit implements the securechip.h interface for the Optiga Trust M V3, with an interface and configuration roughly corresponding to how we use the ATECC608 secure chip: - A KDF key that is internally generated and cannot be read and written from the host MCU - A KDF key that is generated on the host - A monotonic counter attached to the first KDF key which limits the maxmium number of uses of the key over the lifetime of the device - Attestation key that is internally generated and used to sign attestation challenges The factory setup configures the metadata of each object we use, setting the state to Operational. After this, metadata cannot be changed, and the access conditions apply as specified. Shielded communication encrypts the communication with the chip and is active and enforced through the metadata access configs. It roughly corresponds to IO protection in the ATECC608. In the ATECC608, we additionally authorize each command with the authorization_key, another pre-shared secret. The Optiga offers the same functionality, but we don't use it to authorize all commands, as it is redundant to using the shielded communication in terms of enabling the host MCU to execute commands. Co-Authored-By: Niklas <[email protected]>
To disable interrupts when processing Optiga commands.
So the two different securechip implementations (ATECC608 and Optiga Trust M V3) can implement stretching differently. This is needed because in the Optiga, we will add an additional stretching step.
The MCU limits unlock attempts to 10 before resetting. The ATECC securechip further limits the total unlock attempts (successful or failed) to a large monotonic counter, ~730k. In the Optiga we have the same, but with a lower limit due to the chip spec (~600k). This commit additionally adds a small counter that limits the unlocks to 10 failed attempts, same as the MCU. When the counte reaches the limit, no further attempts are possible until reset. When the correct password is entered, the small counter resets to 0. To achieve this, three new slots are added that specifically deal with this small counter. The PASSWORD_SECRET is a key included in the password key stretch, so overwriting/resetting invalidates the password and makes it impossible to unlock or brute force. The PASSWORD_SECRET is initialized to a random value when a password is set. It also authorizes changing the PASSWORD object and the PASSWORD_COUNTER small counter in order to reset it. It can only be read when authorized using the PASSWORD object, i.e. when entering the correct password, which allows us to reset the counter and also to use the PASSWORD_SECRET in the password stretching. The approach is inspired by Trezor, which has a similar setup a small monotonic counter: https://github.com/trezor/trezor-firmware/blob/78cce0ba04436b2ec8a72d00d157a1dd37055572/core/embed/sec/optiga/optiga.c#L35 securechip_init_new_password and securechip_reset_keys are added to the securechip interface to set the new password and to reset all keys involved in the key stretch and the password. When the small counter threshold is reached, further attempts always fail until reset. The MCU also keeps track of the 10 attempts and resets after 10 failed ones, so the securechip error condition is never exercised, similar to the large lifetime counter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See commit messages.