-
Notifications
You must be signed in to change notification settings - Fork 3k
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
PSA compliance tests suite #9312
Conversation
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 review comments
|
||
const psa_api_t psa_api = { | ||
.framework_version = pal_ipc_framework_version, | ||
.version = pal_ipc_version, |
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.
These structures are common to all tests. Therefore, these can be moved to a common file. Moving to common file is more scalable to consume any addition/deletion of an element.
Also you may want add copyright header to such files.
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 prefer to generate the structure for each test
That way it won't mistakenly compiled to an mbed-app and waste flash
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.
after a check I've moved the struct to the framework directory
size_t in_len, | ||
const psa_outvec_t *out_vec, | ||
const psa_outvec *out_vec, |
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.
As per the latest PSA FF spec, out_vec parameter is no more "const". It is now:
const psa_outvec *out_vec, | |
psa_outvec *out_vec, |
@@ -0,0 +1,26 @@ | |||
{ | |||
"name": "psa-compliance", | |||
"config": { |
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.
FYI- These macros definition will be available in pal_config.h in PSA compliance test suite release. Once you have pal_config.h, this json may not be required.
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 is the "mbed way" for configuration
We could add platform specific configuration in the future through this file
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
**/ | ||
#define ITS_TEST |
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 is possible to maintain test specific mbed_lib.json to pass ITS_TEST macro?
Idea is to avoid test editing.
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
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.
test_s001
name does not describe it actually tests PSA ITS implementation.
please rename TESTS/psa-compliance/test_s001
to TESTS/psa-compliance/psa-ist-s001
and fix the importer
@orenc17 - ping |
Making a note here. I think this now relies on #9192 instead. |
@orenc17 What is the status for this PR? The dependencies were integrated, weren't they? |
the porting is being continued by another team.. i believe they use this PR as a base |
@orenc17 They'll still hit the same problem once they introduce a PR. |
Shall this be closed? |
Yes, we will continue with this PR. The PSA team will update tomorrow. |
FYI @netanelgonen |
Checking in, this is still waiting on two other PRs before it can progress, correct? |
Very last dependency here: #9668 - is now in CI. Will this fix also astyle issues in Travis? |
@0xc0170 , this should fix most of the issues, I'm adding an astyle ignore rule to ignore the style of the imported compliance tests shortly. |
exporter likely needs to be restarted, as it probably has incorrectly status as pending after the license issues. |
CI job restarted: |
Restarted CI. Was getting odd null pointer exception issue when restarting single job. |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
{ | ||
#ifndef PSA_ATTESTATION_DISABLED | ||
const uint8_t private_key_data[] = { | ||
0x49, 0xc9, 0xa8, 0xc1, 0x8c, 0x4b, 0x88, 0x56, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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 is a hard-coded attestation key used for testing the attestation feature. it was randomly generated.
The specific key chosen shouldn't matter to the test it just needs a key to be injected before it is run (in practice each decide is expected to have it's own randomly generated key).
if (IS_TEST_FAIL(status) || IS_TEST_SKIP(status)) | ||
{ | ||
GREENTEA_TESTSUITE_RESULT(false); | ||
return; |
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.
Seems odd that this was 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.
if you mean the explicit return, you are right, it should not be needed.
It is likely an artifact from the previous implementation of the function. - Fixed
bool continue_test = true; | ||
|
||
test_info.test_num = test_num; | ||
if (boot.state == BOOT_NOT_EXPECTED || boot.state == BOOT_EXPECTED_CRYPTO) |
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'm probably missing something, but how would this ever not be true?
boot_t boot
isn't static.
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.
good point this check should be removed - fixed
mbed_val_print(PRINT_ERROR, "Call to dispatch SF failed. Status=%x\n", status_of_call); | ||
} | ||
|
||
pal_ipc_close(*handle); |
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 should the handle be closed here instead of outside of 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.
this function is called from a pointer to function in the original attestation test framework (prior to our adaptation to greentea) in the struct val_api_t. The original implementation had the calling semantic that this function frees the handle inside and we preserved this for future compatibility (had we implemented the test framework we would have done many things very differently).
} | ||
|
||
|
||
} |
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.
} // extern "C"
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.
good point, fixed
#endif | ||
|
||
#if defined(MBEDTLS_ENTROPY_NV_SEED) || defined(COMPONENT_PSA_SRV_IPC) | ||
inject_entropy(); |
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.
Seems weird that this and the following line of code are indented.
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.
you are right, however this file has since been replaced (git move) with the file pal_mbed_os_intf.cpp which has been refactored and no longer contains this anomaly
@orenc17 A couple of questions/nits, but just looking for answers before merging. |
@cmonr i've handed over the PR to @NirSonnenschein |
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.
Thanks @cmonr
#endif | ||
|
||
#if defined(MBEDTLS_ENTROPY_NV_SEED) || defined(COMPONENT_PSA_SRV_IPC) | ||
inject_entropy(); |
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.
you are right, however this file has since been replaced (git move) with the file pal_mbed_os_intf.cpp which has been refactored and no longer contains this anomaly
if (IS_TEST_FAIL(status) || IS_TEST_SKIP(status)) | ||
{ | ||
GREENTEA_TESTSUITE_RESULT(false); | ||
return; |
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.
if you mean the explicit return, you are right, it should not be needed.
It is likely an artifact from the previous implementation of the function. - Fixed
bool continue_test = true; | ||
|
||
test_info.test_num = test_num; | ||
if (boot.state == BOOT_NOT_EXPECTED || boot.state == BOOT_EXPECTED_CRYPTO) |
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.
good point this check should be removed - fixed
{ | ||
#ifndef PSA_ATTESTATION_DISABLED | ||
const uint8_t private_key_data[] = { | ||
0x49, 0xc9, 0xa8, 0xc1, 0x8c, 0x4b, 0x88, 0x56, |
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 is a hard-coded attestation key used for testing the attestation feature. it was randomly generated.
The specific key chosen shouldn't matter to the test it just needs a key to be injected before it is run (in practice each decide is expected to have it's own randomly generated key).
mbed_val_print(PRINT_ERROR, "Call to dispatch SF failed. Status=%x\n", status_of_call); | ||
} | ||
|
||
pal_ipc_close(*handle); |
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 function is called from a pointer to function in the original attestation test framework (prior to our adaptation to greentea) in the struct val_api_t. The original implementation had the calling semantic that this function frees the handle inside and we preserved this for future compatibility (had we implemented the test framework we would have done many things very differently).
} | ||
|
||
|
||
} |
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.
good point, fixed
restarted CI on review fixes |
Restarted jenkins-ci/exporter |
Test run: FAILEDSummary: 1 of 13 test jobs failed Failed test jobs:
|
CI has passed again on the CR changes, @cmonr please take a look, if all is ok we can proceed. |
@NirSonnenschein It would be good to capture this as a comment in the file, but that can be added in a seperate PR. Not going to block the PR on that. |
Description
Add PSA compliance tests suite.
Note: this PR has been expanded to contain the entire suite.
This PR include tests for:
Relies on PRs
#9708 (merged)
#9795 (merged)
#9668 (merged)
#9822 (merged)
upcoming mbedTLS release
Note: this PR will not build without these PRs
Pull request type
Reviewers
@alzix @jaypit02 @dreemkiller