Tor
0.4.7.0-alpha-dev
|
Block of functions related with digest and xof utilities and operations. More...
#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto_digest.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "keccak-tiny/keccak-tiny.h"
#include <stdlib.h>
#include <string.h>
#include "lib/arch/bytes.h"
Go to the source code of this file.
Data Structures | |
struct | crypto_xof_t |
Functions | |
int | crypto_common_digests (common_digests_t *ds_out, const char *m, size_t len) |
const char * | crypto_digest_algorithm_get_name (digest_algorithm_t alg) |
int | crypto_digest_algorithm_parse_name (const char *name) |
size_t | crypto_digest_algorithm_get_length (digest_algorithm_t alg) |
void | crypto_mac_sha3_256 (uint8_t *mac_out, size_t len_out, const uint8_t *key, size_t key_len, const uint8_t *msg, size_t msg_len) |
crypto_xof_t * | crypto_xof_new (void) |
void | crypto_xof_add_bytes (crypto_xof_t *xof, const uint8_t *data, size_t len) |
void | crypto_xof_squeeze_bytes (crypto_xof_t *xof, uint8_t *out, size_t len) |
void | crypto_xof_free_ (crypto_xof_t *xof) |
void | crypto_xof (uint8_t *output, size_t output_len, const uint8_t *input, size_t input_len) |
Block of functions related with digest and xof utilities and operations.
Definition in file crypto_digest.c.
int crypto_common_digests | ( | common_digests_t * | ds_out, |
const char * | m, | ||
size_t | len | ||
) |
Set the common_digests_t in ds_out to contain every digest on the len bytes in m that we know how to compute. Return 0 on success, -1 on failure.
Definition at line 30 of file crypto_digest.c.
Referenced by router_get_hashes_impl().
size_t crypto_digest_algorithm_get_length | ( | digest_algorithm_t | alg | ) |
Given an algorithm, return the digest length in bytes.
Definition at line 86 of file crypto_digest.c.
Referenced by crypto_digest_get_digest().
const char* crypto_digest_algorithm_get_name | ( | digest_algorithm_t | alg | ) |
Return the name of an algorithm, as used in directory documents.
Definition at line 44 of file crypto_digest.c.
Referenced by disk_state_put_commit_line().
int crypto_digest_algorithm_parse_name | ( | const char * | name | ) |
Given the name of a digest algorithm, return its integer value, or -1 if the name is not recognized.
Definition at line 68 of file crypto_digest.c.
void crypto_mac_sha3_256 | ( | uint8_t * | mac_out, |
size_t | len_out, | ||
const uint8_t * | key, | ||
size_t | key_len, | ||
const uint8_t * | msg, | ||
size_t | msg_len | ||
) |
Compute a MAC using SHA3-256 of msg_len bytes in msg using a key of length key_len and a salt of length salt_len. Store the result of len_out bytes in in mac_out. This function can't fail.
Definition at line 110 of file crypto_digest.c.
Referenced by compute_introduce_mac().
void crypto_xof | ( | uint8_t * | output, |
size_t | output_len, | ||
const uint8_t * | input, | ||
size_t | input_len | ||
) |
Compute the XOF (SHAKE256) of a input_len bytes at input, putting output_len bytes at output.
Definition at line 229 of file crypto_digest.c.
void crypto_xof_add_bytes | ( | crypto_xof_t * | xof, |
const uint8_t * | data, | ||
size_t | len | ||
) |
Absorb bytes into a XOF object. Must not be called after a call to crypto_xof_squeeze_bytes() for the same instance, and will assert if attempted.
Definition at line 186 of file crypto_digest.c.
Referenced by build_kdf_key(), crypto_fast_rng_add_entopy(), and crypto_xof().
void crypto_xof_free_ | ( | crypto_xof_t * | xof | ) |
Cleanse and deallocate a XOF object.
Definition at line 214 of file crypto_digest.c.
crypto_xof_t* crypto_xof_new | ( | void | ) |
Allocate a new XOF object backed by SHAKE-256. The security level provided is a function of the length of the output used. Read and understand FIPS-202 A.2 "Additional Consideration for Extendable-Output Functions" before using this construct.
Definition at line 166 of file crypto_digest.c.
Referenced by build_kdf_key(), crypto_fast_rng_add_entopy(), and crypto_xof().
void crypto_xof_squeeze_bytes | ( | crypto_xof_t * | xof, |
uint8_t * | out, | ||
size_t | len | ||
) |
Squeeze bytes out of a XOF object. Calling this routine will render the XOF instance ineligible to absorb further data.
Definition at line 201 of file crypto_digest.c.
Referenced by crypto_xof().