randomize(key, keylen);
cipher_set_key(&to->incipher, key, true);
+ digest_set_key(&to->indigest, key, keylen);
bin2hex(key, key, keylen);
key[keylen * 2] = '\0';
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];
char key[MAX_STRING_SIZE];
- int cipher, digest, maclength, compression;
+ int cipher, digest, maclength, compression, keylen;
node_t *from, *to;
if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d",
return false;
}
- if(strlen(key) / 2 != cipher_keylength(&from->outcipher)) {
+ keylen = strlen(key) / 2;
+
+ if(keylen != cipher_keylength(&from->outcipher)) {
logger(LOG_ERR, "Node %s (%s) uses wrong keylength!", from->name, from->hostname);
return false;
}
/* Update our copy of the origin's packet key */
- hex2bin(key, key, cipher_keylength(&from->outcipher));
+ hex2bin(key, key, keylen);
cipher_set_key(&from->outcipher, key, false);
+ digest_set_key(&from->outdigest, key, keylen);
from->status.validkey = true;
from->status.waitingforkey = false;