X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_crypto_lib.h;h=07cade0e30dc49016850d902fe3fda5b350764d4;hb=abdec5e11ff11bb10d32c013e11344a54786f80f;hp=00ecc565f82ce0e5ed1cdc2c0484b8b39a33a031;hpb=727c093dc23c71c792261e295c3d628824bd8ccc;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 00ecc565f..07cade0e3 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h @@ -52,9 +52,24 @@ extern "C" #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). @@ -65,15 +80,6 @@ struct GNUNET_PeerIdentity; #include -/** - * @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. @@ -1030,7 +1036,7 @@ GNUNET_CRYPTO_kdf_v (void *result, 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); @@ -1232,6 +1238,17 @@ struct GNUNET_CRYPTO_EddsaPrivateKey * 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. @@ -1348,7 +1365,7 @@ struct GNUNET_CRYPTO_EccPoint * * @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, @@ -1361,7 +1378,7 @@ 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,