#endif
/**
- * @brief A 512-bit hashcode
+ * @brief A 512-bit hashcode. These are the default length for GNUnet, using SHA-512.
*/
-struct GNUNET_HashCode;
+struct GNUNET_HashCode
+{
+ uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
+};
+
+
+
+/**
+ * @brief A 256-bit hashcode. Used under special conditions, like when space
+ * is critical and security is not impacted by it.
+ */
+struct GNUNET_ShortHashCode
+{
+ uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */
+};
+
/**
* The identity of the host (wraps the signing key of the peer).
#include <gcrypt.h>
-/**
- * @brief A 512-bit hashcode
- */
-struct GNUNET_HashCode
-{
- uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
-};
-
-
/**
* Maximum length of an ECC signature.
* Note: round up to multiple of 8 minus 2 for alignment.
void
GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
gcry_mpi_t n,
- const void *xts, size_t xts_len,
+ const void *xts, size_t xts_len,
const void *skm, size_t skm_len,
const char *ctx);
GNUNET_CRYPTO_eddsa_key_create (void);
+/**
+ * @ingroup crypto
+ * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear().
+ *
+ * @param[out] pk set to fresh private key;
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ */
+int
+GNUNET_CRYPTO_ecdhe_key_create2 (struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
+
+
/**
* @ingroup crypto
* Create a new private key. Caller must free return value.
*
* @param max maximum value the factor can be
* @param mem memory to use (should be smaller than @a max), must not be zero.
- * @return @a max if dlog failed, otherwise the factor
+ * @return NULL on error
*/
struct GNUNET_CRYPTO_EccDlogContext *
GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
*
* @param dlc precalculated values, determine range of factors
* @param input point on the curve to factor
- * @return `dlc->max` if dlog failed, otherwise the factor
+ * @return INT_MAX if dlog failed, otherwise the factor
*/
int
GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,