  The discrepancy between theory and experiment severely limits the development
of quantum key distribution (QKD). Reference-frame-independent (RFI) protocol
has been proposed to avoid alignment of the reference frame. However, multiple
optical modes caused by Trojan horse attacks and equipment loopholes lead to
the imperfect emitted signal unavoidably. In this paper, we analyzed the
security of the RFI-QKD protocol with non-qubit sources based on generalizing
loss-tolerant techniques. The simulation results show that our work can
effectively defend against non-qubit sources including a misaligned reference
frame, state preparation flaws, multiple optical modes, and Trojan horse
attacks. Moreover, it only requires the preparation of four quantum states,
which reduces the complexity of the experiment in the future.
