From: Pekka Riikonen Date: Mon, 9 Oct 2000 11:39:09 +0000 (+0000) Subject: Added flags parameter to assemble_security_properties function. X-Git-Tag: SILC.0.1~360 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=32e2a6bd61791ca66fc11ecca658e62a05d358a7 Added flags parameter to assemble_security_properties function. --- diff --git a/lib/silcske/silcske.c b/lib/silcske/silcske.c index 2ee18f78..1ca94b0f 100644 --- a/lib/silcske/silcske.c +++ b/lib/silcske/silcske.c @@ -17,31 +17,7 @@ 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); diff --git a/lib/silcske/silcske.h b/lib/silcske/silcske.h index c80bf6a7..b087e4f6 100644 --- a/lib/silcske/silcske.h +++ b/lib/silcske/silcske.h @@ -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