GNUnet 0.21.2
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

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)'. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_derived (const struct GNUNET_CRYPTO_EddsaPrivateKey *pkey, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *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. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_derived (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const char *label, const char *context, const struct GNUNET_CRYPTO_EccSignaturePurpose *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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

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()

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)'.

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

Definition at line 48 of file crypto_ecc_gnsrecord.c.

53{
54 static const char *const salt = "key-derivation";
55
57 sizeof(*hc),
58 salt,
59 strlen (salt),
60 pub,
61 pubsize,
62 label,
63 strlen (label),
64 context,
65 strlen (context),
66 NULL,
67 0);
68}
static pa_context * context
Pulseaudio context.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calculations.
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:62

References context, GNUNET_CRYPTO_kdf(), 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 call graph for this function:
Here is the caller graph for this function: