-bool send_ans_key(node_t *to) {
- if(to->status.sptps)
- abort();
-
- size_t keylen = cipher_keylength(&myself->incipher);
- char key[keylen * 2 + 1];
-
- cipher_open_by_nid(&to->incipher, cipher_get_nid(&myself->incipher));
- digest_open_by_nid(&to->indigest, digest_get_nid(&myself->indigest), digest_length(&myself->indigest));
- to->incompression = myself->incompression;
-
- randomize(key, keylen);
- cipher_set_key(&to->incipher, key, false);
- digest_set_key(&to->indigest, key, keylen);
-
- bin2hex(key, key, keylen);
-
- // Reset sequence number and late packet window
- mykeyused = true;
- to->received_seqno = 0;
- if(replaywin) memset(to->late, 0, replaywin);
-
- return send_request(to->nexthop->connection, "%d %s %s %s %d %d %d %d", ANS_KEY,
- myself->name, to->name, key,
- cipher_get_nid(&to->incipher),
- digest_get_nid(&to->indigest),
- (int)digest_length(&to->indigest),
- to->incompression);