Fix memleaks in KDF implementations
[openssl.git] / providers / common / kdfs / sskdf.c
1 /*
2  * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3  * Copyright (c) 2019, Oracle and/or its affiliates.  All rights reserved.
4  *
5  * Licensed under the Apache License 2.0 (the "License").  You may not use
6  * this file except in compliance with the License.  You can obtain a copy
7  * in the file LICENSE in the source distribution or at
8  * https://www.openssl.org/source/license.html
9  */
10
11 /*
12  * Refer to https://csrc.nist.gov/publications/detail/sp/800-56c/rev-1/final
13  * Section 4.1.
14  *
15  * The Single Step KDF algorithm is given by:
16  *
17  * Result(0) = empty bit string (i.e., the null string).
18  * For i = 1 to reps, do the following:
19  *   Increment counter by 1.
20  *   Result(i) = Result(i - 1) || H(counter || Z || FixedInfo).
21  * DKM = LeftmostBits(Result(reps), L))
22  *
23  * NOTES:
24  *   Z is a shared secret required to produce the derived key material.
25  *   counter is a 4 byte buffer.
26  *   FixedInfo is a bit string containing context specific data.
27  *   DKM is the output derived key material.
28  *   L is the required size of the DKM.
29  *   reps = [L / H_outputBits]
30  *   H(x) is the auxiliary function that can be either a hash, HMAC or KMAC.
31  *   H_outputBits is the length of the output of the auxiliary function H(x).
32  *
33  * Currently there is not a comprehensive list of test vectors for this
34  * algorithm, especially for H(x) = HMAC and H(x) = KMAC.
35  * Test vectors for H(x) = Hash are indirectly used by CAVS KAS tests.
36  */
37 #include <stdlib.h>
38 #include <stdarg.h>
39 #include <string.h>
40 #include <openssl/hmac.h>
41 #include <openssl/evp.h>
42 #include <openssl/kdf.h>
43 #include <openssl/core_names.h>
44 #include <openssl/params.h>
45 #include "internal/cryptlib.h"
46 #include "internal/numbers.h"
47 #include "internal/evp_int.h"
48 #include "internal/provider_ctx.h"
49 #include "internal/providercommonerr.h"
50 #include "internal/provider_algs.h"
51
52 typedef struct {
53     void *provctx;
54     EVP_MAC *mac;       /* H(x) = HMAC_hash OR H(x) = KMAC */
55     EVP_MD *md;         /* H(x) = hash OR when H(x) = HMAC_hash */
56     unsigned char *secret;
57     size_t secret_len;
58     unsigned char *info;
59     size_t info_len;
60     unsigned char *salt;
61     size_t salt_len;
62     size_t out_len; /* optional KMAC parameter */
63 } KDF_SSKDF;
64
65 #define SSKDF_MAX_INLEN (1<<30)
66 #define SSKDF_KMAC128_DEFAULT_SALT_SIZE (168 - 4)
67 #define SSKDF_KMAC256_DEFAULT_SALT_SIZE (136 - 4)
68
69 /* KMAC uses a Customisation string of 'KDF' */
70 static const unsigned char kmac_custom_str[] = { 0x4B, 0x44, 0x46 };
71
72 static OSSL_OP_kdf_newctx_fn sskdf_new;
73 static OSSL_OP_kdf_freectx_fn sskdf_free;
74 static OSSL_OP_kdf_reset_fn sskdf_reset;
75 static OSSL_OP_kdf_derive_fn sskdf_derive;
76 static OSSL_OP_kdf_derive_fn x963kdf_derive;
77 static OSSL_OP_kdf_settable_ctx_params_fn sskdf_settable_ctx_params;
78 static OSSL_OP_kdf_set_ctx_params_fn sskdf_set_ctx_params;
79 static OSSL_OP_kdf_gettable_ctx_params_fn sskdf_gettable_ctx_params;
80 static OSSL_OP_kdf_get_ctx_params_fn sskdf_get_ctx_params;
81
82 /*
83  * Refer to https://csrc.nist.gov/publications/detail/sp/800-56c/rev-1/final
84  * Section 4. One-Step Key Derivation using H(x) = hash(x)
85  * Note: X9.63 also uses this code with the only difference being that the
86  * counter is appended to the secret 'z'.
87  * i.e.
88  *   result[i] = Hash(counter || z || info) for One Step OR
89  *   result[i] = Hash(z || counter || info) for X9.63.
90  */
91 static int SSKDF_hash_kdm(const EVP_MD *kdf_md,
92                           const unsigned char *z, size_t z_len,
93                           const unsigned char *info, size_t info_len,
94                           unsigned int append_ctr,
95                           unsigned char *derived_key, size_t derived_key_len)
96 {
97     int ret = 0, hlen;
98     size_t counter, out_len, len = derived_key_len;
99     unsigned char c[4];
100     unsigned char mac[EVP_MAX_MD_SIZE];
101     unsigned char *out = derived_key;
102     EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
103
104     if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
105             || derived_key_len > SSKDF_MAX_INLEN
106             || derived_key_len == 0)
107         return 0;
108
109     hlen = EVP_MD_size(kdf_md);
110     if (hlen <= 0)
111         return 0;
112     out_len = (size_t)hlen;
113
114     ctx = EVP_MD_CTX_create();
115     ctx_init = EVP_MD_CTX_create();
116     if (ctx == NULL || ctx_init == NULL)
117         goto end;
118
119     if (!EVP_DigestInit(ctx_init, kdf_md))
120         goto end;
121
122     for (counter = 1;; counter++) {
123         c[0] = (unsigned char)((counter >> 24) & 0xff);
124         c[1] = (unsigned char)((counter >> 16) & 0xff);
125         c[2] = (unsigned char)((counter >> 8) & 0xff);
126         c[3] = (unsigned char)(counter & 0xff);
127
128         if (!(EVP_MD_CTX_copy_ex(ctx, ctx_init)
129                 && (append_ctr || EVP_DigestUpdate(ctx, c, sizeof(c)))
130                 && EVP_DigestUpdate(ctx, z, z_len)
131                 && (!append_ctr || EVP_DigestUpdate(ctx, c, sizeof(c)))
132                 && EVP_DigestUpdate(ctx, info, info_len)))
133             goto end;
134         if (len >= out_len) {
135             if (!EVP_DigestFinal_ex(ctx, out, NULL))
136                 goto end;
137             out += out_len;
138             len -= out_len;
139             if (len == 0)
140                 break;
141         } else {
142             if (!EVP_DigestFinal_ex(ctx, mac, NULL))
143                 goto end;
144             memcpy(out, mac, len);
145             break;
146         }
147     }
148     ret = 1;
149 end:
150     EVP_MD_CTX_destroy(ctx);
151     EVP_MD_CTX_destroy(ctx_init);
152     OPENSSL_cleanse(mac, sizeof(mac));
153     return ret;
154 }
155
156 static int kmac_init(EVP_MAC_CTX *ctx, const unsigned char *custom,
157                      size_t custom_len, size_t kmac_out_len,
158                      size_t derived_key_len, unsigned char **out)
159 {
160     OSSL_PARAM params[2];
161
162     /* Only KMAC has custom data - so return if not KMAC */
163     if (custom == NULL)
164         return 1;
165
166     params[0] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_CUSTOM,
167                                                   (void *)custom, custom_len);
168     params[1] = OSSL_PARAM_construct_end();
169
170     if (!EVP_MAC_CTX_set_params(ctx, params))
171         return 0;
172
173     /* By default only do one iteration if kmac_out_len is not specified */
174     if (kmac_out_len == 0)
175         kmac_out_len = derived_key_len;
176     /* otherwise check the size is valid */
177     else if (!(kmac_out_len == derived_key_len
178             || kmac_out_len == 20
179             || kmac_out_len == 28
180             || kmac_out_len == 32
181             || kmac_out_len == 48
182             || kmac_out_len == 64))
183         return 0;
184
185     params[0] = OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE,
186                                             &kmac_out_len);
187
188     if (EVP_MAC_CTX_set_params(ctx, params) <= 0)
189         return 0;
190
191     /*
192      * For kmac the output buffer can be larger than EVP_MAX_MD_SIZE: so
193      * alloc a buffer for this case.
194      */
195     if (kmac_out_len > EVP_MAX_MD_SIZE) {
196         *out = OPENSSL_zalloc(kmac_out_len);
197         if (*out == NULL)
198             return 0;
199     }
200     return 1;
201 }
202
203 /*
204  * Refer to https://csrc.nist.gov/publications/detail/sp/800-56c/rev-1/final
205  * Section 4. One-Step Key Derivation using MAC: i.e either
206  *     H(x) = HMAC-hash(salt, x) OR
207  *     H(x) = KMAC#(salt, x, outbits, CustomString='KDF')
208  */
209 static int SSKDF_mac_kdm(EVP_MAC *kdf_mac, const EVP_MD *hmac_md,
210                          const unsigned char *kmac_custom,
211                          size_t kmac_custom_len, size_t kmac_out_len,
212                          const unsigned char *salt, size_t salt_len,
213                          const unsigned char *z, size_t z_len,
214                          const unsigned char *info, size_t info_len,
215                          unsigned char *derived_key, size_t derived_key_len)
216 {
217     int ret = 0;
218     size_t counter, out_len, len;
219     unsigned char c[4];
220     unsigned char mac_buf[EVP_MAX_MD_SIZE];
221     unsigned char *out = derived_key;
222     EVP_MAC_CTX *ctx = NULL, *ctx_init = NULL;
223     unsigned char *mac = mac_buf, *kmac_buffer = NULL;
224     OSSL_PARAM params[3];
225     size_t params_n = 0;
226
227     if (z_len > SSKDF_MAX_INLEN || info_len > SSKDF_MAX_INLEN
228             || derived_key_len > SSKDF_MAX_INLEN
229             || derived_key_len == 0)
230         return 0;
231
232     ctx_init = EVP_MAC_CTX_new(kdf_mac);
233     if (ctx_init == NULL)
234         goto end;
235
236     if (hmac_md != NULL) {
237         const char *mdname = EVP_MD_name(hmac_md);
238         params[params_n++] =
239             OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
240                                              (char *)mdname, 0);
241     }
242     params[params_n++] =
243         OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, (void *)salt,
244                                           salt_len);
245     params[params_n] = OSSL_PARAM_construct_end();
246
247     if (!EVP_MAC_CTX_set_params(ctx_init, params))
248         goto end;
249
250     if (!kmac_init(ctx_init, kmac_custom, kmac_custom_len, kmac_out_len,
251                    derived_key_len, &kmac_buffer))
252         goto end;
253     if (kmac_buffer != NULL)
254         mac = kmac_buffer;
255
256     if (!EVP_MAC_init(ctx_init))
257         goto end;
258
259     out_len = EVP_MAC_size(ctx_init); /* output size */
260     if (out_len <= 0)
261         goto end;
262     len = derived_key_len;
263
264     for (counter = 1;; counter++) {
265         c[0] = (unsigned char)((counter >> 24) & 0xff);
266         c[1] = (unsigned char)((counter >> 16) & 0xff);
267         c[2] = (unsigned char)((counter >> 8) & 0xff);
268         c[3] = (unsigned char)(counter & 0xff);
269
270         ctx = EVP_MAC_CTX_dup(ctx_init);
271         if (!(ctx != NULL
272                 && EVP_MAC_update(ctx, c, sizeof(c))
273                 && EVP_MAC_update(ctx, z, z_len)
274                 && EVP_MAC_update(ctx, info, info_len)))
275             goto end;
276         if (len >= out_len) {
277             if (!EVP_MAC_final(ctx, out, NULL, len))
278                 goto end;
279             out += out_len;
280             len -= out_len;
281             if (len == 0)
282                 break;
283         } else {
284             if (!EVP_MAC_final(ctx, mac, NULL, len))
285                 goto end;
286             memcpy(out, mac, len);
287             break;
288         }
289         EVP_MAC_CTX_free(ctx);
290         ctx = NULL;
291     }
292     ret = 1;
293 end:
294     if (kmac_buffer != NULL)
295         OPENSSL_clear_free(kmac_buffer, kmac_out_len);
296     else
297         OPENSSL_cleanse(mac_buf, sizeof(mac_buf));
298
299     EVP_MAC_CTX_free(ctx);
300     EVP_MAC_CTX_free(ctx_init);
301     return ret;
302 }
303
304 static void *sskdf_new(void *provctx)
305 {
306     KDF_SSKDF *ctx;
307
308     if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
309         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
310     ctx->provctx = provctx;
311     return ctx;
312 }
313
314 static void sskdf_reset(void *vctx)
315 {
316     KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
317
318     EVP_MD_meth_free(ctx->md);
319     EVP_MAC_free(ctx->mac);
320     OPENSSL_clear_free(ctx->secret, ctx->secret_len);
321     OPENSSL_clear_free(ctx->info, ctx->info_len);
322     OPENSSL_clear_free(ctx->salt, ctx->salt_len);
323     memset(ctx, 0, sizeof(*ctx));
324 }
325
326 static void sskdf_free(void *vctx)
327 {
328     KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
329
330     sskdf_reset(ctx);
331     OPENSSL_free(ctx);
332 }
333
334 static int sskdf_set_buffer(unsigned char **out, size_t *out_len,
335                             const OSSL_PARAM *p)
336 {
337     if (p->data == NULL || p->data_size == 0)
338         return 1;
339     OPENSSL_free(*out);
340     *out = NULL;
341     return OSSL_PARAM_get_octet_string(p, (void **)out, 0, out_len);
342 }
343
344 static size_t sskdf_size(KDF_SSKDF *ctx)
345 {
346     int len;
347
348     if (ctx->md == NULL) {
349         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
350         return 0;
351     }
352     len = EVP_MD_size(ctx->md);
353     return (len <= 0) ? 0 : (size_t)len;
354 }
355
356 static int sskdf_derive(void *vctx, unsigned char *key, size_t keylen)
357 {
358     KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
359
360     if (ctx->secret == NULL) {
361         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_SECRET);
362         return 0;
363     }
364
365     if (ctx->mac != NULL) {
366         /* H(x) = KMAC or H(x) = HMAC */
367         int ret;
368         const unsigned char *custom = NULL;
369         size_t custom_len = 0;
370         const char *macname;
371         int default_salt_len;
372
373         /*
374          * TODO(3.0) investigate the necessity to have all these controls.
375          * Why does KMAC require a salt length that's shorter than the MD
376          * block size?
377          */
378         macname = EVP_MAC_name(ctx->mac);
379         if (strcmp(macname, OSSL_MAC_NAME_HMAC) == 0) {
380             /* H(x) = HMAC(x, salt, hash) */
381             if (ctx->md == NULL) {
382                 ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
383                 return 0;
384             }
385             default_salt_len = EVP_MD_block_size(ctx->md);
386             if (default_salt_len <= 0)
387                 return 0;
388         } else if (strcmp(macname, OSSL_MAC_NAME_KMAC128) == 0
389                    || strcmp(macname, OSSL_MAC_NAME_KMAC256) == 0) {
390             /* H(x) = KMACzzz(x, salt, custom) */
391             custom = kmac_custom_str;
392             custom_len = sizeof(kmac_custom_str);
393             if (strcmp(macname, OSSL_MAC_NAME_KMAC128) == 0)
394                 default_salt_len = SSKDF_KMAC128_DEFAULT_SALT_SIZE;
395             else
396                 default_salt_len = SSKDF_KMAC256_DEFAULT_SALT_SIZE;
397         } else {
398             ERR_raise(ERR_LIB_PROV, PROV_R_UNSUPPORTED_MAC_TYPE);
399             return 0;
400         }
401         /* If no salt is set then use a default_salt of zeros */
402         if (ctx->salt == NULL || ctx->salt_len <= 0) {
403             ctx->salt = OPENSSL_zalloc(default_salt_len);
404             if (ctx->salt == NULL) {
405                 ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
406                 return 0;
407             }
408             ctx->salt_len = default_salt_len;
409         }
410         ret = SSKDF_mac_kdm(ctx->mac, ctx->md,
411                             custom, custom_len, ctx->out_len,
412                             ctx->salt, ctx->salt_len,
413                             ctx->secret, ctx->secret_len,
414                             ctx->info, ctx->info_len, key, keylen);
415         return ret;
416     } else {
417         /* H(x) = hash */
418         if (ctx->md == NULL) {
419             ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
420             return 0;
421         }
422         return SSKDF_hash_kdm(ctx->md, ctx->secret, ctx->secret_len,
423                               ctx->info, ctx->info_len, 0, key, keylen);
424     }
425 }
426
427 static int x963kdf_derive(void *vctx, unsigned char *key, size_t keylen)
428 {
429     KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
430
431     if (ctx->secret == NULL) {
432         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_SECRET);
433         return 0;
434     }
435
436     if (ctx->mac != NULL) {
437         ERR_raise(ERR_LIB_PROV, PROV_R_NOT_SUPPORTED);
438         return 0;
439     } else {
440         /* H(x) = hash */
441         if (ctx->md == NULL) {
442             ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
443             return 0;
444         }
445         return SSKDF_hash_kdm(ctx->md, ctx->secret, ctx->secret_len,
446                               ctx->info, ctx->info_len, 1, key, keylen);
447     }
448 }
449
450 static int sskdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
451 {
452     const OSSL_PARAM *p;
453     KDF_SSKDF *ctx = vctx;
454     EVP_MD *md;
455     EVP_MAC *mac;
456     size_t sz;
457     const char *properties = NULL;
458
459     /* Grab search properties, should be before the digest and mac lookups */
460     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_PROPERTIES))
461         != NULL) {
462         if (p->data_type != OSSL_PARAM_UTF8_STRING)
463             return 0;
464         properties = p->data;
465     }
466     /* Handle aliasing of digest parameter names */
467     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_DIGEST)) != NULL) {
468         if (p->data_type != OSSL_PARAM_UTF8_STRING)
469             return 0;
470         md = EVP_MD_fetch(PROV_LIBRARY_CONTEXT_OF(ctx->provctx), p->data,
471                           properties);
472         if (md == NULL) {
473             ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST);
474             return 0;
475         }
476         EVP_MD_meth_free(ctx->md);
477         ctx->md = md;
478     }
479
480     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MAC)) != NULL) {
481         EVP_MAC_free(ctx->mac);
482         ctx->mac = NULL;
483
484         mac = EVP_MAC_fetch(PROV_LIBRARY_CONTEXT_OF(ctx->provctx), p->data,
485                             properties);
486         if (mac == NULL)
487             return 0;
488         EVP_MAC_free(ctx->mac);
489         ctx->mac = mac;
490     }
491
492     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SECRET)) != NULL
493         || (p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_KEY)) != NULL)
494         if (!sskdf_set_buffer(&ctx->secret, &ctx->secret_len, p))
495             return 0;
496
497     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_INFO)) != NULL)
498         if (!sskdf_set_buffer(&ctx->info, &ctx->info_len, p))
499             return 0;
500
501     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SALT)) != NULL)
502         if (!sskdf_set_buffer(&ctx->salt, &ctx->salt_len, p))
503             return 0;
504
505     if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MAC_SIZE))
506         != NULL) {
507         if (!OSSL_PARAM_get_size_t(p, &sz) || sz == 0)
508             return 0;
509         ctx->out_len = sz;
510     }
511     return 1;
512 }
513
514 static const OSSL_PARAM *sskdf_settable_ctx_params(void)
515 {
516     static const OSSL_PARAM known_settable_ctx_params[] = {
517         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SECRET, NULL, 0),
518         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_KEY, NULL, 0),
519         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_INFO, NULL, 0),
520         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0),
521         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_DIGEST, NULL, 0),
522         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_MAC, NULL, 0),
523         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SALT, NULL, 0),
524         OSSL_PARAM_size_t(OSSL_KDF_PARAM_MAC_SIZE, NULL),
525         OSSL_PARAM_END
526     };
527     return known_settable_ctx_params;
528 }
529
530 static int sskdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
531 {
532     KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
533     OSSL_PARAM *p;
534
535     if ((p = OSSL_PARAM_locate(params, OSSL_KDF_PARAM_SIZE)) != NULL)
536         return OSSL_PARAM_set_size_t(p, sskdf_size(ctx));
537     return -2;
538 }
539
540 static const OSSL_PARAM *sskdf_gettable_ctx_params(void)
541 {
542     static const OSSL_PARAM known_gettable_ctx_params[] = {
543         OSSL_PARAM_size_t(OSSL_KDF_PARAM_SIZE, NULL),
544         OSSL_PARAM_END
545     };
546     return known_gettable_ctx_params;
547 }
548
549 const OSSL_DISPATCH kdf_sskdf_functions[] = {
550     { OSSL_FUNC_KDF_NEWCTX, (void(*)(void))sskdf_new },
551     { OSSL_FUNC_KDF_FREECTX, (void(*)(void))sskdf_free },
552     { OSSL_FUNC_KDF_RESET, (void(*)(void))sskdf_reset },
553     { OSSL_FUNC_KDF_DERIVE, (void(*)(void))sskdf_derive },
554     { OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS,
555       (void(*)(void))sskdf_settable_ctx_params },
556     { OSSL_FUNC_KDF_SET_CTX_PARAMS, (void(*)(void))sskdf_set_ctx_params },
557     { OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS,
558       (void(*)(void))sskdf_gettable_ctx_params },
559     { OSSL_FUNC_KDF_GET_CTX_PARAMS, (void(*)(void))sskdf_get_ctx_params },
560     { 0, NULL }
561 };
562
563 const OSSL_DISPATCH kdf_x963_kdf_functions[] = {
564     { OSSL_FUNC_KDF_NEWCTX, (void(*)(void))sskdf_new },
565     { OSSL_FUNC_KDF_FREECTX, (void(*)(void))sskdf_free },
566     { OSSL_FUNC_KDF_RESET, (void(*)(void))sskdf_reset },
567     { OSSL_FUNC_KDF_DERIVE, (void(*)(void))x963kdf_derive },
568     { OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS,
569       (void(*)(void))sskdf_settable_ctx_params },
570     { OSSL_FUNC_KDF_SET_CTX_PARAMS, (void(*)(void))sskdf_set_ctx_params },
571     { OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS,
572       (void(*)(void))sskdf_gettable_ctx_params },
573     { OSSL_FUNC_KDF_GET_CTX_PARAMS, (void(*)(void))sskdf_get_ctx_params },
574     { 0, NULL }
575 };