/* Free old protocol as it is finished now */
silc_protocol_free(protocol);
if (ctx->packet)
- silc_buffer_free(ctx->packet);
+ silc_packet_context_free(ctx->packet);
silc_free(ctx);
/* silc_free(ctx->keymat....); */
sock->protocol = NULL;
silc_client_packet_parse_type(client, sock, packet);
out:
- silc_buffer_clear(buffer);
- if (packet->src_id)
- silc_free(packet->src_id);
- if (packet->dst_id)
- silc_free(packet->dst_id);
- silc_free(packet);
+ silc_buffer_clear(sock->inbuf);
+ silc_packet_context_free(packet);
silc_free(parse_ctx);
}
SilcClientKEInternalContext *proto_ctx =
(SilcClientKEInternalContext *)sock->protocol->context;
- proto_ctx->packet = buffer;
+ proto_ctx->packet = silc_packet_context_dup(packet);
proto_ctx->dest_id_type = packet->src_id_type;
proto_ctx->dest_id = silc_id_str2id(packet->src_id, packet->src_id_type);
(SilcClientKEInternalContext *)sock->protocol->context;
if (proto_ctx->packet)
- silc_buffer_free(proto_ctx->packet);
+ silc_packet_context_free(proto_ctx->packet);
- proto_ctx->packet = buffer;
+ proto_ctx->packet = silc_packet_context_dup(packet);
proto_ctx->dest_id_type = packet->src_id_type;
proto_ctx->dest_id = silc_id_str2id(packet->src_id, packet->src_id_type);
{
SilcPacketContext *p = (SilcPacketContext *)context;
silc_client_notify_by_server(p->context, p->sock, p);
- if (p->src_id)
- silc_free(p->src_id);
- if (p->dst_id)
- silc_free(p->dst_id);
- silc_buffer_free(p->buffer);
- silc_free(p);
+ silc_packet_context_free(p);
}
/* Received notify message from server */
paylaod reply we just got from the responder. The callback
function will receive the processed payload where we will
save it. */
- status = silc_ske_initiator_phase_1(ctx->ske, ctx->packet, NULL, NULL);
+ status = silc_ske_initiator_phase_1(ctx->ske, ctx->packet->buffer,
+ NULL, NULL);
}
if (status != SILC_SKE_STATUS_OK) {
} else {
/* Finish the protocol. This verifies the Key Exchange 2 payload
sent by responder. */
- status = silc_ske_initiator_finish(ctx->ske, ctx->packet,
+ status = silc_ske_initiator_finish(ctx->ske, ctx->packet->buffer,
silc_client_protocol_ke_verify_key,
context, NULL, NULL);
}