]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
AEAD params: generate a TRIE to decode AEAD cipher parameter names
authorPauli <ppzgs1@gmail.com>
Wed, 16 Apr 2025 07:32:13 +0000 (17:32 +1000)
committerTomas Mraz <tomas@openssl.org>
Wed, 7 May 2025 09:47:24 +0000 (11:47 +0200)
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27392)

build.info
providers/implementations/ciphers/build.info
providers/implementations/ciphers/ciphercommon.c.in
providers/implementations/include/prov/ciphercommon.h

index 329f01246373ef43958b2711476d9115927e0636..aca3b90960d3cfdd606bd7e8420091be6c6b1b42 100644 (file)
@@ -48,7 +48,8 @@ DEPEND[]=include/openssl/asn1.h \
          include/openssl/x509_acert.h \
          include/openssl/x509_vfy.h \
          include/crypto/bn_conf.h include/crypto/dso_conf.h \
-         include/internal/param_names.h
+         include/internal/param_names.h \
+         providers/implementations/ciphers/ciphercommon.c
 
 GENERATE[include/openssl/asn1.h]=include/openssl/asn1.h.in
 GENERATE[include/openssl/asn1t.h]=include/openssl/asn1t.h.in
@@ -84,8 +85,11 @@ GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
 GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
 
 DEPEND[include/internal/param_names.h \
+       providers/implementations/ciphers/ciphercommon.c \
        include/openssl/core_names.h]=util/perl|OpenSSL/paramnames.pm
 GENERATE[include/internal/param_names.h]=include/internal/param_names.h.in
+GENERATE[providers/implementations/ciphers/ciphercommon.c]=\
+    providers/implementations/ciphers/ciphercommon.c.in
 GENERATE[include/openssl/core_names.h]=include/openssl/core_names.h.in
 
 IF[{- defined $target{shared_defflag} -}]
index e9dbfecfacff62a4cfb6eeb0395324bcbe6d198d..35b672c150b2315bbebf5f8a2a38c15aec480f58 100644 (file)
@@ -90,6 +90,8 @@ SOURCE[$COMMON_GOAL]=\
         ciphercommon_gcm.c ciphercommon_gcm_hw.c \
         ciphercommon_ccm.c ciphercommon_ccm_hw.c
 
+INCLUDE[ciphercommon.o]=.
+
 IF[{- !$disabled{des} -}]
   SOURCE[$TDES_1_GOAL]=cipher_tdes.c cipher_tdes_common.c cipher_tdes_hw.c
 ENDIF
index 3ce7de7b3e928a669d51782c788759aaef67d971..782b7f0823115c9cd48ede50eab5722dcbfd1ed9 100644 (file)
@@ -6,18 +6,24 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
+{-
+use OpenSSL::paramnames qw(produce_decoder);
+-}
 
 /*
  * Generic dispatch table functions for ciphers.
  */
 
 /* For SSL3_VERSION */
+#include <string.h>
 #include <openssl/prov_ssl.h>
 #include <openssl/proverr.h>
 #include "ciphercommon_local.h"
 #include "prov/provider_ctx.h"
 #include "prov/providercommon.h"
 #include "internal/skey.h"
+#include "internal/e_os.h"
+#include "internal/param_names.h"
 #include "crypto/types.h"
 
 /*-
@@ -170,6 +176,20 @@ const OSSL_PARAM *ossl_cipher_aead_gettable_ctx_params(
     return cipher_aead_known_gettable_ctx_params;
 }
 
+/* Machine generated by util/perl/OpenSSL/paramnames.pm */
+{- produce_decoder('ossl_cipher_aead_get_ctx_params_find_pidx',
+                   ('CIPHER_PARAM_KEYLEN',
+                    'CIPHER_PARAM_IVLEN',
+                    'CIPHER_PARAM_AEAD_TAGLEN',
+                    'CIPHER_PARAM_IV',
+                    'CIPHER_PARAM_UPDATED_IV',
+                    'CIPHER_PARAM_AEAD_TAG',
+                    'CIPHER_PARAM_AEAD_TLS1_AAD_PAD',
+                    'CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN',
+                    'CIPHER_PARAM_AEAD_IV_GENERATED',
+                   )); -}
+/* End of machine generated */
+
 static const OSSL_PARAM cipher_aead_known_settable_ctx_params[] = {
     OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_AEAD_IVLEN, NULL),
     OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
@@ -185,6 +205,16 @@ const OSSL_PARAM *ossl_cipher_aead_settable_ctx_params(
     return cipher_aead_known_settable_ctx_params;
 }
 
+/* Machine generated by util/perl/OpenSSL/paramnames.pm */
+{- produce_decoder('ossl_cipher_aead_set_ctx_params_find_pidx',
+                   ('CIPHER_PARAM_AEAD_IVLEN',
+                    'CIPHER_PARAM_AEAD_TAG',
+                    'CIPHER_PARAM_AEAD_TLS1_AAD',
+                    'CIPHER_PARAM_AEAD_TLS1_IV_FIXED',
+                    'CIPHER_PARAM_AEAD_TLS1_SET_IV_INV',
+                   )); -}
+/* End of machine generated */
+
 void ossl_cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx)
 {
     if (ctx != NULL && ctx->alloced) {
index 46efdc80033f527e934b88d03a04407db841a8fe..7d908c03aa3252256bcf0e451bf29888ab0242a3 100644 (file)
@@ -372,4 +372,8 @@ int ossl_cipher_trailingdata(unsigned char *buf, size_t *buflen,
                              size_t blocksize,
                              const unsigned char **in, size_t *inlen);
 
+/* Machine generated TRIE based OSSL_PARAM name parsers */
+int ossl_cipher_aead_get_ctx_params_find_pidx(const char *);
+int ossl_cipher_aead_set_ctx_params_find_pidx(const char *);
+
 #endif