public key cryptography (ECC) with libgcrypt More...
#include "platform.h"
#include "gnunet_common.h"
#include <gcrypt.h>
#include <sodium.h>
#include "gnunet_util_lib.h"
#include "benchmark.h"
#include "sodium/crypto_scalarmult.h"
#include "sodium/crypto_scalarmult_curve25519.h"
#include "sodium/utils.h"
Go to the source code of this file.
Macros | |
#define | EXTRA_CHECKS 0 |
#define | CURVE "Ed25519" |
IMPLEMENTATION NOTICE: More... | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) |
#define | LOG_STRERROR(kind, syscall) GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) |
#define | LOG_STRERROR_FILE(kind, syscall, filename) |
#define | LOG_GCRY(level, cmd, rc) |
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by gcry_strerror(rc). More... | |
public key cryptography (ECC) with libgcrypt
Definition in file crypto_ecc.c.
#define EXTRA_CHECKS 0 |
Definition at line 37 of file crypto_ecc.c.
#define CURVE "Ed25519" |
IMPLEMENTATION NOTICE:
ECDSA: We use a non-standard curve for ECDSA: Ed25519. For performance reasons, we use cryptographic operations from libsodium wherever we can get away with it, even though libsodium itself does not support ECDSA. This is why the sign and verify functionality from libgcrypt is required and used.
EdDSA: We use a standard EdDSA construction. (We still use libgcrypt for hashing and RNG, but not EC)
ECDHE: For both EdDSA and ECDSA keys, we use libsodium for ECDHE due to performance benefits over libgcrypt. Name of the curve we are using. Note that we have hard-coded structs that use 256 bits, so using a bigger curve will require changes that break stuff badly. The name of the curve given here must be agreed by all peers and be supported by libgcrypt.
Definition at line 62 of file crypto_ecc.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) |
Definition at line 64 of file crypto_ecc.c.
#define LOG_STRERROR | ( | kind, | |
syscall | |||
) | GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) |
Definition at line 66 of file crypto_ecc.c.
#define LOG_STRERROR_FILE | ( | kind, | |
syscall, | |||
filename | |||
) |
Definition at line 69 of file crypto_ecc.c.
#define LOG_GCRY | ( | level, | |
cmd, | |||
rc | |||
) |
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by gcry_strerror(rc).
Definition at line 78 of file crypto_ecc.c.
|
static |
Extract values from an S-expression.
array | where to store the result(s) |
sexp | S-expression to parse |
topname | top-level name in the S-expression that is of interest |
elems | names of the elements to extract |
Definition at line 100 of file crypto_ecc.c.
References list.
Referenced by GNUNET_CRYPTO_ecdsa_sign_().
|
static |
Convert the given private key from the network format to the S-expression that can be used by libgcrypt.
priv | private key to decode |
Definition at line 158 of file crypto_ecc.c.
References CURVE, d, GNUNET_CRYPTO_EcdsaPrivateKey::d, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, LOG_GCRY, and result.
Referenced by GNUNET_CRYPTO_ecdsa_sign_().
|
static |
Definition at line 418 of file crypto_ecc.c.
References p.
Referenced by GNUNET_CRYPTO_ecdhe_key_clear(), GNUNET_CRYPTO_ecdsa_key_clear(), and GNUNET_CRYPTO_eddsa_key_clear().
|
static |
Convert the data specified in the given purpose argument to an S-expression suitable for signature operations.
purpose | data to convert |
Definition at line 531 of file crypto_ecc.c.
References data, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_ERROR, LOG_GCRY, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by GNUNET_CRYPTO_ecdsa_sign_(), and GNUNET_CRYPTO_ecdsa_verify_().