ecdh_exch.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (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. * ECDH low level APIs are deprecated for public use, but still ok for
  11. * internal use.
  12. */
  13. #include "internal/deprecated.h"
  14. #include <string.h>
  15. #include <openssl/crypto.h>
  16. #include <openssl/evp.h>
  17. #include <openssl/core_dispatch.h>
  18. #include <openssl/core_names.h>
  19. #include <openssl/ec.h>
  20. #include <openssl/params.h>
  21. #include <openssl/err.h>
  22. #include <openssl/proverr.h>
  23. #include "prov/provider_ctx.h"
  24. #include "prov/providercommon.h"
  25. #include "prov/implementations.h"
  26. #include "prov/securitycheck.h"
  27. #include "crypto/ec.h" /* ossl_ecdh_kdf_X9_63() */
  28. static OSSL_FUNC_keyexch_newctx_fn ecdh_newctx;
  29. static OSSL_FUNC_keyexch_init_fn ecdh_init;
  30. static OSSL_FUNC_keyexch_set_peer_fn ecdh_set_peer;
  31. static OSSL_FUNC_keyexch_derive_fn ecdh_derive;
  32. static OSSL_FUNC_keyexch_freectx_fn ecdh_freectx;
  33. static OSSL_FUNC_keyexch_dupctx_fn ecdh_dupctx;
  34. static OSSL_FUNC_keyexch_set_ctx_params_fn ecdh_set_ctx_params;
  35. static OSSL_FUNC_keyexch_settable_ctx_params_fn ecdh_settable_ctx_params;
  36. static OSSL_FUNC_keyexch_get_ctx_params_fn ecdh_get_ctx_params;
  37. static OSSL_FUNC_keyexch_gettable_ctx_params_fn ecdh_gettable_ctx_params;
  38. enum kdf_type {
  39. PROV_ECDH_KDF_NONE = 0,
  40. PROV_ECDH_KDF_X9_63
  41. };
  42. /*
  43. * What's passed as an actual key is defined by the KEYMGMT interface.
  44. * We happen to know that our KEYMGMT simply passes EC_KEY structures, so
  45. * we use that here too.
  46. */
  47. typedef struct {
  48. OSSL_LIB_CTX *libctx;
  49. EC_KEY *k;
  50. EC_KEY *peerk;
  51. /*
  52. * ECDH cofactor mode:
  53. *
  54. * . 0 disabled
  55. * . 1 enabled
  56. * . -1 use cofactor mode set for k
  57. */
  58. int cofactor_mode;
  59. /************
  60. * ECDH KDF *
  61. ************/
  62. /* KDF (if any) to use for ECDH */
  63. enum kdf_type kdf_type;
  64. /* Message digest to use for key derivation */
  65. EVP_MD *kdf_md;
  66. /* User key material */
  67. unsigned char *kdf_ukm;
  68. size_t kdf_ukmlen;
  69. /* KDF output length */
  70. size_t kdf_outlen;
  71. } PROV_ECDH_CTX;
  72. static
  73. void *ecdh_newctx(void *provctx)
  74. {
  75. PROV_ECDH_CTX *pectx;
  76. if (!ossl_prov_is_running())
  77. return NULL;
  78. pectx = OPENSSL_zalloc(sizeof(*pectx));
  79. if (pectx == NULL)
  80. return NULL;
  81. pectx->libctx = PROV_LIBCTX_OF(provctx);
  82. pectx->cofactor_mode = -1;
  83. pectx->kdf_type = PROV_ECDH_KDF_NONE;
  84. return (void *)pectx;
  85. }
  86. static
  87. int ecdh_init(void *vpecdhctx, void *vecdh, const OSSL_PARAM params[])
  88. {
  89. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  90. if (!ossl_prov_is_running()
  91. || pecdhctx == NULL
  92. || vecdh == NULL
  93. || !EC_KEY_up_ref(vecdh))
  94. return 0;
  95. EC_KEY_free(pecdhctx->k);
  96. pecdhctx->k = vecdh;
  97. pecdhctx->cofactor_mode = -1;
  98. pecdhctx->kdf_type = PROV_ECDH_KDF_NONE;
  99. return ecdh_set_ctx_params(pecdhctx, params)
  100. && ossl_ec_check_key(pecdhctx->libctx, vecdh, 1);
  101. }
  102. static
  103. int ecdh_match_params(const EC_KEY *priv, const EC_KEY *peer)
  104. {
  105. int ret;
  106. BN_CTX *ctx = NULL;
  107. const EC_GROUP *group_priv = EC_KEY_get0_group(priv);
  108. const EC_GROUP *group_peer = EC_KEY_get0_group(peer);
  109. ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(priv));
  110. if (ctx == NULL) {
  111. ERR_raise(ERR_LIB_PROV, ERR_R_BN_LIB);
  112. return 0;
  113. }
  114. ret = group_priv != NULL
  115. && group_peer != NULL
  116. && EC_GROUP_cmp(group_priv, group_peer, ctx) == 0;
  117. if (!ret)
  118. ERR_raise(ERR_LIB_PROV, PROV_R_MISMATCHING_DOMAIN_PARAMETERS);
  119. BN_CTX_free(ctx);
  120. return ret;
  121. }
  122. static
  123. int ecdh_set_peer(void *vpecdhctx, void *vecdh)
  124. {
  125. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  126. if (!ossl_prov_is_running()
  127. || pecdhctx == NULL
  128. || vecdh == NULL
  129. || !ecdh_match_params(pecdhctx->k, vecdh)
  130. || !ossl_ec_check_key(pecdhctx->libctx, vecdh, 1)
  131. || !EC_KEY_up_ref(vecdh))
  132. return 0;
  133. EC_KEY_free(pecdhctx->peerk);
  134. pecdhctx->peerk = vecdh;
  135. return 1;
  136. }
  137. static
  138. void ecdh_freectx(void *vpecdhctx)
  139. {
  140. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  141. EC_KEY_free(pecdhctx->k);
  142. EC_KEY_free(pecdhctx->peerk);
  143. EVP_MD_free(pecdhctx->kdf_md);
  144. OPENSSL_clear_free(pecdhctx->kdf_ukm, pecdhctx->kdf_ukmlen);
  145. OPENSSL_free(pecdhctx);
  146. }
  147. static
  148. void *ecdh_dupctx(void *vpecdhctx)
  149. {
  150. PROV_ECDH_CTX *srcctx = (PROV_ECDH_CTX *)vpecdhctx;
  151. PROV_ECDH_CTX *dstctx;
  152. if (!ossl_prov_is_running())
  153. return NULL;
  154. dstctx = OPENSSL_zalloc(sizeof(*srcctx));
  155. if (dstctx == NULL)
  156. return NULL;
  157. *dstctx = *srcctx;
  158. /* clear all pointers */
  159. dstctx->k= NULL;
  160. dstctx->peerk = NULL;
  161. dstctx->kdf_md = NULL;
  162. dstctx->kdf_ukm = NULL;
  163. /* up-ref all ref-counted objects referenced in dstctx */
  164. if (srcctx->k != NULL && !EC_KEY_up_ref(srcctx->k))
  165. goto err;
  166. else
  167. dstctx->k = srcctx->k;
  168. if (srcctx->peerk != NULL && !EC_KEY_up_ref(srcctx->peerk))
  169. goto err;
  170. else
  171. dstctx->peerk = srcctx->peerk;
  172. if (srcctx->kdf_md != NULL && !EVP_MD_up_ref(srcctx->kdf_md))
  173. goto err;
  174. else
  175. dstctx->kdf_md = srcctx->kdf_md;
  176. /* Duplicate UKM data if present */
  177. if (srcctx->kdf_ukm != NULL && srcctx->kdf_ukmlen > 0) {
  178. dstctx->kdf_ukm = OPENSSL_memdup(srcctx->kdf_ukm,
  179. srcctx->kdf_ukmlen);
  180. if (dstctx->kdf_ukm == NULL)
  181. goto err;
  182. }
  183. return dstctx;
  184. err:
  185. ecdh_freectx(dstctx);
  186. return NULL;
  187. }
  188. static
  189. int ecdh_set_ctx_params(void *vpecdhctx, const OSSL_PARAM params[])
  190. {
  191. char name[80] = { '\0' }; /* should be big enough */
  192. char *str = NULL;
  193. PROV_ECDH_CTX *pectx = (PROV_ECDH_CTX *)vpecdhctx;
  194. const OSSL_PARAM *p;
  195. if (pectx == NULL)
  196. return 0;
  197. if (params == NULL)
  198. return 1;
  199. p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE);
  200. if (p != NULL) {
  201. int mode;
  202. if (!OSSL_PARAM_get_int(p, &mode))
  203. return 0;
  204. if (mode < -1 || mode > 1)
  205. return 0;
  206. pectx->cofactor_mode = mode;
  207. }
  208. p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_TYPE);
  209. if (p != NULL) {
  210. str = name;
  211. if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(name)))
  212. return 0;
  213. if (name[0] == '\0')
  214. pectx->kdf_type = PROV_ECDH_KDF_NONE;
  215. else if (strcmp(name, OSSL_KDF_NAME_X963KDF) == 0)
  216. pectx->kdf_type = PROV_ECDH_KDF_X9_63;
  217. else
  218. return 0;
  219. }
  220. p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_DIGEST);
  221. if (p != NULL) {
  222. char mdprops[80] = { '\0' }; /* should be big enough */
  223. str = name;
  224. if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(name)))
  225. return 0;
  226. str = mdprops;
  227. p = OSSL_PARAM_locate_const(params,
  228. OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS);
  229. if (p != NULL) {
  230. if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
  231. return 0;
  232. }
  233. EVP_MD_free(pectx->kdf_md);
  234. pectx->kdf_md = EVP_MD_fetch(pectx->libctx, name, mdprops);
  235. if (pectx->kdf_md == NULL)
  236. return 0;
  237. if (!ossl_digest_is_allowed(pectx->libctx, pectx->kdf_md)) {
  238. EVP_MD_free(pectx->kdf_md);
  239. pectx->kdf_md = NULL;
  240. return 0;
  241. }
  242. }
  243. p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_OUTLEN);
  244. if (p != NULL) {
  245. size_t outlen;
  246. if (!OSSL_PARAM_get_size_t(p, &outlen))
  247. return 0;
  248. pectx->kdf_outlen = outlen;
  249. }
  250. p = OSSL_PARAM_locate_const(params, OSSL_EXCHANGE_PARAM_KDF_UKM);
  251. if (p != NULL) {
  252. void *tmp_ukm = NULL;
  253. size_t tmp_ukmlen;
  254. if (!OSSL_PARAM_get_octet_string(p, &tmp_ukm, 0, &tmp_ukmlen))
  255. return 0;
  256. OPENSSL_free(pectx->kdf_ukm);
  257. pectx->kdf_ukm = tmp_ukm;
  258. pectx->kdf_ukmlen = tmp_ukmlen;
  259. }
  260. return 1;
  261. }
  262. static const OSSL_PARAM known_settable_ctx_params[] = {
  263. OSSL_PARAM_int(OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE, NULL),
  264. OSSL_PARAM_utf8_string(OSSL_EXCHANGE_PARAM_KDF_TYPE, NULL, 0),
  265. OSSL_PARAM_utf8_string(OSSL_EXCHANGE_PARAM_KDF_DIGEST, NULL, 0),
  266. OSSL_PARAM_utf8_string(OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS, NULL, 0),
  267. OSSL_PARAM_size_t(OSSL_EXCHANGE_PARAM_KDF_OUTLEN, NULL),
  268. OSSL_PARAM_octet_string(OSSL_EXCHANGE_PARAM_KDF_UKM, NULL, 0),
  269. OSSL_PARAM_END
  270. };
  271. static
  272. const OSSL_PARAM *ecdh_settable_ctx_params(ossl_unused void *vpecdhctx,
  273. ossl_unused void *provctx)
  274. {
  275. return known_settable_ctx_params;
  276. }
  277. static
  278. int ecdh_get_ctx_params(void *vpecdhctx, OSSL_PARAM params[])
  279. {
  280. PROV_ECDH_CTX *pectx = (PROV_ECDH_CTX *)vpecdhctx;
  281. OSSL_PARAM *p;
  282. if (pectx == NULL)
  283. return 0;
  284. p = OSSL_PARAM_locate(params, OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE);
  285. if (p != NULL) {
  286. int mode = pectx->cofactor_mode;
  287. if (mode == -1) {
  288. /* check what is the default for pecdhctx->k */
  289. mode = EC_KEY_get_flags(pectx->k) & EC_FLAG_COFACTOR_ECDH ? 1 : 0;
  290. }
  291. if (!OSSL_PARAM_set_int(p, mode))
  292. return 0;
  293. }
  294. p = OSSL_PARAM_locate(params, OSSL_EXCHANGE_PARAM_KDF_TYPE);
  295. if (p != NULL) {
  296. const char *kdf_type = NULL;
  297. switch (pectx->kdf_type) {
  298. case PROV_ECDH_KDF_NONE:
  299. kdf_type = "";
  300. break;
  301. case PROV_ECDH_KDF_X9_63:
  302. kdf_type = OSSL_KDF_NAME_X963KDF;
  303. break;
  304. default:
  305. return 0;
  306. }
  307. if (!OSSL_PARAM_set_utf8_string(p, kdf_type))
  308. return 0;
  309. }
  310. p = OSSL_PARAM_locate(params, OSSL_EXCHANGE_PARAM_KDF_DIGEST);
  311. if (p != NULL
  312. && !OSSL_PARAM_set_utf8_string(p, pectx->kdf_md == NULL
  313. ? ""
  314. : EVP_MD_get0_name(pectx->kdf_md))) {
  315. return 0;
  316. }
  317. p = OSSL_PARAM_locate(params, OSSL_EXCHANGE_PARAM_KDF_OUTLEN);
  318. if (p != NULL && !OSSL_PARAM_set_size_t(p, pectx->kdf_outlen))
  319. return 0;
  320. p = OSSL_PARAM_locate(params, OSSL_EXCHANGE_PARAM_KDF_UKM);
  321. if (p != NULL &&
  322. !OSSL_PARAM_set_octet_ptr(p, pectx->kdf_ukm, pectx->kdf_ukmlen))
  323. return 0;
  324. return 1;
  325. }
  326. static const OSSL_PARAM known_gettable_ctx_params[] = {
  327. OSSL_PARAM_int(OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE, NULL),
  328. OSSL_PARAM_utf8_string(OSSL_EXCHANGE_PARAM_KDF_TYPE, NULL, 0),
  329. OSSL_PARAM_utf8_string(OSSL_EXCHANGE_PARAM_KDF_DIGEST, NULL, 0),
  330. OSSL_PARAM_size_t(OSSL_EXCHANGE_PARAM_KDF_OUTLEN, NULL),
  331. OSSL_PARAM_DEFN(OSSL_EXCHANGE_PARAM_KDF_UKM, OSSL_PARAM_OCTET_PTR,
  332. NULL, 0),
  333. OSSL_PARAM_END
  334. };
  335. static
  336. const OSSL_PARAM *ecdh_gettable_ctx_params(ossl_unused void *vpecdhctx,
  337. ossl_unused void *provctx)
  338. {
  339. return known_gettable_ctx_params;
  340. }
  341. static ossl_inline
  342. size_t ecdh_size(const EC_KEY *k)
  343. {
  344. size_t degree = 0;
  345. const EC_GROUP *group;
  346. if (k == NULL
  347. || (group = EC_KEY_get0_group(k)) == NULL)
  348. return 0;
  349. degree = EC_GROUP_get_degree(group);
  350. return (degree + 7) / 8;
  351. }
  352. static ossl_inline
  353. int ecdh_plain_derive(void *vpecdhctx, unsigned char *secret,
  354. size_t *psecretlen, size_t outlen)
  355. {
  356. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  357. int retlen, ret = 0;
  358. size_t ecdhsize, size;
  359. const EC_POINT *ppubkey = NULL;
  360. EC_KEY *privk = NULL;
  361. const EC_GROUP *group;
  362. const BIGNUM *cofactor;
  363. int key_cofactor_mode;
  364. if (pecdhctx->k == NULL || pecdhctx->peerk == NULL) {
  365. ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_KEY);
  366. return 0;
  367. }
  368. ecdhsize = ecdh_size(pecdhctx->k);
  369. if (secret == NULL) {
  370. *psecretlen = ecdhsize;
  371. return 1;
  372. }
  373. if ((group = EC_KEY_get0_group(pecdhctx->k)) == NULL
  374. || (cofactor = EC_GROUP_get0_cofactor(group)) == NULL)
  375. return 0;
  376. /*
  377. * NB: unlike PKCS#3 DH, if outlen is less than maximum size this is not
  378. * an error, the result is truncated.
  379. */
  380. size = outlen < ecdhsize ? outlen : ecdhsize;
  381. /*
  382. * The ctx->cofactor_mode flag has precedence over the
  383. * cofactor_mode flag set on ctx->k.
  384. *
  385. * - if ctx->cofactor_mode == -1, use ctx->k directly
  386. * - if ctx->cofactor_mode == key_cofactor_mode, use ctx->k directly
  387. * - if ctx->cofactor_mode != key_cofactor_mode:
  388. * - if ctx->k->cofactor == 1, the cofactor_mode flag is irrelevant, use
  389. * ctx->k directly
  390. * - if ctx->k->cofactor != 1, use a duplicate of ctx->k with the flag
  391. * set to ctx->cofactor_mode
  392. */
  393. key_cofactor_mode =
  394. (EC_KEY_get_flags(pecdhctx->k) & EC_FLAG_COFACTOR_ECDH) ? 1 : 0;
  395. if (pecdhctx->cofactor_mode != -1
  396. && pecdhctx->cofactor_mode != key_cofactor_mode
  397. && !BN_is_one(cofactor)) {
  398. if ((privk = EC_KEY_dup(pecdhctx->k)) == NULL)
  399. return 0;
  400. if (pecdhctx->cofactor_mode == 1)
  401. EC_KEY_set_flags(privk, EC_FLAG_COFACTOR_ECDH);
  402. else
  403. EC_KEY_clear_flags(privk, EC_FLAG_COFACTOR_ECDH);
  404. } else {
  405. privk = pecdhctx->k;
  406. }
  407. ppubkey = EC_KEY_get0_public_key(pecdhctx->peerk);
  408. retlen = ECDH_compute_key(secret, size, ppubkey, privk, NULL);
  409. if (retlen <= 0)
  410. goto end;
  411. *psecretlen = retlen;
  412. ret = 1;
  413. end:
  414. if (privk != pecdhctx->k)
  415. EC_KEY_free(privk);
  416. return ret;
  417. }
  418. static ossl_inline
  419. int ecdh_X9_63_kdf_derive(void *vpecdhctx, unsigned char *secret,
  420. size_t *psecretlen, size_t outlen)
  421. {
  422. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  423. unsigned char *stmp = NULL;
  424. size_t stmplen;
  425. int ret = 0;
  426. if (secret == NULL) {
  427. *psecretlen = pecdhctx->kdf_outlen;
  428. return 1;
  429. }
  430. if (pecdhctx->kdf_outlen > outlen) {
  431. ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
  432. return 0;
  433. }
  434. if (!ecdh_plain_derive(vpecdhctx, NULL, &stmplen, 0))
  435. return 0;
  436. if ((stmp = OPENSSL_secure_malloc(stmplen)) == NULL)
  437. return 0;
  438. if (!ecdh_plain_derive(vpecdhctx, stmp, &stmplen, stmplen))
  439. goto err;
  440. /* Do KDF stuff */
  441. if (!ossl_ecdh_kdf_X9_63(secret, pecdhctx->kdf_outlen,
  442. stmp, stmplen,
  443. pecdhctx->kdf_ukm,
  444. pecdhctx->kdf_ukmlen,
  445. pecdhctx->kdf_md,
  446. pecdhctx->libctx, NULL))
  447. goto err;
  448. *psecretlen = pecdhctx->kdf_outlen;
  449. ret = 1;
  450. err:
  451. OPENSSL_secure_clear_free(stmp, stmplen);
  452. return ret;
  453. }
  454. static
  455. int ecdh_derive(void *vpecdhctx, unsigned char *secret,
  456. size_t *psecretlen, size_t outlen)
  457. {
  458. PROV_ECDH_CTX *pecdhctx = (PROV_ECDH_CTX *)vpecdhctx;
  459. switch (pecdhctx->kdf_type) {
  460. case PROV_ECDH_KDF_NONE:
  461. return ecdh_plain_derive(vpecdhctx, secret, psecretlen, outlen);
  462. case PROV_ECDH_KDF_X9_63:
  463. return ecdh_X9_63_kdf_derive(vpecdhctx, secret, psecretlen, outlen);
  464. default:
  465. break;
  466. }
  467. return 0;
  468. }
  469. const OSSL_DISPATCH ossl_ecdh_keyexch_functions[] = {
  470. { OSSL_FUNC_KEYEXCH_NEWCTX, (void (*)(void))ecdh_newctx },
  471. { OSSL_FUNC_KEYEXCH_INIT, (void (*)(void))ecdh_init },
  472. { OSSL_FUNC_KEYEXCH_DERIVE, (void (*)(void))ecdh_derive },
  473. { OSSL_FUNC_KEYEXCH_SET_PEER, (void (*)(void))ecdh_set_peer },
  474. { OSSL_FUNC_KEYEXCH_FREECTX, (void (*)(void))ecdh_freectx },
  475. { OSSL_FUNC_KEYEXCH_DUPCTX, (void (*)(void))ecdh_dupctx },
  476. { OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS, (void (*)(void))ecdh_set_ctx_params },
  477. { OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS,
  478. (void (*)(void))ecdh_settable_ctx_params },
  479. { OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS, (void (*)(void))ecdh_get_ctx_params },
  480. { OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS,
  481. (void (*)(void))ecdh_gettable_ctx_params },
  482. OSSL_DISPATCH_END
  483. };