31a69a096e3c412f6693bf0022b1d7c932370ce4
[openssl.git] / providers / implementations / kdfs / x942kdf.c
1 /*
2  * Copyright 2019-2020 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 #include "e_os.h"
12 #include <openssl/core_names.h>
13 #include <openssl/core_dispatch.h>
14 #include <openssl/err.h>
15 #include <openssl/evp.h>
16 #include <openssl/params.h>
17 #include "internal/packet.h"
18 #include "internal/der.h"
19 #include "prov/provider_ctx.h"
20 #include "prov/providercommon.h"
21 #include "prov/providercommonerr.h"
22 #include "prov/implementations.h"
23 #include "prov/provider_util.h"
24 #include "prov/der_wrap.h"
25
26 #define X942KDF_MAX_INLEN (1 << 30)
27
28 static OSSL_FUNC_kdf_newctx_fn x942kdf_new;
29 static OSSL_FUNC_kdf_freectx_fn x942kdf_free;
30 static OSSL_FUNC_kdf_reset_fn x942kdf_reset;
31 static OSSL_FUNC_kdf_derive_fn x942kdf_derive;
32 static OSSL_FUNC_kdf_settable_ctx_params_fn x942kdf_settable_ctx_params;
33 static OSSL_FUNC_kdf_set_ctx_params_fn x942kdf_set_ctx_params;
34 static OSSL_FUNC_kdf_gettable_ctx_params_fn x942kdf_gettable_ctx_params;
35 static OSSL_FUNC_kdf_get_ctx_params_fn x942kdf_get_ctx_params;
36
37 typedef struct {
38     void *provctx;
39     PROV_DIGEST digest;
40     unsigned char *secret;
41     size_t secret_len;
42     unsigned char *partyuinfo, *partyvinfo, *supp_pubinfo, *supp_privinfo;
43     size_t partyuinfo_len, partyvinfo_len, supp_pubinfo_len, supp_privinfo_len;
44     size_t dkm_len;
45     const unsigned char *cek_oid;
46     size_t cek_oid_len;
47     int use_keybits;
48 } KDF_X942;
49
50 /*
51  * A table of allowed wrapping algorithms, oids and the associated output
52  * lengths.
53  * NOTE: RC2wrap and camellia128_wrap have been removed as there are no
54  * corresponding ciphers for these operations.
55  */
56 static const struct {
57     const char *name;
58     const unsigned char *oid;
59     size_t oid_len;
60     size_t keklen; /* size in bytes */
61 } kek_algs[] = {
62     { "AES-128-WRAP", ossl_der_oid_id_aes128_wrap, DER_OID_SZ_id_aes128_wrap,
63       16 },
64     { "AES-192-WRAP", ossl_der_oid_id_aes192_wrap, DER_OID_SZ_id_aes192_wrap,
65       24 },
66     { "AES-256-WRAP", ossl_der_oid_id_aes256_wrap, DER_OID_SZ_id_aes256_wrap,
67       32 },
68 #ifndef FIPS_MODULE
69     { "DES3-WRAP", ossl_der_oid_id_alg_CMS3DESwrap,
70       DER_OID_SZ_id_alg_CMS3DESwrap, 24 },
71 #endif
72 };
73
74 static int find_alg_id(OSSL_LIB_CTX *libctx, const char *algname,
75                        const char *propq, size_t *id)
76 {
77     int ret = 1;
78     size_t i;
79     EVP_CIPHER *cipher;
80
81     cipher = EVP_CIPHER_fetch(libctx, algname, propq);
82     if (cipher != NULL) {
83         for (i = 0; i < OSSL_NELEM(kek_algs); i++) {
84             if (EVP_CIPHER_is_a(cipher, kek_algs[i].name)) {
85                 *id = i;
86                 goto end;
87             }
88         }
89     }
90     ret = 0;
91     ERR_raise(ERR_LIB_PROV, PROV_R_UNSUPPORTED_CEK_ALG);
92 end:
93     EVP_CIPHER_free(cipher);
94     return ret;
95 }
96
97 static int DER_w_keyinfo(WPACKET *pkt,
98                          const unsigned char *der_oid, size_t der_oidlen,
99                          unsigned char **pcounter)
100 {
101     return ossl_DER_w_begin_sequence(pkt, -1)
102            /* Store the initial value of 1 into the counter */
103            && ossl_DER_w_octet_string_uint32(pkt, -1, 1)
104            /* Remember where we stored the counter in the buffer */
105            && (pcounter == NULL
106                || (*pcounter = WPACKET_get_curr(pkt)) != NULL)
107            && ossl_DER_w_precompiled(pkt, -1, der_oid, der_oidlen)
108            && ossl_DER_w_end_sequence(pkt, -1);
109 }
110
111 static int der_encode_sharedinfo(WPACKET *pkt, unsigned char *buf, size_t buflen,
112                                  const unsigned char *der_oid, size_t der_oidlen,
113                                  const unsigned char *partyu, size_t partyulen,
114                                  const unsigned char *partyv, size_t partyvlen,
115                                  const unsigned char *supp_pub, size_t supp_publen,
116                                  const unsigned char *supp_priv, size_t supp_privlen,
117                                  uint32_t keylen_bits, unsigned char **pcounter)
118 {
119     return (buf != NULL ? WPACKET_init_der(pkt, buf, buflen) :
120                           WPACKET_init_null_der(pkt))
121            && ossl_DER_w_begin_sequence(pkt, -1)
122            && (supp_priv == NULL
123                || ossl_DER_w_octet_string(pkt, 3, supp_priv, supp_privlen))
124            && (supp_pub == NULL
125                || ossl_DER_w_octet_string(pkt, 2, supp_pub, supp_publen))
126            && (keylen_bits == 0
127                || ossl_DER_w_octet_string_uint32(pkt, 2, keylen_bits))
128            && (partyv == NULL || ossl_DER_w_octet_string(pkt, 1, partyv, partyvlen))
129            && (partyu == NULL || ossl_DER_w_octet_string(pkt, 0, partyu, partyulen))
130            && DER_w_keyinfo(pkt, der_oid, der_oidlen, pcounter)
131            && ossl_DER_w_end_sequence(pkt, -1)
132            && WPACKET_finish(pkt);
133 }
134
135 /*
136  * Encode the other info structure.
137  *
138  * The ANS X9.42-2003 standard uses OtherInfo:
139  *
140  *  OtherInfo ::= SEQUENCE {
141  *      keyInfo KeySpecificInfo,
142  *      partyUInfo [0] OCTET STRING OPTIONAL,
143  *      partyVInfo [1] OCTET STRING OPTIONAL,
144  *      suppPubInfo [2] OCTET STRING OPTIONAL,
145  *      suppPrivInfo [3] OCTET STRING OPTIONAL
146  *  }
147  *
148  *  KeySpecificInfo ::= SEQUENCE {
149  *      algorithm OBJECT IDENTIFIER,
150  *      counter OCTET STRING SIZE (4..4)
151  *  }
152  *
153  *  RFC2631 Section 2.1.2 Contains the following definition for OtherInfo
154  *
155  *  OtherInfo ::= SEQUENCE {
156  *      keyInfo KeySpecificInfo,
157  *      partyAInfo [0] OCTET STRING OPTIONAL,
158  *      suppPubInfo [2] OCTET STRING
159  *  }
160  *  Where suppPubInfo is the key length (in bits) (stored into 4 bytes)
161  *
162 }
163  *
164  * |keylen| is the length (in bytes) of the generated KEK. It is stored into
165  * suppPubInfo (in bits). It is ignored if the value is 0.
166  * |cek_oid| The oid of the key wrapping algorithm.
167  * |cek_oidlen| The length (in bytes) of the key wrapping algorithm oid,
168  * |partyu| is the optional public info contributed by the initiator. It
169  * can be NULL. (It is also used as the ukm by CMS).
170  * |partyu_len| is the |partyu| length (in bytes).
171  * |partyv| is the optional public info contributed by the responder. It
172  * can be NULL.
173  * |partyv_len| is the |partyv| length (in bytes).
174  * |supp_pub| is the optional additional, mutually-known public information. It
175  * can be NULL. |keylen| should be 0 if this is not NULL.
176  * |supp_pub_len| is the |supp_pub| length (in bytes).
177  * |supp_priv| is the optional additional, mutually-known private information. It
178  * can be NULL.
179  * |supp_priv_len| is the |supp_priv| length (in bytes).
180  * |der| is the returned encoded data. It must be freed by the caller.
181  * |der_len| is the returned size of the encoded data.
182  * |out_ctr| returns a pointer to the counter data which is embedded inside the
183  * encoded data. This allows the counter bytes to be updated without re-encoding.
184  *
185  * Returns: 1 if successfully encoded, or 0 otherwise.
186  * Assumptions: |der|, |der_len| & |out_ctr| are not NULL.
187  */
188 static int
189 x942_encode_otherinfo(size_t keylen,
190                       const unsigned char *cek_oid, size_t cek_oidlen,
191                       const unsigned char *partyu, size_t partyu_len,
192                       const unsigned char *partyv, size_t partyv_len,
193                       const unsigned char *supp_pub, size_t supp_pub_len,
194                       const unsigned char *supp_priv, size_t supp_priv_len,
195                       unsigned char **der, size_t *der_len,
196                       unsigned char **out_ctr)
197 {
198     int ret = 0;
199     unsigned char *pcounter = NULL, *der_buf = NULL;
200     size_t der_buflen = 0;
201     WPACKET pkt;
202     uint32_t keylen_bits;
203
204     /* keylenbits must fit into 4 bytes */
205     if (keylen > 0xFFFFFF)
206         return 0;
207     keylen_bits = 8 * keylen;
208
209     /* Calculate the size of the buffer */
210     if (!der_encode_sharedinfo(&pkt, NULL, 0, cek_oid, cek_oidlen,
211                                partyu, partyu_len, partyv, partyv_len,
212                                supp_pub, supp_pub_len, supp_priv, supp_priv_len,
213                                keylen_bits, NULL)
214         || !WPACKET_get_total_written(&pkt, &der_buflen))
215         goto err;
216     WPACKET_cleanup(&pkt);
217     /* Alloc the buffer */
218     der_buf = OPENSSL_zalloc(der_buflen);
219     if (der_buf == NULL)
220         goto err;
221     /* Encode into the buffer */
222     if (!der_encode_sharedinfo(&pkt, der_buf, der_buflen, cek_oid, cek_oidlen,
223                                partyu, partyu_len, partyv, partyv_len,
224                                supp_pub, supp_pub_len, supp_priv, supp_priv_len,
225                                keylen_bits, &pcounter))
226         goto err;
227     /*
228      * Since we allocated the exact size required, the buffer should point to the
229      * start of the alllocated buffer at this point.
230      */
231     if (WPACKET_get_curr(&pkt) != der_buf)
232         goto err;
233
234     /*
235      * The data for the DER encoded octet string of a 32 bit counter = 1
236      * should be 04 04 00 00 00 01
237      * So just check the header is correct and skip over it.
238      * This counter will be incremented in the kdf update loop.
239      */
240     if (pcounter == NULL
241         || pcounter[0] != 0x04
242         || pcounter[1] != 0x04)
243         goto err;
244     *out_ctr = (pcounter + 2);
245     *der = der_buf;
246     *der_len = der_buflen;
247     ret = 1;
248 err:
249     WPACKET_cleanup(&pkt);
250     return ret;
251 }
252
253 static int x942kdf_hash_kdm(const EVP_MD *kdf_md,
254                             const unsigned char *z, size_t z_len,
255                             const unsigned char *other, size_t other_len,
256                             unsigned char *ctr,
257                             unsigned char *derived_key, size_t derived_key_len)
258 {
259     int ret = 0, hlen;
260     size_t counter, out_len, len = derived_key_len;
261     unsigned char mac[EVP_MAX_MD_SIZE];
262     unsigned char *out = derived_key;
263     EVP_MD_CTX *ctx = NULL, *ctx_init = NULL;
264
265     if (z_len > X942KDF_MAX_INLEN || other_len > X942KDF_MAX_INLEN
266             || derived_key_len > X942KDF_MAX_INLEN
267             || derived_key_len == 0) {
268         ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH);
269         return 0;
270     }
271
272     hlen = EVP_MD_size(kdf_md);
273     if (hlen <= 0)
274         return 0;
275     out_len = (size_t)hlen;
276
277     ctx = EVP_MD_CTX_create();
278     ctx_init = EVP_MD_CTX_create();
279     if (ctx == NULL || ctx_init == NULL)
280         goto end;
281
282     if (!EVP_DigestInit(ctx_init, kdf_md))
283         goto end;
284
285     for (counter = 1;; counter++) {
286         /* updating the ctr modifies 4 bytes in the 'other' buffer */
287         ctr[0] = (unsigned char)((counter >> 24) & 0xff);
288         ctr[1] = (unsigned char)((counter >> 16) & 0xff);
289         ctr[2] = (unsigned char)((counter >> 8) & 0xff);
290         ctr[3] = (unsigned char)(counter & 0xff);
291
292         if (!EVP_MD_CTX_copy_ex(ctx, ctx_init)
293             || !EVP_DigestUpdate(ctx, z, z_len)
294             || !EVP_DigestUpdate(ctx, other, other_len))
295             goto end;
296         if (len >= out_len) {
297             if (!EVP_DigestFinal_ex(ctx, out, NULL))
298                 goto end;
299             out += out_len;
300             len -= out_len;
301             if (len == 0)
302                 break;
303         } else {
304             if (!EVP_DigestFinal_ex(ctx, mac, NULL))
305                 goto end;
306             memcpy(out, mac, len);
307             break;
308         }
309     }
310     ret = 1;
311 end:
312     EVP_MD_CTX_free(ctx);
313     EVP_MD_CTX_free(ctx_init);
314     OPENSSL_cleanse(mac, sizeof(mac));
315     return ret;
316 }
317
318 static void *x942kdf_new(void *provctx)
319 {
320     KDF_X942 *ctx;
321
322     if (!ossl_prov_is_running())
323         return 0;
324
325     if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
326         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
327     ctx->provctx = provctx;
328     ctx->use_keybits = 1;
329     return ctx;
330 }
331
332 static void x942kdf_reset(void *vctx)
333 {
334     KDF_X942 *ctx = (KDF_X942 *)vctx;
335     void *provctx = ctx->provctx;
336
337     ossl_prov_digest_reset(&ctx->digest);
338     OPENSSL_clear_free(ctx->secret, ctx->secret_len);
339     OPENSSL_clear_free(ctx->partyuinfo, ctx->partyuinfo_len);
340     OPENSSL_clear_free(ctx->partyvinfo, ctx->partyvinfo_len);
341     OPENSSL_clear_free(ctx->supp_pubinfo, ctx->supp_pubinfo_len);
342     OPENSSL_clear_free(ctx->supp_privinfo, ctx->supp_privinfo_len);
343     memset(ctx, 0, sizeof(*ctx));
344     ctx->provctx = provctx;
345     ctx->use_keybits = 1;
346 }
347
348 static void x942kdf_free(void *vctx)
349 {
350     KDF_X942 *ctx = (KDF_X942 *)vctx;
351
352     if (ctx != NULL) {
353         x942kdf_reset(ctx);
354         OPENSSL_free(ctx);
355     }
356 }
357
358 static int x942kdf_set_buffer(unsigned char **out, size_t *out_len,
359                               const OSSL_PARAM *p)
360 {
361     if (p->data_size == 0 || p->data == NULL)
362         return 1;
363
364     OPENSSL_free(*out);
365     *out = NULL;
366     return OSSL_PARAM_get_octet_string(p, (void **)out, 0, out_len);
367 }
368
369 static size_t x942kdf_size(KDF_X942 *ctx)
370 {
371     int len;
372     const EVP_MD *md = ossl_prov_digest_md(&ctx->digest);
373
374     if (md == NULL) {
375         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
376         return 0;
377     }
378     len = EVP_MD_size(md);
379     return (len <= 0) ? 0 : (size_t)len;
380 }
381
382 static int x942kdf_derive(void *vctx, unsigned char *key, size_t keylen)
383 {
384     KDF_X942 *ctx = (KDF_X942 *)vctx;
385     const EVP_MD *md;
386     int ret = 0;
387     unsigned char *ctr;
388     unsigned char *der = NULL;
389     size_t der_len = 0;
390
391     if (!ossl_prov_is_running())
392         return 0;
393
394     /*
395      * These 2 options encode to the same field so only one of them should be
396      * active at once.
397      */
398     if (ctx->use_keybits && ctx->supp_pubinfo != NULL) {
399         ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PUBINFO);
400         return 0;
401     }
402
403     if (ctx->secret == NULL) {
404         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_SECRET);
405         return 0;
406     }
407     md = ossl_prov_digest_md(&ctx->digest);
408     if (md == NULL) {
409         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST);
410         return 0;
411     }
412     if (ctx->cek_oid == NULL || ctx->cek_oid_len == 0) {
413         ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_CEK_ALG);
414         return 0;
415     }
416     if (ctx->partyuinfo != NULL && ctx->partyuinfo_len >= X942KDF_MAX_INLEN) {
417         /*
418          * Note the ukm length MUST be 512 bits if it is used.
419          * For backwards compatibility the old check is being done.
420          */
421         ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_UKM_LENGTH);
422         return 0;
423     }
424     /* generate the otherinfo der */
425     if (!x942_encode_otherinfo(ctx->use_keybits ? ctx->dkm_len : 0,
426                                ctx->cek_oid, ctx->cek_oid_len,
427                                ctx->partyuinfo, ctx->partyuinfo_len,
428                                ctx->partyvinfo, ctx->partyvinfo_len,
429                                ctx->supp_pubinfo, ctx->supp_pubinfo_len,
430                                ctx->supp_privinfo, ctx->supp_privinfo_len,
431                                &der, &der_len, &ctr)) {
432         ERR_raise(ERR_LIB_PROV, PROV_R_BAD_ENCODING);
433         return 0;
434     }
435     ret = x942kdf_hash_kdm(md, ctx->secret, ctx->secret_len,
436                            der, der_len, ctr, key, keylen);
437     OPENSSL_free(der);
438     return ret;
439 }
440
441 static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
442 {
443     const OSSL_PARAM *p, *pq;
444     KDF_X942 *ctx = vctx;
445     OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
446     const char *propq = NULL;
447     size_t id;
448
449     if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
450         return 0;
451
452     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_SECRET);
453     if (p == NULL)
454         p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_KEY);
455     if (p != NULL && !x942kdf_set_buffer(&ctx->secret, &ctx->secret_len, p))
456         return 0;
457
458     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_X942_PARTYUINFO);
459     if (p == NULL)
460         p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_UKM);
461     if (p != NULL
462         && !x942kdf_set_buffer(&ctx->partyuinfo, &ctx->partyuinfo_len, p))
463         return 0;
464
465     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_X942_PARTYVINFO);
466     if (p != NULL
467         && !x942kdf_set_buffer(&ctx->partyvinfo, &ctx->partyvinfo_len, p))
468         return 0;
469
470     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_X942_USE_KEYBITS);
471     if (p != NULL && !OSSL_PARAM_get_int(p, &ctx->use_keybits))
472         return 0;
473
474     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_X942_SUPP_PUBINFO);
475     if (p != NULL) {
476         if (!x942kdf_set_buffer(&ctx->supp_pubinfo, &ctx->supp_pubinfo_len, p))
477             return 0;
478         ctx->use_keybits = 0;
479     }
480
481     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_X942_SUPP_PRIVINFO);
482     if (p != NULL
483         && !x942kdf_set_buffer(&ctx->supp_privinfo, &ctx->supp_privinfo_len, p))
484         return 0;
485
486     p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_CEK_ALG);
487     if (p != NULL) {
488         if (p->data_type != OSSL_PARAM_UTF8_STRING)
489             return 0;
490         pq = OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_PROPERTIES);
491         /*
492          * We already grab the properties during ossl_prov_digest_load_from_params()
493          * so there is no need to check the validity again..
494          */
495         if (pq != NULL)
496             propq = p->data;
497         if (find_alg_id(provctx, p->data, propq, &id) == 0)
498             return 0;
499         ctx->cek_oid = kek_algs[id].oid;
500         ctx->cek_oid_len = kek_algs[id].oid_len;
501         ctx->dkm_len = kek_algs[id].keklen;
502     }
503     return 1;
504 }
505
506 static const OSSL_PARAM *x942kdf_settable_ctx_params(ossl_unused void *provctx)
507 {
508     static const OSSL_PARAM known_settable_ctx_params[] = {
509         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0),
510         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_DIGEST, NULL, 0),
511         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SECRET, NULL, 0),
512         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_KEY, NULL, 0),
513         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_UKM, NULL, 0),
514         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_PARTYUINFO, NULL, 0),
515         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_PARTYVINFO, NULL, 0),
516         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_SUPP_PUBINFO, NULL, 0),
517         OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_SUPP_PRIVINFO, NULL, 0),
518         OSSL_PARAM_int(OSSL_KDF_PARAM_X942_USE_KEYBITS, NULL),
519         OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_CEK_ALG, NULL, 0),
520         OSSL_PARAM_END
521     };
522     return known_settable_ctx_params;
523 }
524
525 static int x942kdf_get_ctx_params(void *vctx, OSSL_PARAM params[])
526 {
527     KDF_X942 *ctx = (KDF_X942 *)vctx;
528     OSSL_PARAM *p;
529
530     if ((p = OSSL_PARAM_locate(params, OSSL_KDF_PARAM_SIZE)) != NULL)
531         return OSSL_PARAM_set_size_t(p, x942kdf_size(ctx));
532     return -2;
533 }
534
535 static const OSSL_PARAM *x942kdf_gettable_ctx_params(ossl_unused void *provctx)
536 {
537     static const OSSL_PARAM known_gettable_ctx_params[] = {
538         OSSL_PARAM_size_t(OSSL_KDF_PARAM_SIZE, NULL),
539         OSSL_PARAM_END
540     };
541     return known_gettable_ctx_params;
542 }
543
544 const OSSL_DISPATCH ossl_kdf_x942_kdf_functions[] = {
545     { OSSL_FUNC_KDF_NEWCTX, (void(*)(void))x942kdf_new },
546     { OSSL_FUNC_KDF_FREECTX, (void(*)(void))x942kdf_free },
547     { OSSL_FUNC_KDF_RESET, (void(*)(void))x942kdf_reset },
548     { OSSL_FUNC_KDF_DERIVE, (void(*)(void))x942kdf_derive },
549     { OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS,
550       (void(*)(void))x942kdf_settable_ctx_params },
551     { OSSL_FUNC_KDF_SET_CTX_PARAMS, (void(*)(void))x942kdf_set_ctx_params },
552     { OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS,
553       (void(*)(void))x942kdf_gettable_ctx_params },
554     { OSSL_FUNC_KDF_GET_CTX_PARAMS, (void(*)(void))x942kdf_get_ctx_params },
555     { 0, NULL }
556 };