X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fpacket_receive.c;h=2d254cfd65a878bf23379f357a1ca561890e719c;hb=9621b64787287e7cc67061754d80566782cc76ea;hp=2f61ac896094c8fc9dd71cedaaed243b075321ab;hpb=72cfa31520ebc0058763a30e21c13f6e9a964aa0;p=silc.git diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 2f61ac89..2d254cfd 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -2026,3 +2026,32 @@ void silc_server_connection_auth_request(SilcServer server, conn_type, auth_meth); } + +/* Received REKEY packet. The sender of the packet wants to regenerate + its session keys. This starts the REKEY protocol. */ + +void silc_server_rekey(SilcServer server, + SilcSocketConnection sock, + SilcPacketContext *packet) +{ + SilcProtocol protocol; + SilcServerRekeyInternalContext *proto_ctx; + + SILC_LOG_DEBUG(("Start")); + + /* Allocate internal protocol context. This is sent as context + to the protocol. */ + proto_ctx = silc_calloc(1, sizeof(*proto_ctx)); + proto_ctx->server = (void *)server; + proto_ctx->sock = sock; + proto_ctx->responder = TRUE; + + /* Perform rekey protocol. Will call the final callback after the + protocol is over. */ + silc_protocol_alloc(SILC_PROTOCOL_SERVER_REKEY, + &protocol, proto_ctx, silc_server_rekey_final); + sock->protocol = protocol; + + /* Run the protocol */ + protocol->execute(server->timeout_queue, 0, protocol, sock->sock, 0, 0); +}