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

check_names: extend typo check to PSA macro/enum names #6558

Merged
merged 5 commits into from
Dec 13, 2022

Conversation

lpy4105
Copy link
Contributor

@lpy4105 lpy4105 commented Nov 8, 2022

Description

This PR extends typo checks of check_names.py to include PSA macro/enum names.
Resolve: #6416

Status

READY

Todos

Typos of PSA macro and enum names are not checked by check_names.py.
This commit extend the check list to include PSA_XXX references.
The words should be macro/enum names defined as public_macros,
internal_macros, private_macros and enums. This commit alse extend
the scope of enums to include those are defined in library/*.c.
A new type of macros "private", which are defined in library/*.c was
also added.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This macro is expected to be defined out of the library, and there
is no definition in the library. Thus it needs to be excluded from
typo check.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Fix the PSA_XXX typos detected by check_names.py.
PSA_WANT is actually not typo, but would cause a false negative
result. So PSA_WANT is reworded to PSA_WANT_xxx.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
@lpy4105 lpy4105 added enhancement 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 size-s Estimated task size: small (~2d) component-test Test framework and CI scripts priority-medium Medium priority - this can be reviewed as time permits labels Nov 8, 2022
The PSA_CRYPTO_C is excluded from typo check for the following
false negative report:

```
  > include/mbedtls/check_config.h:329: 'PSA_CRYPTO_C' looks like a typo. It
    was not found in any macros or any enums. If this is not a typo, put //no-
    check-names after it.
    |
329 |  * Note: ECJPAKE_C depends on MD_C || PSA_CRYPTO_C. */
    |                                       ^^^^^^^^^^^^

```

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-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

@gilles-peskine-arm gilles-peskine-arm added needs-backports Backports are missing or are pending review and approval. and removed needs-reviewer This PR needs someone to pick it up for review labels Nov 10, 2022
Copy link
Contributor

@yuhaoth yuhaoth left a comment

Choose a reason for hiding this comment

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

LGTM

yuhaoth
yuhaoth previously approved these changes Nov 11, 2022
@yuhaoth yuhaoth 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 Nov 11, 2022
@lpy4105 lpy4105 removed the needs-backports Backports are missing or are pending review and approval. label Nov 18, 2022
@gilles-peskine-arm gilles-peskine-arm added the needs-backports Backports are missing or are pending review and approval. label Nov 22, 2022
r"MBEDTLS_TEST_LIBTESTDRIVER*")
r"MBEDTLS_TEST_LIBTESTDRIVER*|"
r"PSA_CRYPTO_DRIVER_TEST|"
r"PSA_CRYPTO_C")
Copy link
Contributor

Choose a reason for hiding this comment

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

PSA_CRYPTO_C is not needed here. There's only one place that uses it in comment in check_config.h and it can be easily fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know you are referring to

* Note: ECJPAKE_C depends on MD_C || PSA_CRYPTO_C. */

I think it might not be a typo. The MBEDTLS_ prefix is omitted from the macro names not only in PSA_CRYPTO_C, but also in ECJPAKE_C and MD_C. I would like to keep the exclusion here OR add the MBEDTLS_ back for all these three macro names. What's you suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not really a typo, just a decision to shorten the names to keep it compact :)
Compliance-(or typo-)checking scripts should have priority over such simplification in comments, so I would suggest either:

  • Only changing MBEDTLS_PSA_CRYPTO_C to keep the script happy (it's fine, these are just comments);
  • Changing all of these to full macro names to be consistent.

Copy link
Contributor

@AndrzejKurek AndrzejKurek left a comment

Choose a reason for hiding this comment

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

One improvement requested that will also help keep this script in line with the backport.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
@lpy4105 lpy4105 dismissed stale reviews from yuhaoth and gilles-peskine-arm via 3bb0e43 November 24, 2022 09:31
Copy link
Contributor

@yuhaoth yuhaoth left a comment

Choose a reason for hiding this comment

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

LGTM

@mpg mpg removed the needs-backports Backports are missing or are pending review and approval. label Dec 13, 2022
@mpg mpg merged commit 2b70a3f into Mbed-TLS:development Dec 13, 2022
@lpy4105 lpy4105 deleted the 6416-psa_macros_name_typo branch December 14, 2022 02:32
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-medium Medium priority - this can be reviewed as time permits size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check_names misses typo in PSA macro name
5 participants