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

driver-only ECDSA: fix testing disparities in ecp, random, se_driver_hal #6946

Merged
merged 5 commits into from
Feb 3, 2023

Conversation

valeriosetti
Copy link
Contributor

@valeriosetti valeriosetti commented Jan 18, 2023

Description

The goal of this PR is to solve test disparities with and without driver implementation when ECDSA is accelerated. Full description is provided in #6856.
Resolves #6856

NOTES

Gatekeeper checklist

  • changelog not required
  • backport not required
  • tests provided

@valeriosetti valeriosetti requested a review from mpg January 18, 2023 16:37
@valeriosetti valeriosetti self-assigned this Jan 18, 2023
@valeriosetti valeriosetti added enhancement 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) labels Jan 18, 2023
@valeriosetti
Copy link
Contributor Author

Hi @gilles-peskine-arm, I'm adding you as reviewer here since we started a discussion on the original issue and I thought you might be interested in this.
Let's also continue the discussion here for simplicity ;)

@valeriosetti
Copy link
Contributor Author

Compared to my previous attempt and following @gilles-peskine-arm suggestion I did the following:

  • instead of adding a new possible option for depends_on in the .data file, which didn't look very good to me, I preferred to add a new "line" to the .data file called test_options
  • this line is parsed from the generate_test_code.py script
  • several test options can be specified there, but so far only EXCLUDE_FROM_DRIVER_TEST_COVERAGE_PARITY is supported
  • if EXCLUDE_FROM_DRIVER_TEST_COVERAGE_PARITY is defined for that specific test and if the script is invoked with --driver_coverage_test command line option (from the Makefile in our case), then that test is skipped

As a consequence:

  • there is no need to further modify analyze_outcomes.py since the "critical" test is not present so it cannot cause disparities
  • the "critical" test is not always skipped but only when the DRIVER_COVERAGE_TEST environment variable is defined when invoking the makefile from the command line (i.e. DRIVER_COVERAGE_TEST=1 make tests)

Wdyt?

@mpg
Copy link
Contributor

mpg commented Jan 24, 2023

This needs rebasing now that #6855 has been merged. Also, since this is the first follow-up to #6855, can you fix the two typos that @mprse spotted in his review?

@valeriosetti
Copy link
Contributor Author

This needs rebasing now that #6855 has been merged.

yes, I'll do it immediately

Also, since this is the first follow-up to #6855, can you fix #6855 (review)?

sure!

Only 1 last question on my side. Concerning the discussion in the original issue and in particular to this part:

what do you think about my point that referring to a case by its description would be acceptable in the specific case of an ignore list, since any change in the description would be noticed as a result of the script failing?

That's not great, but it's acceptable.

it seems to me that I can return back to the original implementation I proposed, right? It was based on a "simple" check of the test case description in order to understand which test was to be skipped in the driver's coverage analysis

@mpg
Copy link
Contributor

mpg commented Jan 25, 2023

it seems to me that I can return back to the original implementation I proposed, right? It was based on a "simple" check of the test case description in order to understand which test was to be skipped in the driver's coverage analysis

Yes, if that's not too much trouble.

What I like with the original implementation is that all the information about what to ignore is centralized in one data structure in analyze_outcomes.py. Also, it allows trivially to specify what can be ignored per reference-driver pair. Even in terms of code, I think it's better if the changes are confined to analyze_outcomes.py, rather than having to change generate_test_code.py - if we want to change the architecture for driver parity testing in the future, it will be easier if its implementation is well centralized.

@valeriosetti
Copy link
Contributor Author

Yes, if that's not too much trouble.

This is not a problem at all! I asked mostly to be sure what to do ;)

Even in terms of code, I think it's better if the changes are confined to analyze_outcomes.py

I agree. As you might have seen yesterday I tried to fix also other issues (in other python scripts) coming from the fact that I changed something in the test generator script. The original implementation was definitely more limited in scope as number of changes

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
… suite

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

This last forced push is to cancel out the previous implementation, which attempted to modify the test generator script, and to return to a more simple solution which only acts on analyze_outcomes.py.
Now it should be ready for review (if the CI is happy)

mpg
mpg previously approved these changes Jan 25, 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.

Looks all good to me! Thanks!

tests/scripts/analyze_outcomes.py Outdated Show resolved Hide resolved
@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, and removed needs-ci Needs to pass CI tests labels Jan 25, 2023
@valeriosetti valeriosetti removed the request for review from gilles-peskine-arm February 1, 2023 12:37
@mprse mprse self-requested a review February 1, 2023 12:43
mprse
mprse previously approved these changes Feb 2, 2023
Copy link
Contributor

@mprse mprse left a comment

Choose a reason for hiding this comment

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

LGTM. Left only one minor proposition for improvement.
Tested locally with positive results.

Comment on lines 78 to 80
full_test_suite = key.split(';')[0] # retrieve full test suit name
test_string = key.split(';')[1] # retrieve the text string of this test
test_suite = full_test_suite.split('.')[0] # retrieve main part of test suit name
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I think these lines can be move to line 87, so we have everything together.
Additionally if we continue loop because test suite was ignored(line 82) or test was not executed(line 86) it is not needed.

@mprse mprse 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 Feb 2, 2023
@mpg
Copy link
Contributor

mpg commented Feb 2, 2023

@valeriosetti Both Przemek and I left optional comments. Since the CI results have expired in the meantime, I think it would make sense for you to push an updated version, so the CI will run again tonight and we can re-review and hopefully merge tomorrow.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
@valeriosetti valeriosetti dismissed stale reviews from mprse and mpg via 00c1ccb February 2, 2023 10:33
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

@mpg mpg added needs-review Every commit must be reviewed by at least two team members, needs-ci Needs to pass CI tests and removed approved Design and code approved - may be waiting for CI or backports needs-reviewer This PR needs someone to pick it up for review labels Feb 2, 2023
@mpg mpg requested a review from mprse February 2, 2023 10:42
Copy link
Contributor

@mprse mprse left a comment

Choose a reason for hiding this comment

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

LGTM

@mprse mprse 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 Feb 2, 2023
@mpg mpg removed the needs-ci Needs to pass CI tests label Feb 3, 2023
@mpg mpg merged commit d56def5 into Mbed-TLS:development Feb 3, 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 size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

driver-only ECDSA: fix testing disparities in ecp, random, se_driver_hal
3 participants