[gnutls-devel] GnuTLS | Add ecdh compute function gnutls_ecdh_compute_key (!1395)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Mon May 10 21:58:42 CEST 2021
Nicolas Mora commented on a discussion on lib/ecdh.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1395#note_571853220
> + */
> +#include "gnutls_int.h"
> +#include <ecdh.h>
> +#include "errors.h"
> +
> +int gnutls_ecdh_compute_key(gnutls_privkey_t privkey, gnutls_pubkey_t pubkey, gnutls_datum_t *Z)
> +{
> + gnutls_ecc_curve_t curve_pub = GNUTLS_ECC_CURVE_INVALID, curve_priv = GNUTLS_ECC_CURVE_INVALID;
> + unsigned int bits_pub = 0, bits_priv = 0;
> + gnutls_datum_t priv_x = {NULL, 0}, priv_y = {NULL, 0}, priv_k = {NULL, 0}, pub_x = {NULL, 0}, pub_y = {NULL, 0};
> + int ret = GNUTLS_E_SUCCESS, res;
> +
> + Z->data = NULL;
> + Z->size = 0;
> +
> + if (gnutls_privkey_get_pk_algorithm(privkey, &bits_priv) != GNUTLS_PK_ECDSA)
I've tried adding support for Curve25519/Curve448, yet no luck:
https://gitlab.com/babelouest/gnutls/-/tree/ecdh-ed25519
The [ed25519 test](https://gitlab.com/babelouest/gnutls/-/blob/ecdh-ed25519/tests/ecdh-compute.c#L464) fails during [`_gnutls_dh_compute_key`](https://gitlab.com/babelouest/gnutls/-/blob/ecdh-ed25519/lib/ecdh.c#L95) with a return value -55 (GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER).
I couldn't find if the problem comes from my code or outside
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1395#note_571853220
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210510/f41b414a/attachment-0001.html>
More information about the Gnutls-devel
mailing list