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

Fix error code when creating/registering a key with invalid id #4279

Conversation

ronald-cron-arm
Copy link
Contributor

Description

Fix 4271

Status

READY

Requires Backporting

No PSA only

@ronald-cron-arm ronald-cron-arm added component-psa PSA keystore/dispatch layer (storage, drivers, …) enhancement needs-ci Needs to pass CI tests PSA compliance labels Apr 1, 2021
@gabor-mezei-arm gabor-mezei-arm self-requested a review April 1, 2021 08:15
@ronald-cron-arm ronald-cron-arm changed the title Fix invalid id error code Fix error code when creating/registering a key with invalid id Apr 1, 2021
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Add negative tests checking that psa_copy_key()
returns PSA_ERROR_INVALID_ARGUMENT when passed in
an invalid key identifier or key lifetime for the
target key.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
When creating a persistent key or registering a key
with an invalid key identifier return
PSA_ERROR_INVALID_ARGUMENT instead of
PSA_ERROR_INVALID_HANDLE.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
@ronald-cron-arm ronald-cron-arm force-pushed the fix-invalid-id-error-code branch from d8e50a2 to a0fe19c Compare April 1, 2021 12:43
Fix expected error code when importing a persistent key or
registering a key with an invalid key identifier:
PSA_ERROR_INVALID_ARGUMENT instead of PSA_ERROR_INVALID_HANDLE.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
@ronald-cron-arm ronald-cron-arm force-pushed the fix-invalid-id-error-code branch from a0fe19c to 602f986 Compare April 1, 2021 12:55
@ronald-cron-arm ronald-cron-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests labels Apr 1, 2021
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a one-bit copypasta in a test case. Other than that LGTM

tests/suites/test_suite_psa_crypto.data Outdated Show resolved Hide resolved
Fix copy fail test argument for only one of them
to be invalid.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
@gabor-mezei-arm gabor-mezei-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Apr 6, 2021
@gilles-peskine-arm gilles-peskine-arm merged commit 889828d into Mbed-TLS:development Apr 6, 2021
daverodgman pushed a commit that referenced this pull request Apr 23, 2021
Fix error code when creating/registering a key with invalid id
@ronald-cron-arm ronald-cron-arm deleted the fix-invalid-id-error-code branch July 21, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-psa PSA keystore/dispatch layer (storage, drivers, …) enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix return value for psa_copy_key() if lifetime or identifier in attributes is invalid.
3 participants