Using regex for exit/vpn
[oweals/gnunet.git] / src / include / gnunet_crypto_lib.h
index 59f1dad7835d4a04c950cfa9b8d31b2d78373082..1e2af892509c8b97bfa939ace9d26a1e08a51b02 100644 (file)
@@ -71,7 +71,6 @@ enum GNUNET_CRYPTO_Quality
  */
 #define GNUNET_CRYPTO_AES_KEY_LENGTH (256/8)
 
-
 /**
  * @brief Length of RSA encrypted data (2048 bit)
  *
@@ -84,30 +83,26 @@ enum GNUNET_CRYPTO_Quality
  */
 #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256
 
-
 /**
  * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e
  */
 #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258
 
-
 /**
  * Length of a hash value
  */
-#define GNUNET_CRYPTO_HASH_LENGTH 512/8
-
+#define GNUNET_CRYPTO_HASH_LENGTH (512/8)
 
 /**
- * FIXME: what is an acceptable value here?
- * Note: round to multiple of 8 minus 2.
+ * Maximum length of an ECC signature.
+ * Note: round up to multiple of 8 minus 2 for alignment.
  */
-#define GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH 510
+#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 190
 
 /**
- * FIXME: what is an acceptable value here?
  * Maximum length of the public key (q-point, Q = dP) when encoded.
  */
-#define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 254
+#define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 140
 
 
 /**
@@ -270,14 +265,14 @@ struct GNUNET_CRYPTO_EccSignaturePurpose
 struct GNUNET_CRYPTO_EccSignature
 {
   /**
-   * Overall size of the encrypted data.
+   * Overall size of the signature data.
    */
   uint16_t size;
 
   /**
    * S-expression, padded with zeros.
    */
-  char sexpr[GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH];
+  char sexpr[GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH];
 };
 
 
@@ -318,23 +313,6 @@ struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded
 };
 
 
-/**
- * ECC Encrypted data.
- */
-struct GNUNET_CRYPTO_EccEncryptedData
-{
-  /**
-   * Overall size of the encrypted data.
-   */
-  uint16_t size;
-
-  /**
-   * S-expression, padded with zeros.
-   */
-  char encoding[GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH];
-};
-
-
 /**
  * @brief type for session keys
  */
@@ -1324,39 +1302,6 @@ void
 GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name);
 
 
-/**
- * Encrypt a block with the public key of another host that uses the
- * same cipher.
- *
- * @param block the block to encrypt
- * @param size the size of block
- * @param publicKey the encoded public key used to encrypt
- * @param target where to store the encrypted block
- * @returns GNUNET_SYSERR on error, GNUNET_OK if ok
- */
-int
-GNUNET_CRYPTO_ecc_encrypt (const void *block, size_t size,
-                           const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
-                           *publicKey,
-                           struct GNUNET_CRYPTO_EccEncryptedData *target);
-
-
-/**
- * Decrypt a given block with the hostkey.
- *
- * @param key the key with which to decrypt this block
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param result pointer to a location where the result can be stored
- * @param max the maximum number of bits to store for the result, if
- *        the decrypted block is bigger, an error is returned
- * @return the size of the decrypted block, -1 on error
- */
-ssize_t
-GNUNET_CRYPTO_ecc_decrypt (const struct GNUNET_CRYPTO_EccPrivateKey *key,
-                           const struct GNUNET_CRYPTO_EccEncryptedData *block,
-                           void *result, size_t max);
-
-
 /**
  * Sign a given block.
  *