Protocol version 1.2 integrations
[silc.git] / lib / silccrypt / silchmac.h
index 624921691d31fad015d569ac03678e3136929ec8..7b853d91092ddb46757e08ce9222dd5814aca4fd 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1999 - 2001 Pekka Riikonen
+  Copyright (C) 1999 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 #ifndef SILCHMAC_H
 #define SILCHMAC_H
 
-/****h* silccrypt/SilcHMACAPI
+/****h* silccrypt/SILC HMAC Interface
  *
  * DESCRIPTION
  *
@@ -65,7 +65,7 @@ typedef struct SilcHmacStruct *SilcHmac;
  ***/
 typedef struct {
   char *name;
-  uint32 len;
+  SilcUInt32 len;
 } SilcHmacObject;
 
 /* Marks for all hmacs. This can be used in silc_hmac_unregister
@@ -73,7 +73,7 @@ typedef struct {
 #define SILC_ALL_HMACS ((SilcHmacObject *)1)
 
 /* Default hmacs for silc_hmac_register_default(). */
-extern SilcHmacObject silc_default_hmacs[];
+extern DLLAPI const SilcHmacObject silc_default_hmacs[];
 
 /* Default HMAC in the SILC protocol */
 #define SILC_DEFAULT_HMAC "hmac-sha1-96"
@@ -84,7 +84,7 @@ extern SilcHmacObject silc_default_hmacs[];
  *
  * SYNOPSIS
  *
- *    bool silc_hmac_register(SilcHmacObject *hmac);
+ *    bool silc_hmac_register(const SilcHmacObject *hmac);
  *
  * DESCRIPTION
  *
@@ -97,7 +97,7 @@ extern SilcHmacObject silc_default_hmacs[];
  *    that are builtin the sources.  Returns FALSE on error.
  *
  ***/
-bool silc_hmac_register(SilcHmacObject *hmac);
+bool silc_hmac_register(const SilcHmacObject *hmac);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_unregister
  *
@@ -133,11 +133,25 @@ bool silc_hmac_unregister(SilcHmacObject *hmac);
  ***/
 bool silc_hmac_register_default(void);
 
+/****f* silccrypt/SilcHMACAPI/silc_hmac_unregister_all
+ *
+ * SYNOPSIS
+ *
+ *    bool silc_hmac_unregister_all(void);
+ *
+ * DESCRIPTION
+ *
+ *    Unregisters all registered HMACs.
+ *
+ ***/
+bool silc_hmac_unregister_all(void);
+
 /****f* silccrypt/SilcHMACAPI/silc_hmac_alloc
  *
  * SYNOPSIS
  *
- *    bool silc_hmac_alloc(char *name, SilcHash hash, SilcHmac *new_hmac);
+ *    bool silc_hmac_alloc(const char *name, SilcHash hash,
+ *                         SilcHmac *new_hmac);
  *
  * DESCRIPTION
  *
@@ -148,7 +162,7 @@ bool silc_hmac_register_default(void);
  *    FALSE if such HMAC does not exist.
  *
  ***/
-bool silc_hmac_alloc(char *name, SilcHash hash, SilcHmac *new_hmac);
+bool silc_hmac_alloc(const char *name, SilcHash hash, SilcHmac *new_hmac);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_free
  *
@@ -197,14 +211,14 @@ char *silc_hmac_get_supported(void);
  *
  * SYNOPSIS
  *
- *    uint32 silc_hmac_len(SilcHmac hmac);
+ *    SilcUInt32 silc_hmac_len(SilcHmac hmac);
  *
  * DESCRIPTION
  *
  *    Returns the length of the MAC that the HMAC will produce.
  *
  ***/
-uint32 silc_hmac_len(SilcHmac hmac);
+SilcUInt32 silc_hmac_len(SilcHmac hmac);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_get_hash
  *
@@ -238,7 +252,7 @@ const char *silc_hmac_get_name(SilcHmac hmac);
  * SYNOPSIS
  *
  *    void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
- *                           uint32 key_len);
+ *                           SilcUInt32 key_len);
  *
  * DESCRIPTION
  *
@@ -250,15 +264,15 @@ const char *silc_hmac_get_name(SilcHmac hmac);
  *
  ***/
 void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
-                      uint32 key_len);
+                      SilcUInt32 key_len);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_make
  *
  * SYNOPSIS
  *
  *    void silc_hmac_make(SilcHmac hmac, unsigned char *data,
- *                        uint32 data_len, unsigned char *return_hash,
- *                        uint32 *return_len);
+ *                        SilcUInt32 data_len, unsigned char *return_hash,
+ *                        SilcUInt32 *return_len);
  *
  * DESCRIPTION
  *
@@ -270,18 +284,18 @@ void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key,
  *
  ***/
 void silc_hmac_make(SilcHmac hmac, unsigned char *data,
-                   uint32 data_len, unsigned char *return_hash,
-                   uint32 *return_len);
+                   SilcUInt32 data_len, unsigned char *return_hash,
+                   SilcUInt32 *return_len);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_make_with_key
  *
  * SYNOPSIS
  *
  *    void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
- *                                 uint32 data_len, 
- *                                 unsigned char *key, uint32 key_len,
+ *                                 SilcUInt32 data_len, 
+ *                                 unsigned char *key, SilcUInt32 key_len,
  *                                 unsigned char *return_hash,
- *                                 uint32 *return_len);
+ *                                 SilcUInt32 *return_len);
  *
  * DESCRIPTION
  *
@@ -291,10 +305,10 @@ void silc_hmac_make(SilcHmac hmac, unsigned char *data,
  *
  ***/
 void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
-                            uint32 data_len, 
-                            unsigned char *key, uint32 key_len,
+                            SilcUInt32 data_len, 
+                            unsigned char *key, SilcUInt32 key_len,
                             unsigned char *return_hash,
-                            uint32 *return_len);
+                            SilcUInt32 *return_len);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_make_truncated
  *
@@ -302,8 +316,8 @@ void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
  *
  *    void silc_hmac_make_truncated(SilcHmac hmac, 
  *                                  unsigned char *data, 
- *                                  uint32 data_len,
- *                                  uint32 truncated_len,
+ *                                  SilcUInt32 data_len,
+ *                                  SilcUInt32 truncated_len,
  *                                  unsigned char *return_hash);
  *
  * DESCRIPTION
@@ -323,8 +337,8 @@ void silc_hmac_make_with_key(SilcHmac hmac, unsigned char *data,
  ***/
 void silc_hmac_make_truncated(SilcHmac hmac, 
                              unsigned char *data, 
-                             uint32 data_len,
-                             uint32 truncated_len,
+                             SilcUInt32 data_len,
+                             SilcUInt32 truncated_len,
                              unsigned char *return_hash);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_init
@@ -355,7 +369,7 @@ void silc_hmac_init(SilcHmac hmac);
  * SYNOPSIS
  *
  *    void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
- *                                 uint32 key_len);
+ *                                 SilcUInt32 key_len);
  *
  * DESCRIPTION
  *
@@ -364,14 +378,14 @@ void silc_hmac_init(SilcHmac hmac);
  *
  ***/
 void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
-                            uint32 key_len);
+                            SilcUInt32 key_len);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_update
  *
  * SYNOPSIS
  *
  *    void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
- *                          uint32 data_len);
+ *                          SilcUInt32 data_len);
  *
  * DESCRIPTION
  *
@@ -384,7 +398,7 @@ void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
  * EXAMPLE
  *
  *    unsigned char mac[20];
- *    uint32 mac_len;
+ *    SilcUInt32 mac_len;
  *
  *    silc_hmac_init(hmac);
  *    silc_hmac_update(hmac, data, data_len);
@@ -393,14 +407,14 @@ void silc_hmac_init_with_key(SilcHmac hmac, const unsigned char *key,
  *
  ***/
 void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
-                     uint32 data_len);
+                     SilcUInt32 data_len);
 
 /****f* silccrypt/SilcHMACAPI/silc_hmac_final
  *
  * SYNOPSIS
  *
  *    void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
- *                         uint32 *return_len);
+ *                         SilcUInt32 *return_len);
  *
  * DESCRIPTION
  *
@@ -413,6 +427,6 @@ void silc_hmac_update(SilcHmac hmac, const unsigned char *data,
  *
  ***/
 void silc_hmac_final(SilcHmac hmac, unsigned char *return_hash,
-                    uint32 *return_len);
+                    SilcUInt32 *return_len);
 
 #endif