curl_ed25519: add GnuTLS support (via nettle, hogweed)

The necessary cryptography API is provided by nettle 3.1+, via its
'hogweed' library. The minimum GnuTLS version required by curl is 3.6.5,
which requires nettle 3.4.1+, so the API is always available.

Also:
- autotools: detect and use nettle's hogweed library.
- cmake/FindNettle: add support for the hogweed library.
- GHA/http3-linux: enable in the autotools/cmake GnuTLS jobs.

Ref: 4353ea025a

Closes #22456
This commit is contained in:
Viktor Szakats 2026-08-01 00:45:57 +02:00
parent 56457f838c
commit a368fbe968
No known key found for this signature in database
7 changed files with 101 additions and 15 deletions

View file

@ -135,6 +135,26 @@ fail:
return CURLE_AUTH_ERROR;
}
#elif defined(USE_GNUTLS)
#include <nettle/eddsa.h>
CURLcode Curl_ed25519_sign(const unsigned char *key, size_t keylen,
const unsigned char *msg, size_t msglen,
unsigned char *sig, size_t *siglen)
{
uint8_t pubkey[ED25519_KEY_SIZE];
if(keylen != ED25519_KEY_SIZE)
return CURLE_BAD_FUNCTION_ARGUMENT;
nettle_ed25519_sha512_public_key(pubkey, key);
nettle_ed25519_sha512_sign(pubkey, key, msglen, msg, sig);
*siglen = CURL_ED25519_SIGLEN;
return CURLE_OK;
}
#else /* no Ed25519-capable backend */
CURLcode Curl_ed25519_sign(const unsigned char *key, size_t keylen,