summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2024-02-27 13:34:49 +1100
committerMatt Caswell <matt@openssl.org>2024-03-11 12:08:00 +0000
commit5df34ca70a6edc4c0698a6e98add6450b9ce24ff (patch)
tree41935a7f1fa3ca88dc2c3490937d667a62187d27
parent854539889d31ed2ea63280256fd7aab66e828ae5 (diff)
Make the generated params_idx.c file deterministic if run multiple
times. Fixes #23672 There are many name/value pairs currently that have duplicate names e.g. 'CAPABILITY_TLS_GROUP_MAX_TLS' => "tls-max-tls", 'CAPABILITY_TLS_SIGALG_MAX_TLS' => "tls-max-tls", Stripping the .pm file down to just the above entries and running multiple times gives different results for the produce_decoder. On multiple runs any iterations over the unordered hash table keys using foreach my $name (keys %params) results in a different order on multiple runs. Because of this the mapping from the hash 'value' back to the 'key' will be different. Note that the code also uses another mechanism in places that uses "name1" => "value" "name2" => "*name1" Rather than fix all the strings the change done was to sort the keys. If we were to chose to fix the strings then the perl code should be changed to detect duplicates. Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23688)
-rw-r--r--util/perl/OpenSSL/paramnames.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/perl/OpenSSL/paramnames.pm b/util/perl/OpenSSL/paramnames.pm
index df93202d1d..e7de37bb6a 100644
--- a/util/perl/OpenSSL/paramnames.pm
+++ b/util/perl/OpenSSL/paramnames.pm
@@ -563,7 +563,7 @@ sub generate_trie {
my $nodes = 0;
my $chars = 0;
- foreach my $name (keys %params) {
+ foreach my $name (sort keys %params) {
my $val = $params{$name};
if (substr($val, 0, 1) ne '*') {
my $cursor = \%trie;