/*
 * 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);
-}

{- our @HKDF_COMMON_SET_CTX_PARAMS = (
       ['OSSL_KDF_PARAM_MODE',       'mode',   'utf8_string'],
       ['OSSL_KDF_PARAM_MODE',       'mode',   'int'],
       ['OSSL_KDF_PARAM_KEY',        'key',    'octet_string'],
       ['OSSL_KDF_PARAM_SALT',       'salt',   'octet_string'],
   );
   our @HKDF_DIGEST_SET_CTX_PARAMS = (
       ['OSSL_KDF_PARAM_PROPERTIES', 'propq',  'utf8_string'],
       ['OSSL_KDF_PARAM_DIGEST',     'digest', 'utf8_string'],
   );
   our @HKDF_INFO_SET_CTX_PARAMS = (
       ['OSSL_KDF_PARAM_INFO',       'info',   'octet_string', HKDF_MAX_INFOS],
   );

   produce_param_decoder('hkdf_set_ctx_params',
                         (@HKDF_COMMON_SET_CTX_PARAMS,
                          @HKDF_DIGEST_SET_CTX_PARAMS,
                          @HKDF_INFO_SET_CTX_PARAMS,
                          ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k',  'int', 'fips'],
                         )); -}

{- produce_param_decoder('hkdf_get_ctx_params',
                         (['OSSL_KDF_PARAM_SIZE',                    'size',   'size_t'],
                          ['OSSL_KDF_PARAM_DIGEST',                  'digest', 'utf8_string'],
                          ['OSSL_KDF_PARAM_MODE',                    'mode',   'utf8_string'],
                          ['OSSL_KDF_PARAM_MODE',                    'mode',   'int'],
                          ['OSSL_KDF_PARAM_SALT',                    'salt',   'octet_string'],
                          ['OSSL_KDF_PARAM_INFO',                    'info',   'octet_string'],
                          ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind',    'int', 'fips'],
                         )); -}

{- produce_param_decoder('hkdf_fixed_digest_set_ctx_params',
                         (@HKDF_COMMON_SET_CTX_PARAMS,
                          @HKDF_INFO_SET_CTX_PARAMS,
                          ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k',  'int', 'fips'],
                          ['OSSL_KDF_PARAM_DIGEST',         'invalid param'],
                         )); -}

{- produce_param_decoder('kdf_tls1_3_set_ctx_params',
                         (@HKDF_COMMON_SET_CTX_PARAMS,
                          @HKDF_DIGEST_SET_CTX_PARAMS,
                          ['OSSL_KDF_PARAM_FIPS_KEY_CHECK',    'ind_k',  'int', 'fips'],
                          ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d',  'int', 'fips'],
                          ['OSSL_KDF_PARAM_PREFIX',            'prefix', 'octet_string'],
                          ['OSSL_KDF_PARAM_LABEL',             'label',  'octet_string'],
                          ['OSSL_KDF_PARAM_DATA',              'data',   'octet_string'],
                         )); -}
