Added flags parameter to assemble_security_properties function.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 9 Oct 2000 11:39:09 +0000 (11:39 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 9 Oct 2000 11:39:09 +0000 (11:39 +0000)
lib/silcske/silcske.c
lib/silcske/silcske.h

index 2ee18f78f51bc2beb4e78c30adb20b368e117c76..1ca94b0f815b26579b04c3fd74c5304c62c5874a 100644 (file)
   GNU General Public License for more details.
 
 */
-/*
- * $Id$
- * $Log$
- * Revision 1.6  2000/07/19 07:04:37  priikone
- *     Added version detection support to SKE. Minor bugfixes.
- *
- * Revision 1.5  2000/07/10 05:34:22  priikone
- *     Added mp binary encoding as protocols defines.
- *
- * Revision 1.4  2000/07/07 06:46:43  priikone
- *     Removed ske_verify_public_key function as it is not needed
- *     anymore. Added support to the public key verification as callback
- *     function. Other minor changes and bug fixes.
- *
- * Revision 1.3  2000/07/06 07:12:39  priikone
- *     Support for SILC style public keys added.
- *
- * Revision 1.2  2000/07/05 06:05:15  priikone
- *     Global cosmetic change.
- *
- * Revision 1.1.1.1  2000/06/27 11:36:56  priikone
- *     Imported from internal CVS/Added Log headers.
- *
- *
- */
+/* $Id$ */
 
 #include "silcincludes.h"
 #include "payload_internal.h"
@@ -724,24 +700,25 @@ SilcSKEStatus silc_ske_abort(SilcSKE ske, SilcSKEStatus status,
 
 SilcSKEStatus 
 silc_ske_assemble_security_properties(SilcSKE ske,
+                                     unsigned char flags,
                                      char *version,
                                      SilcSKEStartPayload **return_payload)
 {
   SilcSKEStartPayload *rp;
+  int i;
 
   SILC_LOG_DEBUG(("Assembling KE Start Payload"));
 
   rp = silc_calloc(1, sizeof(*rp));
 
-  /* XXX */
   /* Set flags */
-  rp->flags = 0;
+  rp->flags = flags;
 
-  /* XXX */
-  /* Cookie */
-  rp->cookie = silc_calloc(SILC_SKE_COOKIE_LEN, sizeof(unsigned char));
+  /* Set random cookie */
+  rp->cookie = silc_calloc(SILC_SKE_COOKIE_LEN, sizeof(*rp->cookie));
+  for (i = 0; i < SILC_SKE_COOKIE_LEN; i++)
+    rp->cookie[i] = silc_rng_get_byte(ske->rng);
   rp->cookie_len = SILC_SKE_COOKIE_LEN;
-  memcpy(rp->cookie, "1234567890123456", SILC_SKE_COOKIE_LEN);
 
   /* Put version */
   rp->version = strdup(version);
index c80bf6a7b6eacb923781e962b5642b8598552dd8..b087e4f692a51003a880c32d862cfff47509ef2d 100644 (file)
@@ -70,6 +70,7 @@ typedef struct {
   unsigned int hmac_key_len;
 } SilcSKEKeyMaterial;
 
+/* Length of cookie in Start Payload */
 #define SILC_SKE_COOKIE_LEN 16
 
 #include "groups.h"
@@ -77,9 +78,9 @@ typedef struct {
 
 /* Security Property Flags. */
 typedef enum {
-  SILC_SKE_SP_FLAG_NONE = (1L << 0),
-  SILC_SKE_SP_FLAG_NO_REPLY = (1L << 1),
-  SILC_SKE_SP_FLAG_PFS = (1L << 2),
+  SILC_SKE_SP_FLAG_NONE      = (1L << 0),
+  SILC_SKE_SP_FLAG_NO_REPLY  = (1L << 1),
+  SILC_SKE_SP_FLAG_PFS       = (1L << 2),
 } SilcSKESecurityPropertyFlag;
 
 /* Security Properties negotiated between key exchange parties. This
@@ -187,6 +188,7 @@ SilcSKEStatus silc_ske_abort(SilcSKE ske, SilcSKEStatus status,
                             void *context);
 SilcSKEStatus 
 silc_ske_assemble_security_properties(SilcSKE ske,
+                                     unsigned char flags,
                                      char *version,
                                      SilcSKEStartPayload **return_payload);
 SilcSKEStatus