-
Notifications
You must be signed in to change notification settings - Fork 96
Add mock tests for hooks for secure element drivers #174
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c9ad591
crypto_se_driver: add mock tests
AndrzejKurek 9fd6b0c
crypto_se_driver: add key generation mock and test
AndrzejKurek 903b5da
crypto_se_driver: add an error injection mechanism to the mocks
AndrzejKurek 136901c
crypto_se_driver: add public key exporting test
AndrzejKurek b7656a8
crypto_se_driver: add signing mock test
AndrzejKurek f740b0a
crypto_se_driver: add verification mock test
AndrzejKurek 4abb40c
Clean up core storage between tests
Patater 74c932e
Parametrize key bits in import mock test
dgreen-arm 0892d0f
Initialize key bits to max size + 1 in psa_import_key
dgreen-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
SE key importing mock test | ||
mock_import:PSA_SUCCESS:PSA_SUCCESS:0:PSA_SUCCESS | ||
|
||
SE key importing mock test: max key bits | ||
mock_import:PSA_SUCCESS:PSA_SUCCESS:PSA_MAX_KEY_BITS:PSA_SUCCESS | ||
|
||
SE key importing mock test: more than max key bits | ||
mock_import:PSA_SUCCESS:PSA_ERROR_NOT_SUPPORTED:PSA_MAX_KEY_BITS+1:PSA_ERROR_NOT_SUPPORTED | ||
|
||
SE key importing mock test: alloc failed | ||
mock_import:PSA_ERROR_HARDWARE_FAILURE:PSA_SUCCESS:0:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE key importing mock test: import failed | ||
mock_import:PSA_SUCCESS:PSA_ERROR_HARDWARE_FAILURE:0:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE key exporting mock test | ||
mock_export:PSA_SUCCESS:PSA_SUCCESS | ||
|
||
SE key exporting mock test: export failed | ||
mock_export:PSA_ERROR_HARDWARE_FAILURE:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE public key exporting mock test | ||
mock_export_public:PSA_SUCCESS:PSA_SUCCESS | ||
|
||
SE public key exporting mock test: export failed | ||
mock_export_public:PSA_ERROR_HARDWARE_FAILURE:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE key generating mock test | ||
mock_generate:PSA_SUCCESS:PSA_SUCCESS:PSA_SUCCESS | ||
|
||
SE key generating mock test: alloc failed | ||
mock_generate:PSA_ERROR_HARDWARE_FAILURE:PSA_SUCCESS:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE key generating mock test: generating failed | ||
mock_generate:PSA_SUCCESS:PSA_ERROR_HARDWARE_FAILURE:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE signing mock test | ||
mock_sign:PSA_SUCCESS:PSA_SUCCESS | ||
|
||
SE signing mock test: sign failed | ||
mock_sign:PSA_ERROR_HARDWARE_FAILURE:PSA_ERROR_HARDWARE_FAILURE | ||
|
||
SE verification mock test | ||
mock_verify:PSA_SUCCESS:PSA_SUCCESS | ||
|
||
SE verification mock test: verify failed | ||
mock_verify:PSA_ERROR_HARDWARE_FAILURE:PSA_ERROR_HARDWARE_FAILURE |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is this change needed?
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.
Please leave a comment in the code explaining the reason, to improve the code's readability. Others will have the same question.
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 see this change was added in commit "Parametrize key bits in import mock test", which doesn't seem right if all one intends to do is updating a test as the title would imply. If the core has to be updated together with the test change, revise the commit message. If the core has a bug, explain it in the commit message and make a change to fix the bug separate from the mock test updating.
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've split this out into a separate commit and added an explanation.
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.
Please add a comment in the code about why you chose the value you did.
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.
Added a code comment.