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

Miscellaneous changes to scripts for PSA-Crypto enablement #7955

Conversation

davidhorstmann-arm
Copy link
Contributor

@davidhorstmann-arm davidhorstmann-arm commented Jul 18, 2023

Enable the scripts to be used either in Mbed TLS or in the PSA Cryptography repository.

Fixes Mbed-TLS/TF-PSA-Crypto#23

Specifically:

  • Change root directory detection logic in several places
  • Change filepaths in several places dependent on which repo we are in

PR checklist

Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")

  • changelog not required - internal script changes only
  • backport not required - The PSA Crypto repo is based on development only
  • tests not required - changes are only to scripts

@davidhorstmann-arm davidhorstmann-arm force-pushed the psa-crypto-script-changes branch from fd28e9a to c144d97 Compare July 19, 2023 10:01
@daverodgman daverodgman self-requested a review July 19, 2023 11:58
@daverodgman
Copy link
Contributor

Test comment

@daverodgman daverodgman removed their request for review July 19, 2023 11:58
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

This looks overall good to me, things to improve in test_psa_compliance.py though.

tests/scripts/all.sh Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
@ronald-cron-arm ronald-cron-arm added enhancement needs-work needs-reviewer This PR needs someone to pick it up for review priority-high High priority - will be reviewed soon labels Aug 24, 2023
Introduce changes needed to run all.sh in the psa-crypto repo. Where
behaviour must differ, detect that we are in the psa-crypto repo by
checking for the 'core' directory.

Signed-off-by: David Horstmann <[email protected]>
When detecting the root dir, look both for PSA Crypto and Mbed TLS
directories.

Signed-off-by: David Horstmann <[email protected]>
Instead of:
    ! in_psa_crypto_repo()
use
    in_mbedtls_repo()

Signed-off-by: David Horstmann <[email protected]>
Use CMake to build the library out-of-source (rather than make)
in tests/scripts/test_psa_compliance.py and add a script argument for
the out-of-source build directory.

Signed-off-by: David Horstmann <[email protected]>
(For consistency with all.sh)

Signed-off-by: David Horstmann <[email protected]>
@davidhorstmann-arm davidhorstmann-arm force-pushed the psa-crypto-script-changes branch from ad6e0dd to 0ac57ca Compare August 24, 2023 14:18
@davidhorstmann-arm
Copy link
Contributor Author

Rebased on development.

1 minor conflict in all.sh:

<<<<<<< HEAD
        if ! git diff --quiet "$CONFIG_H"; then
            err_msg "Warning - the configuration file 'include/mbedtls/mbedtls_config.h' has been edited. "
=======
        if ! git diff --quiet $CONFIG_H; then
            err_msg "Warning - the configuration file '$CONFIG_H' has been edited. "
>>>>>>> 6383d1b8f2ce (Make all.sh PSA-crypto-friendly)

Resolved to add double quotes (") around $CONFIG_H and also use $CONFIG_H in the message:

        if ! git diff --quiet "$CONFIG_H"; then
            err_msg "Warning - the configuration file '$CONFIG_H' has been edited. "

@davidhorstmann-arm davidhorstmann-arm added needs-review Every commit must be reviewed by at least two team members, needs-ci Needs to pass CI tests and removed needs-work labels Aug 24, 2023
scripts/mbedtls_dev/build_tree.py Outdated Show resolved Hide resolved
tests/scripts/all.sh Show resolved Hide resolved
tests/scripts/all.sh Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Show resolved Hide resolved
Check for the 'drivers' and 'programs' directories additionally to the
ones that are already there.

Signed-off-by: David Horstmann <[email protected]>
Have separate in_mbedtls_repo() and in_psa_crypto_repo() functions

Signed-off-by: David Horstmann <[email protected]>
Use the repo-specific test not just the Mbed TLS specific one.

Signed-off-by: David Horstmann <[email protected]>
This makes it more repo-agnostic

Signed-off-by: David Horstmann <[email protected]>
Either remove exclusive references to Mbed TLS or accompany them with
references to "PSA Crypto".

Signed-off-by: David Horstmann <[email protected]>
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

This looks almost good to me. Otherwise mypy is not happy it seems and the CI is failing.

tests/scripts/all.sh Outdated Show resolved Hide resolved
tests/scripts/test_psa_compliance.py Outdated Show resolved Hide resolved
Use CMake's -t option to build only the crypto target. Parameterize the
crypto target to have the right name depending on whether this is Mbed
TLS or PSA Crypto.

Signed-off-by: David Horstmann <[email protected]>
This will prevent CMake from mistaking the build directory for the
source directory

Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
This enables compatibility with older versions of CMake that do not have
the abbreviated switch.

Signed-off-by: David Horstmann <[email protected]>
@davidhorstmann-arm davidhorstmann-arm added priority-very-high Highest priority - prioritise this over other review work and removed priority-high High priority - will be reviewed soon labels Aug 30, 2023
@ronald-cron-arm ronald-cron-arm removed needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review labels Aug 30, 2023
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks.

Copy link
Member

@paul-elliott-arm paul-elliott-arm left a comment

Choose a reason for hiding this comment

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

LGTM

@paul-elliott-arm paul-elliott-arm added this pull request to the merge queue Aug 31, 2023
@paul-elliott-arm paul-elliott-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, labels Aug 31, 2023
Merged via the queue into Mbed-TLS:development with commit 6147511 Aug 31, 2023
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 enhancement priority-very-high Highest priority - prioritise this over other review work
Projects
Development

Successfully merging this pull request may close these issues.

Merge into Mbed TLS development the changes needed on scripts to build the PSA-Crypto main branch
4 participants