Integer type name change.
[silc.git] / lib / silccore / silcauth.h
index 008f727a0d9083a98942986760b239b5d9dc690a..84d6789c461ca6b3ab14a59ab41dd5bc61e1b1b4 100644 (file)
@@ -1,28 +1,28 @@
-/****h* silccore/silcauth.h
- *
- * NAME
- *
- * silcauth.h
- *
- * COPYRIGHT
- *
- * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
- *
- * Copyright (C) 2001 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+/*
+
+  silcauth.h
+  Author: Pekka Riikonen <priikone@silcnet.org>
+  Copyright (C) 2001 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
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+*/
+
+/****h* silccore/SilcAuthAPI
  *
  * DESCRIPTION
  *
- * Implementations of the Silc Authentication Payload and authentication
+ * Implementations of the SILC Authentication Payload and authentication
  * routines.  The SILC Authentication Payload is used to deliver 
  * authentication data usually from client to server in purpose of 
  * gaining access to some service.  The Payload and the authentication
@@ -42,7 +42,8 @@
  *
  * NAME
  * 
- *    typedef struct SilcAuthPayloadStruct *SilcAuthPayload;
+ *    typedef struct SilcAuthPayloadStruct *SilcAuthPayload; 
+ *
  *
  * DESCRIPTION
  *
@@ -74,7 +75,7 @@ typedef struct SilcKeyAgreementPayloadStruct *SilcKeyAgreementPayload;
  *
  * NAME
  * 
- *    typedef uint16 SilcAuthMethod;
+ *    typedef SilcUInt16 SilcAuthMethod;
  *
  * DESCRIPTION
  *
@@ -84,7 +85,7 @@ typedef struct SilcKeyAgreementPayloadStruct *SilcKeyAgreementPayload;
  *
  * SOURCE
  */
-typedef uint16 SilcAuthMethod;
+typedef SilcUInt16 SilcAuthMethod;
 
 #define SILC_AUTH_NONE        0                   /* No authentication */
 #define SILC_AUTH_PASSWORD    1                   /* Passphrase authentication */
@@ -102,8 +103,8 @@ typedef uint16 SilcAuthMethod;
  *
  * SYNOPSIS
  *
- *    SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
- *                                            uint32 data_len);
+ *    SilcAuthPayload silc_auth_payload_parse(const unsigned char *data,
+ *                                            SilcUInt32 data_len);
  *
  * DESCRIPTION
  *
@@ -111,18 +112,18 @@ typedef uint16 SilcAuthMethod;
  *    `data_len' are the raw payload buffer.
  *
  ***/
-SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
-                                       uint32 data_len);
+SilcAuthPayload silc_auth_payload_parse(const unsigned char *data,
+                                       SilcUInt32 data_len);
 
 /****f* silccore/SilcAuthAPI/silc_auth_payload_encode
  *
  * SYNOPSIS
  *
  *    SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
- *                                        unsigned char *random_data,
- *                                        uint16 random_len,
- *                                        unsigned char *auth_data,
- *                                        uint16 auth_len);
+ *                                        const unsigned char *random_data,
+ *                                        SilcUInt16 random_len,
+ *                                        const unsigned char *auth_data,
+ *                                        SilcUInt16 auth_len);
  *
  * DESCRIPTION
  *
@@ -132,10 +133,10 @@ SilcAuthPayload silc_auth_payload_parse(unsigned char *data,
  *
  ***/
 SilcBuffer silc_auth_payload_encode(SilcAuthMethod method,
-                                   unsigned char *random_data,
-                                   uint16 random_len,
-                                   unsigned char *auth_data,
-                                   uint16 auth_len);
+                                   const unsigned char *random_data,
+                                   SilcUInt16 random_len,
+                                   const unsigned char *auth_data,
+                                   SilcUInt16 auth_len);
 
 /****f* silccore/SilcAuthAPI/silc_auth_payload_free
  *
@@ -168,7 +169,7 @@ SilcAuthMethod silc_auth_get_method(SilcAuthPayload payload);
  * SYNOPSIS
  *
  *    unsigned char *silc_auth_get_data(SilcAuthPayload payload,
- *                                      uint32 *auth_len);
+ *                                      SilcUInt32 *auth_len);
  *
  * DESCRIPTION
  *
@@ -176,7 +177,7 @@ SilcAuthMethod silc_auth_get_method(SilcAuthPayload payload);
  *
  ***/
 unsigned char *silc_auth_get_data(SilcAuthPayload payload,
-                                 uint32 *auth_len);
+                                 SilcUInt32 *auth_len);
 
 /****f* silccore/SilcAuthAPI/silc_auth_public_key_auth_generate
  *
@@ -185,7 +186,8 @@ unsigned char *silc_auth_get_data(SilcAuthPayload payload,
  *    SilcBuffer silc_auth_public_key_auth_generate(SilcPublicKey public_key,
  *                                                  SilcPrivateKey private_key,
  *                                                  SilcHash hash,
- *                                                  void *id, SilcIdType type);
+ *                                                  const void *id, 
+ *                                                  SilcIdType type);
  *
  * DESCRIPTION
  *
@@ -198,16 +200,16 @@ unsigned char *silc_auth_get_data(SilcAuthPayload payload,
 SilcBuffer silc_auth_public_key_auth_generate(SilcPublicKey public_key,
                                              SilcPrivateKey private_key,
                                              SilcHash hash,
-                                             void *id, SilcIdType type);
+                                             const void *id, SilcIdType type);
 
 /****f* silccore/SilcAuthAPI/silc_auth_public_key_auth_verify
  *
  * SYNOPSIS
  *
- *    int silc_auth_public_key_auth_verify(SilcAuthPayload payload,
- *                                         SilcPublicKey public_key, 
- *                                         SilcHash hash,
- *                                         void *id, SilcIdType type);
+ *    bool silc_auth_public_key_auth_verify(SilcAuthPayload payload,
+ *                                          SilcPublicKey public_key, 
+ *                                          SilcHash hash,
+ *                                          const void *id, SilcIdType type);
  *
  * DESCRIPTION
  *
@@ -215,18 +217,20 @@ SilcBuffer silc_auth_public_key_auth_generate(SilcPublicKey public_key,
  *    successful.
  *
  ***/
-int silc_auth_public_key_auth_verify(SilcAuthPayload payload,
-                                    SilcPublicKey public_key, SilcHash hash,
-                                    void *id, SilcIdType type);
+bool silc_auth_public_key_auth_verify(SilcAuthPayload payload,
+                                     SilcPublicKey public_key, SilcHash hash,
+                                     const void *id, SilcIdType type);
 
 /****f* silccore/SilcAuthAPI/silc_auth_public_key_auth_verify_data
  *
  * SYNOPSIS
  *
- *    int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
- *                                              SilcPublicKey public_key, 
- *                                              SilcHash hash,
- *                                              void *id, SilcIdType type);
+ *    bool silc_auth_public_key_auth_verify_data(const unsigned char *payload,
+ *                                               SilcUInt32 payload_len,
+ *                                               SilcPublicKey public_key, 
+ *                                               SilcHash hash,
+ *                                               const void *id, 
+ *                                               SilcIdType type);
  *
  * DESCRIPTION
  *
@@ -235,18 +239,20 @@ int silc_auth_public_key_auth_verify(SilcAuthPayload payload,
  *    was successful.
  *
  ***/
-int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
-                                         SilcPublicKey public_key, 
-                                         SilcHash hash,
-                                         void *id, SilcIdType type);
+bool silc_auth_public_key_auth_verify_data(const unsigned char *payload,
+                                          SilcUInt32 payload_len,
+                                          SilcPublicKey public_key, 
+                                          SilcHash hash,
+                                          const void *id, SilcIdType type);
 
 /****f* silccore/SilcAuthAPI/silc_auth_verify
  *
  * SYNOPSIS
  *
- *    int silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
- *                         void *auth_data, uint32 auth_data_len, 
- *                         SilcHash hash, void *id, SilcIdType type);
+ *    bool silc_auth_verify(SilcAuthPayload payload, 
+ *                          SilcAuthMethod auth_method,
+ *                          const void *auth_data, SilcUInt32 auth_data_len, 
+ *                          SilcHash hash, const void *id, SilcIdType type);
  *
  * DESCRIPTION
  *
@@ -258,19 +264,21 @@ int silc_auth_public_key_auth_verify_data(SilcBuffer payload,
  *    `auth_data_len' is ignored.
  *
  ***/
-int silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
-                    void *auth_data, uint32 auth_data_len, 
-                    SilcHash hash, void *id, SilcIdType type);
+bool silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
+                     const void *auth_data, SilcUInt32 auth_data_len, 
+                     SilcHash hash, const void *id, SilcIdType type);
 
 /****f* silccore/SilcAuthAPI/silc_auth_verify_data
  *
  * SYNOPSIS
  *
- *    int silc_auth_verify_data(unsigned char *payload, uint32 payload_len,
- *                              SilcAuthMethod auth_method, void *auth_data,
- *                              uint32 auth_data_len, SilcHash hash, 
- *                              void *id, SilcIdType type);
- *
+ *    bool silc_auth_verify_data(const unsigned char *payload, 
+ *                               SilcUInt32 payload_len,
+ *                               SilcAuthMethod auth_method, 
+ *                               const void *auth_data,
+ *                               SilcUInt32 auth_data_len, SilcHash hash, 
+ *                               const void *id, SilcIdType type);
+ * 
  * DESCRIPTION
  *
  *    Same as silc_auth_verify but the payload has not been parsed yet.
@@ -282,39 +290,42 @@ int silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
  *    `auth_data_len' is ignored.
  *
  ***/
-int silc_auth_verify_data(unsigned char *payload, uint32 payload_len,
-                         SilcAuthMethod auth_method, void *auth_data,
-                         uint32 auth_data_len, SilcHash hash, 
-                         void *id, SilcIdType type);
+bool silc_auth_verify_data(const unsigned char *payload, SilcUInt32 payload_len,
+                          SilcAuthMethod auth_method, const void *auth_data,
+                          SilcUInt32 auth_data_len, SilcHash hash, 
+                          const void *id, SilcIdType type);
 
 /****f* silccore/SilcAuthAPI/silc_key_agreement_payload_parse
  *
  * SYNOPSIS
  *
  *    SilcKeyAgreementPayload 
- *    silc_key_agreement_payload_parse(SilcBuffer buffer);
+ *    silc_key_agreement_payload_parse(const unsigned char *payload,
+ *                                     SilcUInt32 payload_len);
  *
  * DESCRIPTION
  *
  *    Parses and returns an allocated Key Agreement payload.
  *
  ***/
-SilcKeyAgreementPayload silc_key_agreement_payload_parse(SilcBuffer buffer);
+SilcKeyAgreementPayload 
+silc_key_agreement_payload_parse(const unsigned char *payload,
+                                SilcUInt32 payload_len);
 
 /****f* silccore/SilcAuthAPI/silc_key_agreement_payload_encode
  *
  * SYNOPSIS
  *
  *    SilcBuffer silc_key_agreement_payload_encode(char *hostname,
- *                                                 uint32 port);
+ *                                                 SilcUInt32 port);
  *
  * DESCRIPTION
  *
  *    Encodes the Key Agreement protocol and returns the encoded buffer
  *
  ***/
-SilcBuffer silc_key_agreement_payload_encode(char *hostname,
-                                            uint32 port);
+SilcBuffer silc_key_agreement_payload_encode(const char *hostname,
+                                            SilcUInt32 port);
 
 /****f* silccore/SilcAuthAPI/silc_key_agreement_payload_free
  *
@@ -348,7 +359,7 @@ char *silc_key_agreement_get_hostname(SilcKeyAgreementPayload payload);
  *
  * SYNOPSIS
  *
- *    uint32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
+ *    SilcUInt32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
  *
  * DESCRIPTION
  *
@@ -357,6 +368,6 @@ char *silc_key_agreement_get_hostname(SilcKeyAgreementPayload payload);
  *    the SILC Key Exchange protocol.
  *
  ***/
-uint32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
+SilcUInt32 silc_key_agreement_get_port(SilcKeyAgreementPayload payload);
 
 #endif