Skip to content

Conversation

@gabor-mezei-arm
Copy link
Contributor

@gabor-mezei-arm gabor-mezei-arm commented Sep 24, 2024

Description

In depends.py use PSA macros for the hashes domain.

Resolve #9144 #10203
Depends on #10145 #9292 (merged)

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

  • changelog not required because: test related changes
  • development PR provided this is
  • framework PR not required
  • 3.6 PR not required because: 4.0 related changes
  • 2.28 PR not required because: 4.0 related changes
  • tests provided

@gabor-mezei-arm gabor-mezei-arm added enhancement needs-ci Needs to pass CI tests needs-preceding-pr Requires another PR to be merged first size-s Estimated task size: small (~2d) component-test Test framework and CI scripts priority-high High priority - will be reviewed soon labels Sep 24, 2024
@gabor-mezei-arm gabor-mezei-arm self-assigned this Sep 24, 2024
@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from 8ab32ac to fcfc93d Compare September 25, 2024 11:53
@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from fcfc93d to baa11a9 Compare January 13, 2025 15:11
@gabor-mezei-arm gabor-mezei-arm removed the needs-preceding-pr Requires another PR to be merged first label Jan 13, 2025
@minosgalanakis minosgalanakis self-requested a review January 13, 2025 15:20
@gabor-mezei-arm gabor-mezei-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests labels Jan 14, 2025
@ronald-cron-arm ronald-cron-arm self-requested a review January 15, 2025 08:43
@ronald-cron-arm ronald-cron-arm removed the needs-reviewer This PR needs someone to pick it up for review label Jan 15, 2025
minosgalanakis
minosgalanakis previously approved these changes Jan 17, 2025
Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

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

Looks good. Some minor non blocking comments.

alter_names = {'!' + symbol for symbol in config_settings.keys()}
job = Job(description, config_settings, commands, alter_names)
self.jobs.append(job)
valid_symbols -= config_settings.keys()
Copy link
Contributor

Choose a reason for hiding this comment

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

Question.

Updating the valid_symbols while iterating through the mutual_exlusion implies that that a single valid_symbol can only pair with a single group. So we cannot have two groups that depend on the same valid_symbol

Is that intended as per design?

# across various modules, but it depends on either SHA256 or SHA512.
# As a consequence an "exclusive" test of anything other than SHA256
# or SHA512 with MBEDTLS_ENTROPY_C enabled is not possible.
# Note for update: when MBEDTLS_SHA3_C is removed the mutual_exclusion
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a common operator to indicate things that need to be done in the documentation. Until that is decided shoud we use TODO: which is global?

@gabor-mezei-arm
Copy link
Contributor Author

Rebased

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.

First, I see the grouping mechanism (or mutual_exclusion) as a improvement but not really as something necessary.

In terms of complementary domain jobs, we should have !PSA_WANT_ALG_SHA3_224 !PSA_WANT_ALG_SHA3_256 !PSA_WANT_ALG_SHA3_384 !PSA_WANT_ALG_SHA3_512. I know in all of them MBEDTLS_SHA3_C is enabled but they are not completely equivalent, we have some code guarded by only PSA_WANT_ALG_SHA3_224/256 ... In all these jobs, MBEDTLS_SHA3_C is indeed not disabled but we have the same kind of situation with !PSA_WANT_ALG_SHA_224/384 and !PSA_WANT_ALG_SHA_256/512 (sha256/512.c "enabled").

I agree that it would be nice to keep the case where MBEDTLS_SHA3_C is disabled and have on top of the above jobs, the job !(PSA_WANT_ALG_SHA3_224 PSA_WANT_ALG_SHA3_256 PSA_WANT_ALG_SHA3_384 PSA_WANT_ALG_SHA3_512) as we have currently.

Thus we could add grouping support for complementary and exclusive domains. It should then probably be a "groups" parameter not a "mutual_exclusion" as the latter does not fit well with exclusive domains I'd say. We would have then for hashes, three groups:

  • PSA_WANT_ALG_SHA3_224 + PSA_WANT_ALG_SHA3_256 + PSA_WANT_ALG_SHA3_384 + PSA_WANT_ALG_SHA3_512
  • PSA_WANT_ALG_SHA_224 + PSA_WANT_ALG_SHA_256
  • PSA_WANT_ALG_SHA_384 + PSA_WANT_ALG_SHA_512

I propose to move the grouping support in another PR and here to do only the changes to reach the point where for hashes we have the following jobs:
!PSA_WANT_ALG_SHA3_224 !PSA_WANT_ALG_SHA3_256 !PSA_WANT_ALG_SHA3_384 !PSA_WANT_ALG_SHA3_512 !PSA_WANT_ALG_MD5 !PSA_WANT_ALG_RIPEMD160 !PSA_WANT_ALG_SHA_1 !PSA_WANT_ALG_SHA_224 !PSA_WANT_ALG_SHA_256 !PSA_WANT_ALG_SHA_384 !PSA_WANT_ALG_SHA_512 PSA_WANT_ALG_SHA_256 PSA_WANT_ALG_SHA_512

See my comment below about disabling MBEDTLS_SHA3_C as a reverse dependency.

Comment on lines 359 to 362
'PSA_WANT_ALG_SHA3_224': ['MBEDTLS_SHA3_C'],
'PSA_WANT_ALG_SHA3_256': ['MBEDTLS_SHA3_C'],
'PSA_WANT_ALG_SHA3_384': ['MBEDTLS_SHA3_C'],
'PSA_WANT_ALG_SHA3_512': ['MBEDTLS_SHA3_C'],
Copy link
Contributor

Choose a reason for hiding this comment

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

For !PSA_WANT_ALG_SHA3_224 !PSA_WANT_ALG_SHA3_256 !PSA_WANT_ALG_SHA3_384 !PSA_WANT_ALG_SHA3_512 (see my general comment on the PR) this is problematic. We are close to remove the MBEDTLS_SHA3_C config option, thus I would say let's just remove that now.

@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from 7151645 to 8d62e8f Compare April 24, 2025 14:57
@gabor-mezei-arm gabor-mezei-arm added needs-ci Needs to pass CI tests needs-preceding-pr Requires another PR to be merged first labels Apr 24, 2025
@mpg mpg removed the needs-preceding-pr Requires another PR to be merged first label Apr 25, 2025
@mpg
Copy link
Contributor

mpg commented Apr 25, 2025

I propose to move the grouping support in another PR

Yes, I think we should really prioritize the minimal changes that are needed in order to unblock other work, and leave any improvements for a follow-up.

@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from 8d62e8f to 48372ed Compare April 28, 2025 10:03
@mpg
Copy link
Contributor

mpg commented May 7, 2025

@gabor-mezei-arm Thanks for updating this. Unfortunately, there are now conflicts, and also the CI has complaints about the code style. Can you fix that and then re-request a review?

As of for the other depends.py PR, we have a DI that depends on this, and we're under (justified IMO) pressure to close off our DI taks sooner rather than later.

@gabor-mezei-arm gabor-mezei-arm added the needs-preceding-pr Requires another PR to be merged first label May 7, 2025
@gabor-mezei-arm
Copy link
Contributor Author

The MBEDTLS_SHA3_C macro removal is done in #10145 and this PR depends on it.

@mpg
Copy link
Contributor

mpg commented May 12, 2025

The MBEDTLS_SHA3_C macro removal is done in #10145 and this PR depends on it.

Ah, I wasn't aware, thanks for the info!

@gabor-mezei-arm gabor-mezei-arm linked an issue Jun 5, 2025 that may be closed by this pull request
@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from 48372ed to b65099a Compare June 6, 2025 10:33
@gabor-mezei-arm gabor-mezei-arm force-pushed the 9144_update_depends.py_hashes_domain branch from b65099a to 3795f8a Compare June 10, 2025 14:34
@ronald-cron-arm ronald-cron-arm removed the needs-preceding-pr Requires another PR to be merged first label Jun 11, 2025
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.

LGTM, thanks.

@mpg mpg removed the needs-ci Needs to pass CI tests label Jun 12, 2025
@mpg
Copy link
Contributor

mpg commented Jun 12, 2025

@minosgalanakis This is ready for re-review (and a prompt re-review would be greatly appreciated).

Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation bot moved this from In Development to Has Approval in Roadmap pull requests (new board) Jun 12, 2025
@gabor-mezei-arm gabor-mezei-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 Jun 12, 2025
@ronald-cron-arm ronald-cron-arm added this pull request to the merge queue Jun 13, 2025
Merged via the queue into Mbed-TLS:development with commit b1d3e2e Jun 13, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from Has Approval to Done in Roadmap pull requests (new board) Jun 13, 2025
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 component-test Test framework and CI scripts enhancement priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

Development

Successfully merging this pull request may close these issues.

Remove temporary test component Update the hashes domain to use PSA macros in depends.py

4 participants