GNUnet 0.21.1
crypto_edx25519.c File Reference

An variant of EdDSA which allows for iterative derivation of key pairs. More...

#include "platform.h"
#include <gcrypt.h>
#include <sodium.h>
#include "gnunet_util_lib.h"
Include dependency graph for crypto_edx25519.c:

Go to the source code of this file.

Macros

#define CURVE   "Ed25519"
 

Functions

void GNUNET_CRYPTO_edx25519_key_clear (struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
 Clear memory that was used to store a private key. More...
 
void GNUNET_CRYPTO_edx25519_key_create_from_seed (const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
 Create a new private key for Edx25519 from a given seed. More...
 
void GNUNET_CRYPTO_edx25519_key_create (struct GNUNET_CRYPTO_Edx25519PrivateKey *pk)
 Create a new private key. More...
 
void GNUNET_CRYPTO_edx25519_key_get_public (const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, struct GNUNET_CRYPTO_Edx25519PublicKey *pub)
 Extract the public key for the given private key. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_sign_ (const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Edx25519Signature *sig)
 This function operates the basically same way as the signature function for EdDSA. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_edx25519_verify_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_Edx25519Signature *sig, const struct GNUNET_CRYPTO_Edx25519PublicKey *pub)
 Verify Edx25519 signature. More...
 
static void derive_h (const struct GNUNET_CRYPTO_Edx25519PublicKey *pub, const void *seed, size_t seedsize, struct GNUNET_HashCode *phc)
 Derive the 'h' value for key derivation, where 'h = H(P ∥ seed) mod n' and 'n' is the size of the cyclic subroup. More...
 
void GNUNET_CRYPTO_edx25519_private_key_derive (const struct GNUNET_CRYPTO_Edx25519PrivateKey *priv, const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PrivateKey *result)
 Derive a private scalar from a given private key and a label. More...
 
void GNUNET_CRYPTO_edx25519_public_key_derive (const struct GNUNET_CRYPTO_Edx25519PublicKey *pub, const void *seed, size_t seedsize, struct GNUNET_CRYPTO_Edx25519PublicKey *result)
 Derive a public key from a given public key and a label. More...
 

Detailed Description

An variant of EdDSA which allows for iterative derivation of key pairs.

Author
Özgür Kesim
Christian Grothoff
Florian Dold
Martin Schanzenbach

Definition in file crypto_edx25519.c.

Macro Definition Documentation

◆ CURVE

#define CURVE   "Ed25519"

Definition at line 35 of file crypto_edx25519.c.

Function Documentation

◆ derive_h()

static void derive_h ( const struct GNUNET_CRYPTO_Edx25519PublicKey pub,
const void *  seed,
size_t  seedsize,
struct GNUNET_HashCode phc 
)
static

Derive the 'h' value for key derivation, where 'h = H(P ∥ seed) mod n' and 'n' is the size of the cyclic subroup.

Parameters
pubpublic key for deriviation
seedseed for key the deriviation
seedsizethe size of the seed
[out]phcif not NULL, the output of H() will be written into return h_mod_n (allocated by this function)

Definition at line 217 of file crypto_edx25519.c.

222{
223 static const char *const salt = "edx25519-derivation";
224
225 GNUNET_CRYPTO_kdf (/* output*/
226 phc, sizeof(*phc),
227 /* salt */
228 seed, seedsize,
229 /* ikm */
230 pub, sizeof(*pub),
231 /* ctx chunks*/
232 salt, strlen (salt),
233 NULL, 0);
234
235}
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calcualations.
Definition: gnunet-scrypt.c:34
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
Definition: crypto_kdf.c:70

References GNUNET_CRYPTO_kdf(), pub, and salt.

Referenced by GNUNET_CRYPTO_edx25519_private_key_derive(), and GNUNET_CRYPTO_edx25519_public_key_derive().

Here is the call graph for this function:
Here is the caller graph for this function: