1 | /*
|
---|
2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the OpenSSL license (the "License"). You may not use
|
---|
5 | * this file except in compliance with the License. You can obtain a copy
|
---|
6 | * in the file LICENSE in the source distribution or at
|
---|
7 | * https://www.openssl.org/source/license.html
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef HEADER_KDF_H
|
---|
11 | # define HEADER_KDF_H
|
---|
12 |
|
---|
13 | #ifdef __cplusplus
|
---|
14 | extern "C" {
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | # define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL)
|
---|
18 | # define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1)
|
---|
19 | # define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2)
|
---|
20 | # define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3)
|
---|
21 | # define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4)
|
---|
22 | # define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5)
|
---|
23 | # define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6)
|
---|
24 |
|
---|
25 | # define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \
|
---|
26 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
27 | EVP_PKEY_CTRL_TLS_MD, 0, (void *)md)
|
---|
28 |
|
---|
29 | # define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \
|
---|
30 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
31 | EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)sec)
|
---|
32 |
|
---|
33 | # define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \
|
---|
34 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
35 | EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)seed)
|
---|
36 |
|
---|
37 | # define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
|
---|
38 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
39 | EVP_PKEY_CTRL_HKDF_MD, 0, (void *)md)
|
---|
40 |
|
---|
41 | # define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
|
---|
42 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
43 | EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)salt)
|
---|
44 |
|
---|
45 | # define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
|
---|
46 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
47 | EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)key)
|
---|
48 |
|
---|
49 | # define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
|
---|
50 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
---|
51 | EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)info)
|
---|
52 |
|
---|
53 | /* BEGIN ERROR CODES */
|
---|
54 | /*
|
---|
55 | * The following lines are auto generated by the script mkerr.pl. Any changes
|
---|
56 | * made after this point may be overwritten when the script is next run.
|
---|
57 | */
|
---|
58 |
|
---|
59 | int ERR_load_KDF_strings(void);
|
---|
60 |
|
---|
61 | /* Error codes for the KDF functions. */
|
---|
62 |
|
---|
63 | /* Function codes. */
|
---|
64 | # define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100
|
---|
65 | # define KDF_F_PKEY_TLS1_PRF_DERIVE 101
|
---|
66 |
|
---|
67 | /* Reason codes. */
|
---|
68 | # define KDF_R_INVALID_DIGEST 100
|
---|
69 | # define KDF_R_MISSING_PARAMETER 101
|
---|
70 | # define KDF_R_VALUE_MISSING 102
|
---|
71 |
|
---|
72 | # ifdef __cplusplus
|
---|
73 | }
|
---|
74 | # endif
|
---|
75 | #endif
|
---|