along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: protocol_key.c,v 1.1.4.13 2002/09/09 21:24:56 guus Exp $
+ $Id: protocol_key.c,v 1.1.4.16 2003/05/06 21:13:18 guus Exp $
*/
#include "config.h"
int mykeyused = 0;
-int send_key_changed(connection_t * c, node_t * n)
+int send_key_changed(connection_t *c, node_t *n)
{
cp();
return send_request(c, "%d %lx %s", KEY_CHANGED, random(), n->name);
}
-int key_changed_h(connection_t * c)
+int key_changed_h(connection_t *c)
{
char name[MAX_STRING_SIZE];
node_t *n;
return 0;
}
-int send_req_key(connection_t * c, node_t * from, node_t * to)
+int send_req_key(connection_t *c, node_t *from, node_t *to)
{
cp();
return send_request(c, "%d %s %s", REQ_KEY, from->name, to->name);
}
-int req_key_h(connection_t * c)
+int req_key_h(connection_t *c)
{
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];
if(to == myself) { /* Yes, send our own key back */
mykeyused = 1;
from->received_seqno = 0;
+ memset(from->late, 0, sizeof(from->late));
send_ans_key(c, myself, from);
} else {
send_req_key(to->nexthop->connection, from, to);
return 0;
}
-int send_ans_key(connection_t * c, node_t * from, node_t * to)
+int send_ans_key(connection_t *c, node_t *from, node_t *to)
{
char key[MAX_STRING_SIZE];
from->compression);
}
-int ans_key_h(connection_t * c)
+int ans_key_h(connection_t *c)
{
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];
from->digest = NULL;
}
+ if(compression < 0 || compression > 11) {
+ syslog(LOG_ERR, _("Node %s (%s) uses bogus compression level!"), from->name, from->hostname);
+ return -1;
+ }
+
from->compression = compression;
+ EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len);
+
flush_queue(from);
return 0;