- /* Check and lookup cipher and digest algorithms */
-
- if(!(from->outcipher = cipher_open_by_nid(cipher))) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown cipher!", from->name, from->hostname);
- return false;
- }
-
- if(!(from->outdigest = digest_open_by_nid(digest, maclength))) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses unknown digest!", from->name, from->hostname);
- return false;
- }
-
- if(maclength != digest_length(from->outdigest)) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses bogus MAC length!", from->name, from->hostname);
- return false;
- }
-
- /* Process key */
-
- keylen = hex2bin(key, key, sizeof key);
-
- if(keylen != cipher_keylength(from->outcipher)) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Node %s (%s) uses wrong keylength!", from->name, from->hostname);
- return true;
- }
-
- /* Update our copy of the origin's packet key */
-
- if(!cipher_set_key(from->outcipher, key, true))
- return false;
- if(!digest_set_key(from->outdigest, key, keylen))
- return false;
-
- from->status.validkey = true;
- from->sent_seqno = 0;
-
- if(*address && *port) {
- logger(DEBUG_PROTOCOL, LOG_DEBUG, "Using reflexive UDP address from %s: %s port %s", from->name, address, port);
- sockaddr_t sa = str2sockaddr(address, port);
- update_node_udp(from, &sa);
- }
-
- if(from->options & OPTION_PMTU_DISCOVERY)
- send_mtu_probe(from);
-