Method for realizing legal data protection based on MPU mechanism and electric energy meter

By using the MPU mechanism to divide and protect the storage space in a single chip, the legal and illegal engineering are isolated, and the problem of legal data isolation protection in the chip storage space is solved, and efficient data isolation and security protection are achieved.

CN119740272APending Publication Date: 2025-04-01JIANGSU LINYANG ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411642809.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

Isolate legal projects and illegal projects in a single chip, especially allocating reasonable storage areas for two projects in limited chip storage space to prevent illegal projects from overstepping access to the storage areas of legal projects.

Method used

The MPU mechanism is used to divide and protect the chip's storage space, deploy legal projects in protected legal storage areas, and illegal projects are deployed in illegal storage areas, and access to legal data by illegal projects through legal security interface threads.

Benefits of technology

It realizes the isolation and protection of legal data, prevents illegal projects from affecting legal data and parameters, reduces costs, and provides a reliable legal data security protection solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740272A_ABST
    Figure CN119740272A_ABST
Patent Text Reader

Abstract

The invention provides a method for realizing legal data protection based on an MPU (Microprocessor Unit) mechanism and an electric energy meter, which are characterized in that safe separation of legal data and illegal data is realized in a single chip through MPU protection, and the chip supporting the MPU is divided into two regions, namely a legal project and an illegal project; and the legal project and the illegal project are completely separated from FLASH by distributing an RAM (Random Access Memory) in the chip. And legal functions and parameters are realized through the MPU, and data are not directly accessed by illegal engineering, so that the method has a good application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of electric energy meters, and in particular relates to a method and an electric energy meter for realizing separation of legal and illegal systems based on an MPU mechanism. Background Art

[0002] At present, the WELMEC Guide 7.2 standard for software testing in the EU MID certification of measuring instruments requires the separation of legal and illegal functions. The legal functions include: original data of the energy meter such as power, voltage, and current, and the illegal part includes demand, curves, and other functions based on secondary processing of the original data. Changes to legal functions require re-certification, while changes to illegal functions do not require certification. Illegal functions can only access legal data, such as power and voltage, through limited interfaces. Illegal functions cannot directly access data and parameters in the security area.

[0003] Currently, there are chips in the market that use two chips and support TrustZone functions, but these solutions are relatively expensive.

[0004] In terms of isolating legal and illegal projects, how to allocate reasonable storage areas for the two projects in the limited chip storage space is a technical challenge. Legal projects require sufficient storage space to ensure the storage of key data and codes, while illegal projects also require a certain amount of storage space to run necessary functions. Improper allocation of storage space may cause a project to fail to operate normally. In addition, when dividing the storage area, how to achieve complete isolation of the two projects in the physical storage of the chip is also a thorny issue. It is necessary to consider the physical characteristics of the memory and the storage architecture of the chip to prevent illegal projects from unauthorized access to the storage area of ​​the legal project and ensure the reliability of isolation. Summary of the invention

[0005] The purpose of the present invention is to solve the problem of how to isolate legal engineering from illegal engineering in a single chip, and to propose a method and electric energy meter for legal data protection based on the MPU mechanism. In the present invention, illegal functions access legal data through the security interface of the legal area. Because the legal function functions and peripherals are protected by the MPU, illegal functions cannot write a bottom-level driver or forcibly access legal data; it ensures that illegal functions cannot affect legal data and parameters; at the same time, the present invention adopts the MPU mechanism, and only chips that support the M3 core support the MPU function, which can effectively reduce costs.

[0006] The technical solution of the present invention is:

[0007] The present invention provides a method for implementing legal data protection based on an MPU mechanism, comprising:

[0008] A single chip supporting the MPU function is configured, and a storage space of the chip is divided into a legal storage area and an illegal storage area;

[0009] Creating a legal project and an illegal project in the chip, and deploying the legal project in the legal storage area, and deploying the illegal project in the illegal storage area;

[0010] The legal storage area is protected by using an MPU mechanism, so that non-legal projects cannot directly access the legal storage area;

[0011] The legal project includes a legal thread and a legal security interface thread. The legal security interface thread is used to receive and process access requests from non-legal projects, and judge the legality of the request according to preset access control rules. If the request is judged to be legal, access is allowed, otherwise access is denied.

[0012] Furthermore, the legal project also includes:

[0013] The legal project is protected by a digital signature, and the public key used to verify the signature is stored in the electricity meter to ensure that the legal project can only be upgraded by the predetermined authorized party to prevent illegal tampering.

[0014] Furthermore, an asymmetric encryption algorithm is used to sign the binary file of the legal project using the private key provided by the customer to obtain a digital signature, and the generated digital signature is attached to the binary file of the legal project.

[0015] Furthermore, the illegal project includes illegal threads. When creating an illegal thread, it is necessary to verify the hash value and digital signature of the illegal project carried in the request, and check the thread priority of the request. Creation is allowed only if the verification passes and the priority is lower than the legal thread.

[0016] Furthermore, for operation requests involving reading legal data, the legal security interface thread also needs to verify the digital signature carried by the request, and access is allowed only if the verification passes.

[0017] Furthermore, the peripheral access interface of the chip is protected by the MPU, and only legal engineering is allowed to access it, so that non-legal engineering cannot bypass the security interface to directly operate the peripheral access data.

[0018] Furthermore, the step of using the MPU mechanism to protect the legal storage area includes:

[0019] Configure the access permission table of the MPU, assign different access permissions to different threads or processes, and set the access permission of the legal storage area to allow only legal engineering to access.

[0020] Furthermore, the legal security interface thread is used to receive and process access requests from non-legal projects, including:

[0021] Perform address range checks on access requests initiated by non-authorized threads to ensure that non-authorized threads can only access FLASH and RAM resources within their own area;

[0022] Signature verification is performed on requests from non-legal threads to access legal storage area data to ensure that only authorized non-legal function codes can access legal storage area data.

[0023] Furthermore, the step of judging the legitimacy of the request according to the preset access control rules includes:

[0024] The source address, target address, operation type and other information of the request are obtained, and the information is matched with the preset access control list. If the match is successful, the request is judged to be legal, otherwise the request is judged to be illegal.

[0025] An electric energy meter that implements legal data protection based on an MPU mechanism adopts the method described. The electric energy meter includes a single chip, and the single chip supports the MPU function; the storage space of the chip is divided into a legal storage area and an illegal storage area, the legal storage area is used to run legal projects, and the illegal storage area is used to run illegal projects, and data interaction between the two storage areas is carried out through a legal security interface thread.

[0026] Beneficial effects of the present invention:

[0027] The present invention divides and protects the chip storage space through the MPU mechanism, deploys legal projects in the protected legal storage area, and deploys illegal projects in the illegal storage area, thereby realizing the isolation protection of legal data.

[0028] The present invention sets a legal security interface thread in the legal project to receive and process access requests from illegal projects, and controls the access of illegal projects to legal data according to preset access control rules and digital signature verification mechanism.

[0029] The present invention also performs digital signature protection on the legal project, and ensures that the legal project can only be upgraded by the authorized party by storing the public key for verifying the signature in the chip, thereby preventing illegal tampering.

[0030] The present invention utilizes the MPU mechanism to protect the peripheral access interface of the chip, allowing only legal engineering to access it, and preventing illegal engineering from bypassing the security interface and directly accessing sensitive data.

[0031] The present invention effectively solves the security risks faced when legal data coexists with illegal projects in a single chip, provides a reliable legal data security protection solution, and ensures the confidentiality and integrity of legal data.

[0032] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.

[0034] Figure 1 A system architecture diagram according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0035] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0036] Figure 1 A system architecture diagram according to an embodiment of the present invention is shown.

[0037] like Figure 1 As shown, the present invention provides a method for implementing legal data protection based on the MPU mechanism. Through MPU protection, the legal and illegal security separation is realized in a single chip, and the chip supporting the MPU is divided into two areas, one area runs the legal function, and the other area runs the illegal function. The legal function and the illegal function are two independent projects that will produce two binary files after compilation, and the legal signature is stored behind the bin file of the legal project, the private key is in the hands of the customer, and the public key is stored in the table.

[0038] The two areas of legal functions and illegal functions are completely separated in the RAM and FLASH allocated inside the chip, and the data interaction between the two projects can only be accessed through the security interface thread. Legal threads and legal security interface threads will be created in the legal project. Legal threads and legal security interface threads can only be accessed through the privileged mode of the MPU, and illegal threads are only allowed to be accessed in user mode. However, illegal threads can send messages to the legal security interface thread.

[0039] The operating system of the present invention creates threads in the project of legal functions. Non-legal systems cannot create threads, but the information used when creating illegal threads is provided by illegal systems. In order to prevent attacks when creating illegal threads, illegal hash values ​​and signatures are stored at the end of illegal projects. When the hash, signature, and thread priority of illegal threads are abnormal, the creation of illegal threads is prohibited.

[0040] The legal security interface of the present invention has three functions: 1. Access to illegal memory; 2. Access to security algorithm; 3. Access to legal data; wherein when accessing illegal memory, the address range of the operating memory will be restricted, and illegal devices are only allowed to access illegal data areas. The access to security algorithm includes some encryption algorithms and signature algorithms. The access to legal data includes setting and reading legal data. For example, setting time, reading time, displaying and sending, etc. wherein, when accessing illegal memory to communicate with the algorithm, no authentication is required, but when accessing legal data, a signature is required. It is ensured that the function of the legal device is not affected after the illegal device is modified.

[0041] In the present invention, the private key of the signature of the legal project is in the hands of the customer, and the public key is stored in the table. It can only be set in the factory and cannot be modified outside the factory. To upgrade the legal function, it is necessary to verify whether the signature of the legal function is correct. Since the private key is stored in the table, it is ensured that the legal function can only be upgraded by the customer, and the meter manufacturer cannot upgrade it, which ensures that the legal project cannot be rewritten. The security of the legal function of the meter is guaranteed.

[0042] In this embodiment, the present invention realizes the security separation of legal and illegal areas in a single chip through MPU protection, which can effectively distinguish between legal areas and illegal areas. The data, parameters, and measurements in the legal areas are all protected and cannot be directly accessed by illegal areas, thereby ensuring the security of legal data.

[0043] The present invention provides an electric energy meter that implements legal data protection based on an MPU mechanism. The electric energy meter includes a single chip, and the single chip supports the MPU function; the storage space of the chip is divided into a legal storage area and an illegal storage area, the legal storage area is used to run legal projects, and the illegal storage area is used to run illegal projects, and data interaction between the two storage areas is carried out through a legal security interface thread.

[0044] In this embodiment, the legal functions of the electric energy meter include: chip peripherals, interrupts, IO, EE driver, norflash driver, metering function, upgrade function, data security function, power function and other functions. The legal functions can only be run in the legal thread. These functions are protected by the MPU and cannot be accessed by non-legal threads. When non-legal threads need to access the legal thread, they can only send messages to the security interface thread to access it. The security interface thread will filter the accessed data, memory address, and ID. If the operated data is out of bounds, access is prohibited.

[0045] The method of the present invention divides the chip supporting the MPU into two areas: a legal project and an illegal project, and allocates independent RAM and FLASH storage spaces to the two projects inside the chip to achieve physical isolation.

[0046] There are four ways for illegal systems to rewrite legal system data and parameters: 1. Directly operate the chip's peripherals to access the memory; 2. Know the function address of the driver that writes the legal system to the memory, and directly access the function of the address; 3. Send messages through the legal system interface; 4. Rewrite the legal system's functions through upgrades.

[0047] In response to the above four methods, the measures of the present invention are as follows: 1. Since the MPU protects the peripherals of the chip, non-legal systems cannot directly operate the peripherals, and cannot write drivers to access the memory protection; 2. The driver function of the memory is also protected by the MPU. If non-legal systems use pointers to convert into function addresses to directly access, it will also trigger an MPU interrupt, thereby protecting the security of the legal system; 3. The security interface also needs to be signed, and non-legal systems cannot directly rewrite it, which also ensures the security of the legal system; 4. The signature for upgrading the legal system is controlled by the customer, and can only be upgraded by the customer, which also protects the data and parameters of the legal system.

[0048] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.

Claims

1. A method for implementing legal data protection based on the MPU mechanism, characterized in that: include: A single chip supporting the MPU function is configured, and a storage space of the chip is divided into a legal storage area and an illegal storage area; Creating a legal project and an illegal project in the chip, and deploying the legal project in the legal storage area, and deploying the illegal project in the illegal storage area; The legal storage area is protected by using an MPU mechanism, so that non-legal projects cannot directly access the legal storage area; The legal project includes a legal thread and a legal security interface thread. The legal security interface thread is used to receive and process access requests from non-legal projects, and judge the legality of the request according to preset access control rules. If the request is judged to be legal, access is allowed, otherwise access is denied.

2. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: The legal works also include: The legal project is protected by a digital signature, and the public key used to verify the signature is stored in the electricity meter to ensure that the legal project can only be upgraded by the predetermined authorized party to prevent illegal tampering.

3. The method for implementing legal data protection based on the MPU mechanism according to claim 2, characterized in that: Adopt asymmetric encryption algorithm, use the private key provided by the customer to sign the binary file of the legal project, obtain a digital signature, and attach the generated digital signature to the binary file of the legal project.

4. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: The illegal project includes illegal threads. When creating an illegal thread, it is necessary to verify the hash value and digital signature of the illegal project carried in the request, and check the thread priority of the request. Only if the verification passes and the priority is lower than the legal thread, is the creation allowed.

5. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: For operation requests involving reading legal data, the legal security interface thread also needs to verify the digital signature carried by the request, and access is allowed only if the verification passes.

6. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: The peripheral access interface of the chip is protected by the MPU and is only accessible to legal engineering, so that non-legal engineering cannot bypass the security interface to directly operate the peripheral access data.

7. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: The step of using the MPU mechanism to protect the legal storage area includes: Configure the access permission table of the MPU, assign different access permissions to different threads or processes, and set the access permission of the legal storage area to allow only legal engineering to access.

8. The method for implementing legal data protection based on the MPU mechanism according to claim 4, characterized in that: The legal security interface thread is used to receive and process access requests from non-legal projects, including: Perform address range checks on access requests initiated by non-authorized threads to ensure that non-authorized threads can only access FLASH and RAM resources within their own area; Signature verification is performed on requests from non-legal threads to access legal storage area data to ensure that only authorized non-legal function codes can access legal storage area data.

9. The method for implementing legal data protection based on the MPU mechanism according to claim 1, characterized in that: The step of judging the legitimacy of the request according to the preset access control rules includes: The source address, target address, operation type and other information of the request are obtained, and the information is matched with the preset access control list. If the match is successful, the request is judged to be legal, otherwise the request is judged to be illegal.

10. An electric energy meter for implementing legal data protection based on MPU mechanism, adopting the method according to any one of claims 1 to 8, characterized in that: The electric energy meter includes a single chip, which supports MPU functions; the storage space of the chip is divided into a legal storage area and an illegal storage area, the legal storage area is used to run legal projects, and the illegal storage area is used to run illegal projects, and data interaction between the two storage areas is carried out through a legal security interface thread.