*Timo Keller*
+ * Added `EVP_KDF_CTX_get0_kdf()` and `EVP_KDF_CTX_get1_kdf()` functions
+ as a replacement for the now deprecated `EVP_KDF_CTX_kdf()`.
+
+ *Leon Timmermans*
+
* Add `FIPS_mode()` as a convenience define to
`EVP_default_properties_is_fips_enabled(NULL)`, which is
shorthand to check whether the `fips=yes` property is currently enabled
return kdf->prov;
}
-const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx)
+const EVP_KDF *EVP_KDF_CTX_get0_kdf(const EVP_KDF_CTX *ctx)
{
return ctx->meth;
}
+#if !defined(OPENSSL_NO_DEPRECATED_4_1)
+const EVP_KDF *EVP_KDF_CTX_kdf(const EVP_KDF_CTX *ctx)
+{
+ return EVP_KDF_CTX_get0_kdf(ctx);
+}
+#endif /* !OPENSSL_NO_DEPRECATED_4_1 */
+
+EVP_KDF *EVP_KDF_CTX_get1_kdf(const EVP_KDF_CTX *ctx)
+{
+ if (!EVP_KDF_up_ref(ctx->meth))
+ return NULL;
+ return ctx->meth;
+}
+
void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx)
{
if (ctx == NULL)
EVP_KDF_CTX, EVP_KDF_CTX_new, EVP_KDF_CTX_free, EVP_KDF_CTX_dup,
EVP_KDF_CTX_reset, EVP_KDF_derive,
EVP_KDF_CTX_set_SKEY, EVP_KDF_derive_SKEY,
-EVP_KDF_CTX_get_kdf_size,
+EVP_KDF_CTX_get_kdf_size, EVP_KDF_CTX_get0_kdf, EVP_KDF_CTX_get1_kdf,
EVP_KDF_get0_provider, EVP_KDF_CTX_kdf, EVP_KDF_is_a,
EVP_KDF_get0_name, EVP_KDF_names_do_all, EVP_KDF_get0_description,
EVP_KDF_CTX_get_params, EVP_KDF_CTX_set_params, EVP_KDF_do_all_provided,
typedef struct evp_kdf_ctx_st EVP_KDF_CTX;
EVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf);
- const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);
+ const EVP_KDF *EVP_KDF_CTX_get0_kdf(const EVP_KDF_CTX *ctx);
+ EVP_KDF *EVP_KDF_CTX_get1_kdf(EVP_KDF_CTX *ctx);
void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);
EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src);
void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx);
const OSSL_PARAM *EVP_KDF_CTX_settable_params(const EVP_KDF *kdf);
const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);
+The following functions have been deprecated since OpenSSL 4.1,
+and can be hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable
+version value, see L<openssl_user_macros(7)>:
+
+ const EVP_KDF *EVP_KDF_CTX_kdf(const EVP_KDF_CTX *ctx);
+
=head1 DESCRIPTION
The EVP KDF routines are a high-level interface to Key Derivation Function
EVP_KDF_CTX_free() frees up the context I<ctx>. If I<ctx> is NULL, nothing
is done.
-EVP_KDF_CTX_kdf() returns the B<EVP_KDF> associated with the context
-I<ctx>.
+EVP_KDF_CTX_get0_kdf() returns the B<EVP_KDF> associated with the context
+I<ctx>. EVP_KDF_CTX_get1_kdf() is the same, except ownership is passed
+to the caller.
+EVP_KDF_CTX_kdf() is an alias for EVP_KDF_CTX_get0_kdf().
=head2 Computing functions
EVP_KDF_derive_SKEY() and EVP_KDF_CTX_set_SKEY() functions were introduced in
OpenSSL 3.6.
+EVP_KDF_CTX_get0_kdf() and EVP_KDF_CTX_get1_kdf() functions were introduced
+in OpenSSL 4.1.
+
+EVP_KDF_CTX_kdf() function was deprecated in favour of EVP_KDF_CTX_get0_kdf()
+in OpenSSL 4.1.
+
=head1 COPYRIGHT
Copyright 2019-2025 The OpenSSL Project Authors. All Rights Reserved.
ASN1_BIT_STRING_set() does, validates the function arguments and sets
unused bits after setting the BIT STRING value.
+=head3 Deprecation of EVP_KDF_CTX_kdf()
+
+This function is deprecated in favour of EVP_KDF_CTX_get0_ctx(), to align
+with the naming of functions that provide similar functionality for other kinds
+of EVP context oobjects.
+
=head1 OPENSSL 4.0
=head2 Main Changes from OpenSSL 3.6
int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name);
const char *EVP_KDF_get0_name(const EVP_KDF *kdf);
const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);
-const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);
+const EVP_KDF *EVP_KDF_CTX_get0_kdf(const EVP_KDF_CTX *ctx);
+EVP_KDF *EVP_KDF_CTX_get1_kdf(const EVP_KDF_CTX *ctx);
+
+#if !defined(OPENSSL_NO_DEPRECATED_4_1)
+OSSL_DEPRECATEDIN_4_1_FOR("Use EVP_KDF_CTX_get0_kdf")
+const EVP_KDF *EVP_KDF_CTX_kdf(const EVP_KDF_CTX *ctx);
+#endif /* !OPENSSL_NO_DEPRECATED_4_1 */
void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx);
size_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx);
KDF_DATA *kdata = t->data;
int rv;
char *p, *name;
- const OSSL_PARAM *defs = EVP_KDF_settable_ctx_params(EVP_KDF_CTX_kdf(kctx));
+ const OSSL_PARAM *defs = EVP_KDF_settable_ctx_params(EVP_KDF_CTX_get0_kdf(kctx));
if (!TEST_ptr(name = OPENSSL_strdup(value)))
return 0;
EVP_KDF_is_a 1615 4_0_0 EXIST::FUNCTION:
EVP_KDF_get0_name 1616 4_0_0 EXIST::FUNCTION:
EVP_KDF_get0_provider 1617 4_0_0 EXIST::FUNCTION:
-EVP_KDF_CTX_kdf 1618 4_0_0 EXIST::FUNCTION:
+EVP_KDF_CTX_kdf 1618 4_0_0 EXIST::FUNCTION:DEPRECATEDIN_4_1
EVP_KDF_CTX_reset 1619 4_0_0 EXIST::FUNCTION:
EVP_KDF_CTX_get_kdf_size 1620 4_0_0 EXIST::FUNCTION:
EVP_KDF_derive 1621 4_0_0 EXIST::FUNCTION:
EVP_EC_affine2oct ? 4_1_0 EXIST::FUNCTION:
OPENSSL_sk_set_copy_thunks ? 4_1_0 EXIST::FUNCTION:
ASN1_STRING_new_not_owned ? 4_1_0 EXIST::FUNCTION:
+EVP_KDF_CTX_get0_kdf ? 4_1_0 EXIST::FUNCTION:
+EVP_KDF_CTX_get1_kdf ? 4_1_0 EXIST::FUNCTION:
ERR_raise_data define
EVP_DigestSignUpdate define
EVP_DigestVerifyUpdate define
+EVP_KDF_CTX_kdf define
EVP_MD_CTX_get_block_size define
EVP_MD_CTX_get0_name define
EVP_MD_CTX_get_size define