[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
Sat Mar 20 18:42:25 CET 2021
Nicolas Mora commented on a discussion on lib/ecdh.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1395#note_534050838
> + */
> +#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)
Curve25519/Curve448 don't have a 'y' coordinate, so `_gnutls_ecdh_compute_key` wouldn't work.
I can use `_gnutls_dh_compute_key` for Curve25519/Curve448 if I assume it's the right way.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1395#note_534050838
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/20210320/e60bedd5/attachment-0001.html>
More information about the Gnutls-devel
mailing list