]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
params: allow param name aliases
authorPauli <ppzgs1@gmail.com>
Thu, 10 Jul 2025 00:40:55 +0000 (10:40 +1000)
committerTomas Mraz <tomas@openssl.org>
Thu, 31 Jul 2025 18:21:25 +0000 (20:21 +0200)
We allowed multiple names for the same parameter in a number of places.
This is best dealt with in the generated code.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27923)

util/perl/OpenSSL/paramnames.pm

index 075bbd190e728cc52d97736e39c5f66deae7ee24..e13deb476f90633d83dae7175273fb5ae10294fe 100644 (file)
@@ -688,7 +688,7 @@ sub generate_decoder_from_trie {
         }
         print ")) {\n";
         trie_matched($field, $num, $indent1, $indent2);
-       printf "%s}\n", $indent0;
+        printf "%s}\n", $indent0;
         return;
     }
 
@@ -817,12 +817,16 @@ sub output_param_decoder {
     # Output param pointer structure
     printf "#ifndef %s_st\n", $decoder_name_base;
     printf "struct %s_st {\n", $decoder_name_base;
+    my %done_prms = ();
     foreach my $pident (sort values %prms) {
-        if (defined($concat_num{$pident})) {
-            printf "    OSSL_PARAM *%s[%s];\n", $pident, $concat_num{$pident};
-            printf "    int num_%s;\n", $pident;
-        } else {
-            printf "    OSSL_PARAM *%s;\n", $pident;
+        if (not defined $done_prms{$pident}) {
+            $done_prms{$pident} = 1;
+            if (defined($concat_num{$pident})) {
+                printf "    OSSL_PARAM *%s[%s];\n", $pident, $concat_num{$pident};
+                printf "    int num_%s;\n", $pident;
+            } else {
+                printf "    OSSL_PARAM *%s;\n", $pident;
+            }
         }
     }
     print "};\n#endif\n\n";