psa_cipher_setup leaves operation in partially initialized state in case of error #68

Closed
opened 2019-02-24 08:15:40 -06:00 by NirSonnenschein · 2 comments
NirSonnenschein commented 2019-02-24 08:15:40 -06:00 (Migrated from github.com)

Description

in some of the setup functions the operation structure is not properly cleaned up in case of failure.
we specifically encountered this in the psa_cipher _setup. When passing in an invalid key handle (with other valid parameters) it will fail but leave the operation structure with the algorithm set.
This is OS and platform independent behavior.

Note: this likely also impacts other setup functions (e.g. psa_hmac_setup_internal, psa_mac_setup, etc..)

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug
<!-- ************************************** WARNING ************************************** The ciarcom bot parses this header automatically. Any deviation from the template may cause the bot to automatically correct this header or may result in a warning message, requesting updates. Please ensure that nothing follows the Issue request type section, all issue details are within the Description section and no changes are made to the template format (as detailed below). ************************************************************************************* --> ### Description <!-- Required Add detailed description of what you are reporting. Good example: https://os.mbed.com/docs/latest/reference/workflow.html Things to consider sharing: - What target does this relate to? - What toolchain (name + version) are you using? - What tools (name + version - is it mbed-cli, online compiler or IDE) are you using? - What is the SHA of Mbed OS (git log -n1 --oneline)? - Steps to reproduce. (Did you publish code or a test case that exhibits the problem?) --> in some of the setup functions the operation structure is not properly cleaned up in case of failure. we specifically encountered this in the psa_cipher _setup. When passing in an invalid key handle (with other valid parameters) it will fail but leave the operation structure with the algorithm set. This is OS and platform independent behavior. Note: this likely also impacts other setup functions (e.g. psa_hmac_setup_internal, psa_mac_setup, etc..) ### Issue request type <!-- Required Please add only one X to one of the following types. Do not fill multiple types (split the issue otherwise.) Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front of them would change the meaning incorrectly. The only changes to be made are to add a description text under the description heading and to add a 'x' to the correct box. --> [ ] Question [ ] Enhancement [X] Bug
ciarmcom commented 2019-02-24 10:35:50 -06:00 (Migrated from github.com)

Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-701

*Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-701*
gilles-peskine-arm commented 2019-02-25 15:28:09 -06:00 (Migrated from github.com)

Fix for cipher in #72. By code inspection, the MAC code looks correct to me (psa_mac_init either succeeds or reinitializes the context, and psa_mac_setup reinitializes the context on failure if psa_mac_init has succeeded).

Fix for cipher in #72. By code inspection, the MAC code looks correct to me (`psa_mac_init` either succeeds or reinitializes the context, and `psa_mac_setup` reinitializes the context on failure if `psa_mac_init` has succeeded).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-ARMmbed/mbed-crypto#68
No description provided.