The invention relates to the technical field of
software security, and discloses an anti-
control flow planarization method based on
firmware security, which comprises the following steps: inputting a target code for
control flow planarization into an external
knowledge base to obtain an explanation of a program document corresponding to the target code; the external
knowledge base is constructed based on the same type of program document corresponding to the target code; and inputting the target code subjected to
control flow planarization and the explanation of the program document corresponding to the target code into the trained large
language model to generate a target
source code subjected to reverse control flow planarization. According to the method, on one hand, the problem that information outside a model training
data set cannot be obtained due to offline of a large
language model is effectively solved based on application of an external
knowledge base, and application of the large
language model to program document knowledge is improved; and on the other hand, the external knowledge base can assist the large language model in understanding the target code, so that the large language model generates a more accurate
source code. The invention further discloses a reverse control flow planarization device based on
firmware security and a computer readable storage medium.