More W32 resolver workarounds
[oweals/gnunet.git] / src / include / gnunet_crypto_lib.h
index c65c9223a7ea248cc300e6985607da818b48740b..a82b2fdd63d7360ac2fc3d27045e414d4e090be4 100644 (file)
@@ -110,6 +110,12 @@ enum GNUNET_CRYPTO_Quality
  */
 #define GNUNET_CRYPTO_HASH_LENGTH (512/8)
 
+/**
+ * How many characters (without 0-terminator) are our ASCII-encoded
+ * public keys (ECDSA/EDDSA/ECDHE).
+ */
+#define GNUNET_CRYPTO_PKEY_ASCII_LENGTH 52
+
 /**
  * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode.
  */
@@ -210,9 +216,7 @@ struct GNUNET_CRYPTO_EcdsaPublicKey
 {
   /**
    * Q consists of an x- and a y-value, each mod p (256 bits), given
-   * here in affine coordinates.  For the Ed25519 curve we need to
-   * convey the y-value along with the sign.  The compact format used
-   * is the same as with EdDSA (little endian).
+   * here in affine coordinates and Ed25519 standard compact format.
    */
   unsigned char q_y[256 / 8];
 
@@ -448,14 +452,14 @@ GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessio
  * Encrypt a block using a symmetric sessionkey.
  *
  * @param block the block to encrypt
- * @param len the size of the block
+ * @param size the size of the @a block
  * @param sessionkey the key used to encrypt
  * @param iv the initialization vector to use, use INITVALUE
  *        for streams.
  * @return the size of the encrypted block, -1 for errors
  */
 ssize_t
-GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len,
+GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t size,
                                  const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey,
                                  const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv,
                                  void *result);
@@ -1098,6 +1102,19 @@ int
 GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                  struct GNUNET_PeerIdentity *dst);
 
+/**
+ * Compare two Peer Identities.
+ *
+ * @param first first peer identity
+ * @param second second peer identity
+ * @return bigger than 0 if first > second,
+ *         0 if they are the same
+ *         smaller than 0 if second > first
+ */
+int
+GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
+                                 const struct GNUNET_PeerIdentity *second);
+
 
 /**
  * @ingroup crypto