]>
Commit | Line | Data |
---|---|---|
1eff3485 | 1 | /* |
21dcbebc | 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. |
1eff3485 | 3 | * |
21dcbebc RS |
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 | |
1eff3485 DSH |
8 | */ |
9 | ||
10 | #ifndef HEADER_KDF_H | |
11 | # define HEADER_KDF_H | |
12 | ||
52df25cf | 13 | # include <openssl/kdferr.h> |
1eff3485 DSH |
14 | #ifdef __cplusplus |
15 | extern "C" { | |
16 | #endif | |
17 | ||
d2139cf8 MC |
18 | # define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) |
19 | # define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) | |
20 | # define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) | |
21 | # define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) | |
22 | # define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) | |
23 | # define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) | |
24 | # define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) | |
25 | # define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) | |
cefa762e JB |
26 | # define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) |
27 | # define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) | |
28 | # define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) | |
29 | # define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) | |
30 | # define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) | |
31 | # define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) | |
d2139cf8 MC |
32 | |
33 | # define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0 | |
34 | # define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1 | |
35 | # define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2 | |
1eff3485 DSH |
36 | |
37 | # define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \ | |
38 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 39 | EVP_PKEY_CTRL_TLS_MD, 0, (void *)(md)) |
1eff3485 DSH |
40 | |
41 | # define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \ | |
42 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 43 | EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)(sec)) |
1eff3485 DSH |
44 | |
45 | # define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \ | |
46 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 47 | EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)(seed)) |
1eff3485 | 48 | |
aacfb134 AG |
49 | # define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \ |
50 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 51 | EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md)) |
aacfb134 AG |
52 | |
53 | # define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \ | |
54 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 55 | EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt)) |
aacfb134 AG |
56 | |
57 | # define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \ | |
58 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 59 | EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key)) |
aacfb134 AG |
60 | |
61 | # define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \ | |
62 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
37659ea4 | 63 | EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info)) |
aacfb134 | 64 | |
d2139cf8 MC |
65 | # define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \ |
66 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
67 | EVP_PKEY_CTRL_HKDF_MODE, mode, NULL) | |
cefa762e JB |
68 | |
69 | # define EVP_PKEY_CTX_set1_pbe_pass(pctx, pass, passlen) \ | |
70 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
71 | EVP_PKEY_CTRL_PASS, passlen, (void *)(pass)) | |
72 | ||
73 | # define EVP_PKEY_CTX_set1_scrypt_salt(pctx, salt, saltlen) \ | |
74 | EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
75 | EVP_PKEY_CTRL_SCRYPT_SALT, saltlen, (void *)(salt)) | |
76 | ||
77 | # define EVP_PKEY_CTX_set_scrypt_N(pctx, n) \ | |
78 | EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
79 | EVP_PKEY_CTRL_SCRYPT_N, n) | |
80 | ||
81 | # define EVP_PKEY_CTX_set_scrypt_r(pctx, r) \ | |
82 | EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
83 | EVP_PKEY_CTRL_SCRYPT_R, r) | |
84 | ||
85 | # define EVP_PKEY_CTX_set_scrypt_p(pctx, p) \ | |
86 | EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
87 | EVP_PKEY_CTRL_SCRYPT_P, p) | |
88 | ||
89 | # define EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, maxmem_bytes) \ | |
90 | EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ | |
91 | EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES, maxmem_bytes) | |
92 | ||
69588edb | 93 | int ERR_load_KDF_strings(void); |
3e30fa0a | 94 | |
0cd0a820 | 95 | # ifdef __cplusplus |
1eff3485 | 96 | } |
0cd0a820 | 97 | # endif |
1eff3485 | 98 | #endif |