logger(mesh, MESHLINK_ERROR, "Peer %s had unknown identity (%s)", c->hostname, c->name);
return false;
}
+ }
- read_ecdsa_public_key(mesh, c);
- } else {
- if(c->protocol_minor && !ecdsa_active(c->ecdsa))
- c->protocol_minor = 1;
+ read_ecdsa_public_key(mesh, c);
+
+ if(!ecdsa_active(c->ecdsa)) {
+ logger(mesh, MESHLINK_ERROR, "No key known for peer %s (%s)", c->name, c->hostname);
+
+ node_t *n = lookup_node(mesh, c->name);
+ if(n && !n->status.waitingforkey) {
+ logger(mesh, MESHLINK_INFO, "Requesting key from peer %s (%s)", c->name, c->hostname);
+ send_req_key(mesh, n);
+ }
+
+ return false;
}
/* Forbid version rollback for nodes whose ECDSA key we know */
// Start a SPTPS session.
bool sptps_start(sptps_t *s, void *handle, bool initiator, bool datagram, ecdsa_t *mykey, ecdsa_t *hiskey, const char *label, size_t labellen, send_data_t send_data, receive_record_t receive_record) {
+ if(!s || !mykey || !hiskey || !label || !labellen || !send_data || !receive_record)
+ return error(s, EINVAL, "Invalid argument to sptps_start()");
+
// Initialise struct sptps
memset(s, 0, sizeof *s);