check
[oweals/gnunet.git] / src / include / gnunet_crypto_lib.h
index baea6859a1b2bfd81fc17196e99bf323dbf3f136..8836645344d077bb583ecfd52df8b5299603d66f 100644 (file)
@@ -333,8 +333,9 @@ ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block,
  */
 void
 GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv,
-    const struct GNUNET_CRYPTO_AesSessionKey *skey, void *salt,
-    size_t salt_len, ...);
+    const struct GNUNET_CRYPTO_AesSessionKey *skey,
+    const void *salt, size_t salt_len,
+    ...);
 
 
 /**
@@ -347,8 +348,9 @@ GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv,
  */
 void
 GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv,
-    const struct GNUNET_CRYPTO_AesSessionKey *skey, void *salt,
-    size_t salt_len, va_list argp);
+    const struct GNUNET_CRYPTO_AesSessionKey *skey,
+    const void *salt, size_t salt_len,
+    va_list argp);
 
 
 /**
@@ -434,7 +436,6 @@ struct GNUNET_CRYPTO_FileHashContext;
 /**
  * Compute the hash of an entire file.
  *
- * @param sched scheduler to use
  * @param priority scheduling priority to use
  * @param filename name of file to hash
  * @param blocksize number of bytes to process in one task
@@ -443,8 +444,7 @@ struct GNUNET_CRYPTO_FileHashContext;
  * @return NULL on (immediate) errror
  */
 struct GNUNET_CRYPTO_FileHashContext *
-GNUNET_CRYPTO_hash_file (struct GNUNET_SCHEDULER_Handle *sched,
-                        enum GNUNET_SCHEDULER_Priority priority,
+GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority,
                         const char *filename,
                         size_t blocksize,
                         GNUNET_CRYPTO_HashCompletedCallback callback,
@@ -583,8 +583,8 @@ void
 GNUNET_CRYPTO_hmac_derive_key_v(struct GNUNET_CRYPTO_AuthKey *key,
                                 const struct GNUNET_CRYPTO_AesSessionKey *rkey,
                                 const void *salt,
-                                const size_t salt_len,
-                                const va_list argp);
+                                size_t salt_len,
+                               va_list argp);
 
 
 /**
@@ -599,7 +599,7 @@ void
 GNUNET_CRYPTO_hmac_derive_key(struct GNUNET_CRYPTO_AuthKey *key,
                               const struct GNUNET_CRYPTO_AesSessionKey *rkey,
                               const void *salt,
-                              const size_t salt_len,
+                              size_t salt_len,
                               ...);
 
 /**
@@ -612,14 +612,15 @@ GNUNET_CRYPTO_hmac_derive_key(struct GNUNET_CRYPTO_AuthKey *key,
  * @param xts_len length of xts
  * @param skm source key material
  * @param skm_len length of skm
- * @param ctx context info
- * @param ctx_len length of ctx
  * @return GNUNET_YES on success
  */
 int
-GNUNET_CRYPTO_hkdf (void *result, const unsigned long long out_len,
-    int xtr_algo, int prf_algo, const void *xts, const size_t xts_len,
-    const void *skm, const size_t skm_len, ...);
+GNUNET_CRYPTO_hkdf (void *result, 
+                   size_t out_len,
+                   int xtr_algo, int prf_algo, 
+                   const void *xts, size_t xts_len,
+                   const void *skm, size_t skm_len, 
+                   ...);
 
 
 /**
@@ -636,9 +637,13 @@ GNUNET_CRYPTO_hkdf (void *result, const unsigned long long out_len,
  * @return GNUNET_YES on success
  */
 int
-GNUNET_CRYPTO_hkdf_v (void *result, const unsigned long long out_len,
-    int xtr_algo, int prf_algo, const void *xts, const size_t xts_len,
-    const void *skm, const size_t skm_len, va_list argp);
+GNUNET_CRYPTO_hkdf_v (void *result, 
+                     size_t out_len,
+                     int xtr_algo, 
+                     int prf_algo, 
+                     const void *xts, size_t xts_len,
+                     const void *skm, size_t skm_len, 
+                     va_list argp);
 
 
 /**
@@ -653,9 +658,11 @@ GNUNET_CRYPTO_hkdf_v (void *result, const unsigned long long out_len,
  * @return GNUNET_YES on success
  */
 int
-GNUNET_CRYPTO_kdf_v (void *result, const unsigned long long out_len,
-    const void *xts, const size_t xts_len, const void *skm,
-    const size_t skm_len, va_list argp);
+GNUNET_CRYPTO_kdf_v (void *result, 
+                    size_t out_len,
+                    const void *xts, size_t xts_len, 
+                    const void *skm, size_t skm_len, 
+                    va_list argp);
 
 
 /**
@@ -670,9 +677,9 @@ GNUNET_CRYPTO_kdf_v (void *result, const unsigned long long out_len,
  * @return GNUNET_YES on success
  */
 int
-GNUNET_CRYPTO_kdf (void *result, const unsigned long long out_len,
-    const void *xts, const size_t xts_len, const void *skm,
-    const size_t skm_len, ...);
+GNUNET_CRYPTO_kdf (void *result, size_t out_len,
+    const void *xts, size_t xts_len, const void *skm,
+    size_t skm_len, ...);
 
 
 /**
@@ -682,6 +689,15 @@ GNUNET_CRYPTO_kdf (void *result, const unsigned long long out_len,
  */
 struct GNUNET_CRYPTO_RsaPrivateKey *GNUNET_CRYPTO_rsa_key_create (void);
 
+/**
+ * Decode the private key from the data-format back
+ * to the "normal", internal format.
+ *
+ * @param buf the buffer where the private key data is stored
+ * @param len the length of the data in 'buffer'
+ */
+struct GNUNET_CRYPTO_RsaPrivateKey *
+GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len);
 
 /**
  * Create a new private key by reading it from a file.  If the