cleaning up set handlers, eliminating 2nd level demultiplexing and improving use...
[oweals/gnunet.git] / src / include / gnunet_crypto_lib.h
index 8002b771098b5cac3c960f1e6069d1a4798dd3ef..07cade0e30dc49016850d902fe3fda5b350764d4 100644 (file)
@@ -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 <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.
@@ -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.