From: Simo Sorce Date: Mon, 13 Oct 2025 21:48:54 +0000 (-0400) Subject: storemgmt: Use include file for generated code X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e982779f99028e189f9fffd8217d2bce96a4620;p=thirdparty%2Fopenssl.git storemgmt: Use include file for generated code 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 f4d759b5d6f..9c29f7ef2ad 100644 --- a/.gitignore +++ b/.gitignore @@ -137,9 +137,9 @@ providers/implementations/signature/rsa_sig.c providers/implementations/signature/slh_dsa_sig.c providers/implementations/signature/sm2_sig.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 +providers/implementations/storemgmt/file_store_any2obj.inc +providers/implementations/storemgmt/file_store.inc +providers/implementations/storemgmt/winstore_store.inc providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c providers/implementations/ciphers/cipher_aes_gcm_siv.c diff --git a/build.info b/build.info index 66898cb8a7e..27f4866a4e5 100644 --- a/build.info +++ b/build.info @@ -96,9 +96,9 @@ DEPEND[]=include/openssl/asn1.h \ providers/implementations/signature/slh_dsa_sig.c \ providers/implementations/signature/sm2_sig.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 \ + providers/implementations/storemgmt/file_store_any2obj.inc \ + providers/implementations/storemgmt/file_store.inc \ + providers/implementations/storemgmt/winstore_store.inc \ providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c \ providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c \ providers/implementations/ciphers/cipher_aes_gcm_siv.c \ @@ -214,9 +214,9 @@ DEPEND[providers/implementations/asymciphers/rsa_enc.c \ providers/implementations/signature/slh_dsa_sig.c \ providers/implementations/signature/sm2_sig.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 \ + providers/implementations/storemgmt/file_store_any2obj.inc \ + providers/implementations/storemgmt/file_store.inc \ + providers/implementations/storemgmt/winstore_store.inc \ providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c \ providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c \ providers/implementations/ciphers/cipher_aes_gcm_siv.c \ @@ -347,12 +347,12 @@ GENERATE[providers/implementations/signature/sm2_sig.c]=\ providers/implementations/signature/sm2_sig.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]=\ - providers/implementations/storemgmt/file_store.c.in -GENERATE[providers/implementations/storemgmt/winstore_store.c]=\ - providers/implementations/storemgmt/winstore_store.c.in +GENERATE[providers/implementations/storemgmt/file_store_any2obj.inc]=\ + providers/implementations/storemgmt/file_store_any2obj.inc.in +GENERATE[providers/implementations/storemgmt/file_store.inc]=\ + providers/implementations/storemgmt/file_store.inc.in +GENERATE[providers/implementations/storemgmt/winstore_store.inc]=\ + providers/implementations/storemgmt/winstore_store.inc.in GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c]=\ providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c.in GENERATE[providers/implementations/ciphers/cipher_aes_cbc_hmac_sha_etm.c]=\ diff --git a/providers/implementations/storemgmt/file_store.c.in b/providers/implementations/storemgmt/file_store.c similarity index 98% rename from providers/implementations/storemgmt/file_store.c.in rename to providers/implementations/storemgmt/file_store.c index c1007af34cc..527c5f2b7e4 100644 --- a/providers/implementations/storemgmt/file_store.c.in +++ b/providers/implementations/storemgmt/file_store.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); --} /* This file has quite some overlap with engines/e_loader_attic.c */ @@ -35,6 +32,8 @@ use OpenSSL::paramnames qw(produce_param_decoder); #include "prov/providercommon.h" #include "prov/file_store_local.h" +#include "providers/implementations/storemgmt/file_store.inc" + DEFINE_STACK_OF(OSSL_STORE_INFO) #ifdef _WIN32 @@ -293,13 +292,6 @@ void *file_attach(void *provctx, OSSL_CORE_BIO *cin) * ------------------ */ -{- produce_param_decoder('file_set_ctx_params', - (['OSSL_STORE_PARAM_PROPERTIES', 'propq', 'utf8_string'], - ['OSSL_STORE_PARAM_EXPECT', 'expect', 'int'], - ['OSSL_STORE_PARAM_SUBJECT', 'sub', 'octet_string'], - ['OSSL_STORE_PARAM_INPUT_TYPE', 'type', 'utf8_string'], - )); -} - static const OSSL_PARAM *file_settable_ctx_params(void *provctx) { return file_set_ctx_params_list; diff --git a/providers/implementations/storemgmt/file_store.inc.in b/providers/implementations/storemgmt/file_store.inc.in new file mode 100644 index 00000000000..a108df48e22 --- /dev/null +++ b/providers/implementations/storemgmt/file_store.inc.in @@ -0,0 +1,18 @@ +/* + * 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('file_set_ctx_params', + (['OSSL_STORE_PARAM_PROPERTIES', 'propq', 'utf8_string'], + ['OSSL_STORE_PARAM_EXPECT', 'expect', 'int'], + ['OSSL_STORE_PARAM_SUBJECT', 'sub', 'octet_string'], + ['OSSL_STORE_PARAM_INPUT_TYPE', 'type', 'utf8_string'], + )); -} diff --git a/providers/implementations/storemgmt/file_store_any2obj.c.in b/providers/implementations/storemgmt/file_store_any2obj.c similarity index 97% rename from providers/implementations/storemgmt/file_store_any2obj.c.in rename to providers/implementations/storemgmt/file_store_any2obj.c index c21c3ad3723..cf61b00dbf3 100644 --- a/providers/implementations/storemgmt/file_store_any2obj.c.in +++ b/providers/implementations/storemgmt/file_store_any2obj.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); --} /* * This is a decoder that's completely internal to the 'file:' store @@ -41,6 +38,7 @@ use OpenSSL::paramnames qw(produce_param_decoder); #include "crypto/pem.h" /* For internal PVK and "blob" headers */ #include "prov/bio.h" #include "prov/file_store_local.h" +#include "providers/implementations/storemgmt/file_store_any2obj.inc" /* * newctx and freectx are not strictly necessary. However, the method creator, @@ -70,10 +68,6 @@ static void any2obj_freectx(void *ctx) OPENSSL_free(ctx); } -{- produce_param_decoder('any2obj_set_ctx_params', - (['OSSL_OBJECT_PARAM_DATA_STRUCTURE', 'datastruct', 'utf8_string'], - )); -} - static int any2obj_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { struct any2obj_ctx_st *ctx = vctx; @@ -190,7 +184,6 @@ static int msblob2obj_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, if (!ok) goto next; - ERR_set_mark(); p = (unsigned char *)&mem->data[0]; ok = ossl_do_blob_header(&p, 16, &magic, &bitlen, &isdss, &ispub) > 0; @@ -259,7 +252,6 @@ static int pvk2obj_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, if (!ok) goto next; - ERR_set_mark(); p = (unsigned char *)&mem->data[0]; ok = ossl_do_PVK_header(&p, 24, 0, &isdss, &saltlen, &keylen) > 0; diff --git a/providers/implementations/storemgmt/file_store_any2obj.inc.in b/providers/implementations/storemgmt/file_store_any2obj.inc.in new file mode 100644 index 00000000000..9e3f6f61dfd --- /dev/null +++ b/providers/implementations/storemgmt/file_store_any2obj.inc.in @@ -0,0 +1,16 @@ +/* + * 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('any2obj_set_ctx_params', + (['OSSL_OBJECT_PARAM_DATA_STRUCTURE', 'datastruct', 'utf8_string'], + )); -} diff --git a/providers/implementations/storemgmt/winstore_store.c.in b/providers/implementations/storemgmt/winstore_store.c similarity index 96% rename from providers/implementations/storemgmt/winstore_store.c.in rename to providers/implementations/storemgmt/winstore_store.c index 5539e1e8467..42a84107adf 100644 --- a/providers/implementations/storemgmt/winstore_store.c.in +++ b/providers/implementations/storemgmt/winstore_store.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 @@ -32,6 +29,7 @@ use OpenSSL::paramnames qw(produce_param_decoder); # include #endif #include +#include "providers/implementations/storemgmt/winstore_store.inc" enum { STATE_IDLE, @@ -108,11 +106,6 @@ static void *winstore_attach(void *provctx, OSSL_CORE_BIO *cin) return NULL; /* not supported */ } -{- produce_param_decoder('winstore_set_ctx_params', - (['OSSL_STORE_PARAM_SUBJECT', 'sub', 'octet_string'], - ['OSSL_STORE_PARAM_PROPERTIES', 'propq', 'utf8_string'], - )); -} - static const OSSL_PARAM *winstore_settable_ctx_params(void *loaderctx, const OSSL_PARAM params[]) { return winstore_set_ctx_params_list; diff --git a/providers/implementations/storemgmt/winstore_store.inc.in b/providers/implementations/storemgmt/winstore_store.inc.in new file mode 100644 index 00000000000..f8c7c46869b --- /dev/null +++ b/providers/implementations/storemgmt/winstore_store.inc.in @@ -0,0 +1,17 @@ +/* + * 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('winstore_set_ctx_params', + (['OSSL_STORE_PARAM_SUBJECT', 'sub', 'octet_string'], + ['OSSL_STORE_PARAM_PROPERTIES', 'propq', 'utf8_string'], + )); -}