GNUnet 0.26.2-98-gb402d9955
 
Loading...
Searching...
No Matches
crypto_ecc_gnsrecord.c File Reference

public key cryptography (ECC) for GNS records (LSD0001) More...

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

Go to the source code of this file.

Macros

#define CURVE   "Ed25519"
 

Functions

static void derive_h (const void *pub, size_t pubsize, const char *label, const char *context, struct GNUNET_HashCode *hc)
 Derive the 'h' value for key derivation, where 'h = H(l,P)'.
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_derived (const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig)
 This is a signature function for EdDSA which takes a private key and derives it using the label and context before signing.
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_derived (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const char *label, const char *context, const struct GNUNET_CRYPTO_SignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
 This is a signature function for ECDSA which takes a private key, derives/blinds it and signs the message.
 
struct GNUNET_CRYPTO_EcdsaPrivateKeyGNUNET_CRYPTO_ecdsa_private_key_derive (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const char *label, const char *context)
 Derive a private key from a given private key and a label.
 
void GNUNET_CRYPTO_ecdsa_public_key_derive (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, const char *context, struct GNUNET_CRYPTO_EcdsaPublicKey *result)
 Derive a public key from a given public key and a label.
 
void GNUNET_CRYPTO_eddsa_private_key_derive (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const char *label, const char *context, struct GNUNET_CRYPTO_EddsaPrivateScalar *result)
 Derive a private scalar from a given private key and a label.
 
void GNUNET_CRYPTO_eddsa_public_key_derive (const struct GNUNET_CRYPTO_EddsaPublicKey *pub, const char *label, const char *context, struct GNUNET_CRYPTO_EddsaPublicKey *result)
 Derive a public key from a given public key and a label.
 
void GNUNET_CRYPTO_eddsa_key_get_public_from_scalar (const struct GNUNET_CRYPTO_EddsaPrivateScalar *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pkey)
 Extract the public key of the given private scalar.
 

Detailed Description

public key cryptography (ECC) for GNS records (LSD0001)

Author
Christian Grothoff
Florian Dold
Martin Schanzenbach

Definition in file crypto_ecc_gnsrecord.c.

Macro Definition Documentation

◆ CURVE

#define CURVE   "Ed25519"

Definition at line 34 of file crypto_ecc_gnsrecord.c.

Function Documentation

◆ derive_h()

static void derive_h ( const void *  pub,
size_t  pubsize,
const char *  label,
const char *  context,
struct GNUNET_HashCode hc 
)
static

Derive the 'h' value for key derivation, where 'h = H(l,P)'.

Parameters
pubpublic key for deriviation
pubsizethe size of the public key
labellabel for deriviation
contextadditional context to use for HKDF of 'h'; typically the name of the subsystem/application
hcwhere to write the result

NOTE: While (H)KDF calls this value a salt it is not necessary for it to be a random value. It is more common to use a NULL value here (https://www.rfc-editor.org/rfc/rfc8446#section-7.1) But it is safe either way (See RFC 5869)

Definition at line 48 of file crypto_ecc_gnsrecord.c.

53{
60 static const char *const salt = "key-derivation";
61
63 hc,
64 sizeof(*hc),
65 salt,
66 strlen (salt),
67 pub,
68 pubsize,
71}
static pa_context * context
Pulseaudio context.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calculations.
#define GNUNET_CRYPTO_hkdf_gnunet(result, out_len, xts, xts_len, skm, skm_len,...)
A peculiar HKDF instantiation that tried to mimic Truncated NMAC.
#define GNUNET_CRYPTO_kdf_arg_string(d)

References context, GNUNET_CRYPTO_hkdf_gnunet, GNUNET_CRYPTO_kdf_arg_string, pub, and salt.

Referenced by GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_eddsa_private_key_derive(), and GNUNET_CRYPTO_eddsa_public_key_derive().

Here is the caller graph for this function: