Abstract:RISC-V is a free and open instruction set architecture built by the principle of reduced instruction sets, which features complete open source, simple architecture, easy portability, and modular design. With the rapid development of networks, security risks are ubiquitous. The extensibility feature of RISC-V can be utilized to effectively improve the security of RISC-V devices. Therefore, this study designs a simple and efficient RISC-V custom instruction considering the security capabilities of RISC-V custom instructions and by use of trusted computing and stream cipher technology to realize the function of data security storage based on the trusted computing base. Moreover, the compilation support for the custom instruction is achieved with the GNU compilation toolchain. The calling and execution of the custom instruction by an application are tested on a simulator. This instruction fully combines the security features of trusted computing and stream ciphers, and hence, it can achieve strong security.