* - Matthias Wachs (08.10.2010)
*/
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
/**
* Set this to 0 if you compile this code outside of GNUnet.
*/
#define DEBUG_HKDF 0
+
#if GNUNET_BUILD
#include "platform.h"
#include "gnunet_crypto_lib.h"
* @return HMAC, freed by caller via gcry_md_close/_reset
*/
static const void *
-doHMAC (gcry_md_hd_t mac,
- const void *key, size_t key_len, const void *buf, size_t buf_len)
+doHMAC (gcry_md_hd_t mac, const void *key, size_t key_len, const void *buf,
+ size_t buf_len)
{
gcry_md_setkey (mac, key, key_len);
gcry_md_write (mac, buf, buf_len);
* @return GNUNET_YES on success
*/
static int
-getPRK (gcry_md_hd_t mac,
- const void *xts, size_t xts_len,
- const void *skm, size_t skm_len, void *prk)
+getPRK (gcry_md_hd_t mac, const void *xts, size_t xts_len, const void *skm,
+ size_t skm_len, void *prk)
{
const void *ret;
* @return GNUNET_YES on success
*/
int
-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)
+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)
{
const void *hc;
unsigned long i, t, d;
* @param xtr_algo hash algorithm for the extraction phase, GCRY_MD_...
* @param prf_algo hash algorithm for the expansion phase, GCRY_MD_...
* @param xts salt
- * @param xts_len length of xts
+ * @param xts_len length of @a xts
* @param skm source key material
- * @param skm_len length of skm
- * @return GNUNET_YES on success
+ * @param skm_len length of @a skm
+ * @return #GNUNET_YES on success
*/
int
-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, ...)
+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, ...)
{
va_list argp;
int ret;
va_start (argp, skm_len);
- ret = GNUNET_CRYPTO_hkdf_v (result, out_len, xtr_algo, prf_algo, xts,
- xts_len, skm, skm_len, argp);
+ ret =
+ GNUNET_CRYPTO_hkdf_v (result, out_len, xtr_algo, prf_algo, xts, xts_len,
+ skm, skm_len, argp);
va_end (argp);
return ret;