![]() |
GNUnet
0.11.x
|
cryptographic primitives for GNUnet More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_CRYPTO_HashAsciiEncoded |
0-terminated ASCII encoding of a struct GNUNET_HashCode. More... | |
struct | GNUNET_CRYPTO_EccSignaturePurpose |
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed data More... | |
struct | GNUNET_CRYPTO_EddsaSignature |
an ECC signature using EdDSA. More... | |
struct | GNUNET_CRYPTO_EcdsaSignature |
an ECC signature using ECDSA More... | |
struct | GNUNET_CRYPTO_EddsaPublicKey |
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and EdDSA signatures. More... | |
struct | GNUNET_CRYPTO_EcdsaPublicKey |
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDSA signatures. More... | |
struct | GNUNET_PeerIdentity |
The identity of the host (wraps the signing key of the peer). More... | |
struct | GNUNET_CRYPTO_EcdhePublicKey |
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encryption (ECDH), See http://cr.yp.to/ecdh.html. More... | |
struct | GNUNET_CRYPTO_EcdhePrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_EcdsaPrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_EddsaPrivateKey |
Private ECC key encoded for transmission. More... | |
struct | GNUNET_CRYPTO_SymmetricSessionKey |
type for session keys More... | |
struct | ChallengeNonceP |
Type of a nonce used for challenges. More... | |
struct | GNUNET_CRYPTO_SymmetricInitializationVector |
IV for sym cipher. More... | |
struct | GNUNET_CRYPTO_AuthKey |
type for (message) authentication keys More... | |
struct | GNUNET_CRYPTO_PaillierPublicKey |
Paillier public key. More... | |
struct | GNUNET_CRYPTO_PaillierPrivateKey |
Paillier private key. More... | |
struct | GNUNET_CRYPTO_PaillierCiphertext |
Paillier ciphertext. More... | |
struct | GNUNET_CRYPTO_PowSalt |
Value for a salt for GNUNET_CRYPTO_pow_hash(). More... | |
struct | GNUNET_CRYPTO_EccPoint |
Point on a curve (always for Curve25519) encoded in a format suitable for network transmission (ECDH), see http://cr.yp.to/ecdh.html. More... | |
struct | GNUNET_CRYPTO_RsaBlindingKeySecret |
Constant-size pre-secret for blinding key generation. More... | |
Macros | |
#define | GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 |
Maximum length of an ECC signature. More... | |
#define | GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8) |
length of the sessionkey in bytes (256 BIT sessionkey) More... | |
#define | GNUNET_CRYPTO_HASH_LENGTH (512 / 8) |
Length of a hash value. More... | |
#define | GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52 |
How many characters (without 0-terminator) are our ASCII-encoded public keys (ECDSA/EDDSA/ECDHE). More... | |
#define | GNUNET_CRYPTO_PAILLIER_BITS 2048 |
Size of paillier plain texts and public keys. More... | |
#define | GNUNET_CRYPTO_hash_from_string(enc, result) GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result) |
Convert ASCII encoding back to struct GNUNET_HashCode More... | |
#define | GNUNET_CRYPTO_eddsa_sign(priv, ps, sig) |
EdDSA sign a given block. More... | |
#define | GNUNET_CRYPTO_ecdsa_sign(priv, ps, sig) |
ECDSA sign a given block. More... | |
#define | GNUNET_CRYPTO_eddsa_verify(purp, ps, sig, pub) |
Verify EdDSA signature. More... | |
#define | GNUNET_CRYPTO_ecdsa_verify(purp, ps, sig, pub) |
Verify ECDSA signature. More... | |
Typedefs | |
typedef void(* | GNUNET_CRYPTO_HashCompletedCallback) (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over the specified file has completed. More... | |
Enumerations | |
enum | GNUNET_CRYPTO_Quality { GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_QUALITY_NONCE } |
Desired quality level for random numbers. More... | |
Functions | |
void | GNUNET_CRYPTO_seed_weak_random (int32_t seed) |
Seed a weak random generator. More... | |
uint8_t | GNUNET_CRYPTO_crc8_n (const void *buf, size_t len) |
Calculate the checksum of a buffer in one step. More... | |
uint32_t | GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len) |
Perform an incremental step in a CRC16 (for TCP/IP) calculation. More... | |
uint16_t | GNUNET_CRYPTO_crc16_finish (uint32_t sum) |
Convert results from GNUNET_CRYPTO_crc16_step to final crc16. More... | |
uint16_t | GNUNET_CRYPTO_crc16_n (const void *buf, size_t len) |
Calculate the checksum of a buffer in one step. More... | |
int32_t | GNUNET_CRYPTO_crc32_n (const void *buf, size_t len) |
Compute the CRC32 checksum for the first len bytes of the buffer. More... | |
void | GNUNET_CRYPTO_zero_keys (void *buffer, size_t length) |
Zero out buffer, securely against compiler optimizations. More... | |
void | GNUNET_CRYPTO_random_block (enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length) |
Fill block with a random values. More... | |
void | GNUNET_CRYPTO_random_timeflake (enum GNUNET_CRYPTO_Quality mode, struct GNUNET_Uuid *uuid) |
Fill UUID with a timeflake pseudo-random value. More... | |
uint32_t | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i) |
Produce a random value. More... | |
uint64_t | GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max) |
Random on unsigned 64-bit values. More... | |
unsigned int * | GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n) |
Get an array with a random permutation of the numbers 0...n-1. More... | |
void | GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
Create a new random session key. More... | |
ssize_t | GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result) |
Encrypt a block using a symmetric sessionkey. More... | |
ssize_t | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result) |
Decrypt a given block using a symmetric sessionkey. More... | |
void | GNUNET_CRYPTO_symmetric_derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len,...) |
Derive an IV. More... | |
void | GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len, va_list argp) |
Derive an IV. More... | |
void | GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block, struct GNUNET_CRYPTO_HashAsciiEncoded *result) |
Convert hash to ASCII encoding. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, struct GNUNET_HashCode *result) |
Convert ASCII encoding back to a 'struct GNUNET_HashCode'. More... | |
uint32_t | GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b) |
Compute the distance between 2 hashcodes. More... | |
void | GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode *ret) |
Compute hash of a given block. More... | |
void | GNUNET_CRYPTO_pow_hash (const struct GNUNET_CRYPTO_PowSalt *salt, const void *buf, size_t buf_len, struct GNUNET_HashCode *result) |
Calculate the 'proof-of-work' hash (an expensive hash). More... | |
struct GNUNET_HashContext * | GNUNET_CRYPTO_hash_context_start (void) |
Start incremental hashing operation. More... | |
struct GNUNET_HashContext * | GNUNET_CRYPTO_hash_context_copy (const struct GNUNET_HashContext *hc) |
Make a copy of the hash computation. More... | |
void | GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc, const void *buf, size_t size) |
Add data to be hashed. More... | |
void | GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash) |
Finish the hash computation. More... | |
void | GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc) |
Abort hashing, do not bother calculating final result. More... | |
void | GNUNET_CRYPTO_hmac_raw (const void *key, size_t key_len, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac) |
Calculate HMAC of a message (RFC 2104) TODO: Shouldn' this be the standard hmac function and the above be renamed? More... | |
void | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac) |
Calculate HMAC of a message (RFC 2104) More... | |
struct GNUNET_CRYPTO_FileHashContext * | GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority, const char *filename, size_t blocksize, GNUNET_CRYPTO_HashCompletedCallback callback, void *callback_cls) |
Compute the hash of an entire file. More... | |
void | GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc) |
Cancel a file hashing operation. More... | |
void | GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result) |
Create a random hash code. More... | |
void | GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result) |
compute result = b - a More... | |
void | GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *delta, struct GNUNET_HashCode *result) |
compute result = a + delta More... | |
void | GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result) |
compute result = a ^ b More... | |
void | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) |
Convert a hashcode into a key. More... | |
int | GNUNET_CRYPTO_hash_get_bit_ltr (const struct GNUNET_HashCode *code, unsigned int bit) |
Obtain a bit from a hashcode. More... | |
int | GNUNET_CRYPTO_hash_get_bit_rtl (const struct GNUNET_HashCode *code, unsigned int bit) |
Obtain a bit from a hashcode. More... | |
unsigned int | GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode *first, const struct GNUNET_HashCode *second) |
Determine how many low order bits match in two struct GNUNET_HashCodes . More... | |
int | GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2) |
Compare function for HashCodes, producing a total ordering of all hashcodes. More... | |
int | GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2, const struct GNUNET_HashCode *target) |
Find out which of the two GNUNET_CRYPTO_hash codes is closer to target in the XOR metric (Kademlia). More... | |
void | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len, va_list argp) |
Derive an authentication key. More... | |
void | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, const void *salt, size_t salt_len,...) |
Derive an authentication key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf (void *result, size_t out_len, int xtr_algo, int prf_algo, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...) |
Derive key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo, const void *xts, size_t xts_len, const void *skm, size_t skm_len, va_list argp) |
Derive key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_kdf_v (void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len, va_list argp) |
Derive key. More... | |
void | GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r, gcry_mpi_t n, const void *xts, size_t xts_len, const void *skm, size_t skm_len, const char *ctx) |
Deterministically generate a pseudo-random number uniformly from the integers modulo a libgcrypt mpi. More... | |
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. More... | |
void | GNUNET_CRYPTO_ecdsa_key_get_public (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Extract the public key for the given private key. More... | |
void | GNUNET_CRYPTO_eddsa_key_get_public (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Extract the public key for the given private key. More... | |
void | GNUNET_CRYPTO_ecdhe_key_get_public (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub) |
Extract the public key for the given private key. More... | |
char * | GNUNET_CRYPTO_ecdsa_public_key_to_string (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Convert a public key to a string. More... | |
char * | GNUNET_CRYPTO_ecdsa_private_key_to_string (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv) |
Convert a private key to a string. More... | |
char * | GNUNET_CRYPTO_eddsa_private_key_to_string (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) |
Convert a private key to a string. More... | |
char * | GNUNET_CRYPTO_eddsa_public_key_to_string (const struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Convert a public key to a string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_public_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Convert a string representing a public key to a public key. More... | |
int | GNUNET_CRYPTO_eddsa_private_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPrivateKey *pub) |
Convert a string representing a private key to a private key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_public_key_from_string (const char *enc, size_t enclen, struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Convert a string representing a public key to a public key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename, int do_create, struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey) |
Create a new private key by reading it from a file. More... | |
int | GNUNET_CRYPTO_eddsa_key_from_file (const char *filename, int do_create, struct GNUNET_CRYPTO_EddsaPrivateKey *pkey) |
Create a new private key by reading it from a file. More... | |
struct GNUNET_CRYPTO_EddsaPrivateKey * | GNUNET_CRYPTO_eddsa_key_create_from_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Create a new private key by reading our peer's key from the file specified in the configuration. More... | |
void | GNUNET_CRYPTO_ecdsa_key_create (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk) |
Create a new private key. More... | |
void | GNUNET_CRYPTO_eddsa_key_create (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) |
Create a new private key. More... | |
void | GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) |
Create a new private key. More... | |
void | GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) |
Clear memory that was used to store a private key. More... | |
void | GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk) |
Clear memory that was used to store a private key. More... | |
void | GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) |
Clear memory that was used to store a private key. More... | |
const struct GNUNET_CRYPTO_EcdsaPrivateKey * | GNUNET_CRYPTO_ecdsa_key_get_anonymous (void) |
Get the shared private key we use for anonymous users. More... | |
void | GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name) |
Setup a hostkey file for a peer given the name of the configuration file (!). More... | |
int | GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *dst) |
Retrieve the identity of the host's peer. More... | |
struct GNUNET_CRYPTO_EccDlogContext * | GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, unsigned int mem) |
Do pre-calculation for ECC discrete logarithm for small factors. More... | |
int | GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t input) |
Calculate ECC discrete logarithm for small factors. More... | |
gcry_mpi_point_t | GNUNET_CRYPTO_ecc_dexp (struct GNUNET_CRYPTO_EccDlogContext *edc, int val) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val. More... | |
gcry_mpi_point_t | GNUNET_CRYPTO_ecc_dexp_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_t val) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val. More... | |
gcry_mpi_point_t | GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t p, gcry_mpi_t val) |
Multiply the point p on the elliptic curve by val. More... | |
void | GNUNET_CRYPTO_ecc_point_to_bin (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t point, struct GNUNET_CRYPTO_EccPoint *bin) |
Convert point value to binary representation. More... | |
gcry_mpi_point_t | GNUNET_CRYPTO_ecc_bin_to_point (struct GNUNET_CRYPTO_EccDlogContext *edc, const struct GNUNET_CRYPTO_EccPoint *bin) |
Convert binary representation of a point to computational representation. More... | |
gcry_mpi_point_t | GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t a, gcry_mpi_point_t b) |
Add two points on the elliptic curve. More... | |
void | GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_point_t *r, gcry_mpi_point_t *r_inv) |
Obtain a random point on the curve and its additive inverse. More... | |
void | GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, gcry_mpi_t *r, gcry_mpi_t *r_inv) |
Obtain a random scalar for point multiplication on the curve and its multiplicative inverse. More... | |
gcry_mpi_t | GNUNET_CRYPTO_ecc_random_mod_n (struct GNUNET_CRYPTO_EccDlogContext *edc) |
Generate a random value mod n. More... | |
void | GNUNET_CRYPTO_ecc_free (gcry_mpi_point_t p) |
Free a point value returned by the API. More... | |
void | GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc) |
Release precalculated values. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material) |
Derive key material from a public and a private ECC key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material) |
Derive key material from a ECDH public key and a private EdDSA key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material) |
Derive key material from a ECDH public key and a private ECDSA key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material) |
Derive key material from a EdDSA public key and a private ECDH key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, struct GNUNET_HashCode *key_material) |
Derive key material from a EcDSA public key and a private ECDH key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_eddsa_sign_ (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig) |
EdDSA sign a given block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_ecdsa_sign_ (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig) |
ECDSA Sign a given block. More... | |
int | GNUNET_CRYPTO_eddsa_verify_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_CRYPTO_EddsaPublicKey *pub) |
Verify EdDSA signature. More... | |
int | GNUNET_CRYPTO_ecdsa_verify_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
Verify ECDSA signature. More... | |
struct GNUNET_CRYPTO_EcdsaPrivateKey * | GNUNET_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_mpi_print_unsigned (void *buf, size_t size, gcry_mpi_t val) |
Output the given MPI value to the given buffer in network byte order. More... | |
void | GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, const void *data, size_t size) |
Convert data buffer into MPI value. More... | |
void | GNUNET_CRYPTO_paillier_create (struct GNUNET_CRYPTO_PaillierPublicKey *public_key, struct GNUNET_CRYPTO_PaillierPrivateKey *private_key) |
Create a freshly generated paillier public key. More... | |
int | GNUNET_CRYPTO_paillier_encrypt (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const gcry_mpi_t m, int desired_ops, struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext) |
Encrypt a plaintext with a paillier public key. More... | |
void | GNUNET_CRYPTO_paillier_decrypt (const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key, const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext, gcry_mpi_t m) |
Decrypt a paillier ciphertext with a private key. More... | |
int | GNUNET_CRYPTO_paillier_hom_add (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *c1, const struct GNUNET_CRYPTO_PaillierCiphertext *c2, struct GNUNET_CRYPTO_PaillierCiphertext *result) |
Compute a ciphertext that represents the sum of the plaintext in x1 and x2. More... | |
int | GNUNET_CRYPTO_paillier_hom_get_remaining (const struct GNUNET_CRYPTO_PaillierCiphertext *c) |
Get the number of remaining supported homomorphic operations. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len) |
Create a new private key. More... | |
void | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key) |
Free memory occupied by the private key. More... | |
size_t | GNUNET_CRYPTO_rsa_private_key_encode (const struct GNUNET_CRYPTO_RsaPrivateKey *key, void **buffer) |
Encode the private key in a format suitable for storing it into a file. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_decode (const void *buf, size_t buf_size) |
Decode the private key from the data-format back to the "normal", internal format. More... | |
struct GNUNET_CRYPTO_RsaPrivateKey * | GNUNET_CRYPTO_rsa_private_key_dup (const struct GNUNET_CRYPTO_RsaPrivateKey *key) |
Duplicate the given private key. More... | |
struct GNUNET_CRYPTO_RsaPublicKey * | GNUNET_CRYPTO_rsa_private_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey *priv) |
Extract the public key of the given private key. More... | |
void | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, struct GNUNET_HashCode *hc) |
Compute hash over the public key. More... | |
unsigned int | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
Obtain the length of the RSA key in bits. More... | |
void | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key) |
Free memory occupied by the public key. More... | |
size_t | GNUNET_CRYPTO_rsa_public_key_encode (const struct GNUNET_CRYPTO_RsaPublicKey *key, void **buffer) |
Encode the public key in a format suitable for storing it into a file. More... | |
struct GNUNET_CRYPTO_RsaPublicKey * | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len) |
Decode the public key from the data-format back to the "normal", internal format. More... | |
struct GNUNET_CRYPTO_RsaPublicKey * | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key) |
Duplicate the given public key. More... | |
int | GNUNET_CRYPTO_rsa_signature_cmp (const struct GNUNET_CRYPTO_RsaSignature *s1, const struct GNUNET_CRYPTO_RsaSignature *s2) |
Compare the values of two signatures. More... | |
int | GNUNET_CRYPTO_rsa_private_key_cmp (const struct GNUNET_CRYPTO_RsaPrivateKey *p1, const struct GNUNET_CRYPTO_RsaPrivateKey *p2) |
Compare the values of two private keys. More... | |
int | GNUNET_CRYPTO_rsa_public_key_cmp (const struct GNUNET_CRYPTO_RsaPublicKey *p1, const struct GNUNET_CRYPTO_RsaPublicKey *p2) |
Compare the values of two public keys. More... | |
int | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey, void **buf, size_t *buf_size) |
Blinds the given message with the given blinding key. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const void *msg, size_t msg_len) |
Sign a blinded value, which must be a full domain hash of a message. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const struct GNUNET_HashCode *hash) |
Create and sign a full domain hash of a message. More... | |
void | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig) |
Free memory occupied by signature. More... | |
size_t | GNUNET_CRYPTO_rsa_signature_encode (const struct GNUNET_CRYPTO_RsaSignature *sig, void **buffer) |
Encode the given signature in a format suitable for storing it into a file. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_signature_decode (const void *buf, size_t buf_size) |
Decode the signature from the data-format back to the "normal", internal format. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig) |
Duplicate the given rsa signature. More... | |
struct GNUNET_CRYPTO_RsaSignature * | GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, struct GNUNET_CRYPTO_RsaPublicKey *pkey) |
Unblind a blind-signed signature. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_RsaSignature *sig, const struct GNUNET_CRYPTO_RsaPublicKey *public_key) |
Verify whether the given hash corresponds to the given signature and the signature is valid with respect to the given public key. More... | |
cryptographic primitives for GNUnet
Definition in file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 |
Maximum length of an ECC signature.
Note: round up to multiple of 8 minus 2 for alignment.
Definition at line 68 of file gnunet_crypto_lib.h.
#define GNUNET_CRYPTO_AES_KEY_LENGTH (256 / 8) |
length of the sessionkey in bytes (256 BIT sessionkey)
Definition at line 101 of file gnunet_crypto_lib.h.
Referenced by block_create_ecdsa(), block_decrypt_ecdsa(), derive_block_aes_key(), ecdsa_symmetric_decrypt(), ecdsa_symmetric_encrypt(), GNUNET_CRYPTO_symmetric_create_session_key(), and init_aes().
#define GNUNET_CRYPTO_HASH_LENGTH (512 / 8) |
Length of a hash value.
Definition at line 106 of file gnunet_crypto_lib.h.
Referenced by RPS_sampler_elem_reinit().
#define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52 |
How many characters (without 0-terminator) are our ASCII-encoded public keys (ECDSA/EDDSA/ECDHE).
Definition at line 112 of file gnunet_crypto_lib.h.
Referenced by uri_loc_parse().
#define GNUNET_CRYPTO_PAILLIER_BITS 2048 |
Size of paillier plain texts and public keys.
Private keys and ciphertexts are twice this size.
Definition at line 333 of file gnunet_crypto_lib.h.
Referenced by encrypt_fair(), get_fair_encryption_challenge(), GNUNET_CRYPTO_paillier_create(), GNUNET_CRYPTO_paillier_encrypt(), GNUNET_CRYPTO_paillier_encrypt1(), run(), and verify_fair().
typedef void(* GNUNET_CRYPTO_HashCompletedCallback) (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over the specified file has completed.
cls | closure |
res | resulting hash, NULL on error |
Definition at line 811 of file gnunet_crypto_lib.h.
uint32_t GNUNET_CRYPTO_crc16_step | ( | uint32_t | sum, |
const void * | buf, | ||
size_t | len | ||
) |
Perform an incremental step in a CRC16 (for TCP/IP) calculation.
sum | current sum, initially 0 |
buf | buffer to calculate CRC over (must be 16-bit aligned) |
len | number of bytes in buf, must be multiple of 2 |
sum | current sum, initially 0 |
buf | buffer to calculate CRC over (must be 16-bit aligned) |
len | number of bytes in hdr, must be multiple of 2 |
Definition at line 125 of file crypto_crc.c.
References buf.
Referenced by GNUNET_CRYPTO_crc16_n(), GNUNET_TUN_calculate_icmp_checksum(), GNUNET_TUN_calculate_tcp4_checksum(), GNUNET_TUN_calculate_tcp6_checksum(), GNUNET_TUN_calculate_udp4_checksum(), and GNUNET_TUN_calculate_udp6_checksum().
uint16_t GNUNET_CRYPTO_crc16_finish | ( | uint32_t | sum | ) |
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
sum | cumulative sum |
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
sum | cumulative sum |
Definition at line 144 of file crypto_crc.c.
Referenced by GNUNET_CRYPTO_crc16_n(), GNUNET_TUN_calculate_icmp_checksum(), GNUNET_TUN_calculate_tcp4_checksum(), GNUNET_TUN_calculate_tcp6_checksum(), GNUNET_TUN_calculate_udp4_checksum(), and GNUNET_TUN_calculate_udp6_checksum().
void GNUNET_CRYPTO_symmetric_derive_iv_v | ( | struct GNUNET_CRYPTO_SymmetricInitializationVector * | iv, |
const struct GNUNET_CRYPTO_SymmetricSessionKey * | skey, | ||
const void * | salt, | ||
size_t | salt_len, | ||
va_list | argp | ||
) |
Derive an IV.
iv | initialization vector |
skey | session key |
salt | salt for the derivation |
salt_len | size of the salt |
argp | pairs of void * & size_t for context chunks, terminated by NULL |
iv | initialization vector |
skey | session key |
salt | salt for the derivation |
salt_len | size of the salt |
argp | pairs of void * & size_t for context chunks, terminated by NULL |
Definition at line 229 of file crypto_symmetric.c.
References GNUNET_CRYPTO_SymmetricInitializationVector::aes_iv, GNUNET_CRYPTO_SymmetricSessionKey::aes_key, GNUNET_CRYPTO_kdf_v(), GNUNET_memcpy, GNUNET_CRYPTO_SymmetricInitializationVector::twofish_iv, and GNUNET_CRYPTO_SymmetricSessionKey::twofish_key.
Referenced by GNUNET_CRYPTO_symmetric_derive_iv().
void GNUNET_CRYPTO_pow_hash | ( | const struct GNUNET_CRYPTO_PowSalt * | salt, |
const void * | buf, | ||
size_t | buf_len, | ||
struct GNUNET_HashCode * | result | ||
) |
Calculate the 'proof-of-work' hash (an expensive hash).
salt | salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. |
buf | data to hash |
buf_len | number of bytes in buf |
result | where to write the resulting hash |
We're using a non-standard formula to avoid issues with ASICs appearing (see #3795).
salt | salt for the hash. Must be crypto_pwhash_argon2id_SALTBYTES long. |
buf | data to hash |
buf_len | number of bytes in buf |
result | where to write the resulting hash |
Definition at line 41 of file crypto_pow.c.
References GNUNET_break.
Referenced by check_proof_of_work(), find_proof(), GNUNET_REVOCATION_check_pow(), and GNUNET_REVOCATION_pow_round().
struct GNUNET_HashContext* GNUNET_CRYPTO_hash_context_start | ( | void | ) |
Start incremental hashing operation.
Definition at line 321 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_new, and GNUNET_HashContext::hd.
Referenced by GCCH_hash_port(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), and GNUNET_SETU_element_hash().
struct GNUNET_HashContext* GNUNET_CRYPTO_hash_context_copy | ( | const struct GNUNET_HashContext * | hc | ) |
Make a copy of the hash computation.
hc | hash context to use (to continue hashing independently) |
Definition at line 351 of file crypto_hash.c.
References GNUNET_assert, GNUNET_new, and GNUNET_HashContext::hd.
void GNUNET_CRYPTO_hash_context_read | ( | struct GNUNET_HashContext * | hc, |
const void * | buf, | ||
size_t | size | ||
) |
Add data to be hashed.
hc | cumulative hash context |
buf | data to add |
size | number of bytes in buf |
Definition at line 340 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, and GNUNET_HashContext::hd.
Referenced by GCCH_hash_port(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), and GNUNET_SETU_element_hash().
void GNUNET_CRYPTO_hash_context_finish | ( | struct GNUNET_HashContext * | hc, |
struct GNUNET_HashCode * | r_hash | ||
) |
Finish the hash computation.
hc | hash context to use, is freed in the process |
r_hash | where to write the latest / final hash code |
Definition at line 364 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_CRYPTO_hash_context_abort(), GNUNET_memcpy, GNUNET_HashContext::hd, and res.
Referenced by GCCH_hash_port(), GNUNET_SET_element_hash(), GNUNET_SETI_element_hash(), and GNUNET_SETU_element_hash().
void GNUNET_CRYPTO_hash_context_abort | ( | struct GNUNET_HashContext * | hc | ) |
Abort hashing, do not bother calculating final result.
hc | hash context to destroy |
Definition at line 382 of file crypto_hash.c.
References GNUNET_free, and GNUNET_HashContext::hd.
Referenced by GNUNET_CRYPTO_hash_context_finish().
void GNUNET_CRYPTO_hmac_raw | ( | const void * | key, |
size_t | key_len, | ||
const void * | plaintext, | ||
size_t | plaintext_len, | ||
struct GNUNET_HashCode * | hmac | ||
) |
Calculate HMAC of a message (RFC 2104) TODO: Shouldn' this be the standard hmac function and the above be renamed?
key | secret key |
key_len | secret key length |
plaintext | input plaintext |
plaintext_len | length of plaintext |
hmac | where to store the hmac |
Definition at line 274 of file crypto_hash.c.
References GNUNET_HashCode::bits, GNUNET_assert, GNUNET_memcpy, mc, and once.
Referenced by calculate_hmac(), GNUNET_CRYPTO_hmac(), and OIDC_generate_id_token().
void GNUNET_CRYPTO_hash_file_cancel | ( | struct GNUNET_CRYPTO_FileHashContext * | fhc | ) |
Cancel a file hashing operation.
fhc | operation to cancel (callback must not yet have been invoked) |
Definition at line 233 of file crypto_hash_file.c.
References GNUNET_CRYPTO_FileHashContext::fh, GNUNET_CRYPTO_FileHashContext::filename, GNUNET_break, GNUNET_DISK_file_close(), GNUNET_free, GNUNET_OK, GNUNET_SCHEDULER_cancel(), and GNUNET_CRYPTO_FileHashContext::task.
Referenced by client_disconnect_cb(), GNUNET_FS_indexing_done(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_stop(), and publish_cleanup().
int GNUNET_CRYPTO_hash_get_bit_rtl | ( | const struct GNUNET_HashCode * | code, |
unsigned int | bit | ||
) |
Obtain a bit from a hashcode.
code | the GNUNET_CRYPTO_hash to index bit-wise |
bit | index into the hashcode, [0...511] where 0 is the rightmost bit (bytes in code interpreted little endian) |
Definition at line 180 of file crypto_hash.c.
References GNUNET_assert.
Referenced by get_distance(), and GNUNET_CRYPTO_hash_matching_bits().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf_v | ( | void * | result, |
size_t | out_len, | ||
const void * | xts, | ||
size_t | xts_len, | ||
const void * | skm, | ||
size_t | skm_len, | ||
va_list | argp | ||
) |
Derive key.
result | buffer for the derived key, allocated by caller |
out_len | desired length of the derived key |
xts | salt |
xts_len | length of xts |
skm | source key material |
skm_len | length of skm |
argp | va_list of void * & size_t pairs for context chunks |
Definition at line 47 of file crypto_kdf.c.
References GNUNET_CRYPTO_hkdf_v().
Referenced by GNUNET_CRYPTO_hmac_derive_key_v(), GNUNET_CRYPTO_kdf(), and GNUNET_CRYPTO_symmetric_derive_iv_v().
void GNUNET_CRYPTO_kdf_mod_mpi | ( | gcry_mpi_t * | r, |
gcry_mpi_t | n, | ||
const void * | xts, | ||
size_t | xts_len, | ||
const void * | skm, | ||
size_t | skm_len, | ||
const char * | ctx | ||
) |
Deterministically generate a pseudo-random number uniformly from the integers modulo a libgcrypt mpi.
[out] | r | MPI value set to the FDH |
n | MPI to work modulo | |
xts | salt | |
xts_len | length of xts | |
skm | source key material | |
skm_len | length of skm | |
ctx | context string |
Definition at line 127 of file crypto_kdf.c.
References buf, GNUNET_assert, GNUNET_CRYPTO_kdf(), and GNUNET_YES.
Referenced by rsa_blinding_key_derive(), and rsa_full_domain_hash().
char* GNUNET_CRYPTO_ecdsa_public_key_to_string | ( | const struct GNUNET_CRYPTO_EcdsaPublicKey * | pub | ) |
Convert a public key to a string.
pub | key to convert |
Definition at line 208 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
Referenced by abd_value_to_string(), delegation_chain_fw_resolution_start(), forward_resolution(), get_ego(), GNUNET_ABD_delegate_to_string(), handle_intermediate_result(), handle_verify_result(), print_deleset(), and store_cb().
char* GNUNET_CRYPTO_ecdsa_private_key_to_string | ( | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | priv | ) |
Convert a private key to a string.
priv | key to convert |
Definition at line 289 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
char* GNUNET_CRYPTO_eddsa_private_key_to_string | ( | const struct GNUNET_CRYPTO_EddsaPrivateKey * | priv | ) |
Convert a private key to a string.
priv | key to convert |
Definition at line 262 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
Referenced by run().
char* GNUNET_CRYPTO_eddsa_public_key_to_string | ( | const struct GNUNET_CRYPTO_EddsaPublicKey * | pub | ) |
Convert a public key to a string.
pub | key to convert |
Definition at line 235 of file crypto_ecc.c.
References end, GNUNET_free, GNUNET_malloc, and GNUNET_STRINGS_data_to_string().
Referenced by conversation_value_to_string(), create_keys(), GCP_2s(), GNUNET_FRIENDS_write(), GNUNET_HELLO_compose_uri(), GNUNET_i2s(), GNUNET_i2s2(), GNUNET_i2s_full(), main(), print_key(), run(), and uri_loc_to_string().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_public_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EcdsaPublicKey * | pub | ||
) |
Convert a string representing a public key to a public key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
pub | where to store the public key |
Definition at line 316 of file crypto_ecc.c.
References GNUNET_OK, GNUNET_STRINGS_string_to_data(), and GNUNET_SYSERR.
Referenced by abd_string_to_value(), access_handler_callback(), GNUNET_ABD_delegate_from_string(), identity_cb(), run(), and sign_cb().
int GNUNET_CRYPTO_eddsa_private_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EddsaPrivateKey * | pub | ||
) |
Convert a string representing a private key to a private key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
priv | where to store the private key |
Definition at line 366 of file crypto_ecc.c.
References GNUNET_break, GNUNET_OK, GNUNET_STRINGS_string_to_data(), and GNUNET_SYSERR.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_public_key_from_string | ( | const char * | enc, |
size_t | enclen, | ||
struct GNUNET_CRYPTO_EddsaPublicKey * | pub | ||
) |
Convert a string representing a public key to a public key.
enc | encoded public key |
enclen | number of bytes in enc (without 0-terminator) |
pub | where to store the public key |
Definition at line 341 of file crypto_ecc.c.
References GNUNET_OK, GNUNET_STRINGS_string_to_data(), and GNUNET_SYSERR.
Referenced by blacklist_cfg_iter(), conversation_string_to_value(), create_keys(), gns_string_to_value(), GNUNET_FRIENDS_parse(), hosts_directory_scan_callback(), on_identity(), run(), s2i_full(), server_parse_url(), show_peer(), and uri_loc_parse().
struct GNUNET_CRYPTO_EccDlogContext* GNUNET_CRYPTO_ecc_dlog_prepare | ( | unsigned int | max, |
unsigned int | mem | ||
) |
Do pre-calculation for ECC discrete logarithm for small factors.
max | maximum value the factor can be |
mem | memory to use (should be smaller than max), must not be zero. |
Definition at line 157 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, CURVE, edc, extract_pk(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_CRYPTO_EccDlogContext::map, GNUNET_CRYPTO_EccDlogContext::max, and GNUNET_CRYPTO_EccDlogContext::mem.
Referenced by run().
int GNUNET_CRYPTO_ecc_dlog | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_point_t | input | ||
) |
Calculate ECC discrete logarithm for small factors.
Opposite of GNUNET_CRYPTO_ecc_dexp().
dlc | precalculated values, determine range of factors |
input | point on the curve to factor |
edc | precalculated values, determine range of factors |
input | point on the curve to factor |
Definition at line 225 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, extract_pk(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), INT_MAX, GNUNET_CRYPTO_EccDlogContext::map, GNUNET_CRYPTO_EccDlogContext::max, GNUNET_CRYPTO_EccDlogContext::mem, q, and res.
Referenced by compute_scalar_product().
gcry_mpi_point_t GNUNET_CRYPTO_ecc_dexp | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
int | val | ||
) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val.
Afterwards, point addition will correspond to integer addition. GNUNET_CRYPTO_ecc_dlog() can be used to convert a point back to an integer (as long as the integer is smaller than the MAX of the edc context).
edc | calculation context for ECC operations |
val | value to encode into a point |
Definition at line 334 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, and GNUNET_assert.
gcry_mpi_point_t GNUNET_CRYPTO_ecc_dexp_mpi | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_t | val | ||
) |
Multiply the generator g of the elliptic curve by val to obtain the point on the curve representing val.
edc | calculation context for ECC operations |
val | (positive) value to encode into a point |
Definition at line 374 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, and GNUNET_assert.
Referenced by send_alices_cryptodata_message().
gcry_mpi_point_t GNUNET_CRYPTO_ecc_pmul_mpi | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_point_t | p, | ||
gcry_mpi_t | val | ||
) |
Multiply the point p on the elliptic curve by val.
edc | calculation context for ECC operations |
p | point to multiply |
val | (positive) value to encode into a point |
Definition at line 420 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx.
Referenced by compute_scalar_product(), and handle_alices_cryptodata_message().
void GNUNET_CRYPTO_ecc_point_to_bin | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_point_t | point, | ||
struct GNUNET_CRYPTO_EccPoint * | bin | ||
) |
Convert point value to binary representation.
edc | calculation context for ECC operations | |
point | computational point representation | |
[out] | bin | binary point representation |
Definition at line 101 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, GNUNET_assert, GNUNET_CRYPTO_mpi_print_unsigned(), and GNUNET_CRYPTO_EccPoint::q_y.
Referenced by send_alices_cryptodata_message(), and transmit_bobs_cryptodata_message().
gcry_mpi_point_t GNUNET_CRYPTO_ecc_bin_to_point | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
const struct GNUNET_CRYPTO_EccPoint * | bin | ||
) |
Convert binary representation of a point to computational representation.
edc | calculation context for ECC operations |
bin | binary point representation |
Definition at line 125 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, CURVE, GNUNET_assert, GNUNET_break, q, and GNUNET_CRYPTO_EccPoint::q_y.
Referenced by handle_alices_cryptodata_message(), and handle_bobs_cryptodata_message().
gcry_mpi_point_t GNUNET_CRYPTO_ecc_add | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_point_t | a, | ||
gcry_mpi_point_t | b | ||
) |
Add two points on the elliptic curve.
edc | calculation context for ECC operations |
a | some value |
b | some value |
Definition at line 398 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx.
Referenced by compute_scalar_product(), and handle_alices_cryptodata_message().
void GNUNET_CRYPTO_ecc_rnd | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_point_t * | r, | ||
gcry_mpi_point_t * | r_inv | ||
) |
Obtain a random point on the curve and its additive inverse.
Both returned values must be freed using GNUNET_CRYPTO_ecc_free().
edc | calculation context for ECC operations | |
[out] | r | set to a random point on the curve |
[out] | r_inv | set to the additive inverse of r |
Definition at line 442 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, GNUNET_assert, and GNUNET_CRYPTO_ecc_random_mod_n().
void GNUNET_CRYPTO_ecc_rnd_mpi | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc, |
gcry_mpi_t * | r, | ||
gcry_mpi_t * | r_inv | ||
) |
Obtain a random scalar for point multiplication on the curve and its multiplicative inverse.
edc | calculation context for ECC operations | |
[out] | r | set to a random scalar on the curve |
[out] | r_inv | set to the multiplicative inverse of r |
Definition at line 479 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, and GNUNET_CRYPTO_ecc_random_mod_n().
Referenced by run().
gcry_mpi_t GNUNET_CRYPTO_ecc_random_mod_n | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc | ) |
Generate a random value mod n.
edc | ECC context |
Definition at line 278 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, and GNUNET_assert.
Referenced by GNUNET_CRYPTO_ecc_rnd(), GNUNET_CRYPTO_ecc_rnd_mpi(), and send_alices_cryptodata_message().
void GNUNET_CRYPTO_ecc_free | ( | gcry_mpi_point_t | p | ) |
Free a point value returned by the API.
p | point to free |
Definition at line 499 of file crypto_ecc_dlog.c.
void GNUNET_CRYPTO_ecc_dlog_release | ( | struct GNUNET_CRYPTO_EccDlogContext * | edc | ) |
Release precalculated values.
dlc | dlog context |
edc | dlog context |
Definition at line 312 of file crypto_ecc_dlog.c.
References GNUNET_CRYPTO_EccDlogContext::ctx, GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_free, and GNUNET_CRYPTO_EccDlogContext::map.
Referenced by shutdown_task().
void GNUNET_CRYPTO_mpi_print_unsigned | ( | void * | buf, |
size_t | size, | ||
gcry_mpi_t | val | ||
) |
Output the given MPI value to the given buffer in network byte order.
The MPI val may not be negative.
buf | where to output to |
size | number of bytes in buf |
val | value to write to buf |
Definition at line 78 of file crypto_mpi.c.
References adjust(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_memcpy, LOG_GCRY, p, and size.
Referenced by decrypt_conclude(), encrypt_fair(), extract_pk(), GNUNET_CRYPTO_ecc_point_to_bin(), GNUNET_CRYPTO_ecdsa_key_get_anonymous(), GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_ecdsa_sign_(), GNUNET_CRYPTO_paillier_create(), GNUNET_CRYPTO_paillier_encrypt(), GNUNET_CRYPTO_paillier_encrypt1(), GNUNET_CRYPTO_paillier_hom_add(), GNUNET_SECRETSHARING_encrypt(), GNUNET_SECRETSHARING_plaintext_generate_i(), insert_decrypt_element(), insert_round1_element(), insert_round2_element(), and keygen_round2_conclude().
void GNUNET_CRYPTO_mpi_scan_unsigned | ( | gcry_mpi_t * | result, |
const void * | data, | ||
size_t | size | ||
) |
Convert data buffer into MPI value.
The buffer is interpreted as network byte order, unsigned integer.
result | where to store MPI value (allocated) |
data | raw data (GCRYMPI_FMT_USG) |
size | number of bytes in data |
Definition at line 131 of file crypto_mpi.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, and LOG_GCRY.
Referenced by decrypt_conclude(), decrypt_new_element(), derive_h(), encrypt_fair(), get_fair_encryption_challenge(), GNUNET_CRYPTO_ecdsa_private_key_derive(), GNUNET_CRYPTO_paillier_decrypt(), GNUNET_CRYPTO_paillier_encrypt(), GNUNET_CRYPTO_paillier_encrypt1(), GNUNET_CRYPTO_paillier_hom_add(), GNUNET_SECRETSHARING_encrypt(), insert_decrypt_element(), keygen_reveal_get_exp_coeff(), keygen_reveal_get_exp_preshare(), keygen_round1_new_element(), restore_fair(), and verify_fair().
void GNUNET_CRYPTO_paillier_create | ( | struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
struct GNUNET_CRYPTO_PaillierPrivateKey * | private_key | ||
) |
Create a freshly generated paillier public key.
[out] | public_key | Where to store the public key? |
[out] | private_key | Where to store the private key? |
Definition at line 39 of file crypto_paillier.c.
References GNUNET_assert, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_CRYPTO_PaillierPrivateKey::lambda, GNUNET_CRYPTO_PaillierPrivateKey::mu, p, and q.
Referenced by handle_client_keygen(), and run().
int GNUNET_CRYPTO_paillier_encrypt | ( | const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
const gcry_mpi_t | m, | ||
int | desired_ops, | ||
struct GNUNET_CRYPTO_PaillierCiphertext * | ciphertext | ||
) |
Encrypt a plaintext with a paillier public key.
public_key | Public key to use. | |
m | Plaintext to encrypt. | |
desired_ops | How many homomorphic ops the caller intends to use | |
[out] | ciphertext | Encryption of plaintext with public_key. |
Definition at line 220 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_MIN, GNUNET_SYSERR, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
Referenced by compute_service_response(), and send_alices_cryptodata_message().
void GNUNET_CRYPTO_paillier_decrypt | ( | const struct GNUNET_CRYPTO_PaillierPrivateKey * | private_key, |
const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, | ||
const struct GNUNET_CRYPTO_PaillierCiphertext * | ciphertext, | ||
gcry_mpi_t | m | ||
) |
Decrypt a paillier ciphertext with a private key.
private_key | Private key to use for decryption. | |
public_key | Public key to use for decryption. | |
ciphertext | Ciphertext to decrypt. | |
[out] | m | Decryption of ciphertext with . |
private_key | Private key to use for decryption. | |
public_key | Public key to use for encryption. | |
ciphertext | Ciphertext to decrypt. | |
[out] | m | Decryption of ciphertext with . |
Definition at line 335 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PaillierPrivateKey::lambda, and GNUNET_CRYPTO_PaillierPrivateKey::mu.
Referenced by compute_scalar_product(), and keygen_round2_new_element().
int GNUNET_CRYPTO_paillier_hom_add | ( | const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
const struct GNUNET_CRYPTO_PaillierCiphertext * | c1, | ||
const struct GNUNET_CRYPTO_PaillierCiphertext * | c2, | ||
struct GNUNET_CRYPTO_PaillierCiphertext * | result | ||
) |
Compute a ciphertext that represents the sum of the plaintext in x1 and x2.
Note that this operation can only be done a finite number of times before an overflow occurs.
public_key | Public key to use for encryption. | |
c1 | Paillier cipher text. | |
c2 | Paillier cipher text. | |
[out] | result | Result of the homomorphic operation. |
Compute a ciphertext that represents the sum of the plaintext in x1 and x2.
Note that this operation can only be done a finite number of times before an overflow occurs.
public_key | Public key to use for encryption. | |
c1 | Paillier cipher text. | |
c2 | Paillier cipher text. | |
[out] | result | Result of the homomorphic operation. |
Definition at line 413 of file crypto_paillier.c.
References testconfigure::b, GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_MIN, GNUNET_SYSERR, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
Referenced by compute_service_response().
int GNUNET_CRYPTO_paillier_hom_get_remaining | ( | const struct GNUNET_CRYPTO_PaillierCiphertext * | c | ) |
Get the number of remaining supported homomorphic operations.
c | Paillier cipher text. |
Definition at line 476 of file crypto_paillier.c.
References GNUNET_assert, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
struct GNUNET_CRYPTO_RsaPrivateKey* GNUNET_CRYPTO_rsa_private_key_create | ( | unsigned int | len | ) |
Create a new private key.
Caller must free return value.
len | length of the key in bits (i.e. 2048) |
Definition at line 143 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_new, ret, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
Referenced by output_vectors().
void GNUNET_CRYPTO_rsa_private_key_free | ( | struct GNUNET_CRYPTO_RsaPrivateKey * | key | ) |
Free memory occupied by the private key.
key | pointer to the memory to free |
Definition at line 172 of file crypto_rsa.c.
References GNUNET_free, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
Referenced by GNUNET_CRYPTO_rsa_private_key_decode(), and output_vectors().
size_t GNUNET_CRYPTO_rsa_private_key_encode | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | key, |
void ** | buffer | ||
) |
Encode the private key in a format suitable for storing it into a file.
key | the private key | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 180 of file crypto_rsa.c.
References testconfigure::b, GNUNET_assert, GNUNET_malloc, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
Referenced by GNUNET_CRYPTO_rsa_private_key_cmp(), and output_vectors().
struct GNUNET_CRYPTO_RsaPrivateKey* GNUNET_CRYPTO_rsa_private_key_decode | ( | const void * | buf, |
size_t | buf_size | ||
) |
Decode the private key from the data-format back to the "normal", internal format.
buf | the buffer where the private key data is stored |
buf_size | the size of the data in buf |
Definition at line 203 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_free(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_new, key, LOG, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
Referenced by checkvec().
struct GNUNET_CRYPTO_RsaPrivateKey* GNUNET_CRYPTO_rsa_private_key_dup | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | key | ) |
Duplicate the given private key.
key | the private key to duplicate |
Definition at line 1174 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, and GNUNET_CRYPTO_RsaPrivateKey::sexp.
struct GNUNET_CRYPTO_RsaPublicKey* GNUNET_CRYPTO_rsa_private_key_get_public | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | priv | ) |
Extract the public key of the given private key.
priv | the private key |
Definition at line 232 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_break_op, GNUNET_new, key_from_sexp(), pub, result, GNUNET_CRYPTO_RsaPrivateKey::sexp, and GNUNET_CRYPTO_RsaPublicKey::sexp.
Referenced by GNUNET_CRYPTO_rsa_sign_fdh(), output_vectors(), and rsa_sign_mpi().
void GNUNET_CRYPTO_rsa_public_key_hash | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key, |
struct GNUNET_HashCode * | hc | ||
) |
Compute hash over the public key.
key | public key to hash |
hc | where to store the hash code |
Definition at line 367 of file crypto_rsa.c.
References buf, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_rsa_public_key_encode(), and GNUNET_free.
unsigned int GNUNET_CRYPTO_rsa_public_key_len | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Obtain the length of the RSA key in bits.
key | the public key to introspect |
Definition at line 634 of file crypto_rsa.c.
References GNUNET_break, key_from_sexp(), and GNUNET_CRYPTO_RsaPublicKey::sexp.
void GNUNET_CRYPTO_rsa_public_key_free | ( | struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Free memory occupied by the public key.
key | pointer to the memory to free |
Definition at line 267 of file crypto_rsa.c.
References GNUNET_free, GNUNET_NETWORK_STRUCT_BEGIN, and GNUNET_CRYPTO_RsaPublicKey::sexp.
Referenced by clean_rsa_pub(), clean_rsa_public_key(), GNUNET_CRYPTO_rsa_sign_fdh(), output_vectors(), and rsa_sign_mpi().
size_t GNUNET_CRYPTO_rsa_public_key_encode | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key, |
void ** | buffer | ||
) |
Encode the public key in a format suitable for storing it into a file.
key | the private key | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 300 of file crypto_rsa.c.
References buf, GNUNET_assert, GNUNET_break, GNUNET_malloc, key_from_sexp(), GNUNET_CRYPTO_RsaPublicKeyHeaderP::modulus_length, GNUNET_CRYPTO_RsaPublicKeyHeaderP::public_exponent_length, ret, and GNUNET_CRYPTO_RsaPublicKey::sexp.
Referenced by bind_rsa_pub(), checkvec(), GNUNET_CRYPTO_rsa_public_key_cmp(), GNUNET_CRYPTO_rsa_public_key_hash(), GNUNET_JSON_from_rsa_public_key(), my_conv_rsa_public_key(), output_vectors(), qconv_rsa_public_key(), and rsa_full_domain_hash().
struct GNUNET_CRYPTO_RsaPublicKey* GNUNET_CRYPTO_rsa_public_key_decode | ( | const char * | buf, |
size_t | len | ||
) |
Decode the public key from the data-format back to the "normal", internal format.
buf | the buffer where the public key data is stored |
len | the length of the data in buf |
Definition at line 383 of file crypto_rsa.c.
References data, e, GNUNET_break, GNUNET_break_op, GNUNET_new, key, GNUNET_CRYPTO_RsaPublicKeyHeaderP::modulus_length, GNUNET_CRYPTO_RsaPublicKeyHeaderP::public_exponent_length, and GNUNET_CRYPTO_RsaPublicKey::sexp.
Referenced by checkvec(), extract_rsa_pub(), extract_rsa_public_key(), parse_rsa_public_key(), and post_extract_rsa_public_key().
struct GNUNET_CRYPTO_RsaPublicKey* GNUNET_CRYPTO_rsa_public_key_dup | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | key | ) |
Duplicate the given public key.
key | the public key to duplicate |
Definition at line 1028 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, and GNUNET_CRYPTO_RsaPublicKey::sexp.
int GNUNET_CRYPTO_rsa_signature_cmp | ( | const struct GNUNET_CRYPTO_RsaSignature * | s1, |
const struct GNUNET_CRYPTO_RsaSignature * | s2 | ||
) |
Compare the values of two signatures.
s1 | one signature |
s2 | the other signature |
Definition at line 556 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_free, and ret.
int GNUNET_CRYPTO_rsa_private_key_cmp | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | p1, |
const struct GNUNET_CRYPTO_RsaPrivateKey * | p2 | ||
) |
Compare the values of two private keys.
p1 | one private key |
p2 | the other private key |
Definition at line 608 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_encode(), GNUNET_free, and ret.
int GNUNET_CRYPTO_rsa_public_key_cmp | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | p1, |
const struct GNUNET_CRYPTO_RsaPublicKey * | p2 | ||
) |
Compare the values of two public keys.
p1 | one public key |
p2 | the other public key |
Definition at line 582 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_free, and ret.
int GNUNET_CRYPTO_rsa_blind | ( | const struct GNUNET_HashCode * | hash, |
const struct GNUNET_CRYPTO_RsaBlindingKeySecret * | bks, | ||
struct GNUNET_CRYPTO_RsaPublicKey * | pkey, | ||
void ** | buf, | ||
size_t * | buf_size | ||
) |
Blinds the given message with the given blinding key.
hash | hash of the message to sign | |
bkey | the blinding key | |
pkey | the public key of the signer | |
[out] | buf | set to a buffer with the blinded message to be signed |
[out] | buf_size | number of bytes stored in buf |
Definition at line 744 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, data, GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_YES, key_from_sexp(), numeric_mpi_alloc_n_print(), RsaBlindingKey::r, ret, rsa_blinding_key_derive(), rsa_blinding_key_free(), rsa_full_domain_hash(), and GNUNET_CRYPTO_RsaPublicKey::sexp.
Referenced by checkvec(), and output_vectors().
struct GNUNET_CRYPTO_RsaSignature* GNUNET_CRYPTO_rsa_sign_blinded | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | key, |
const void * | msg, | ||
size_t | msg_len | ||
) |
Sign a blinded value, which must be a full domain hash of a message.
key | private key to use for the signing |
msg | the (blinded) message to sign |
msg_len | number of bytes in msg to sign |
Definition at line 900 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, and rsa_sign_mpi().
Referenced by checkvec(), and output_vectors().
struct GNUNET_CRYPTO_RsaSignature* GNUNET_CRYPTO_rsa_sign_fdh | ( | const struct GNUNET_CRYPTO_RsaPrivateKey * | key, |
const struct GNUNET_HashCode * | hash | ||
) |
Create and sign a full domain hash of a message.
key | private key to use for the signing |
hash | the hash of the message to sign |
Definition at line 924 of file crypto_rsa.c.
References GNUNET_CRYPTO_rsa_private_key_get_public(), GNUNET_CRYPTO_rsa_public_key_free(), pkey, rsa_full_domain_hash(), and rsa_sign_mpi().
void GNUNET_CRYPTO_rsa_signature_free | ( | struct GNUNET_CRYPTO_RsaSignature * | sig | ) |
Free memory occupied by signature.
sig | memory to free |
Definition at line 944 of file crypto_rsa.c.
References GNUNET_free, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by clean_rsa_sig(), clean_rsa_signature(), and output_vectors().
size_t GNUNET_CRYPTO_rsa_signature_encode | ( | const struct GNUNET_CRYPTO_RsaSignature * | sig, |
void ** | buffer | ||
) |
Encode the given signature in a format suitable for storing it into a file.
sig | the signature | |
[out] | buffer | set to a buffer with the encoded key |
Definition at line 952 of file crypto_rsa.c.
References buf, GNUNET_assert, GNUNET_malloc, key_from_sexp(), ret, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by bind_rsa_sig(), checkvec(), GNUNET_CRYPTO_rsa_signature_cmp(), GNUNET_JSON_from_rsa_signature(), my_conv_rsa_signature(), output_vectors(), and qconv_rsa_signature().
struct GNUNET_CRYPTO_RsaSignature* GNUNET_CRYPTO_rsa_signature_decode | ( | const void * | buf, |
size_t | buf_size | ||
) |
Decode the signature from the data-format back to the "normal", internal format.
buf | the buffer where the public key data is stored |
buf_size | the number of bytes of the data in buf |
Definition at line 992 of file crypto_rsa.c.
References data, GNUNET_break, GNUNET_break_op, GNUNET_new, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by extract_rsa_sig(), extract_rsa_signature(), parse_rsa_signature(), and post_extract_rsa_signature().
struct GNUNET_CRYPTO_RsaSignature* GNUNET_CRYPTO_rsa_signature_dup | ( | const struct GNUNET_CRYPTO_RsaSignature * | sig | ) |
Duplicate the given rsa signature.
sig | the signature to duplicate |
Definition at line 1194 of file crypto_rsa.c.
References GNUNET_assert, GNUNET_new, key_from_sexp(), ret, and GNUNET_CRYPTO_RsaSignature::sexp.
struct GNUNET_CRYPTO_RsaSignature* GNUNET_CRYPTO_rsa_unblind | ( | const struct GNUNET_CRYPTO_RsaSignature * | sig, |
const struct GNUNET_CRYPTO_RsaBlindingKeySecret * | bks, | ||
struct GNUNET_CRYPTO_RsaPublicKey * | pkey | ||
) |
Unblind a blind-signed signature.
The signature should have been generated with #GNUNET_CRYPTO_rsa_sign() using a hash that was blinded with GNUNET_CRYPTO_rsa_blind().
sig | the signature made on the blinded signature purpose |
bks | the blinding key secret used to blind the signature purpose |
pkey | the public key of the signer |
Definition at line 1047 of file crypto_rsa.c.
References BENCHMARK_END, BENCHMARK_START, GNUNET_assert, GNUNET_break_op, GNUNET_new, key_from_sexp(), RsaBlindingKey::r, ret, rsa_blinding_key_derive(), rsa_blinding_key_free(), GNUNET_CRYPTO_RsaPublicKey::sexp, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by checkvec(), and output_vectors().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_rsa_verify | ( | const struct GNUNET_HashCode * | hash, |
const struct GNUNET_CRYPTO_RsaSignature * | sig, | ||
const struct GNUNET_CRYPTO_RsaPublicKey * | public_key | ||
) |
Verify whether the given hash corresponds to the given signature and the signature is valid with respect to the given public key.
hash | the message to verify to match the sig |
sig | signature that is being validated |
public_key | public key of the signer |
Definition at line 1128 of file crypto_rsa.c.
References _, BENCHMARK_END, BENCHMARK_START, data, GNUNET_break_op, GNUNET_ERROR_TYPE_WARNING, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, LOG, mpi_to_sexp(), rsa_full_domain_hash(), GNUNET_CRYPTO_RsaPublicKey::sexp, and GNUNET_CRYPTO_RsaSignature::sexp.
Referenced by checkvec(), and output_vectors().