The invention provides an
encryption method and device for a nonvolatile memory in a security
chip. The
encryption device for the nonvolatile memory of the security
chip comprises main equipment, a
bus, an
encryption circuit and a nonvolatile memory, wherein the encryption circuit comprises four round encryption circuits and an encryption sequence generator, each round encryption circuit is divided into five
layers of round encryption units, and each layer of round encryption unit comprises a key addition operation unit, a nonlinear operation unit, a
linear operation unit and a replacement operation unit; when the round encryption circuit executes encryption, the first round encryption circuit begins to execute encryption, the other round encryption circuits sequentially encrypt in sequence,
ciphertext obtained after encryption
processing is completed is input into the nonvolatile memory, and the encryption process is completed. According to the method, a 2-4 rounds of symmetric
algorithm structure is utilized, and the encryption strength and speed are improved within a small round number; meanwhile, the encryption method comprises a nonlinear
mask transformation method, and it isguaranteed that no
plaintext exists in the whole
data migration process.