Skip to content

Add SSL log validator script#296

Open
gilles-peskine-arm wants to merge 7 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:ssl_fork_server-rng-test-framework
Open

Add SSL log validator script#296
gilles-peskine-arm wants to merge 7 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:ssl_fork_server-rng-test-framework

Conversation

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor

Add a script scripts/validate_ssl_logs.py to validate logs from ssl_client2 and ssl_server2. Useful for testing things that we can't test from within a single run of a test programs. Use this to check that when two clients connect to the same server, the connections use different random values.

PR checklist

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When two clients connect to the same server, validate that they get distinct
server_random values and distinct ephemeral public keys.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
If the data from `MBEDTLS_SSL_DEBUG_BUF` that's listed in text form after
the hex digits starts with two bytes that happen to be hex digits, this
could be interpreted as an extra pair of hex digits. Fix this.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels Apr 1, 2026
@gilles-peskine-arm gilles-peskine-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 Apr 1, 2026
bjwtaylor
bjwtaylor previously approved these changes Apr 8, 2026
if 'DHM: GY' in client_log.dumps:
values = client_log.dumps['DHM: GY']
else:
values = client_log.dumps['server ephemeral public key']
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If I've understood correctly I believe this will abort if the lookup fails as no matches are present, is this the desired behavior or should it return a validation failure?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I'll return a more informative and non-fatal validation failure.

def main() -> int:
"""Command line entry point."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--list-tasks',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you need to add action='store_true', action='store_false', or nargs=0, argparse to avoid the error "error: argument --list-tasks: expected one argument" here?

@bjwtaylor bjwtaylor self-requested a review April 8, 2026 13:27
Copy link
Copy Markdown

@bjwtaylor bjwtaylor left a comment

Choose a reason for hiding this comment

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

As per previous comments

@bjwtaylor bjwtaylor self-requested a review April 8, 2026 13:27
Copy link
Copy Markdown

@bjwtaylor bjwtaylor left a comment

Choose a reason for hiding this comment

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

As per previous comments, approved by mistake. Was supposed to be a comment

@bjwtaylor bjwtaylor self-requested a review April 8, 2026 13:28
@gilles-peskine-arm gilles-peskine-arm removed the needs-reviewer This PR needs someone to pick it up for review label Apr 8, 2026
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…f the key is not found

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Don't require the file and task arguments when `--list-tasks` is passed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Every commit must be reviewed by at least two team members. priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

Projects

Development

Successfully merging this pull request may close these issues.

2 participants