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

ssl-opt: improve PSK mode detection #9556

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Sep 11, 2024

Fix some issues in ssl-opt.sh around requirement detections, mostly related to PSK vs certificates. Prerequisite of #9541.

Straight forward port of #9546.

PR checklist

  • changelog not required because: test only
  • development PR here
  • framework PR ssl-opt: improve PSK mode detection mbedtls-framework#44
  • 3.6 PR [3.6] ssl-opt: improve PSK mode detection #9546
  • 2.28 PR not required because: it's mostly about TLS 1.3 changes, and not worth backporting the few changes that aren't.
  • tests provided + check that we aren't executing fewer test cases, compared with the baseline outcomes.csv.xz (excluding ;component_release_ which are not run in the PR job). The following command lists the test cases that have changed, excluding those that used to be skipped; its output is empty.
    wget -O 8c95999b3828f1b3e7a069e61c2b33b9f509e446.outcomes.csv.xz https://mbedtls.trustedfirmware.org/job/mbed-tls-nightly-tests/942/artifact/outcomes.csv.xz
    wget -O 1.outcomes.csv.xz https://mbedtls.trustedfirmware.org/job/mbed-tls-pr-head/job/PR-9556-head/1/artifact/outcomes.csv.xz
    comm -23 <(xzcat 8c95999b3828f1b3e7a069e61c2b33b9f509e446.outcomes.csv.xz | grep -v ';component_release_' | sort) <(xzcat 1.outcomes.csv.xz | sort) | grep -v ';SKIP;'
    

@gilles-peskine-arm gilles-peskine-arm added component-tls needs-ci Needs to pass CI tests size-s Estimated task size: small (~2d) labels Sep 11, 2024
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-backports Backports are missing or are pending review and approval. and removed needs-ci Needs to pass CI tests labels Sep 11, 2024
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 but it seems you need to rebase the framework PR.

@gilles-peskine-arm
Copy link
Contributor Author

I'll need to rewrite the history to amend the submodule update commit, anyway, once the framework PR is merged.

How about I do that now, since the framework PR is approved and has passed the CI on both branches?

mpg
mpg previously approved these changes Sep 13, 2024
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 but there's a conflict in framework (also in the 3.6 PR now).

@mpg mpg removed the needs-review Every commit must be reviewed by at least two team members, label Sep 13, 2024
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…config

It's faster and more readable.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When requiring a cryptographic mechanism for the sake of certificate
authentication, also require that certificate authentication is enabled.

Setting auth_mode explicitly means that we're testing something related to
how certificate-based authentication is handled, so require a key exchange
with certificate-based authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Don't add a certificate requirement when PSK is enabled.

Do command line requirement detection after the injection of PSK into the
command line in PSK-only mode. Otherwise certificate requirements would be
added even in PSK-only mode.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
requires_certificate_authentication was called in more places, but did not
do fine-grained analysis of key exchanges and so gave the wrong results in
some builds.

requires_key_exchange_with_cert_in_tls12_or_tls13_enabled gave the correct
result but was only used in some test cases, not in the automatic detection
code.

Remove all uses of requires_key_exchange_with_cert_in_tls12_or_tls13_enabled
because they are in fact covered by automated detection that calls
requires_certificate_authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…lable

The point of PSK-only mode is to transform certificate-based command lines
into PSK-based command lines, when the certificates are not relevant to what
is being tested. So it makes sense to do that in with PSK-ephemeral key
exchanges too.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
It was causing the test case to be incorrectly skipped as needing
certificate authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When checking whether the build supports certificate authentication, check
the key exchange modes enabled in the default protocol version. This is TLS
1.3 when it's enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm
Copy link
Contributor Author

I've rebased both this PR and the 3.6 one to get the latest framework updates.

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.

The rebase looks good to me.

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

@gilles-peskine-arm gilles-peskine-arm added the approved Design and code approved - may be waiting for CI or backports label Sep 13, 2024
@gilles-peskine-arm gilles-peskine-arm added this pull request to the merge queue Sep 13, 2024
Merged via the queue into Mbed-TLS:development with commit e16aecc Sep 13, 2024
4 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 component-tls needs-backports Backports are missing or are pending review and approval. size-s Estimated task size: small (~2d)
Development

Successfully merging this pull request may close these issues.

3 participants