+/**
+ * Derive the key for symmetric encryption/decryption from
+ * the public key and the label.
+ *
+ * @param skey where to store symmetric key
+ * @param iv where to store the IV
+ * @param label label to use for key derivation
+ * @param pub public key to use for key derivation
+ */
+static void
+derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
+ struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
+ const char *label,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
+{
+ struct GNUNET_HashCode key;
+
+ /* derive key from 'label' and public key of the namespace */
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CRYPTO_kdf (&key, sizeof (key),
+ "UBLOCK-ENC", strlen ("UBLOCK-ENC"),
+ label, strlen (label),
+ pub, sizeof (*pub),
+ NULL, 0));
+ GNUNET_CRYPTO_hash_to_aes_key (&key, skey, iv);
+}
+
+