Use the correct direction flag when setting cipher keys.
[tinc] / src / protocol_auth.c
index 41911e4..7595c48 100644 (file)
@@ -155,7 +155,7 @@ bool send_metakey_ec(connection_t *c) {
 
        b64encode(key, key, ECDH_SIZE + siglen);
        
-       bool result = send_request(c, "%d %s", METAKEY, key);
+       return send_request(c, "%d %s", METAKEY, key);
 }
 
 bool send_metakey(connection_t *c) {
@@ -285,10 +285,10 @@ static bool metakey_ec_h(connection_t *c, const char *request) {
 
        free(seed);
 
-       cipher_set_key(&c->incipher, mykey, true);
+       cipher_set_key(&c->incipher, mykey, false);
        digest_set_key(&c->indigest, mykey + mykeylen, mykeylen);
 
-       cipher_set_key(&c->outcipher, hiskey, false);
+       cipher_set_key(&c->outcipher, hiskey, true);
        digest_set_key(&c->outdigest, hiskey + hiskeylen, hiskeylen);
 
        c->status.decryptin = true;