CN107563228B - Memory data encryption and decryption method - Google Patents

Memory data encryption and decryption method Download PDF

Info

Publication number
CN107563228B
CN107563228B CN201710657407.5A CN201710657407A CN107563228B CN 107563228 B CN107563228 B CN 107563228B CN 201710657407 A CN201710657407 A CN 201710657407A CN 107563228 B CN107563228 B CN 107563228B
Authority
CN
China
Prior art keywords
memory
encryption
module
key
processor module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710657407.5A
Other languages
Chinese (zh)
Other versions
CN107563228A (en
Inventor
许海波
应志伟
杜朝晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haiguang Information Technology Co Ltd
Original Assignee
Haiguang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Haiguang Information Technology Co Ltd filed Critical Haiguang Information Technology Co Ltd
Priority to CN201710657407.5A priority Critical patent/CN107563228B/en
Publication of CN107563228A publication Critical patent/CN107563228A/en
Application granted granted Critical
Publication of CN107563228B publication Critical patent/CN107563228B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a memory data encryption and decryption method, and belongs to the technical field of data encryption processing. The method comprises S1, the processor module sending a key update request to the encryption module, the encryption module generating a new key after receiving the request; s2, for each encrypted memory page in the memory, the encryption module decrypts the memory page data corresponding to the encrypted memory page by using the old key, and re-encrypts each decrypted page data by using the new key. By using the memory data encryption and decryption method provided by the invention, malicious attacks caused by keeping an encryption key of an SME technology unchanged can be effectively reduced, so that the security of memory encryption is remarkably improved; and the flexibility of a security scheme is provided, and a user and a system can dynamically update the encryption and decryption keys according to needs.

Description

Memory data encryption and decryption method
Technical Field
The invention relates to the technical field of data encryption, in particular to a memory data encryption and decryption method.
Background
With the increasing complexity of modern computer systems and the increasing security requirements of computing environments due to emerging technologies such as cloud computing and big data in recent years, the industry is generally aware of the need to fully support the encryption function of data on the underlying hardware of the computer system. Among them, the CPU design and manufacturer in the united states proposed Secure Memory Encryption (SME) technology (see [1] AMD Memory Encryption White Paper; [2] cryptographic protection of information in processing systems (patent: CN 106062768A)). In the technology, a memory encryption module is added on the basis of the existing CPU hardware, so that data are encrypted and then written into a memory; when the CPU needs to read data, the encryption module automatically decrypts the encrypted data, and the whole process is completely transparent to upper-layer software. The method can effectively resist the data leakage problem caused by physical attack to the memory, isolation failure caused by software defects and the like. However, in this method, since the encrypted security key remains unchanged after running on the system, it is easy for a malicious attacker to perform cryptographic attack and cracking against the weakness of the encryption method. The above security risks presented by SME are especially evident in the use scenario of SEV as the basis of the SEV ([1] AMD Memory Encryption white te Paper) scheme.
Fig. 1 shows a structure diagram of a conventional SME scheme, in which security information is isolated by using a hardware encryption module 2 in an access path of a memory module. Where the encryption module 2 is located in the memory control module 3 and provides an indication to the processor module 1 whether or not each access is a secure access. The encryption key in the graph is automatically generated when the system is powered on and remains unchanged in the whole system operation process, which easily causes a malicious attacker to implement password attack and crack aiming at the weakness of the encryption method.
Disclosure of Invention
The invention provides a memory data encryption and decryption method, which solves the problem of malicious attack caused by the fact that an encryption key is kept unchanged.
The invention provides a memory data encryption and decryption method, which comprises the following steps:
s1, the processor module sends a key updating request to the encryption module, and the encryption module generates a new key after receiving the request;
s2, for each encrypted memory page in the memory, the encryption module decrypts the memory page data corresponding to the encrypted memory page by using the old key, and re-encrypts each decrypted page data by using the new key.
Wherein, step S1 is preceded by: the operating system checks the current state of the processor module, and if the processor module is busy, the operating system directly exits;
if the processor module is in the idle state, the operating system is suspended, no input-output operation of any other process is accepted, and the above-described steps S1 and S2 are performed.
In addition, after the steps are successfully executed, the operating system returns to success; if an error occurs in the above steps, the operating system returns to error and ends the updating process.
Step S1 further includes the encryption module saving the new key to the register of the memory controller module or its internal EEPROM.
In step S1, the processor module sends a key update request to the encryption module via the key update interface.
Preferably, the processor module sends the key update request to the cryptographic module in step S1 by a new machine instruction, or the controller Firmware (FW) providing a new application programming interface.
By using the memory data encryption and decryption method provided by the invention, malicious attacks caused by keeping an encryption key of an SME technology unchanged can be effectively reduced, so that the security of memory encryption is remarkably improved; and the flexibility of a security scheme is provided, and a user and a system can dynamically update the encryption and decryption keys according to needs.
Drawings
FIG. 1 is a schematic diagram of a conventional SME scheme;
FIG. 2 is a diagram of a system for increasing security of memory encryption by dynamically updating encryption keys;
fig. 3 is a flowchart of a method for encrypting and decrypting memory data according to an embodiment of the present invention.
Detailed Description
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
As shown in fig. 2 and 3, the present invention provides a method for encrypting and decrypting memory data, wherein the method comprises:
s1, the processor module 1 sends a key updating request to the encryption module 2, and the encryption module generates a new key after receiving the request;
s2, for each encrypted memory page in the memory, the encryption module 2 decrypts the memory page data corresponding to the encrypted memory page by using the old key, and re-encrypts each decrypted page data by using the new key.
By using the memory data encryption and decryption method provided by the invention, malicious attacks caused by keeping an encryption key of an SME technology unchanged can be effectively reduced, so that the security of memory encryption is remarkably improved; and the flexibility of a security scheme is provided, and a user and a system can dynamically update the encryption and decryption keys according to needs.
Because the updating of the encryption key can cause the invalidation of the current encrypted data in the memory, the encrypted data in the memory needs to be decrypted after the key is updated successfully, and then the new key is used for encryption storage again. When the system is in a full-load operation state, the system has a large amount of data stored in the memory. If the key is updated at this point, it will take a long time to decrypt/encrypt the data in memory, which may result in the system being unavailable for a long period of time.
Therefore, in a preferred embodiment of the present invention, step S1 is preceded by: the operating system checks the current state of the processor module 1, and if the processor module 1 is busy, the operating system directly exits;
if the processor module 1 is in the idle state, the operating system is suspended, no input-output operation of any other process is accepted, and the above-described steps S1 and S2 are performed.
By using the memory data encryption and decryption method provided by the invention, malicious attacks caused by keeping an encryption key of an SME technology unchanged can be effectively reduced, so that the security of memory encryption is remarkably improved; and the flexibility of a security scheme is provided, and a user and a system can dynamically update the encryption and decryption keys according to needs.
In addition, after the steps are successfully executed, the operating system returns to success; if an error occurs in the above steps, the operating system returns to error and ends the updating process.
Step S1 further includes the encryption module saving the new key to the register in the memory controller module or its internal EEPROM.
A system for increasing memory encryption security by dynamically updating encryption keys is shown in fig. 2. The system supports the dynamic updating function of the encryption KEY by passing a KEY updating interface (shown as an interface by a dotted line in fig. 3, the implementation form includes a hardware instruction UPDATE _ MEM _ KEY, the encryption module FW provides a new API, etc.) between the processor module 1 and the encryption module 2. After the function is added, the operating system can send a key update request to the cryptographic module 2 at an appropriate timing to generate a new cryptographic key. Further, the processor module 1 realizes sending the key update request to the cryptographic module 2 by a new machine instruction, or by the controller Firmware (FW) providing a new Application Programming Interface (API), in step S1.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, it should be understood that the above embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (7)

1. A method for dynamically updating a memory encryption key, the method comprising:
s1, the processor module sends a key updating request to the encryption module of the memory controller, and the encryption module generates a new key after receiving the request;
s2, for the encrypted memory page in the memory, the encryption module decrypts the encrypted memory page using the old key, and re-encrypts the decrypted memory page using the new key;
step S1 is preceded by: the operating system checks the current state of the processor module, and if the processor module is busy, the operating system directly exits; if the processor module is in the idle state, the operating system is suspended, no input-output operation of any other process is accepted, and the above-described steps S1 and S2 are performed.
2. The method of claim 1, wherein after the steps are successfully performed, the operating system returns a "success"; if an error occurs in the above steps, the operating system returns to error and ends the updating process.
3. The method of claim 1, wherein step S1 further comprises the encryption module saving the new key to a register or EEPROM in the memory controller module.
4. The method of claim 1, wherein the processor module is configured to send the rekeying request to the cryptographic module via the rekeying interface in step S1.
5. The method of claim 1, wherein the processor module sends the key update request to the cryptographic module in step S1 via a new machine instruction or a new application programming interface provided by the controller firmware.
6. A system for dynamically updating memory encryption keys, comprising:
a processor module, and
the memory controller comprises an encryption module and a memory, wherein the encryption module is used for encrypting and decrypting memory pages in the memory, the memory stores a secret key,
wherein the processor module is configured to send a key update request to the cryptographic module, the cryptographic module is configured to generate a new key upon receipt of the request and to store the new key to the memory,
the encryption module decrypts the encrypted memory page by using an old key and re-encrypts the decrypted memory page by using the new key;
the operating system checks the current state of the processor module, and directly exits if the processor module is busy; if the processor module is in an idle state, the operating system is suspended, does not accept input-output operations of any other process, and executes the processor module.
7. The system of claim 6, wherein the memory is a register or an EEPROM.
CN201710657407.5A 2017-08-03 2017-08-03 Memory data encryption and decryption method Active CN107563228B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710657407.5A CN107563228B (en) 2017-08-03 2017-08-03 Memory data encryption and decryption method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710657407.5A CN107563228B (en) 2017-08-03 2017-08-03 Memory data encryption and decryption method

Publications (2)

Publication Number Publication Date
CN107563228A CN107563228A (en) 2018-01-09
CN107563228B true CN107563228B (en) 2021-04-20

Family

ID=60973950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710657407.5A Active CN107563228B (en) 2017-08-03 2017-08-03 Memory data encryption and decryption method

Country Status (1)

Country Link
CN (1) CN107563228B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108427889A (en) * 2018-01-10 2018-08-21 链家网(北京)科技有限公司 Document handling method and device
CN111614464B (en) * 2019-01-31 2023-09-29 创新先进技术有限公司 Method for safely updating secret key in blockchain, node and storage medium
CN109918897A (en) * 2019-02-27 2019-06-21 苏州浪潮智能科技有限公司 A kind of password authentification test method and system based on AEP memory

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218572A (en) * 2012-01-23 2013-07-24 国际商业机器公司 Memory address translation-based data encryption/compression
WO2017030745A1 (en) * 2015-08-17 2017-02-23 Micron Technology, Inc. Encryption of executables in computational memory

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103679060B (en) * 2012-09-19 2018-03-27 腾讯科技(深圳)有限公司 Encryption method and encryption device
US9411973B2 (en) * 2013-05-02 2016-08-09 International Business Machines Corporation Secure isolation of tenant resources in a multi-tenant storage system using a security gateway
US9639671B2 (en) * 2014-05-27 2017-05-02 Assured Information Security, Inc. Secure execution of encrypted program instructions
US9536088B1 (en) * 2015-11-09 2017-01-03 AO Kaspersky Lab System and method for protection of memory in a hypervisor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218572A (en) * 2012-01-23 2013-07-24 国际商业机器公司 Memory address translation-based data encryption/compression
WO2017030745A1 (en) * 2015-08-17 2017-02-23 Micron Technology, Inc. Encryption of executables in computational memory

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向敏感进程的相变内存加密方法;刘巍等;《中国科技论文》;20161031(第20期);正文第2337页第1段-第2340段第2段 *

Also Published As

Publication number Publication date
CN107563228A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
US10708051B2 (en) Controlled access to data in a sandboxed environment
KR100692348B1 (en) Sleep protection
US8516271B2 (en) Securing non-volatile memory regions
RU2295834C2 (en) Initialization, maintenance, renewal and restoration of protected mode of operation of integrated system, using device for controlling access to data
US20170277898A1 (en) Key management for secure memory address spaces
JP3880933B2 (en) Data access control method using tamper resistant microprocessor and cache memory processor
US11240008B2 (en) Key management method, security chip, service server and information system
US9762548B2 (en) Controlling encrypted data stored on a remote storage device
US20090187771A1 (en) Secure data storage with key update to prevent replay attacks
KR101613146B1 (en) Method for encrypting database
EP2151763A1 (en) Method and apparatus for obfuscating virtual to physical memory mapping
CN101441601B (en) Ciphering transmission method of hard disk ATA instruction and system
CN110430051B (en) Key storage method, device and server
TW201633152A (en) System and method for reducing information leakage from memory
US11755499B2 (en) Locally-stored remote block data integrity
CN107526974B (en) Information password protection device and method
US7636441B2 (en) Method for secure key exchange
CN107563228B (en) Memory data encryption and decryption method
CN113711194A (en) Efficient side-channel attack resistant memory encryptor based on key update
Chang et al. User-friendly deniable storage for mobile devices
JP2021090151A (en) Storage system and data protection method thereof
US20130145145A1 (en) System and method of securing data using a server-resident key
CN107563226B (en) Memory controller, processor module and key updating method
CN103605934A (en) Protection method and device for executable files
CN108092937B (en) Method and system for preventing unauthorized access of Web system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20180109

Address after: 300143 Tianjin Haitai Huayuan Industrial Zone No. 18 West North 2-204 industrial incubation -3-8

Applicant after: Hai Guang Information Technology Co., Ltd.

Address before: 201203 3F, No. 1388, 02-01, Zhang Dong Road, Pudong New Area, Shanghai

Applicant before: Analog Microelectronics (Shanghai) Co., Ltd.

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 300143 Tianjin Haitai Huayuan Industrial Zone No. 18 West North 2-204 industrial incubation -3-8

Applicant after: Haiguang Information Technology Co., Ltd

Address before: 300143 Tianjin Haitai Huayuan Industrial Zone No. 18 West North 2-204 industrial incubation -3-8

Applicant before: HAIGUANG INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant