+ server = (SILC_SERVER_REC*)conn->context;
+
+ /*
+ * If we don't have a context yet, then we'll set it up based on the
+ * stream context associated with the SilcPacketStream that is attached
+ * to the SilcClientConnection. This is a bit ugly, but we need to have a
+ * per-connection context value to perform the public key verify operation,
+ * and the public API was not designed to let us have this in a particularly
+ * straightforward fashion.
+ */
+
+ if (!server) {
+ SilcPacketStream packet_stream;
+ SilcStream stream;
+
+ packet_stream = conn->stream;
+
+ if (!packet_stream)
+ {
+ if (completion)
+ completion(FALSE, context);
+ return;
+ }
+
+ stream = silc_packet_stream_get_stream(packet_stream);
+
+ if (!stream)
+ {
+ if (completion)
+ completion(FALSE, context);
+ return;
+ }
+
+ server = (SILC_SERVER_REC*)(silc_socket_stream_get_context(stream));
+
+ if (!server)
+ {
+ if (completion)
+ completion(FALSE, context);
+ return;
+ }
+
+ conn->context = (void *)server;
+ }
+