Backport 3.6: ssl_fork_server RNG testing#10666
Open
gilles-peskine-arm wants to merge 9 commits intoMbed-TLS:mbedtls-3.6from
Open
Backport 3.6: ssl_fork_server RNG testing#10666gilles-peskine-arm wants to merge 9 commits intoMbed-TLS:mbedtls-3.6from
gilles-peskine-arm wants to merge 9 commits intoMbed-TLS:mbedtls-3.6from
Conversation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
`ssl_fork_server` reseeds its RNG, so in a build with a nonvolatile seed, it re-reads the seed file midway. If the client also rewrites the seed file while the server is running, that causes the test conditions to not reflect real-world conditions for the server. Fix this by running `ssl_fork_server` in its own directory when we're asserting properties of the random generator. This was a relatively easy way to separate the client seed file from the server seed file, since the seed file name `"seedfile"` is not configurable at runtime. This mostly matters for builds with no actual entropy source, only an NV seed. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Assert that when two clients connect to ssl_fork_server, they see different random values from the server. This validates that each child process has its own random generator state. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Assert that when two clients connect to ssl_fork_server, they see different ephemeral public keys from the server. This validates that each child process has its own random generator state. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Run some of `ssl-opt.sh` on builds with only an NV seed as the entropy source. There isn't much that isn't already covered by unit tests, but do test that it works in a "real" program. In particular, run `ssl_fork_server` which has a peculiar challenge since its RNG state is replicated. Test both builds with `MBEDTLS_USE_PSA_CRYPTO` enabled (via the `full` config) and `MBEDTLS_USE_PSA_CRYPTO` disabled (by minimally tweaking the default config), as this makes a difference to RNG usage. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
6 tasks
bjwtaylor
reviewed
Apr 10, 2026
| @@ -2041,6 +2076,10 @@ cleanup() { | |||
| rm -f $CLI_OUT $SRV_OUT $PXY_OUT $SESSION | |||
There was a problem hiding this comment.
Fairly minor, however if I've understood correctly this cleanup is only run under the conditions on line 2273 ie. INT TERM HUP. Would it be better to to either add normal exit to the exit conditions or change the test -s as currently the seedfile will be reused for each test. If the test corrupts or overwrites it possibly could effect the result.
…ient random values Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
bjwtaylor
previously approved these changes
Apr 13, 2026
Fix a bug introduced in "Fix temporary directory left behind on normal exit" that caused the exit code of `ssl-opt.sh` to be 1 on success. Also, when exiting on a trapped signal, re-raise the signal rather than exiting with status 1. Also, on failure, where we report the number of failures through the exit code, clamp the exit code to 125 to avoid confusion with standard values. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test that
ssl_fork_serverhas a different RNG state in each client. Fixes #10664.Needs preceding PR: Mbed-TLS/mbedtls-framework#296
PR checklist