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

Do not return PSA_ERROR_DOES_NOT_EXIST for a non-existing key #4162

Closed
gilles-peskine-arm opened this issue Feb 22, 2021 · 0 comments · Fixed by #4198
Closed

Do not return PSA_ERROR_DOES_NOT_EXIST for a non-existing key #4162

gilles-peskine-arm opened this issue Feb 22, 2021 · 0 comments · Fixed by #4198
Assignees
Labels
bug size-m Estimated task size: medium (~1w)

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Feb 22, 2021

As of version 1.0.0, PSA Crypto API functions return PSA_ERROR_INVALID_HANDLE to indicate that a key identifier that should exist does not exist, no matter the reason (potentially valid identifier that does not exist now, or permanently invalid value). Mbed TLS still returns PSA_ERROR_DOES_NOT_EXIST in some cases, including psa_destroy_key and key operations. We should return PSA_ERROR_INVALID_HANDLE instead.

PSA_ERROR_DOES_NOT_EXIST can still be returned:

  • By psa_open_key.
  • By psa_its_xxx and internal storage functions.
  • Potentially by driver interface functions.

The goal of this task is to change code that returns PSA_ERROR_DOES_NOT_EXIST, but should not, to return PSA_ERROR_INVALID_HANDLE instead, and update tests and documentation accordingly.

@gilles-peskine-arm gilles-peskine-arm added bug PSA compliance size-m Estimated task size: medium (~1w) labels Feb 22, 2021
@gilles-peskine-arm gilles-peskine-arm changed the title psa_destroy_key must not return PSA_ERROR_DOES_NOT_EXIST Do not return PSA_ERROR_DOES_NOT_EXIST for a non-existing key Feb 23, 2021
@daverodgman daverodgman self-assigned this Mar 2, 2021
maulik-arm added a commit to maulik-arm/mbedtls that referenced this issue Mar 4, 2021
maulik-arm added a commit to maulik-arm/mbedtls that referenced this issue Mar 4, 2021
non-existing key.

Signed-off-by: Maulik  Patel <[email protected]>
maulik-arm added a commit to maulik-arm/mbedtls that referenced this issue Mar 15, 2021
non-existing key.

Signed-off-by: Maulik  Patel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug size-m Estimated task size: medium (~1w)
Projects
None yet
3 participants