providers/implementations/encode_decode/decode_spki2typespki.inc
providers/implementations/encode_decode/encode_key2any.inc
providers/implementations/encode_decode/encode_key2ms.inc
-providers/implementations/kdfs/argon2.c
-providers/implementations/kdfs/hkdf.c
-providers/implementations/kdfs/hmacdrbg_kdf.c
-providers/implementations/kdfs/kbkdf.c
-providers/implementations/kdfs/krb5kdf.c
-providers/implementations/kdfs/pbkdf1.c
-providers/implementations/kdfs/pbkdf2.c
-providers/implementations/kdfs/pkcs12kdf.c
-providers/implementations/kdfs/pvkkdf.c
-providers/implementations/kdfs/scrypt.c
-providers/implementations/kdfs/sshkdf.c
-providers/implementations/kdfs/sskdf.c
-providers/implementations/kdfs/tls1_prf.c
-providers/implementations/kdfs/x942kdf.c
+providers/implementations/kdfs/argon2.inc
+providers/implementations/kdfs/hkdf.inc
+providers/implementations/kdfs/hmacdrbg_kdf.inc
+providers/implementations/kdfs/kbkdf.inc
+providers/implementations/kdfs/krb5kdf.inc
+providers/implementations/kdfs/pbkdf1.inc
+providers/implementations/kdfs/pbkdf2.inc
+providers/implementations/kdfs/pkcs12kdf.inc
+providers/implementations/kdfs/pvkkdf.inc
+providers/implementations/kdfs/scrypt.inc
+providers/implementations/kdfs/sshkdf.inc
+providers/implementations/kdfs/sskdf.inc
+providers/implementations/kdfs/tls1_prf.inc
+providers/implementations/kdfs/x942kdf.inc
providers/implementations/kem/ec_kem.c
providers/implementations/kem/ecx_kem.c
providers/implementations/kem/ml_kem_kem.c
providers/implementations/encode_decode/decode_spki2typespki.inc \
providers/implementations/encode_decode/encode_key2any.inc \
providers/implementations/encode_decode/encode_key2ms.inc \
- providers/implementations/kdfs/argon2.c \
- providers/implementations/kdfs/hkdf.c \
- providers/implementations/kdfs/hmacdrbg_kdf.c \
- providers/implementations/kdfs/kbkdf.c \
- providers/implementations/kdfs/krb5kdf.c \
- providers/implementations/kdfs/pbkdf1.c \
- providers/implementations/kdfs/pbkdf2.c \
- providers/implementations/kdfs/pkcs12kdf.c \
- providers/implementations/kdfs/pvkkdf.c \
- providers/implementations/kdfs/scrypt.c \
- providers/implementations/kdfs/sshkdf.c \
- providers/implementations/kdfs/sskdf.c \
- providers/implementations/kdfs/tls1_prf.c \
- providers/implementations/kdfs/x942kdf.c \
+ providers/implementations/kdfs/argon2.inc \
+ providers/implementations/kdfs/hkdf.inc \
+ providers/implementations/kdfs/hmacdrbg_kdf.inc \
+ providers/implementations/kdfs/kbkdf.inc \
+ providers/implementations/kdfs/krb5kdf.inc \
+ providers/implementations/kdfs/pbkdf1.inc \
+ providers/implementations/kdfs/pbkdf2.inc \
+ providers/implementations/kdfs/pkcs12kdf.inc \
+ providers/implementations/kdfs/pvkkdf.inc \
+ providers/implementations/kdfs/scrypt.inc \
+ providers/implementations/kdfs/sshkdf.inc \
+ providers/implementations/kdfs/sskdf.inc \
+ providers/implementations/kdfs/tls1_prf.inc \
+ providers/implementations/kdfs/x942kdf.inc \
providers/implementations/kem/ec_kem.c \
providers/implementations/kem/ecx_kem.c \
providers/implementations/kem/ml_kem_kem.c \
providers/implementations/encode_decode/decode_spki2typespki.inc \
providers/implementations/encode_decode/encode_key2any.inc \
providers/implementations/encode_decode/encode_key2ms.inc \
- providers/implementations/kdfs/argon2.c \
- providers/implementations/kdfs/hkdf.c \
- providers/implementations/kdfs/hmacdrbg_kdf.c \
- providers/implementations/kdfs/kbkdf.c \
- providers/implementations/kdfs/krb5kdf.c \
- providers/implementations/kdfs/pbkdf1.c \
- providers/implementations/kdfs/pbkdf2.c \
- providers/implementations/kdfs/pkcs12kdf.c \
- providers/implementations/kdfs/pvkkdf.c \
- providers/implementations/kdfs/scrypt.c \
- providers/implementations/kdfs/sshkdf.c \
- providers/implementations/kdfs/sskdf.c \
- providers/implementations/kdfs/tls1_prf.c \
- providers/implementations/kdfs/x942kdf.c \
+ providers/implementations/kdfs/argon2.inc \
+ providers/implementations/kdfs/hkdf.inc \
+ providers/implementations/kdfs/hmacdrbg_kdf.inc \
+ providers/implementations/kdfs/kbkdf.inc \
+ providers/implementations/kdfs/krb5kdf.inc \
+ providers/implementations/kdfs/pbkdf1.inc \
+ providers/implementations/kdfs/pbkdf2.inc \
+ providers/implementations/kdfs/pkcs12kdf.inc \
+ providers/implementations/kdfs/pvkkdf.inc \
+ providers/implementations/kdfs/scrypt.inc \
+ providers/implementations/kdfs/sshkdf.inc \
+ providers/implementations/kdfs/sskdf.inc \
+ providers/implementations/kdfs/tls1_prf.inc \
+ providers/implementations/kdfs/x942kdf.inc \
providers/implementations/kem/ec_kem.c \
providers/implementations/kem/ecx_kem.c \
providers/implementations/kem/ml_kem_kem.c \
providers/implementations/encode_decode/encode_key2any.inc.in
GENERATE[providers/implementations/encode_decode/encode_key2ms.inc]=\
providers/implementations/encode_decode/encode_key2ms.inc.in
-GENERATE[providers/implementations/kdfs/argon2.c]=\
- providers/implementations/kdfs/argon2.c.in
-GENERATE[providers/implementations/kdfs/hkdf.c]=\
- providers/implementations/kdfs/hkdf.c.in
-GENERATE[providers/implementations/kdfs/hmacdrbg_kdf.c]=\
- providers/implementations/kdfs/hmacdrbg_kdf.c.in
-GENERATE[providers/implementations/kdfs/kbkdf.c]=\
- providers/implementations/kdfs/kbkdf.c.in
-GENERATE[providers/implementations/kdfs/krb5kdf.c]=\
- providers/implementations/kdfs/krb5kdf.c.in
-GENERATE[providers/implementations/kdfs/pbkdf1.c]=\
- providers/implementations/kdfs/pbkdf1.c.in
-GENERATE[providers/implementations/kdfs/pbkdf2.c]=\
- providers/implementations/kdfs/pbkdf2.c.in
-GENERATE[providers/implementations/kdfs/pkcs12kdf.c]=\
- providers/implementations/kdfs/pkcs12kdf.c.in
-GENERATE[providers/implementations/kdfs/pvkkdf.c]=\
- providers/implementations/kdfs/pvkkdf.c.in
-GENERATE[providers/implementations/kdfs/scrypt.c]=\
- providers/implementations/kdfs/scrypt.c.in
-GENERATE[providers/implementations/kdfs/sshkdf.c]=\
- providers/implementations/kdfs/sshkdf.c.in
-GENERATE[providers/implementations/kdfs/sskdf.c]=\
- providers/implementations/kdfs/sskdf.c.in
-GENERATE[providers/implementations/kdfs/tls1_prf.c]=\
- providers/implementations/kdfs/tls1_prf.c.in
-GENERATE[providers/implementations/kdfs/x942kdf.c]=\
- providers/implementations/kdfs/x942kdf.c.in
+GENERATE[providers/implementations/kdfs/argon2.inc]=\
+ providers/implementations/kdfs/argon2.inc.in
+GENERATE[providers/implementations/kdfs/hkdf.inc]=\
+ providers/implementations/kdfs/hkdf.inc.in
+GENERATE[providers/implementations/kdfs/hmacdrbg_kdf.inc]=\
+ providers/implementations/kdfs/hmacdrbg_kdf.inc.in
+GENERATE[providers/implementations/kdfs/kbkdf.inc]=\
+ providers/implementations/kdfs/kbkdf.inc.in
+GENERATE[providers/implementations/kdfs/krb5kdf.inc]=\
+ providers/implementations/kdfs/krb5kdf.inc.in
+GENERATE[providers/implementations/kdfs/pbkdf1.inc]=\
+ providers/implementations/kdfs/pbkdf1.inc.in
+GENERATE[providers/implementations/kdfs/pbkdf2.inc]=\
+ providers/implementations/kdfs/pbkdf2.inc.in
+GENERATE[providers/implementations/kdfs/pkcs12kdf.inc]=\
+ providers/implementations/kdfs/pkcs12kdf.inc.in
+GENERATE[providers/implementations/kdfs/pvkkdf.inc]=\
+ providers/implementations/kdfs/pvkkdf.inc.in
+GENERATE[providers/implementations/kdfs/scrypt.inc]=\
+ providers/implementations/kdfs/scrypt.inc.in
+GENERATE[providers/implementations/kdfs/sshkdf.inc]=\
+ providers/implementations/kdfs/sshkdf.inc.in
+GENERATE[providers/implementations/kdfs/sskdf.inc]=\
+ providers/implementations/kdfs/sskdf.inc.in
+GENERATE[providers/implementations/kdfs/tls1_prf.inc]=\
+ providers/implementations/kdfs/tls1_prf.inc.in
+GENERATE[providers/implementations/kdfs/x942kdf.inc]=\
+ providers/implementations/kdfs/x942kdf.inc.in
GENERATE[providers/implementations/kem/ec_kem.c]=\
providers/implementations/kem/ec_kem.c.in
GENERATE[providers/implementations/kem/ecx_kem.c]=\
* RFC 9106 Argon2 (see https://www.rfc-editor.org/rfc/rfc9106.txt)
*
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
#include <stdlib.h>
#include <stddef.h>
#ifndef OPENSSL_NO_ARGON2
+# include "providers/implementations/kdfs/argon2.inc"
+
# define ARGON2_MIN_LANES 1u
# define ARGON2_MAX_LANES 0xFFFFFFu
# define ARGON2_MIN_THREADS 1u
return 1;
}
-{- produce_param_decoder('argon2_set_ctx_params',
- (['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_ARGON2_AD', 'ad', 'octet_string'],
- ['OSSL_KDF_PARAM_SIZE', 'size', 'uint32'],
- ['OSSL_KDF_PARAM_ITER', 'iter', 'uint32'],
- ['OSSL_KDF_PARAM_THREADS', 'thrds', 'uint32'],
- ['OSSL_KDF_PARAM_ARGON2_LANES', 'lanes', 'uint32'],
- ['OSSL_KDF_PARAM_ARGON2_MEMCOST', 'mem', 'uint32'],
- ['OSSL_KDF_PARAM_EARLY_CLEAN', 'eclean', 'uint32'],
- ['OSSL_KDF_PARAM_ARGON2_VERSION', 'vers', 'uint32'],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- )); -}
-
static int argon2_set_ctx_params(KDF_ARGON2 *ctx, const OSSL_PARAM params[],
OSSL_PARAM **size_param_ptr)
{
return argon2_set_ctx_params_list;
}
-{- produce_param_decoder('argon2_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int kdf_argon2_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct argon2_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('argon2_set_ctx_params',
+ (['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_ARGON2_AD', 'ad', 'octet_string'],
+ ['OSSL_KDF_PARAM_SIZE', 'size', 'uint32'],
+ ['OSSL_KDF_PARAM_ITER', 'iter', 'uint32'],
+ ['OSSL_KDF_PARAM_THREADS', 'thrds', 'uint32'],
+ ['OSSL_KDF_PARAM_ARGON2_LANES', 'lanes', 'uint32'],
+ ['OSSL_KDF_PARAM_ARGON2_MEMCOST', 'mem', 'uint32'],
+ ['OSSL_KDF_PARAM_EARLY_CLEAN', 'eclean', 'uint32'],
+ ['OSSL_KDF_PARAM_ARGON2_VERSION', 'vers', 'uint32'],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ )); -}
+
+{- produce_param_decoder('argon2_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
/*
* HMAC low level APIs are deprecated for public use, but still ok for internal
int num_info;
};
+#define hkdf_set_ctx_params_st hkdf_all_set_ctx_params_st
+#define hkdf_fixed_digest_set_ctx_params_st hkdf_all_set_ctx_params_st
+#define kdf_tls1_3_set_ctx_params_st hkdf_all_set_ctx_params_st
+
+#include "providers/implementations/kdfs/hkdf.inc"
+
static int hkdf_common_set_ctx_params
(KDF_HKDF *ctx, struct hkdf_all_set_ctx_params_st *p)
{
return 1;
}
-#define hkdf_set_ctx_params_st hkdf_all_set_ctx_params_st
-
-{- produce_param_decoder('hkdf_set_ctx_params',
- (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
- ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', HKDF_MAX_INFOS],
- )); -}
-
static int kdf_hkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct hkdf_all_set_ctx_params_st p;
return hkdf_set_ctx_params_list;
}
-{- 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'],
- )); -}
-
static const OSSL_PARAM *hkdf_gettable_ctx_params(ossl_unused void *ctx,
ossl_unused void *provctx)
{
return ctx;
}
-#define hkdf_fixed_digest_set_ctx_params_st hkdf_all_set_ctx_params_st
-
-{- produce_param_decoder('hkdf_fixed_digest_set_ctx_params',
- (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
- ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', HKDF_MAX_INFOS],
- )); -}
-
static int kdf_hkdf_fixed_digest_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct hkdf_all_set_ctx_params_st p;
return hkdf_fixed_digest_set_ctx_params_list;
}
-
#define KDF_HKDF_FIXED_DIGEST_NEW(hashname, hashstring) \
static void *kdf_hkdf_##hashname##_new(void *provctx) \
{ \
}
}
-#define kdf_tls1_3_set_ctx_params_st hkdf_all_set_ctx_params_st
-
-{- produce_param_decoder('kdf_tls1_3_set_ctx_params',
- (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
- ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['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'],
- )); -}
-
static int kdf_tls1_3_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct hkdf_all_set_ctx_params_st p;
--- /dev/null
+/*
+ * 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('hkdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', HKDF_MAX_INFOS],
+ )); -}
+
+{- 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',
+ (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', HKDF_MAX_INFOS],
+ )); -}
+
+{- produce_param_decoder('kdf_tls1_3_set_ctx_params',
+ (['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MODE', 'mode', 'int'],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['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'],
+ )); -}
* 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 <stdlib.h>
#include <string.h>
#include "prov/implementations.h"
#include "prov/hmac_drbg.h"
#include "prov/provider_ctx.h"
+#include "providers/implementations/kdfs/hmacdrbg_kdf.inc"
static OSSL_FUNC_kdf_newctx_fn hmac_drbg_kdf_new;
static OSSL_FUNC_kdf_dupctx_fn hmac_drbg_kdf_dup;
return ossl_drbg_hmac_generate(drbg, out, outlen, NULL, 0);
}
-{- produce_param_decoder('hmac_drbg_kdf_get_ctx_params',
- (['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- )); -}
-
static int hmac_drbg_kdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
KDF_HMAC_DRBG *hmac = (KDF_HMAC_DRBG *)vctx;
return hmac_drbg_kdf_get_ctx_params_list;
}
-{- produce_param_decoder('hmac_drbg_kdf_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_HMACDRBG_ENTROPY', 'ent', 'octet_string'],
- ['OSSL_KDF_PARAM_HMACDRBG_NONCE', 'nonce', 'octet_string'],
- )); -}
-
static int hmac_drbg_kdf_set_ctx_params(void *vctx,
const OSSL_PARAM params[])
{
--- /dev/null
+/*
+ * 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('hmac_drbg_kdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ )); -}
+
+{- produce_param_decoder('hmac_drbg_kdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_HMACDRBG_ENTROPY', 'ent', 'octet_string'],
+ ['OSSL_KDF_PARAM_HMACDRBG_NONCE', 'nonce', 'octet_string'],
+ )); -}
* 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 implements https://csrc.nist.gov/publications/detail/sp/800-108/final
#define KBKDF_MAX_INFOS 5
+#include "providers/implementations/kdfs/kbkdf.inc"
+
typedef enum {
COUNTER = 0,
FEEDBACK
return ret;
}
-{- produce_param_decoder('kbkdf_set_ctx_params',
- (['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', KBKDF_MAX_INFOS],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_SEED', 'seed', 'octet_string'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_CIPHER', 'cipher', 'utf8_string'],
- ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
- ['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_KBKDF_USE_L', 'use_l', 'int'],
- ['OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR', 'sep', 'int'],
- ['OSSL_KDF_PARAM_KBKDF_R', 'r', 'int'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
KBKDF *ctx = (KBKDF *)vctx;
return kbkdf_set_ctx_params_list;
}
-{- produce_param_decoder('kbkdf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int kbkdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct kbkdf_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('kbkdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', KBKDF_MAX_INFOS],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_SEED', 'seed', 'octet_string'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_CIPHER', 'cipher', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MODE', 'mode', 'utf8_string'],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_KBKDF_USE_L', 'use_l', 'int'],
+ ['OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR', 'sep', 'int'],
+ ['OSSL_KDF_PARAM_KBKDF_R', 'r', 'int'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('kbkdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
/*
* DES low level APIs are deprecated for public use, but still ok for internal
#include "prov/provider_ctx.h"
#include "prov/provider_util.h"
#include "prov/providercommon.h"
+#include "providers/implementations/kdfs/krb5kdf.inc"
/* KRB5 KDF defined in RFC 3961, Section 5.1 */
key, keylen);
}
-{- produce_param_decoder('krb5kdf_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_CIPHER', 'cipher', 'utf8_string'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_CONSTANT', 'cnst', 'octet_string'],
- )); -}
-
static int krb5kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct krb5kdf_set_ctx_params_st p;
return krb5kdf_set_ctx_params_list;
}
-{- produce_param_decoder('krb5kdf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int krb5kdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct krb5kdf_get_ctx_params_st p;
OPENSSL_cleanse(block, EVP_MAX_BLOCK_LENGTH * 2);
return ret;
}
-
--- /dev/null
+/*
+ * 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('krb5kdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_CIPHER', 'cipher', 'utf8_string'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_CONSTANT', 'cnst', 'octet_string'],
+ )); -}
+
+{- produce_param_decoder('krb5kdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* 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 <openssl/trace.h>
#include <stdlib.h>
#include "prov/providercommon.h"
#include "prov/implementations.h"
#include "prov/provider_util.h"
+#include "providers/implementations/kdfs/pbkdf1.inc"
static OSSL_FUNC_kdf_newctx_fn kdf_pbkdf1_new;
static OSSL_FUNC_kdf_dupctx_fn kdf_pbkdf1_dup;
ctx->iter, md, key, keylen);
}
-{- produce_param_decoder('pbkdf1_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
- )); -}
-
static int kdf_pbkdf1_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct pbkdf1_set_ctx_params_st p;
return pbkdf1_set_ctx_params_list;
}
-{- produce_param_decoder('pbkdf1_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int kdf_pbkdf1_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct pbkdf1_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('pbkdf1_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
+ )); -}
+
+{- produce_param_decoder('pbkdf1_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
/*
* HMAC low level APIs are deprecated for public use, but still ok for internal
#include "prov/implementations.h"
#include "prov/provider_util.h"
#include "prov/securitycheck.h"
+#include "providers/implementations/kdfs/pbkdf2.inc"
/* Constants specified in SP800-132 */
#define KDF_PBKDF2_MIN_KEY_LEN_BITS 112
md, key, keylen, ctx->lower_bound_checks);
}
-{- produce_param_decoder('pbkdf2_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
- ['OSSL_KDF_PARAM_PKCS5', 'pkcs5', 'int'],
- )); -}
-
static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct pbkdf2_set_ctx_params_st p;
return pbkdf2_set_ctx_params_list;
}
-{- produce_param_decoder('pbkdf2_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int kdf_pbkdf2_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
KDF_PBKDF2 *ctx = vctx;
--- /dev/null
+/*
+ * 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('pbkdf2_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
+ ['OSSL_KDF_PARAM_PKCS5', 'pkcs5', 'int'],
+ )); -}
+
+{- produce_param_decoder('pbkdf2_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}
* 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 <openssl/trace.h>
#include <stdlib.h>
#include "prov/providercommon.h"
#include "prov/implementations.h"
#include "prov/provider_util.h"
+#include "providers/implementations/kdfs/pkcs12kdf.inc"
static OSSL_FUNC_kdf_newctx_fn kdf_pkcs12_new;
static OSSL_FUNC_kdf_dupctx_fn kdf_pkcs12_dup;
ctx->id, ctx->iter, md, key, keylen);
}
-{- produce_param_decoder('pkcs12_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
- ['OSSL_KDF_PARAM_PKCS12_ID', 'p12id', 'int'],
- )); -}
-
static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct pkcs12_set_ctx_params_st p;
return pkcs12_set_ctx_params_list;
}
-{- produce_param_decoder('pkcs12_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int kdf_pkcs12_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct pkcs12_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('pkcs12_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_ITER', 'iter', 'uint64'],
+ ['OSSL_KDF_PARAM_PKCS12_ID', 'p12id', 'int'],
+ )); -}
+
+{- produce_param_decoder('pkcs12_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* 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 <string.h>
#include <openssl/evp.h>
#include "prov/providercommon.h"
#include "prov/implementations.h"
#include "prov/provider_util.h"
+#include "providers/implementations/kdfs/pvkkdf.inc"
static OSSL_FUNC_kdf_newctx_fn kdf_pvk_new;
static OSSL_FUNC_kdf_dupctx_fn kdf_pvk_dup;
return res;
}
-{- produce_param_decoder('pvk_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_PASSWORD', 'pass', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- )); -}
-
static int kdf_pvk_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct pvk_set_ctx_params_st p;
return pvk_set_ctx_params_list;
}
-{- produce_param_decoder('pvk_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int kdf_pvk_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct pvk_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('pvk_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_PASSWORD', 'pass', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ )); -}
+
+{- produce_param_decoder('pvk_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* 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 <stdlib.h>
#include <stdarg.h>
#include "prov/provider_ctx.h"
#include "prov/providercommon.h"
#include "prov/provider_util.h"
+#include "providers/implementations/kdfs/scrypt.inc"
#ifndef OPENSSL_NO_SCRYPT
return (value != 0) && ((value & (value - 1)) == 0);
}
-{- produce_param_decoder('scrypt_set_ctx_params',
- (['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_SCRYPT_N', 'n', 'uint64'],
- ['OSSL_KDF_PARAM_SCRYPT_R', 'r', 'uint32'],
- ['OSSL_KDF_PARAM_SCRYPT_P', 'p', 'uint32'],
- ['OSSL_KDF_PARAM_SCRYPT_MAXMEM', 'maxmem', 'uint64'],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- )); -}
-
static int kdf_scrypt_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct scrypt_set_ctx_params_st p;
return scrypt_set_ctx_params_list;
}
-{- produce_param_decoder('scrypt_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- )); -}
-
static int kdf_scrypt_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct scrypt_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('scrypt_set_ctx_params',
+ (['OSSL_KDF_PARAM_PASSWORD', 'pw', 'octet_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_SCRYPT_N', 'n', 'uint64'],
+ ['OSSL_KDF_PARAM_SCRYPT_R', 'r', 'uint32'],
+ ['OSSL_KDF_PARAM_SCRYPT_P', 'p', 'uint32'],
+ ['OSSL_KDF_PARAM_SCRYPT_MAXMEM', 'maxmem', 'uint64'],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ )); -}
+
+{- produce_param_decoder('scrypt_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ )); -}
* 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 <stdlib.h>
#include <stdarg.h>
#include "prov/implementations.h"
#include "prov/provider_util.h"
#include "prov/securitycheck.h"
+#include "providers/implementations/kdfs/sshkdf.inc"
/* See RFC 4253, Section 7.2 */
static OSSL_FUNC_kdf_newctx_fn kdf_sshkdf_new;
ctx->type, key, keylen);
}
-{- produce_param_decoder('sshkdf_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
- ['OSSL_KDF_PARAM_SSHKDF_XCGHASH', 'xcg', 'octet_string'],
- ['OSSL_KDF_PARAM_SSHKDF_SESSION_ID', 'sid', 'octet_string'],
- ['OSSL_KDF_PARAM_SSHKDF_TYPE', 'type', 'utf8_string'],
- ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int kdf_sshkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct sshkdf_set_ctx_params_st p;
return sshkdf_set_ctx_params_list;
}
-{- produce_param_decoder('sshkdf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int kdf_sshkdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
KDF_SSHKDF *ctx = (KDF_SSHKDF *)vctx;
--- /dev/null
+/*
+ * 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('sshkdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_KEY', 'key', 'octet_string'],
+ ['OSSL_KDF_PARAM_SSHKDF_XCGHASH', 'xcg', 'octet_string'],
+ ['OSSL_KDF_PARAM_SSHKDF_SESSION_ID', 'sid', 'octet_string'],
+ ['OSSL_KDF_PARAM_SSHKDF_TYPE', 'type', 'utf8_string'],
+ ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('sshkdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
/*
* Refer to https://csrc.nist.gov/publications/detail/sp/800-56c/rev-1/final
int num_info;
};
+#define sskdf_set_ctx_params_st sskdf_all_set_ctx_params_st
+#define x963kdf_set_ctx_params_st sskdf_all_set_ctx_params_st
+
+#include "providers/implementations/kdfs/sskdf.inc"
+
static int sskdf_common_set_ctx_params
(KDF_SSKDF *ctx, struct sskdf_all_set_ctx_params_st *p,
const OSSL_PARAM *params)
return 1;
}
-#define sskdf_set_ctx_params_st sskdf_all_set_ctx_params_st
-
-{- produce_param_decoder('sskdf_set_ctx_params',
- (['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', SSKDF_MAX_INFOS],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_MAC_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int sskdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
return sskdf_set_ctx_params_list;
}
-{- produce_param_decoder('sskdf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int sskdf_common_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
return sskdf_get_ctx_params_list;
}
-#define x963kdf_set_ctx_params_st sskdf_all_set_ctx_params_st
-
-{- produce_param_decoder('x963kdf_set_ctx_params',
- (['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', SSKDF_MAX_INFOS],
- ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
- ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
- ['OSSL_KDF_PARAM_MAC_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int x963kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
--- /dev/null
+/*
+ * 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('sskdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', SSKDF_MAX_INFOS],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_MAC_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('sskdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('x963kdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_INFO', 'info', 'octet_string', SSKDF_MAX_INFOS],
+ ['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_MAC', 'mac', 'utf8_string'],
+ ['OSSL_KDF_PARAM_SALT', 'salt', 'octet_string'],
+ ['OSSL_KDF_PARAM_MAC_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
-{-
-use OpenSSL::paramnames qw(produce_param_decoder);
--}
/*
* Refer to "The TLS Protocol Version 1.0" Section 5
#define TLSPRF_MAX_SEEDS 6
+#include "providers/implementations/kdfs/tls1_prf.inc"
+
/* TLS KDF kdf context structure */
typedef struct {
void *provctx;
key, keylen);
}
-{- produce_param_decoder('tls1prf_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_SEED', 'seed', 'octet_string', TLSPRF_MAX_SEEDS],
- ['OSSL_KDF_PARAM_FIPS_EMS_CHECK', 'ind_e', 'int', 'fips'],
- ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int kdf_tls1_prf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct tls1prf_set_ctx_params_st p;
return tls1prf_set_ctx_params_list;
}
-{- produce_param_decoder('tls1prf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int kdf_tls1_prf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
struct tls1prf_get_ctx_params_st p;
--- /dev/null
+/*
+ * 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('tls1prf_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_SEED', 'seed', 'octet_string', TLSPRF_MAX_SEEDS],
+ ['OSSL_KDF_PARAM_FIPS_EMS_CHECK', 'ind_e', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_FIPS_DIGEST_CHECK', 'ind_d', 'int', 'fips'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('tls1prf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}
* 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 "internal/e_os.h"
#include <openssl/core_names.h>
#include "prov/provider_util.h"
#include "prov/securitycheck.h"
#include "prov/der_wrap.h"
+#include "providers/implementations/kdfs/x942kdf.inc"
#define X942KDF_MAX_INLEN (1 << 30)
return ret;
}
-{- produce_param_decoder('sshkdf_set_ctx_params',
- (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
- ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
- ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
- ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
- ['OSSL_KDF_PARAM_UKM', 'uinfo', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_ACVPINFO', 'acvp', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_PARTYUINFO', 'uinfo', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_PARTYVINFO', 'vinfo', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_SUPP_PUBINFO', 'pub', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_SUPP_PRIVINFO', 'priv', 'octet_string'],
- ['OSSL_KDF_PARAM_X942_USE_KEYBITS', 'kbits', 'int'],
- ['OSSL_KDF_PARAM_CEK_ALG', 'cekalg', 'utf8_string'],
- ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
- )); -}
-
static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct sshkdf_set_ctx_params_st p;
return sshkdf_set_ctx_params_list;
}
-{- produce_param_decoder('sshkdf_get_ctx_params',
- (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
- ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
- )); -}
-
static int x942kdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
{
KDF_X942 *ctx = (KDF_X942 *)vctx;
--- /dev/null
+/*
+ * 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('sshkdf_set_ctx_params',
+ (['OSSL_KDF_PARAM_PROPERTIES', 'propq', 'utf8_string'],
+ ['OSSL_ALG_PARAM_ENGINE', 'engine', 'utf8_string', 'hidden'],
+ ['OSSL_KDF_PARAM_DIGEST', 'digest', 'utf8_string'],
+ ['OSSL_KDF_PARAM_SECRET', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_KEY', 'secret', 'octet_string'],
+ ['OSSL_KDF_PARAM_UKM', 'uinfo', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_ACVPINFO', 'acvp', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_PARTYUINFO', 'uinfo', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_PARTYVINFO', 'vinfo', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_SUPP_PUBINFO', 'pub', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_SUPP_PRIVINFO', 'priv', 'octet_string'],
+ ['OSSL_KDF_PARAM_X942_USE_KEYBITS', 'kbits', 'int'],
+ ['OSSL_KDF_PARAM_CEK_ALG', 'cekalg', 'utf8_string'],
+ ['OSSL_KDF_PARAM_FIPS_KEY_CHECK', 'ind_k', 'int', 'fips'],
+ )); -}
+
+{- produce_param_decoder('sshkdf_get_ctx_params',
+ (['OSSL_KDF_PARAM_SIZE', 'size', 'size_t'],
+ ['OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR', 'ind', 'int', 'fips'],
+ )); -}