-
Notifications
You must be signed in to change notification settings - Fork 674
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
Enforce TLV protected entries #1938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few minor comments, otherwise it looks good to me.
IMAGE_TLV_KEYHASH, | ||
IMAGE_TLV_PUBKEY, | ||
IMAGE_TLV_SHA256, | ||
IMAGE_TLV_SHA384, | ||
IMAGE_TLV_RSA2048_PSS, | ||
IMAGE_TLV_ECDSA224, | ||
IMAGE_TLV_ECDSA_SIG, | ||
IMAGE_TLV_RSA3072_PSS, | ||
IMAGE_TLV_ED25519, | ||
IMAGE_TLV_ENC_RSA2048, | ||
IMAGE_TLV_ENC_KW, | ||
IMAGE_TLV_ENC_EC256, | ||
IMAGE_TLV_ENC_X25519, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the current situation - considering how imgtool
works.
In theory the keyhash/pubkey and encryption TLVs could be in the protected area.
Do you think it would make sense to move these TLVs in the future?
As for the keyhash/pubkey TLV, I prefer to have it together with the signature TLV to make re-signing of an image more convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the keyhash/pubhash can stay in the unprotected. The things directly related to signature verification make sense to keep there. It probably makes sense to move the enc ones, but it isn't urgent.
I'll fix the whitespace.
Add a query to the TLV iterator that will indicate if the currently iterated TLV entry was found in the protected region or not. Signed-off-by: David Brown <david.brown@linaro.org>
Only allow TLV entries that are needed for signature verification to be placed in the unprotected area of the TLV. Signed-off-by: David Brown <david.brown@linaro.org>
Add a release not stub for the TLV check. Signed-off-by: David Brown <david.brown@linaro.org>
Add an additional check to the image validation to ensure that TLV entries that need to be protected are actually in the protected section. This works with a whitelist of entries that are allowed to be unprotected. There is a define
ALLOW_ROGUE_TLVS
that can be set to bypass this check.