K&R style braces
[tinc] / src / protocol_key.c
index e393dd6..0cf33d7 100644 (file)
@@ -1,7 +1,7 @@
 /*
     protocol_key.c -- handle the meta-protocol, key exchange
-    Copyright (C) 1999-2005 Ivo Timmermans <ivo@tinc-vpn.org>,
-                  2000-2005 Guus Sliepen <guus@tinc-vpn.org>
+    Copyright (C) 1999-2005 Ivo Timmermans,
+                  2000-2006 Guus Sliepen <guus@tinc-vpn.org>
 
     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
@@ -37,8 +37,7 @@
 
 bool mykeyused = false;
 
-bool send_key_changed(connection_t *c, const node_t *n)
-{
+bool send_key_changed(connection_t *c, const node_t *n) {
        cp();
 
        /* Only send this message if some other daemon requested our key previously.
@@ -51,8 +50,7 @@ bool send_key_changed(connection_t *c, const node_t *n)
        return send_request(c, "%d %lx %s", KEY_CHANGED, random(), n->name);
 }
 
-bool key_changed_h(connection_t *c)
-{
+bool key_changed_h(connection_t *c) {
        char name[MAX_STRING_SIZE];
        node_t *n;
 
@@ -86,15 +84,13 @@ bool key_changed_h(connection_t *c)
        return true;
 }
 
-bool send_req_key(connection_t *c, const node_t *from, const node_t *to)
-{
+bool send_req_key(connection_t *c, const node_t *from, const node_t *to) {
        cp();
 
        return send_request(c, "%d %s %s", REQ_KEY, from->name, to->name);
 }
 
-bool req_key_h(connection_t *c)
-{
+bool req_key_h(connection_t *c) {
        char from_name[MAX_STRING_SIZE];
        char to_name[MAX_STRING_SIZE];
        node_t *from, *to;
@@ -140,8 +136,7 @@ bool req_key_h(connection_t *c)
        return true;
 }
 
-bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
-{
+bool send_ans_key(connection_t *c, const node_t *from, const node_t *to) {
        char *key;
 
        cp();
@@ -157,8 +152,7 @@ bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
                                                from->compression);
 }
 
-bool ans_key_h(connection_t *c)
-{
+bool ans_key_h(connection_t *c) {
        char from_name[MAX_STRING_SIZE];
        char to_name[MAX_STRING_SIZE];
        char key[MAX_STRING_SIZE];
@@ -262,7 +256,7 @@ bool ans_key_h(connection_t *c)
        from->compression = compression;
 
        if(from->cipher)
-               if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len)) {
+               if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, (unsigned char *)from->key, (unsigned char *)from->key + from->cipher->key_len)) {
                        logger(LOG_ERR, _("Error during initialisation of key from %s (%s): %s"),
                                        from->name, from->hostname, ERR_error_string(ERR_get_error(), NULL));
                        return false;