# info > EVP_KDF-TLS1_PRF

---
type: CommandReference
command: EVP_KDF-TLS1_PRF
mode: man
section: 7SSL
source: man-pages
---

## Quick Reference
- Fetch KDF: `EVP_KDF_fetch(NULL, "TLS1-PRF", NULL)`
- Create context: `EVP_KDF_CTX_new(kdf)`
- Set digest: `OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, "SHA256", ...)`
- Set secret/seed: `OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET, "secret", 6)`, `OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED, "seed", 4)`
- Derive key: `EVP_KDF_derive(kctx, out, sizeof(out), params)`

## Name
EVP_KDF-TLS1_PRF — The TLS1 PRF EVP_KDF implementation

## Synopsis
c
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
// set parameters via OSSL_PARAM, then:
int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen,
                   const OSSL_PARAM params[]);
## Options
Parameters passed as `OSSL_PARAM` array:

- `"digest"` (`OSSL_KDF_PARAM_DIGEST`) — message digest (UTF8 string). Use `"SHA256"`, `"SHA384"`, etc. For TLS 1.0/1.1, use `EVP_md5_sha1()`.
- `"secret"` (`OSSL_KDF_PARAM_SECRET`) — secret value (octet string). Replaces any existing secret.
- `"seed"` (`OSSL_KDF_PARAM_SEED`) — context seed (octet string). Maximum length 1024 bytes.
- `"properties"` (`OSSL_KDF_PARAM_PROPERTIES`) — algorithm properties (UTF8 string), as in `EVP_KDF(3)`.

## Examples
Derive 10 bytes using SHA-256 with secret `"secret"` and seed `"seed"`:

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

kdf = EVP_KDF_fetch(NULL, "TLS1-PRF", 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_SEED,
                                         "seed", (size_t)4);
*p = OSSL_PARAM_construct_end();

if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
    /* handle error */
}
EVP_KDF_CTX_free(kctx);
## See Also
- [EVP_KDF(3)](http://localhost/phpMan.php/man/EVPKDF/3/markdown)
- [EVP_KDF_CTX_new(3)](http://localhost/phpMan.php/man/EVPKDFCTXnew/3/markdown)
- [EVP_KDF_CTX_free(3)](http://localhost/phpMan.php/man/EVPKDFCTXfree/3/markdown)
- [EVP_KDF_CTX_set_params(3)](http://localhost/phpMan.php/man/EVPKDFCTXsetparams/3/markdown)
- [EVP_KDF_derive(3)](http://localhost/phpMan.php/man/EVPKDFderive/3/markdown)