-
Notifications
You must be signed in to change notification settings - Fork 232
[nrf noup] Added BOOT_SIGNATURE_USING_ITS for ecdsa configuration #476
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
base: main
Are you sure you want to change the base?
Conversation
Note: I have not added |
static psa_key_id_t builtin_key_ids[BOOT_SIGNATURE_BUILTIN_KEY_SLOTS] = { | ||
0x40022100, | ||
0x40022101, | ||
// 0x40022102, |
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.
commented line can go?
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.
Done
@@ -491,6 +495,61 @@ static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx, | |||
return (int) psa_verify_hash(ctx->key_id, PSA_ALG_ECDSA(ctx->required_algorithm), | |||
hash, hlen, reformatted_signature, 2*ctx->curve_byte_count); | |||
} | |||
#else /* !CONFIG_BOOT_SIGNATURE_USING_ITS */ | |||
|
|||
#define BOOT_SIGNATURE_BUILTIN_KEY_SLOTS 4 |
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.
#define BOOT_SIGNATURE_BUILTIN_KEY_SLOTS 4 |
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.
Done
psa_algorithm_t algorithm; | ||
}; | ||
|
||
static psa_key_id_t builtin_key_ids[BOOT_SIGNATURE_BUILTIN_KEY_SLOTS] = { |
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.
static psa_key_id_t builtin_key_ids[BOOT_SIGNATURE_BUILTIN_KEY_SLOTS] = { | |
static psa_key_id_t builtin_key_ids[] = { |
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.
Done
1214847
to
2f2be35
Compare
2f2be35
to
6a24060
Compare
320e0de
to
6b51018
Compare
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.
BOOT_LOG_ERR("ECDSA signature verification failed %d", status); | ||
} | ||
|
||
return (int) status; |
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.
No. Translate the status to something like 1 or 2, or whatever.
I do not think that PSA codes should leave the bootutil_ecdsa_verify
, because they make no sense to MCUboot.
I guess that what we have outside is a mess, but we are sure to understand PSA statuses here, but not sure we do so outside the function.
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.
Ok, I probably just wanted to return similarly as the normal PSA implementation, now the function is returning 2 on error.
static psa_key_id_t builtin_key_ids[] = { | ||
0x40022100, | ||
0x40022101, | ||
0x40022102, | ||
0x40022103 | ||
}; |
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.
Doesn't this cause link errors that there is unused static builtin_key_ids
defined in all the units that include the ecdsa.h?
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 should probably be defined within the bootutil_ecdsa_verify
.
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.
It doesn't cause errors, as it is under CONFIG_BOOT_SIGNATURE_USING_ITS
.
I think keeping it outside of the function seems a bit cleaner. I tried to mimic the implementation from CRACEN KMU as much as possible, where the array is kept outside the function. But I do not have any strong feelings about it, I can move it inside of the function if you prefer it.
In the future I'd like to move this to some sort of external hook, but I didn't want to complicate the commit too much currently, as the current version is OK for our current needs and I assume we will want to rework the ECDSA signing code in the near future anyway.
struct boot_ecdsa_key_info { | ||
psa_key_id_t key_id; | ||
psa_algorithm_t algorithm; | ||
}; |
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.
Where is this thing used?
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.
Sorry, it is a leftover from the development process, I have missed this, removed.
This configuration has the purpose of using keys provisioned to the internal trusted storage (ITS). It makes use of the already existing parts of code for MCUBOOT_BUILTIN_KEY Signed-off-by: Artur Hadasz <[email protected]>
6b51018
to
8c4a36f
Compare
|
@@ -422,7 +422,14 @@ config BOOT_KMU_KEYS_REVOCATION | |||
help | |||
Enabling KMU key revocation backend. | |||
|
|||
if !BOOT_SIGNATURE_USING_KMU | |||
config BOOT_SIGNATURE_USING_ITS | |||
bool "Use KMU stored keys for signature verification" |
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.
Is 'KMU' here intended ?
This configuration has the purpose of using keys provisioned to the internal trusted storage (ITS). It makes use of the already existing parts of code for MCUBOOT_BUILTIN_KEY