From: Simo Sorce Date: Fri, 10 Oct 2025 20:32:27 +0000 (-0400) Subject: Move generic skeymgmt param decoder to .inc file X-Git-Tag: 4.0-PRE-CLANG-FORMAT-WEBKIT~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=594c436d24cf2c1bd70caf7ad31a223f54cc9ce8;p=thirdparty%2Fopenssl.git Move generic skeymgmt param decoder to .inc file The Perl-generated code for the generic symmetric key import parameter decoder is extracted from `generic.c.in` into a new `generic.inc.in` template. The main `generic.c` file now includes the generated `generic.inc` file. This change separates the auto-generated code from the handwritten C code, improving modularity and readability. Signed-off-by: Simo Sorce Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/28838) --- diff --git a/.gitignore b/.gitignore index 88cd92f9d0d..f4d759b5d6f 100644 --- a/.gitignore +++ b/.gitignore @@ -136,7 +136,7 @@ providers/implementations/signature/ml_dsa_sig.c providers/implementations/signature/rsa_sig.c providers/implementations/signature/slh_dsa_sig.c providers/implementations/signature/sm2_sig.c -providers/implementations/skeymgmt/generic.c +providers/implementations/skeymgmt/generic.inc providers/implementations/storemgmt/file_store_any2obj.c providers/implementations/storemgmt/file_store.c providers/implementations/storemgmt/winstore_store.c @@ -155,6 +155,7 @@ providers/implementations/ciphers/cipher_chacha20_poly1305.c providers/implementations/ciphers/cipher_null.c providers/implementations/ciphers/cipher_rc4_hmac_md5.c providers/implementations/ciphers/cipher_sm2_xts.c +providers/implementations/ciphers/cipher_sm4_xts.c providers/implementations/digests/blake2_prov.c providers/implementations/digests/digestcommon.c providers/implementations/digests/mdc2_prov.c diff --git a/build.info b/build.info index d63a1d9e028..66898cb8a7e 100644 --- a/build.info +++ b/build.info @@ -95,7 +95,7 @@ DEPEND[]=include/openssl/asn1.h \ providers/implementations/signature/rsa_sig.c \ providers/implementations/signature/slh_dsa_sig.c \ providers/implementations/signature/sm2_sig.c \ - providers/implementations/skeymgmt/generic.c \ + providers/implementations/skeymgmt/generic.inc \ providers/implementations/storemgmt/file_store_any2obj.c \ providers/implementations/storemgmt/file_store.c \ providers/implementations/storemgmt/winstore_store.c \ @@ -213,7 +213,7 @@ DEPEND[providers/implementations/asymciphers/rsa_enc.c \ providers/implementations/signature/rsa_sig.c \ providers/implementations/signature/slh_dsa_sig.c \ providers/implementations/signature/sm2_sig.c \ - providers/implementations/skeymgmt/generic.c \ + providers/implementations/skeymgmt/generic.inc \ providers/implementations/storemgmt/file_store_any2obj.c \ providers/implementations/storemgmt/file_store.c \ providers/implementations/storemgmt/winstore_store.c \ @@ -345,8 +345,8 @@ GENERATE[providers/implementations/signature/slh_dsa_sig.c]=\ providers/implementations/signature/slh_dsa_sig.c.in GENERATE[providers/implementations/signature/sm2_sig.c]=\ providers/implementations/signature/sm2_sig.c.in -GENERATE[providers/implementations/skeymgmt/generic.c]=\ - providers/implementations/skeymgmt/generic.c.in +GENERATE[providers/implementations/skeymgmt/generic.inc]=\ + providers/implementations/skeymgmt/generic.inc.in GENERATE[providers/implementations/storemgmt/file_store_any2obj.c]=\ providers/implementations/storemgmt/file_store_any2obj.c.in GENERATE[providers/implementations/storemgmt/file_store.c]=\ diff --git a/providers/implementations/skeymgmt/generic.c.in b/providers/implementations/skeymgmt/generic.c similarity index 92% rename from providers/implementations/skeymgmt/generic.c.in rename to providers/implementations/skeymgmt/generic.c index d32624b9308..92b8532adfb 100644 --- a/providers/implementations/skeymgmt/generic.c.in +++ b/providers/implementations/skeymgmt/generic.c @@ -6,9 +6,6 @@ * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ -{- -use OpenSSL::paramnames qw(produce_param_decoder); --} #include #include @@ -22,6 +19,8 @@ use OpenSSL::paramnames qw(produce_param_decoder); #include "prov/implementations.h" #include "prov/skeymgmt_lcl.h" +#include "providers/implementations/skeymgmt/generic.inc" + void generic_free(void *keydata) { PROV_SKEY *generic = keydata; @@ -33,10 +32,6 @@ void generic_free(void *keydata) OPENSSL_free(generic); } -{- produce_param_decoder('generic_skey_import', - (['OSSL_SKEY_PARAM_RAW_BYTES', 'raw_bytes', 'octet_string'], - )); -} - void *generic_import(void *provctx, int selection, const OSSL_PARAM params[]) { OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx); diff --git a/providers/implementations/skeymgmt/generic.inc.in b/providers/implementations/skeymgmt/generic.inc.in new file mode 100644 index 00000000000..6f30d5bce1e --- /dev/null +++ b/providers/implementations/skeymgmt/generic.inc.in @@ -0,0 +1,15 @@ +/* + * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ +{- +use OpenSSL::paramnames qw(produce_param_decoder); +-} + +{- produce_param_decoder('generic_skey_import', + (['OSSL_SKEY_PARAM_RAW_BYTES', 'raw_bytes', 'octet_string'], + )); -}