1EVP_KDF_SS(7) OpenSSL EVP_KDF_SS(7)
2
3
4
6 EVP_KDF_SS - The Single Step / One Step EVP_KDF implementation
7
9 The EVP_KDF_SS algorithm implements the Single Step key derivation
10 function (SSKDF). SSKDF derives a key using input such as a shared
11 secret key (that was generated during the execution of a key
12 establishment scheme) and fixedinfo. SSKDF is also informally referred
13 to as 'Concat KDF'.
14
15 Auxilary function
16 The implementation uses a selectable auxiliary function H, which can be
17 in the backported version only a:
18
19 H(x) = hash(x, digest=md)
20
21 Numeric identity
22 EVP_KDF_SS is the numeric identity for this implementation; it can be
23 used with the EVP_KDF_CTX_new_id() function.
24
25 Supported controls
26 The supported controls are:
27
28 EVP_KDF_CTRL_SET_MD
29 This control works as described in "CONTROLS" in EVP_KDF_CTX(3).
30
31 EVP_KDF_CTRL_SET_KEY
32 This control expects two arguments: "unsigned char *secret",
33 "size_t secretlen"
34
35 The shared secret used for key derivation. This control sets the
36 secret.
37
38 EVP_KDF_ctrl_str() takes two type strings for this control:
39
40 "secret"
41 The value string is used as is.
42
43 "hexsecret"
44 The value string is expected to be a hexadecimal number, which
45 will be decoded before being passed on as the control value.
46
47 EVP_KDF_CTRL_SET_SSKDF_INFO
48 This control expects two arguments: "unsigned char *info", "size_t
49 infolen"
50
51 An optional value for fixedinfo, also known as otherinfo. This
52 control sets the fixedinfo.
53
54 EVP_KDF_ctrl_str() takes two type strings for this control:
55
56 "info"
57 The value string is used as is.
58
59 "hexinfo"
60 The value string is expected to be a hexadecimal number, which
61 will be decoded before being passed on as the control value.
62
64 A context for SSKDF can be obtained by calling:
65
66 EVP_KDF_CTX *kctx = EVP_KDF_CTX_new_id(EVP_KDF_SS);
67
68 The output length of an SSKDF is specified via the "keylen" parameter
69 to the EVP_KDF_derive(3) function.
70
72 This example derives 10 bytes using H(x) = SHA-256, with the secret key
73 "secret" and fixedinfo value "label":
74
75 EVP_KDF_CTX *kctx;
76 unsigned char out[10];
77
78 kctx = EVP_KDF_CTX_new_id(EVP_KDF_SS);
79
80 if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_MD, EVP_sha256()) <= 0) {
81 error("EVP_KDF_CTRL_SET_MD");
82 }
83 if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_KEY, "secret", (size_t)6) <= 0) {
84 error("EVP_KDF_CTRL_SET_KEY");
85 }
86 if (EVP_KDF_ctrl(kctx, EVP_KDF_CTRL_SET_SSKDF_INFO, "label", (size_t)5) <= 0) {
87 error("EVP_KDF_CTRL_SET_SSKDF_INFO");
88 }
89 if (EVP_KDF_derive(kctx, out, sizeof(out)) <= 0) {
90 error("EVP_KDF_derive");
91 }
92
93 EVP_KDF_CTX_free(kctx);
94
96 NIST SP800-56Cr1.
97
99 EVP_KDF_CTX, EVP_KDF_CTX_new_id(3), EVP_KDF_CTX_free(3),
100 EVP_KDF_ctrl(3), EVP_KDF_size(3), EVP_KDF_derive(3), "CONTROLS" in
101 EVP_KDF_CTX(3)
102
104 This functionality was added to OpenSSL 3.0.0.
105
107 Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
108 Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
109
110 Licensed under the Apache License 2.0 (the "License"). You may not use
111 this file except in compliance with the License. You can obtain a copy
112 in the file LICENSE in the source distribution or at
113 <https://www.openssl.org/source/license.html>.
114
115
116
1171.1.1l 2021-09-15 EVP_KDF_SS(7)