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

Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/DH #7903

Merged
merged 7 commits into from
Aug 2, 2023

Conversation

valeriosetti
Copy link
Contributor

@valeriosetti valeriosetti commented Jul 10, 2023

This PR replaces temporary occurrences of DH_KEY_TYPE_LEGACY with proper new symbols.

Depends on #7902 and #7909
Resolves #7773.

PR checklist

@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels Jul 10, 2023
@valeriosetti valeriosetti requested a review from mpg July 10, 2023 13:38
@valeriosetti valeriosetti self-assigned this Jul 10, 2023
@valeriosetti valeriosetti added needs-preceding-pr Requires another PR to be merged first and removed needs-ci Needs to pass CI tests labels Jul 11, 2023
@mpg
Copy link
Contributor

mpg commented Jul 11, 2023

changelog not required: already introduced in #7614 - can be extended once #7772 and #7773 are done.

Well, this PR is when 7773 is done :) I think we could indeed extend the existing "features" entry a bit, to mention that (1) DERIVE is only available for ECC so far, and (2) the implementation is free to enable more than was requested (for example it currently enables import and export as soon as basic is present, though that might change in the future).

@valeriosetti valeriosetti force-pushed the issue7773 branch 2 times, most recently from 0f91405 to e738f42 Compare July 13, 2023 12:20
@paul-elliott-arm paul-elliott-arm self-requested a review July 13, 2023 13:45
@paul-elliott-arm paul-elliott-arm removed the needs-reviewer This PR needs someone to pick it up for review label Jul 13, 2023
@valeriosetti valeriosetti force-pushed the issue7773 branch 2 times, most recently from 696f6c6 to 322b7fd Compare July 26, 2023 06:52
@valeriosetti valeriosetti removed the needs-preceding-pr Requires another PR to be merged first label Jul 26, 2023
@valeriosetti
Copy link
Contributor Author

Just rebased after #7902 was merged yesterday. CI was green before this rebase so hopefully it would be again soon.
I think that this PR is ready for review ;)

@mpg mpg requested review from tom-daubney-arm and removed request for paul-elliott-arm July 26, 2023 07:38
@valeriosetti valeriosetti added needs-preceding-pr Requires another PR to be merged first and removed needs-preceding-pr Requires another PR to be merged first labels Jul 26, 2023
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
@valeriosetti
Copy link
Contributor Author

Rebased again on development because #7909 was merged yesterday

Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

I'm happy with the changes that are there (except two hickups in the Changelog), but I think a few more changes are needed:

  • fulfill the prophecy in tests/scripts/generate_psa_tests.py
  • adjust the opening comment in psa/crypto_legacy.h: I think we just want to remove _LEGACY here, which probably was added by mistake (mass replace) in the first place.

Once these two changes are done, git grep KEY_PAIR_LEGACY will no longer find any match, as should be.

ChangeLog.d/Define-PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy.txt Outdated Show resolved Hide resolved
ChangeLog.d/Define-PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy.txt Outdated Show resolved Hide resolved
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
@valeriosetti valeriosetti requested a review from mpg July 27, 2023 09:11
mpg
mpg previously approved these changes Jul 27, 2023
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@tom-daubney-arm tom-daubney-arm left a comment

Choose a reason for hiding this comment

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

I noticed that we still have the line //#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1 in the file configs/crypto_config_profile_medium.h which we import from TF-M. I think we should remove it now in this PR however others might not agree so we will check with the team. Other than that this PR is looking good so I will approve once we get an answer on this.

@valeriosetti
Copy link
Contributor Author

valeriosetti commented Aug 1, 2023

I noticed that we still have the line //#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1 in the file configs/crypto_config_profile_medium.h which we import from TF-M. I think we should remove it now in this PR however others might not agree so we will check with the team. Other than that this PR is looking good so I will approve once we get an answer on this.

Correct. I would say we have 2 options here: either use new symbols for the RSA key pair or remove it. Then what about DH? Should I add it here as well (still commented out of course)?

Edit: thinking a bit more about this, usually having something commented out in a config file it means that it is supposed to be enabled in some test (even though I didn't find any of such case in all.sh), so I think answers to my questions are:

  • replace PSA_WANT_KEY_TYPE_RSA_KEY_PAIR with new symbols for RSA, still keeping them commented out
  • do not add DH keys support

Am I right?

@mpg
Copy link
Contributor

mpg commented Aug 2, 2023

I think there are several possible reasons from having things commented out like this:

  • so that it's easy to re-enable it for testing, as you mentionned,
  • or just because they want to keep their file close to the upstream psa/crypto_config.h file,
  • or to be explicit about what could be enable and what isn't (which can be seen as a mix of the above two).

There seems to be consensus on Slack that we want to keep the top of this file unchanged from their version and add our changes in an explicitly-delimited section at the end, with #undefs and/or new #defines. Since this is about a commented-out line, I guess there's no #undef-ing to do, we can just add a comment. For example

/***********************************************************************
 * Local edits below this delimiter
 **********************************************************************/

/* Between Mbed TLS 3.4 and 3.5, the following macro, commented-out above,
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
 * has been replaced with the following new macros:
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE 1
 */

/* Between Mbed TLS 3.4 and 3.5, the following macros have been added:
// [...]
 */

Wdyt?

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tom-daubney-arm tom-daubney-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, thank you. I am marking "needs-ci" just while CI completes.

@tom-daubney-arm tom-daubney-arm added approved Design and code approved - may be waiting for CI or backports needs-ci Needs to pass CI tests and removed needs-review Every commit must be reviewed by at least two team members, labels Aug 2, 2023
@gilles-peskine-arm
Copy link
Contributor

@tom-daubney-arm FYI now that we're using merge queues, the merge action is “put on a queue to merge when the CI has finished” and no longer “merge now”. So we no longer need “needs-ci” when a pull request has been approved.

@tom-daubney-arm
Copy link
Contributor

@tom-daubney-arm FYI now that we're using merge queues, the merge action is “put on a queue to merge when the CI has finished” and no longer “merge now”. So we no longer need “needs-ci” when a pull request has been approved.

That's great! Ok I will remove the label then. Thanks for letting me know.

@tom-daubney-arm tom-daubney-arm removed the needs-ci Needs to pass CI tests label Aug 2, 2023
@mpg
Copy link
Contributor

mpg commented Aug 2, 2023

Ah, I hadn't realised either the move to merge queues has that effect, so I was also waiting for the CI to complete before pressing the "merge when ready" button, which sounds a bit silly now that I'm writing it - thanks for connecting the dots :)

@gilles-peskine-arm gilles-peskine-arm added this pull request to the merge queue Aug 2, 2023
Merged via the queue into Mbed-TLS:development with commit 267bee9 Aug 2, 2023
2 checks passed
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 priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/DH
5 participants