Provides hashing and operations on hashes. More...
Macros | |
#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... | |
Functions | |
uint8_t | GNUNET_CRYPTO_crc8_n (const void *buf, size_t len) |
Calculate the checksum of a buffer in one step. 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_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_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_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_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_extract (struct GNUNET_ShortHashCode *prk, const void *salt, size_t salt_len, const void *ikm, size_t ikm_len) |
HKDF-Extract using SHA256. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf_expand (void *result, size_t out_len, const struct GNUNET_ShortHashCode *prk,...) |
HKDF-Expand using SHA256. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf_expand_v (void *result, size_t out_len, const struct GNUNET_ShortHashCode *prk, va_list argp) |
HKDF-Expand using SHA256. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf_gnunet (void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...) |
A peculiar HKDF instantiation that tried to mimic Truncated NMAC. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CRYPTO_hkdf_gnunet_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... | |
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... | |
Provides hashing and operations on hashes.
#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
enc | the encoding |
result | where to store the hash code |
Definition at line 988 of file gnunet_crypto_lib.h.
uint8_t GNUNET_CRYPTO_crc8_n | ( | const void * | buf, |
size_t | len | ||
) |
Calculate the checksum of a buffer in one step.
buf | buffer to calculate CRC over |
len | number of bytes in buf |
Definition at line 151 of file crypto_crc.c.
References data.
uint16_t GNUNET_CRYPTO_crc16_n | ( | const void * | buf, |
size_t | len | ||
) |
Calculate the checksum of a buffer in one step.
buf | buffer to calculate CRC over (must be 16-bit aligned) |
len | number of bytes in buf, must be multiple of 2 |
Definition at line 133 of file crypto_crc.c.
References GNUNET_CRYPTO_crc16_finish(), GNUNET_CRYPTO_crc16_step(), and consensus-simulation::sum.
Referenced by GNUNET_TUN_initialize_ipv4_header().
int32_t GNUNET_CRYPTO_crc32_n | ( | const void * | buf, |
size_t | len | ||
) |
Compute the CRC32 checksum for the first len bytes of the buffer.
buf | the data over which we're taking the CRC |
len | the length of the buffer buf in bytes |
Definition at line 99 of file crypto_crc.c.
References gn_crc32(), and Z_NULL.
Referenced by do_decrypt(), do_encrypt(), and ibf_get_indices().
void GNUNET_CRYPTO_hash_to_enc | ( | const struct GNUNET_HashCode * | block, |
struct GNUNET_CRYPTO_HashAsciiEncoded * | result | ||
) |
Convert hash to ASCII encoding.
block | the hash code |
result | where to store the encoding (struct GNUNET_CRYPTO_HashAsciiEncoded can be safely cast to char*, a '\0' termination is set). |
Definition at line 55 of file crypto_hash.c.
References GNUNET_assert, GNUNET_STRINGS_data_to_string(), and result.
Referenced by get_update_information_directory(), GNUNET_e2s(), GNUNET_e2s2(), GNUNET_h2s(), GNUNET_h2s2(), GNUNET_h2s_full(), GNUNET_NETWORK_shorten_unixpath(), GNUNET_p2s(), GNUNET_p2s2(), store_and_free_entries(), uri_chk_to_string(), and uri_loc_to_string().
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'.
enc | the encoding |
enclen | number of characters in enc (without 0-terminator, which can be missing) |
result | where to store the hash code |
Definition at line 72 of file crypto_hash.c.
References enc, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_STRINGS_utf8_toupper(), GNUNET_SYSERR, and result.
uint32_t GNUNET_CRYPTO_hash_distance_u32 | ( | const struct GNUNET_HashCode * | a, |
const struct GNUNET_HashCode * | b | ||
) |
Compute the distance between 2 hashcodes.
The computation must be fast, not involve a[0] or a[4] (they're used elsewhere), and be somewhat consistent. And of course, the result should be a positive number.
a | some hash code |
b | some hash code |
Definition at line 89 of file crypto_hash.c.
References GNUNET_HashCode::bits.
Referenced by score_content().
void GNUNET_CRYPTO_hash | ( | const void * | block, |
size_t | size, | ||
struct GNUNET_HashCode * | ret | ||
) |
Compute hash of a given block.
block | the data to hash |
size | size of the block |
ret | pointer to where to write the hashcode |
Definition at line 41 of file crypto_hash.c.
References BENCHMARK_END, BENCHMARK_START, ret, and size.
Referenced by add_file(), add_member_session(), add_to_keyword_counter(), add_to_meta_counter(), advertise_dns_exit(), automaton_create_proofs(), block_plugin_dht_check_block(), block_plugin_dht_check_reply(), block_plugin_dht_get_key(), block_plugin_dns_check_reply(), block_plugin_fs_check_reply(), block_plugin_fs_get_key(), block_plugin_gns_check_reply(), block_plugin_regex_check_reply(), block_plugin_revocation_get_key(), block_plugin_test_check_reply(), build_authz_response(), calculate_hmac(), check_and_remove_pending_reversal(), checkvec(), client_request_complete_alice(), code_redirect(), collector(), commit_set(), connection_destroy(), consume_fail(), consume_ticket(), convert_messenger_key_to_port(), cookie_identity_interpretation(), create_peers(), create_response(), create_stream(), create_subnet_peers(), create_subnets(), create_target(), cs_full_domain_hash(), data_to_ecdsa_value(), decode_short_message(), decrypt_new_element(), delayed_put(), derive_aes_key(), derive_auth_key(), derive_iv(), derive_pong_iv(), determine_id(), do_rekey(), ego_get_all(), ego_get_response(), ego_sign_data(), encode_short_message(), encrypt_existing_match(), es_to_sh(), extract_blind_sign_pub(), find_advertisable_hello(), find_stream(), find_target(), find_trees(), forward_reply(), GC_u2h(), GCT_handle_kx_auth(), GDS_helper_sign_path(), GDS_try_connect(), GDS_u_connect(), get_cadet(), get_context_from_member(), get_destination_key_from_ip(), get_fair_encryption_challenge(), get_file_handle(), get_gns_cont(), get_matching_bits(), get_member_session(), get_node_info(), get_store_contact(), get_update_information_directory(), get_url_parameter_copy(), GNUNET_b2s(), GNUNET_BLOCK_mingle_hash(), GNUNET_CONVERSATION_phone_create(), GNUNET_CRYPTO_blind_sign_keys_create_va(), GNUNET_CRYPTO_ecc_ecdh(), GNUNET_CRYPTO_ecdh_ecdsa(), GNUNET_CRYPTO_ecdh_eddsa(), GNUNET_CRYPTO_ecdsa_ecdh(), GNUNET_CRYPTO_eddsa_ecdh(), GNUNET_CRYPTO_edx25519_key_create_from_seed(), GNUNET_CRYPTO_rsa_public_key_hash(), GNUNET_DHT_verify_path(), GNUNET_e2s(), GNUNET_e2s2(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_namespace_list_updateable(), GNUNET_FS_publish_ublock_(), GNUNET_FS_search_start_searching_(), GNUNET_FS_tree_encoder_next(), GNUNET_FS_unindex_do_remove_kblocks_(), GNUNET_FS_uri_to_key(), GNUNET_GNSRECORD_query_from_block(), GNUNET_GNSRECORD_query_from_public_key(), GNUNET_HELLO_sign_address(), GNUNET_IDENTITY_ego_get_anonymous(), GNUNET_NETWORK_shorten_unixpath(), GNUNET_p2s(), GNUNET_p2s2(), GNUNET_TESTING_barrier_name_hash_(), GNUNET_TESTING_get_topo_from_string_(), GNUNET_TESTING_interpreter_get_command(), GNUNET_TESTING_interpreter_run_cmd_(), GNUNET_TUN_service_name_to_hash(), GSC_KX_encrypt_and_transmit(), GSC_KX_init(), GSC_TYPEMAP_hash(), GSF_cadet_start_server(), handle_client_decrypt(), handle_core_connect(), handle_encrypted(), handle_ephemeral_key(), handle_identity_update(), handle_put(), handle_query_message(), handle_regex_result(), handle_transport_notify_connect(), hash_message(), hash_pkey_and_label(), header_iterator(), iface_proc(), init_socket(), insert_decrypt_element(), insert_round1_element(), iterate_initial_edge(), iterateBits(), join_room_run(), load_state(), login_cont(), lookup_diff(), lookup_rfn(), lookup_set(), lookup_task(), maint_child_death(), mq_init(), namestore_get(), notify_connect(), notify_srv_handle_message(), ns_lookup_result_cb(), on_identity(), output_vectors(), parse_credentials_basic_auth(), parse_credentials_post_body(), peer_destroy(), PEERSTORE_hash_key(), pending_reversal_timeout(), post_data_iter(), postgres_plugin_put(), process(), process_client_result(), process_kblock_for_unindex(), process_reply(), publicize_rm(), put_diff(), put_rfn(), put_set(), put_task(), queue(), queue_destroy(), REGEX_BLOCK_check_proof(), REGEX_BLOCK_get_key(), REGEX_INTERNAL_get_first_key(), remove_high_frequency_keywords(), remove_member_session(), remove_room_member_session(), remove_store_contact(), remove_stream(), reset_cadet(), run(), schedule_next_hello(), schedule_transmit_search_request(), score_content(), select_store_contact_map(), send_key(), send_kx_auth(), setup_filter(), sock_read(), sqlite_plugin_put(), start_address_validation(), start_intersection(), token_endpoint(), try_match_block(), try_open_exit(), try_top_down_reconstruction(), update_store_contact(), url_iterator(), and userinfo_endpoint().
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)
key | secret key |
plaintext | input plaintext |
plaintext_len | length of plaintext |
hmac | where to store the hmac |
Definition at line 327 of file crypto_hash.c.
References GNUNET_CRYPTO_hmac_raw(), and key.
Referenced by dv_hmac(), GSC_KX_encrypt_and_transmit(), handle_encrypted(), RPS_sampler_elem_next(), t_ax_hmac_hash(), and t_hmac().
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.
priority | scheduling priority to use |
filename | name of file to hash |
blocksize | number of bytes to process in one task |
callback | function to call upon completion |
callback_cls | closure for callback |
Definition at line 169 of file crypto_hash_file.c.
References GNUNET_CRYPTO_FileHashContext::bsize, GNUNET_CRYPTO_FileHashContext::buffer, GNUNET_CRYPTO_FileHashContext::callback, GNUNET_CRYPTO_FileHashContext::callback_cls, GNUNET_CRYPTO_FileHashContext::fh, file_hash_task(), filename, GNUNET_CRYPTO_FileHashContext::filename, GNUNET_CRYPTO_FileHashContext::fsize, GNUNET_assert, GNUNET_break, GNUNET_DISK_file_open(), GNUNET_DISK_file_size(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_free, GNUNET_malloc, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_with_priority(), GNUNET_strdup, GNUNET_YES, GNUNET_CRYPTO_FileHashContext::md, GNUNET_CRYPTO_FileHashContext::priority, SIZE_MAX, and GNUNET_CRYPTO_FileHashContext::task.
Referenced by deserialize_unindex_file(), GNUNET_FS_publish_main_(), GNUNET_FS_unindex_start(), and handle_client_index_start().
void GNUNET_CRYPTO_hash_create_random | ( | enum GNUNET_CRYPTO_Quality | mode, |
struct GNUNET_HashCode * | result | ||
) |
Create a random hash code.
mode | desired quality level |
result | hash code that is randomized |
Definition at line 100 of file crypto_hash.c.
References GNUNET_CRYPTO_random_block(), mode, and result.
Referenced by commit_set(), and run().
void GNUNET_CRYPTO_hash_difference | ( | const struct GNUNET_HashCode * | a, |
const struct GNUNET_HashCode * | b, | ||
struct GNUNET_HashCode * | result | ||
) |
compute result = b - a
a | some hash code |
b | some hash code |
result | set to b - a |
Definition at line 108 of file crypto_hash.c.
References GNUNET_HashCode::bits, and result.
void GNUNET_CRYPTO_hash_sum | ( | const struct GNUNET_HashCode * | a, |
const struct GNUNET_HashCode * | delta, | ||
struct GNUNET_HashCode * | result | ||
) |
compute result = a + delta
a | some hash code |
delta | some hash code |
result | set to a + delta |
Definition at line 120 of file crypto_hash.c.
References GNUNET_HashCode::bits, delta, and result.
Referenced by convert_messenger_key_to_port().
void GNUNET_CRYPTO_hash_xor | ( | const struct GNUNET_HashCode * | a, |
const struct GNUNET_HashCode * | b, | ||
struct GNUNET_HashCode * | result | ||
) |
compute result = a ^ b
a | some hash code |
b | some hash code |
result | set to a ^ b |
Definition at line 132 of file crypto_hash.c.
References GNUNET_static_assert, and result.
Referenced by determine_id(), filter_all(), filtered_map_initialization(), find_bucket(), GDS_DATACACHE_handle_put(), get_context_from_member(), get_matching_bits(), initialize_map_unfiltered(), iterator_bf_reduce(), process_sks_result(), and select_peer().
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.
hc | hash code that serves to generate the key |
skey | set to a valid session key |
iv | set to a valid initialization vector |
Definition at line 149 of file crypto_hash.c.
References GNUNET_assert, GNUNET_CRYPTO_kdf(), and GNUNET_YES.
Referenced by derive_ublock_encryption_key(), encrypt_existing_match(), GNUNET_FS_handle_on_demand_block(), GNUNET_FS_tree_encoder_next(), process_result_with_request(), and try_match_block().
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.
h1 | some hash code |
h2 | some hash code |
Definition at line 218 of file crypto_hash.c.
References consensus-simulation::int.
Referenced by check_member_session_completion(), clear_linked_hash(), create_message_request(), decode_short_message(), element_cmp(), find_closest(), find_linked_hash(), get_store_message(), handle_client_join(), handle_core_connect(), handle_transport_notify_connect(), op_get_element_iterator(), REGEX_BLOCK_check_proof(), remove_from_list_messages(), RPS_sampler_elem_next(), and select_store_contact_map().
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).
h1 | some hash code |
h2 | some hash code |
target | some hash code |
Definition at line 240 of file crypto_hash.c.
References GNUNET_static_assert, and t.
Referenced by GDS_am_closest_peer(), and select_peer().
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.
key | authentication key |
rkey | root key |
salt | salt |
salt_len | size of the salt |
argp | pair of void * & size_t for context chunks, terminated by NULL |
Definition at line 283 of file crypto_hash.c.
References GNUNET_CRYPTO_kdf_v(), key, and salt.
Referenced by GNUNET_CRYPTO_hmac_derive_key().
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.
key | authentication key |
rkey | root key |
salt | salt |
salt_len | size of the salt |
... | pair of void * & size_t for context chunks, terminated by NULL |
Definition at line 264 of file crypto_hash.c.
References GNUNET_CRYPTO_hmac_derive_key_v(), key, and salt.
Referenced by derive_auth_key(), t_ax_hmac_hash(), and t_hmac().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_extract | ( | struct GNUNET_ShortHashCode * | prk, |
const void * | salt, | ||
size_t | salt_len, | ||
const void * | ikm, | ||
size_t | ikm_len | ||
) |
HKDF-Extract using SHA256.
RFC 5869
prk | the PRK |
salt | salt |
salt_len | length of xts |
ikm | source key material |
ikm_len | length of skm |
Definition at line 224 of file crypto_hkdf.c.
References GNUNET_OK, GNUNET_SYSERR, and st.
Referenced by get_kid(), and labeled_extract().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_expand | ( | void * | result, |
size_t | out_len, | ||
const struct GNUNET_ShortHashCode * | prk, | ||
... | |||
) |
HKDF-Expand using SHA256.
RFC 5869
result | buffer for the derived key, allocated by caller |
out_len | desired length of the derived key |
... | pair of void * & size_t for context chunks, terminated by NULL |
Definition at line 156 of file crypto_hkdf.c.
References GNUNET_CRYPTO_hkdf_expand_v(), result, and ret.
Referenced by calculate_cmac(), dv_setup_key_state_from_km(), get_iv_key(), get_kid(), labeled_expand(), and setup_cipher().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_expand_v | ( | void * | result, |
size_t | out_len, | ||
const struct GNUNET_ShortHashCode * | prk, | ||
va_list | argp | ||
) |
HKDF-Expand using SHA256.
result | buffer for the derived key, allocated by caller |
out_len | desired length of the derived key |
argp | va_list of void * & size_t pairs for context chunks |
Definition at line 144 of file crypto_hkdf.c.
References hkdf_expand(), and result.
Referenced by GNUNET_CRYPTO_hkdf_expand().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_gnunet | ( | void * | result, |
size_t | out_len, | ||
const void * | xts, | ||
size_t | xts_len, | ||
const void * | skm, | ||
size_t | skm_len, | ||
... | |||
) |
A peculiar HKDF instantiation that tried to mimic Truncated NMAC.
But, what it actually does is HKDF-Extract with SHA512 and instead of truncating the PRK, it uses it as a 64 byte key in the HKDF-Expand phase with SHA256. (Truncated NMAC would require us to, well, truncate it to 32 byte.) ONLY USE FOR COMPATIBILITY WITH OLDER KEY DERIVATIONS. Use the more standard GNUNET_CRYPTO_hkdf_extract and #GNUNET_CRYPTO_HKDF_expand instead!
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 |
... | pair of void * & size_t for context chunks, terminated by NULL |
Definition at line 199 of file crypto_hkdf.c.
References GNUNET_CRYPTO_hkdf_gnunet_v(), result, and ret.
Referenced by GNUNET_CRYPTO_cs_blinding_secrets_derive(), GNUNET_CRYPTO_cs_sign_derive(), and output_vectors().
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf_gnunet_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 172 of file crypto_hkdf.c.
References GNUNET_SYSERR, hkdf_expand(), result, and st.
Referenced by GNUNET_CRYPTO_hkdf_gnunet(), and GNUNET_CRYPTO_kdf_v().
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.
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 |
... | void * & size_t pairs for context chunks |
Definition at line 62 of file crypto_kdf.c.
References GNUNET_CRYPTO_kdf_v(), result, and ret.
Referenced by checkvec(), compute_global_id(), derive_aes_key(), derive_h(), derive_ublock_encryption_key(), get_ibf_key(), GNR_derive_block_aes_key(), GNR_derive_block_xsalsa_key(), GNUNET_CRYPTO_cs_r_derive(), GNUNET_CRYPTO_hash_to_aes_key(), GNUNET_CRYPTO_kdf_mod_mpi(), hash_from_share_val(), output_vectors(), t_ax_decrypt_and_validate(), t_ax_encrypt(), t_hmac_derive_key(), and update_ax_by_kx().