* gc.h (gc_nonce, gc_pseudo_random, gc_random): Add prototypes.
authorSimon Josefsson <simon@josefsson.org>
Mon, 17 Oct 2005 13:41:56 +0000 (13:41 +0000)
committerSimon Josefsson <simon@josefsson.org>
Mon, 17 Oct 2005 13:41:56 +0000 (13:41 +0000)
lib/ChangeLog
lib/gc.h

index 22176e3..12f42b6 100644 (file)
@@ -1,5 +1,9 @@
 2005-10-17  Simon Josefsson  <jas@extundo.com>
 
+       * gc.h (gc_nonce, gc_pseudo_random, gc_random): Add prototypes.
+
+2005-10-17  Simon Josefsson  <jas@extundo.com>
+
        * gc.h, gc-libgcrypt.c: Add more hash types/functions.
 
 2005-10-17  Simon Josefsson  <jas@extundo.com>
index 9016381..9a4c6be 100644 (file)
--- a/lib/gc.h
+++ b/lib/gc.h
 # include <stddef.h>
 
 enum Gc_rc
-  {
-    GC_OK = 0,
-    GC_MALLOC_ERROR,
-    GC_INIT_ERROR,
-    GC_RANDOM_ERROR,
-    GC_INVALID_CIPHER,
-    GC_INVALID_HASH,
-    GC_PKCS5_INVALID_ITERATION_COUNT,
-    GC_PKCS5_INVALID_DERIVED_KEY_LENGTH,
-    GC_PKCS5_DERIVED_KEY_TOO_LONG
-  };
+{
+  GC_OK = 0,
+  GC_MALLOC_ERROR,
+  GC_INIT_ERROR,
+  GC_RANDOM_ERROR,
+  GC_INVALID_CIPHER,
+  GC_INVALID_HASH,
+  GC_PKCS5_INVALID_ITERATION_COUNT,
+  GC_PKCS5_INVALID_DERIVED_KEY_LENGTH,
+  GC_PKCS5_DERIVED_KEY_TOO_LONG
+};
 typedef enum Gc_rc Gc_rc;
 
 /* Hash types. */
 enum Gc_hash
-  {
-    GC_MD5,
-    GC_SHA1,
-    GC_MD2,
-    GC_RMD160
-  };
+{
+  GC_MD5,
+  GC_SHA1,
+  GC_MD2,
+  GC_RMD160
+};
 typedef enum Gc_hash Gc_hash;
 
 enum Gc_hash_mode
-  {
-    GC_HMAC = 1
-  };
+{
+  GC_HMAC = 1
+};
 typedef enum Gc_hash_mode Gc_hash_mode;
 
 typedef void *gc_hash_handle;
@@ -61,23 +61,23 @@ typedef void *gc_hash_handle;
 
 /* Cipher types. */
 enum Gc_cipher
-  {
-    GC_AES128,
-    GC_AES192,
-    GC_AES256,
-    GC_3DES,
-    GC_DES,
-    GC_ARCFOUR128,
-    GC_ARCFOUR40,
-    GC_ARCTWO40
-  };
+{
+  GC_AES128,
+  GC_AES192,
+  GC_AES256,
+  GC_3DES,
+  GC_DES,
+  GC_ARCFOUR128,
+  GC_ARCFOUR40,
+  GC_ARCTWO40
+};
 typedef enum Gc_cipher Gc_cipher;
 
 enum Gc_cipher_mode
-  {
-    GC_CBC,
-    GC_STREAM
-  };
+{
+  GC_CBC,
+  GC_STREAM
+};
 typedef enum Gc_cipher_mode Gc_cipher_mode;
 
 typedef void *gc_cipher_handle;
@@ -97,9 +97,14 @@ extern void gc_set_allocators (gc_malloc_t func_malloc,
                               gc_realloc_t func_realloc,
                               gc_free_t func_free);
 
+/* Randomness. */
+extern Gc_rc gc_nonce (char *data, size_t datalen);
+extern Gc_rc gc_pseudo_random (char *data, size_t datalen);
+extern Gc_rc gc_random (char *data, size_t datalen);
+
 /* Ciphers. */
 extern Gc_rc gc_cipher_open (Gc_cipher cipher, Gc_cipher_mode mode,
-                            gc_cipher_handle * outhandle);
+                            gc_cipher_handle *outhandle);
 extern Gc_rc gc_cipher_setkey (gc_cipher_handle handle,
                               size_t keylen, const char *key);
 extern Gc_rc gc_cipher_setiv (gc_cipher_handle handle,
@@ -113,8 +118,8 @@ extern Gc_rc gc_cipher_close (gc_cipher_handle handle);
 /* Hashes. */
 
 extern Gc_rc gc_hash_open (Gc_hash hash, Gc_hash_mode mode,
-                          gc_hash_handle * outhandle);
-extern Gc_rc gc_hash_clone (gc_hash_handle handle, gc_hash_handle * outhandle);
+                          gc_hash_handle *outhandle);
+extern Gc_rc gc_hash_clone (gc_hash_handle handle, gc_hash_handle *outhandle);
 extern size_t gc_hash_digest_length (Gc_hash hash);
 extern void gc_hash_hmac_setkey (gc_hash_handle handle,
                                 size_t len, const char *key);
@@ -136,11 +141,9 @@ gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out);
 extern Gc_rc gc_md5 (const void *in, size_t inlen, void *resbuf);
 extern Gc_rc gc_sha1 (const void *in, size_t inlen, void *resbuf);
 extern Gc_rc gc_hmac_md5 (const void *key, size_t keylen,
-                         const void *in, size_t inlen,
-                         char *resbuf);
+                         const void *in, size_t inlen, char *resbuf);
 extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
-                          const void *in, size_t inlen,
-                          char *resbuf);
+                          const void *in, size_t inlen, char *resbuf);
 
 /* Derive cryptographic keys from a password P of length PLEN, with
    salt S of length SLEN, placing the result in pre-allocated buffer
@@ -152,8 +155,7 @@ extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
 extern Gc_rc
 gc_pbkdf2_sha1 (const char *P, size_t Plen,
                const char *S, size_t Slen,
-               unsigned int c,
-               char *DK, size_t dkLen);
+               unsigned int c, char *DK, size_t dkLen);
 
 /*
   TODO: