EVP_KDF-X963(7ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… EVP_KDF-X963 β€” the X9.63-2001 EVP_KDF glow-up

okay so bestie, this is the EVP_KDF-X963(7ossl) page from the OpenSSL manual set, and we're about to make key derivation make sense. no cap. πŸŽ€


✨ NAME ✨

EVP_KDF-X963 β€” literally the X9.63-2001 EVP_KDF implementation. that's her. that's the whole name. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

she's an algorithm implementation, so there's no flags-and-args situation here β€” just vibes, parameters, and a fetch. keep reading, i promise it slaps. ✨


🌸 DESCRIPTION 🌸

so the EVP_KDF-X963 algorithm implements the key derivation function (X963KDF). iconic behavior. πŸ”₯

X963KDF gets used by Cryptographic Message Syntax (CMS) for EC KeyAgreement, to derive a key using input like a shared secret key and shared info. think of it as the group chat translation layer for your crypto material.

the output is considered to be keying material, periodt. πŸ‘‘

🧚 Identity

"X963KDF" is the name for this implementation β€” that's her government name. you can use it with the EVP_KDF_fetch() function. πŸ’…

πŸ“ Supported parameters

these are the parameters she supports, bestie:

  • "properties" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>
  • "digest" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>

these two parameters work as described in "PARAMETERS" in EVP_KDF(3). yes, go read that one too, i'll wait. 🫢

  • "key" (OSSL_KDF_PARAM_KEY) <octet string> β€” the shared secret used for key derivation. this parameter sets the secret. lowkey the main character of the whole operation. πŸ”‘
  • "info" (OSSL_KDF_PARAM_INFO) <octet string> β€” this parameter specifies an optional value for shared info. optional! she's flexible. πŸ’β€β™€οΈ

the OpenSSL FIPS provider also supports the following parameters:

  • "fips-indicator" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer> β€” a getter that returns 1 if the operation is FIPS approved, or 0 otherwise. this may be used after calling EVP_KDF_derive. it returns 0 if any "***-check" related parameter is set to 0 and the check fails. she's telling on herself, honestly. πŸ™ˆ
  • "digest-check" (OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <int> β€” the default value of 1 causes an error during EVP_KDF_CTX_set_params() if the used digest is not approved. setting this to zero will ignore the error and set the approved "fips-indicator" to 0.
⚠️ this option breaks FIPS compliance if it causes the approved "fips-indicator" to return 0. so like… know what you're doing, bestie. πŸ’€

according to ANSI X9.63-2001, the following are the approved digest algorithms: SHA2-224, SHA2-256, SHA2-384, SHA2-512, SHA2-512/224, SHA2-512/256, SHA3-224, SHA3-256, SHA3-384, SHA3-512. the whole SHA squad showed up and they all ate. 🌈

  • "key-check" (OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer> β€” the default value of 1 causes an error during EVP_KDF_CTX_set_params() if the length of the used key-derivation key (OSSL_KDF_PARAM_KEY) is shorter than 112 bits. setting this to zero will ignore the error and set the approved "fips-indicator" to 0.
⚠️ same warning, same energy: this option breaks FIPS compliance if it causes the approved "fips-indicator" to return 0. 🚨

πŸ’œ NOTES πŸ’œ

X963KDF is very similar to the SSKDF that uses a digest as the auxiliary function β€” but here's the tea: X963KDF appends the counter to the secret, whereas SSKDF prepends the counter. same energy, different order. it's giving sibling rivalry. 😭

you can obtain a context for X963KDF by calling:

EVP_KDF *kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);

the output length of an X963KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function. so you tell her how much keying material you want, and she delivers. 🎁


πŸ”₯ EXAMPLES πŸ”₯

this example derives 10 bytes, with the secret key "secret" and the sharedinfo value "label". look at her go:

EVP_KDF *kdf;
EVP_KDF_CTX *kctx;
unsigned char out[10];
OSSL_PARAM params[4], *p = params;

kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);

*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
                                        SN_sha256, strlen(SN_sha256));
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
                                         "secret", (size_t)6);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
                                         "label", (size_t)5);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
    error("EVP_KDF_derive");
}

EVP_KDF_CTX_free(kctx);

no leaks, no crumbs, only free'd contexts. πŸ’…βœ¨


πŸ‘‘ CONFORMING TO πŸ‘‘

"SEC 1: Elliptic Curve Cryptography" β€” that's the standard she's serving. πŸ“œ


🌟 SEE ALSO 🌟

the whole friend group, go say hi:

EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), "PARAMETERS" in EVP_KDF(3)


πŸŽ€ HISTORY πŸŽ€

this functionality was added in OpenSSL 3.0. she's not new new, but she's still that girl. ⭐


Copyright 2019-2024 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>.


and that's the page, bestie 🫢 β€” brought to you by OpenSSL 3.5.0, dated 2026-09-25, filed under EVP_KDF-X963(7ossl). slay, stay encrypted, and don't forget to free your contexts. πŸ’…βœ¨

πŸ“¦ where this page comes from