The invention relates to the technical field of
network security, in particular to a full-cycle fine-grained
program logic consistency protection method and
system based on passwords, in a program
design stage, code values and address offset information of each instruction in a program are extracted, a fixed
label corresponding to each instruction is generated by using a cryptographic
algorithm, and a
verification account book is formed; and when a program runs, extracting a code value and address offset information of a current execution instruction in real time, obtaining a
verification label through a cryptographic
algorithm, and carrying out matching
verification on the verification
label and a corresponding fixed label in a verification account book. When a program runs, if a function calling instruction is encountered, a return address of a
current function is extracted, and a dynamic label of the return address is generated through a cryptographic
algorithm; after function calling is completed, the return address is extracted, a verification label is obtained through cryptographic algorithm calculation, and matching verification is conducted on the verification label and the stored dynamic label. The logic consistency of the
full life cycle of the program is effectively protected, malicious tampering is prevented, and the safety and reliability of the program are improved.