X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fcrypto_kdf.c;h=0e7fbbbec17df7c8d82feefc19ecded6be3f09f8;hb=72c8645af31896829b674b575c5375706f362a30;hp=785603c8c7a8d33f9827ed8e1b02a7818bb99a17;hpb=9d9853441df5b565f6932fcf7fbb156b2d929392;p=oweals%2Fgnunet.git diff --git a/src/util/crypto_kdf.c b/src/util/crypto_kdf.c index 785603c8c..0e7fbbbec 100644 --- a/src/util/crypto_kdf.c +++ b/src/util/crypto_kdf.c @@ -29,6 +29,8 @@ #include "platform.h" #include "gnunet_crypto_lib.h" +#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) + /** * @brief Derive key * @param result buffer for the derived key, allocated by caller @@ -41,24 +43,24 @@ * @return GNUNET_YES on success */ int -GNUNET_CRYPTO_kdf_v (void *result, const unsigned long long out_len, - const void *xts, const size_t xts_len, const void *skm, - const size_t skm_len, va_list argp) +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) { /* - "Finally, we point out to a particularly advantageous instantiation using - HMAC-SHA512 as XTR and HMAC-SHA256 in PRF* (in which case the output from SHA-512 is - truncated to 256 bits). This makes sense in two ways: First, the extraction part is where we need a - stronger hash function due to the unconventional demand from the hash function in the extraction - setting. Second, as shown in Section 6, using HMAC with a truncated output as an extractor - allows to prove the security of HKDF under considerably weaker assumptions on the underlying - hash function." - - http://eprint.iacr.org/2010/264 + * "Finally, we point out to a particularly advantageous instantiation using + * HMAC-SHA512 as XTR and HMAC-SHA256 in PRF* (in which case the output from SHA-512 is + * truncated to 256 bits). This makes sense in two ways: First, the extraction part is where we need a + * stronger hash function due to the unconventional demand from the hash function in the extraction + * setting. Second, as shown in Section 6, using HMAC with a truncated output as an extractor + * allows to prove the security of HKDF under considerably weaker assumptions on the underlying + * hash function." + * + * http://eprint.iacr.org/2010/264 */ return GNUNET_CRYPTO_hkdf_v (result, out_len, GCRY_MD_SHA512, GCRY_MD_SHA256, - xts, xts_len, skm, skm_len, argp); + xts, xts_len, skm, skm_len, argp); } /** @@ -73,16 +75,15 @@ GNUNET_CRYPTO_kdf_v (void *result, const unsigned long long out_len, * @return GNUNET_YES on success */ int -GNUNET_CRYPTO_kdf (void *result, const unsigned long long out_len, - const void *xts, const size_t xts_len, const void *skm, - const size_t skm_len, ...) +GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, + size_t xts_len, const void *skm, size_t skm_len, ...) { va_list argp; int ret; - va_start(argp, skm_len); + va_start (argp, skm_len); ret = GNUNET_CRYPTO_kdf_v (result, out_len, xts, xts_len, skm, skm_len, argp); - va_end(argp); + va_end (argp); return ret; }