-doxygen, plus FIXME request for clarification
[oweals/gnunet.git] / src / include / gnunet_crypto_lib.h
index a8e9d6027f3c8a3e1b76c4ffe53ba59cb720ce57..18e49ee93571b29f00b0fc73fd1aa153aaeeff1c 100644 (file)
@@ -365,18 +365,6 @@ struct GNUNET_CRYPTO_PaillierPrivateKey
 };
 
 
-/**
- * Paillier plaintext.
- */
-struct GNUNET_CRYPTO_PaillierPlaintext
-{
-  /**
-   * The bits of the plaintext.
-   */
-  unsigned char bits[GNUNET_CRYPTO_PAILLIER_BITS / 8];
-};
-
-
 /**
  * Paillier ciphertext.
  */
@@ -385,7 +373,7 @@ struct GNUNET_CRYPTO_PaillierCiphertext
   /**
    * guaranteed minimum number of homomorphic operations with this ciphertext
    */
-  uint32_t remaining_ops GNUNET_PACKED;
+  int32_t remaining_ops GNUNET_PACKED;
   
   /**
    * The bits of the ciphertext.
@@ -1058,6 +1046,8 @@ GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename);
 struct GNUNET_CRYPTO_EddsaPrivateKey *
 GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename);
 
+struct GNUNET_CONFIGURATION_Handle;
+
 
 /**
  * @ingroup crypto
@@ -1342,12 +1332,16 @@ GNUNET_CRYPTO_paillier_create (struct GNUNET_CRYPTO_PaillierPublicKey *public_ke
  *
  * @param public_key Public key to use.
  * @param m Plaintext to encrypt.
+ * @param desired_ops How many homomorphic ops the caller intends to use
  * @param[out] ciphertext Encrytion of @a plaintext with @a public_key.
- * @return guaranteed number of supported homomorphic operations
+ * @return guaranteed number of supported homomorphic operations >= 1, 
+ *         or desired_ops, in case that is lower,
+ *         or -1 if less than one homomorphic operation is possible
  */
 int
 GNUNET_CRYPTO_paillier_encrypt (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
                                 const gcry_mpi_t m,
+                                int desired_ops,
                                 struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext);
 
 
@@ -1372,18 +1366,29 @@ GNUNET_CRYPTO_paillier_decrypt (const struct GNUNET_CRYPTO_PaillierPrivateKey *p
  * Note that this operation can only be done a finite number of times
  * before an overflow occurs.
  *
- * @param x1 Paillier cipher text.
- * @param x2 Paillier cipher text.
+ * @param public_key Public key to use for encryption.
+ * @param c1 Paillier cipher text.
+ * @param c2 Paillier cipher text.
  * @param[out] result Result of the homomorphic operation.
  * @return #GNUNET_OK if the result could be computed,
  *         #GNUNET_SYSERR if no more homomorphic operations are remaining.
  */
 int
-GNUNET_CRYPTO_paillier_hom_add (const struct GNUNET_CRYPTO_PaillierCiphertext *x1,
-                                const struct GNUNET_CRYPTO_PaillierCiphertext *x2,
-                                const struct GNUNET_CRYPTO_PaillierCiphertext *result);
+GNUNET_CRYPTO_paillier_hom_add (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key,
+                                const struct GNUNET_CRYPTO_PaillierCiphertext *c1,
+                                const struct GNUNET_CRYPTO_PaillierCiphertext *c2,
+                                struct GNUNET_CRYPTO_PaillierCiphertext *result);
 
 
+/**
+ * Get the number of remaining supported homomorphic operations. 
+ *
+ * @param c Paillier cipher text.
+ * @return the number of remaining homomorphic operations
+ */
+int
+GNUNET_CRYPTO_paillier_hom_get_remaining (const struct GNUNET_CRYPTO_PaillierCiphertext *c);
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif