WO2020248088A1 - Secure access method and electronic device - Google Patents

Secure access method and electronic device Download PDF

Info

Publication number
WO2020248088A1
WO2020248088A1 PCT/CN2019/090478 CN2019090478W WO2020248088A1 WO 2020248088 A1 WO2020248088 A1 WO 2020248088A1 CN 2019090478 W CN2019090478 W CN 2019090478W WO 2020248088 A1 WO2020248088 A1 WO 2020248088A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
identifier
module
memory block
hardware module
Prior art date
Application number
PCT/CN2019/090478
Other languages
French (fr)
Chinese (zh)
Inventor
查克拉博蒂·齐元吉
方中华
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2019/090478 priority Critical patent/WO2020248088A1/en
Priority to CN201980097157.1A priority patent/CN113906398A/en
Publication of WO2020248088A1 publication Critical patent/WO2020248088A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules

Definitions

  • This application relates to the field of multimedia technology, in particular to a secure access method and electronic equipment.
  • the media path is the transmission path of the media stream.
  • a media path is composed of at least one hardware module and at least one memory (buffer), and each hardware module in the at least one hardware module can access any memory in the at least one memory.
  • a secure media path is a transmission path for transmitting media streams with security requirements.
  • media streams with security requirements are referred to as secure media streams.
  • applications in a non-secure environment generally do not have access rights to the memory in the SMP. This application refers to the memory in the SMP as a secure memory block.
  • This application provides a secure access method and electronic equipment to solve the problem of poor security of existing SMPs.
  • this application provides a secure access method, which includes: determining a target hardware module and a target memory block according to a detection request; determining whether the target hardware module and the target memory block belong to the same media path; When the hardware module and the target memory block belong to the same media path, determine whether the target hardware module has access rights to the target memory block; when the target hardware module has access rights to the target memory block, call the target hardware module to access The target memory block.
  • this application is executed on the TEE side.
  • the electronic device in this application first detects whether the hardware module and the memory block to be accessed by the hardware module belong to the same SMP, thereby preventing the hardware module of the first SMP from accessing the security of the second SMP RAM.
  • the electronic device further detects whether the hardware module has access rights to the memory block.
  • the hardware module accesses the memory block in accordance with the access authority, so as to prevent the hardware module without the access authority from accessing the data in the secure memory to cause the leakage of the secure media stream.
  • the electronic device first detects whether the hardware module and the memory block belong to the same media channel, and when they belong to the same media channel, it then detects whether the hardware module has access rights to the memory block.
  • the hardware Modules can only access memory blocks that belong to the same secure media channel and have access rights, to avoid the leakage of secure media streams from the secure memory blocks caused by cross access of different secure media channels or hardware modules accessing memory blocks without access rights , Improve the security of SMP access to memory.
  • determining whether the target hardware module and the target memory block belong to the same media path includes: obtaining the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first A path identifier indicates the media path corresponding to the target hardware module, the second path identifier indicates the media path corresponding to the target memory block; detecting whether the first path identifier and the second path identifier are the same; in the first path identifier and When the second path identifiers are the same, it is determined that the target hardware module and the target memory block belong to the same media path.
  • each SMP in this application is represented by a unique path identifier.
  • the electronic device can accurately detect whether the target hardware module and the target memory block belong to the same SMP based on the path identifier.
  • determining whether the target hardware module and the target memory block belong to the same media path includes: obtaining the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first A path identifier indicates the media path corresponding to the target hardware module, the second path identifier indicates the media path corresponding to the target memory block; it is detected whether the first path identifier and the second path identifier are the same as the target path identifier, the target path The identifier is used to indicate the target media path; when the first path identifier is the same as the target path identifier, determine that the target hardware module belongs to the target media path; and when the second path identifier is the same as the path identifier, determine the target The memory block belongs to the target media channel.
  • the electronic device can determine whether the target hardware module and the target memory block belong to the target media channel.
  • the target media channel can call the target hardware module.
  • the target memory block is a memory block that the target media channel can access, so as to prevent the target media channel from calling a hardware module that does not belong to the target media channel or accessing a memory block that does not belong to the target media channel.
  • the target media path can be any SMP among the created SMPs.
  • the acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically includes: acquiring the module identity identifier of the target hardware module, and in the first correspondence relationship Determine the first path identifier corresponding to the module identity; obtain the memory identity identifier of the target memory block, and determine the second path identifier corresponding to the memory identity in the first correspondence; wherein, the first A corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier.
  • a path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block. At least one hardware module corresponds to the same path identifier.
  • the first corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier.
  • One path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block.
  • the same path identifier corresponds to at least One hardware module and at least one memory block belong to the media channel indicated by the channel identifier.
  • the acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically includes: acquiring the module identity of the target hardware module, and in accordance with the module identity
  • the first corresponding relationship determines the first path identifier corresponding to the module identity, and the first corresponding relationship includes the corresponding relationship between the path identifier and the module identity.
  • One path identifier corresponds to the module identity of at least one hardware module.
  • At least one hardware module corresponding to the path identifier belongs to the media path indicated by the same path identifier; acquires the target address to be accessed, where the target address indicates the target memory block, and determines the target memory block in the second correspondence relationship according to the target address
  • the second correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
  • determining whether the target hardware module has access rights to the target memory block includes: obtaining the module identity of the target hardware module and the memory identity of the target memory block; detecting the third correspondence relationship Whether there is an access authority identifier corresponding to the module identity identifier and the memory identifier, the third correspondence relationship includes the corresponding relationship between the module identity identifier, the memory identity identifier, and the access authority identifier; in the third correspondence relationship is set with When the module identity identifier and the access authority identifier corresponding to the memory identity identifier, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • the access permission of the target hardware module to the target memory block is detected, so as to avoid the hardware module that has no access permission to the media stream in the target memory block from accessing the target memory block
  • the media stream can improve the security of SMP.
  • the target hardware module corresponds to the target input-output memory management unit IOMMU
  • the target IOMMU includes an identification register
  • the identification register includes at least one memory identity identifier with access rights
  • the target hardware module is determined Whether the target memory block has access authority includes: obtaining the memory identity of the target memory block; determining whether the at least one memory identity with access authority includes the memory identity; when the at least one memory identity with access authority When the memory identity is included in the identity, it is determined that the target hardware module has the access authority indicated by the access authority to the target memory block.
  • the access authority includes a read operation authority and a write operation authority
  • the identification register includes a read identification register and a write identification register
  • the read identification register includes at least one memory identification identifier with read operation authority.
  • the write identification register includes at least one memory identification with write operation authority.
  • determining whether the target hardware module has access rights to the target memory block includes: determining whether the at least one memory identity with read operation permission includes the memory identity; when the at least one has When the memory identity of the read operation permission includes the memory identity, it is determined that the target hardware module has read operation permission for the target memory block; or, it is determined whether the memory identity is included in the at least one memory identity with the write operation permission Identification; when the at least one memory identity with write operation authority includes the memory identity, it is determined that the target hardware module has write operation authority for the target memory block.
  • the method before determining the target hardware module and the target memory block according to the detection request, the method further includes: obtaining a request to create a media path; generating a path identifier of the media path; configuring at least one hardware module and at least one memory block , Obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one memory block form the media path; according to the path identifier, the module of the at least one hardware module The identity identifier and the memory identity identifier of the at least one memory block establish the first correspondence relationship.
  • the corresponding relationship between the path identifier of the SMP and the hardware module and secure memory block belonging to the SMP is established, and each hardware module in the SMP is bound to the secure memory related to the hardware module Piece.
  • each hardware module in the SMP is bound to the secure memory related to the hardware module Piece.
  • the method further includes: obtaining from the third correspondence relationship at least one memory identity that the target hardware module has access rights; At least one memory identity of the authority is set in the identity register of the target IOMMU.
  • the access authority of the target hardware module to the target memory block is set, so that the access authority of the target hardware module to the target memory block can be configured at the hardware level, and the security of the SMP is improved.
  • the target memory block after configuring at least one hardware module and at least one memory block, it further includes: mapping the virtual address of each memory block in the at least one memory block, the memory identity identifier of the memory block, and the channel identifier Store to obtain the second correspondence.
  • mapping the virtual address of each memory block in the at least one memory block, the memory identity identifier of the memory block, and the channel identifier Store to obtain the second correspondence.
  • this application provides an electronic device that includes a processor, a target hardware module, and a target memory block, where the processor is configured to determine the target hardware module and the target memory block according to a detection request; The processor is also used to determine whether the target hardware module and the target memory block belong to the same media path; the processor is also used to determine whether the target hardware module and the target memory block belong to the same media path Whether the target hardware module has access authority to the target memory block; the target hardware module is used to access the target memory block when the target hardware module has access authority to the target memory block.
  • the electronic device may be a processor chip.
  • the processor in the electronic device is a processor core or a central processing unit in the processor chip.
  • the processor is further configured to obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module , The second path identifier indicates the media path corresponding to the target memory block; the processor is also used to detect whether the first path identifier and the second path identifier are the same; the processor is also used to When the identifier is the same as the second path identifier, it is determined that the target hardware module and the target memory block belong to the same media path.
  • the processor is further configured to obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module ,
  • the second path identifier indicates the media path corresponding to the target memory block;
  • the processor is also used to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate the target Media path;
  • the processor is also used for determining that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier;
  • the processor is also used for determining that the second path identifier is the same as the target path identifier When the path identifiers are the same, it is determined that the target memory block belongs to the target media path.
  • the processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence; the processor, It is also used to obtain the memory identity identifier of the target memory block, and determine the second path identifier corresponding to the memory identifier in the first correspondence relationship; wherein, the first correspondence relationship includes the path identifier and the module identity identifier and Correspondence of the memory identity identifier, a path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and at least one hardware module and at least one memory block corresponding to the same path identifier belong to the same path Identifies the indicated media path.
  • the processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence according to the module identity
  • the first correspondence relationship includes the correspondence relationship between the path identifier and the module identity identifier, one path identifier corresponds to the module identifier of at least one hardware module, and at least one hardware module corresponding to the same path identifier belongs to the media path indicated by the same path identifier
  • the processor is also used to obtain the target address to be accessed, the target address indicates the target memory block, and the second path identifier corresponding to the target memory block is determined in the second correspondence according to the target address, and the second The correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
  • the processor is also used to obtain the module identity of the target hardware module and the memory identity of the target memory block; the processor is also used to detect whether the third correspondence is set The access authority identifier corresponding to the module identity identifier and the memory identity identifier, and the third correspondence relationship includes the corresponding relationship between the module identity identifier, the memory identity identifier, and the access authority identifier; the processor is also used for setting the third correspondence relationship When the access authority identifier corresponding to the module identity identifier and the memory identifier is set in the module, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • the electronic device further includes a target input-output memory management unit IOMMU, the target IOMMU corresponds to the target hardware module, the target IOMMU includes an identification register, and the identification register includes at least one access authority Memory identity, where the target IOMMU is used to obtain the memory identity of the target memory block, and to determine whether the at least one memory identity with access rights includes the memory identity; the target IOMMU is also used to When the at least one memory identity identifier with access authority includes the memory identity identifier, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • IOMMU target input-output memory management unit
  • the access authority includes a read operation authority and a write operation authority
  • the identification register includes a read identification register and a write identification register
  • the read identification register includes at least one memory identification identifier with read operation authority
  • the write identification register includes at least one memory identification with write operation authority.
  • the target IOMMU is also used to determine whether the at least one memory identity with read operation permission includes the memory identity, and the at least one memory identity with read operation permission includes When the memory identity is identified, it is determined that the target hardware module has the read operation permission for the target memory block; the target IOMMU is also used to determine whether the memory identity is present in the at least one memory identity with write operation permission, and When the at least one memory identity with read operation permission includes the memory identity, it is determined that the target hardware module has write operation permission on the target memory block.
  • the processor is also used to obtain a request to create a media path; the processor is also used to generate a path identifier of the media path; the processor is also used to configure at least one hardware module and At least one memory block, the module identity of the at least one hardware module and the memory identity of the at least one memory block are obtained, the at least one hardware module and the at least one memory block form the media path; the processor is also used for The path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block establish the first correspondence relationship.
  • the processor is further configured to obtain at least one memory identity that the target hardware module has access permission from the third correspondence; the processor is further configured to At least one memory identity is configured in the identity register of the target IOMMU.
  • the technical effects produced by the second aspect and the implementation manners of the second aspect are the same as the technical effects produced by the implementation manners of the first aspect and the first aspect, and will not be repeated here.
  • the present application also provides a device, the device includes: a determining module for determining a target hardware module and a target memory block according to a detection request; a determining module for determining whether the target hardware module and the target memory block are Belong to the same media path; the determining module is also used to determine whether the target hardware module has access rights to the target memory block when the target hardware module and the target memory block belong to the same media path; the calling module is used to When the target hardware module has access authority to the target memory block, the target hardware module is called to access the target memory block.
  • the device further includes an acquisition module and a detection module.
  • the acquisition module is configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first The path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the media path corresponding to the target memory block;
  • the detection module is used to detect whether the first path identifier and the second path identifier are the same; the determination The module is also used to determine that the target hardware module and the target memory block belong to the same media path when the first path identifier and the second path identifier are the same.
  • the acquiring module is further configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module ,
  • the second path identifier indicates the media path corresponding to the target memory block;
  • the detection module is also used to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate the target Media path;
  • the determining module is also used to determine that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier;
  • the determining module is also used to determine whether the second path identifier is the same as the target media path When the path identifiers are the same, it is determined that the target memory block belongs to the target media path.
  • the acquisition module is further configured to acquire the module identity of the target hardware module, and determine the first path identifier corresponding to the module identity in the first correspondence; the acquisition module, It is also used to obtain the memory identity of the target memory block, and determine the second path identity corresponding to the memory identity in the first corresponding relationship; wherein, the first corresponding relationship includes the path identity and the module identity and Correspondence of the memory identity identifier, a path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and at least one hardware module and at least one memory block corresponding to the same path identifier belong to the same path Identifies the indicated media path.
  • the acquisition module is further configured to acquire the module identity of the target hardware module, and determine the first path identifier corresponding to the module identity in the first correspondence according to the module identity
  • the first correspondence relationship includes the correspondence relationship between the path identifier and the module identity identifier, one path identifier corresponds to the module identifier of at least one hardware module, and at least one hardware module corresponding to the same path identifier belongs to the media path indicated by the same path identifier
  • the acquisition module is also used to acquire the target address to be accessed, the target address indicates the target memory block, and the second path identifier corresponding to the target memory block is determined in the second correspondence according to the target address, and the second The correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
  • the acquisition module is also used to acquire the module identity of the target hardware module and the memory identity of the target memory block; the detection module is also used to detect whether the third correspondence is set The access authority identifier corresponding to the module identity and the memory identity, the third correspondence includes the correspondence between the module identity, the memory identity, and the access authority identifier; the determining module is also used in the third correspondence When the access authority identifier corresponding to the module identity identifier and the memory identifier is set in the module, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • the device further includes a generation module, a configuration module, and an establishment module, wherein the acquisition module is also used to acquire a request to create a media path; the generation module is also used to generate a path of the media path Identification; the configuration module is also used to configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one The memory block forms the media path; the establishing module is further configured to establish the first correspondence relationship according to the path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block.
  • the obtaining module is also used to obtain at least one memory identity that the target hardware module has access permission from the third correspondence; the configuration module is also used to obtain the access permission At least one memory identity is configured in the identity register of the target IOMMU, where the target IOMMU corresponds to the target hardware module.
  • the technical effects produced by the third aspect and the implementation manners of the third aspect are the same as those produced by the implementation manners of the first aspect and the first aspect, and will not be repeated here.
  • this application provides a computer-readable storage medium with instructions stored in the computer-readable storage medium, which when run on a computer or processor, cause the computer or processor to execute the first aspect or the first aspect. In terms of any possible design method.
  • this application provides a computer program product containing instructions that, when the instructions run on a computer or processor, cause the computer or processor to perform any possible design as in the first aspect or any possible design in the first aspect.
  • the electronic device before the hardware module accesses the memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP. If the hardware module and the corresponding secure memory block belong to the same SMP, the electronic device further detects the hardware Whether the module has the authority to access the secure memory block, if the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block; otherwise, the hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
  • FIG. 1A is a system architecture diagram of a typical electronic device provided by this application.
  • FIG. 1B is a schematic diagram of the first exemplary application scenario of SMP provided in this application.
  • FIG. 1C is a schematic diagram of a second exemplary application scenario of SMP provided in this application.
  • FIG. 2 is a schematic diagram of the system architecture of an exemplary application environment of the electronic device 10 provided by the present application;
  • FIG. 3 is an exemplary method flowchart of the secure access method 100 provided by the present application.
  • Fig. 4 is an exemplary schematic diagram of a bitmap in the identification register provided by the present application.
  • FIG. 5 is a schematic diagram of an exemplary structure of an electronic device 20 provided in the present application.
  • FIG. 6A is an exemplary signaling interaction diagram of the SMP creation method 200 provided by this application.
  • FIG. 6B is an exemplary signaling interaction diagram of the secure media stream transmission method 300 provided by the present application.
  • FIG. 7A is a schematic diagram of an exemplary structure of an electronic device 70 provided in the present application.
  • FIG. 7B is a schematic diagram of an exemplary structure of an electronic device 71 provided by the present application.
  • FIG. 7C is a schematic diagram of an exemplary scenario for detecting access permissions provided in FIG. 7B based on the present application.
  • This application can be applied to electronic devices supporting audio and video input/output, such as smart phones, smart set-top boxes, smart TVs, surveillance, computers, tablet computers, etc.
  • Figure 1A shows the system architecture of a typical electronic device.
  • the system architecture includes: application layer, driver layer, operating system layer, hardware module and storage module.
  • the application layer is used to run application software, such as Tencent, Youku, etc.
  • the driver layer includes a driver program written for each hardware module, and the driver program is used to drive the corresponding hardware module to access the memory block.
  • the operating system layer is responsible for memory management, stack management, task scheduling management, etc. When the application software of the application layer is running, it can apply to the operating system layer to allocate a memory block and obtain the virtual address of the allocated memory block.
  • the allocated memory block is used to store data during the running of the application software, such as the following various media stream data.
  • the driver layer can drive the hardware module to access the corresponding memory block according to the virtual address of the memory block.
  • the media stream transmitted during the running of the application software may also be referred to as a media data stream, including different forms of media data streams such as transport stream (TS) and elementary stream (ES).
  • Media streams include audio streams and/or video streams.
  • the application software Before the application software transmits the media stream, it can create a media path according to the intention of the application software and the processing process of the media stream.
  • the media path is the path through which the application software processes the media stream on the electronic device.
  • the processing process includes but is not limited to Play, record, transcode, and forward, etc.
  • the media path may include, for example, a recording path, a playback path, and a transcoding path.
  • the media path includes the resources used for audio and video processing, such as a series of hardware modules and memory.
  • application software may apply to the operating system layer to occupy hardware module 1, hardware module 2 and hardware module 3, and apply to the operating system layer to allocate memory block 1 and memory block 2.
  • Hardware module 1, hardware module 2, and hardware module 3, as well as memory block 1 and memory block 2, for example, can form a media channel, and the transmission process of the media stream on the media channel is, for example: hardware module 1 to memory block 1, memory block 1 to hardware module 2, hardware module 2 to memory block 2, and memory block 2 to hardware module 3.
  • the driver layer receives instructions from the application software, and then drives the corresponding hardware modules in the media path to perform access operations on the corresponding memory blocks.
  • the electronic device shown in FIG. 1A may, for example, support a trusted execution environment (TEE) and a rich execution environment (REE).
  • TEE corresponds to REE.
  • TEE is used to provide a protected execution environment for protected application software
  • REE is used to provide an execution environment for unprotected application software.
  • the memory (buffer) between TEE and REE is isolated, that is, the application software in REE is not allowed to access the memory in TEE.
  • the media paths involved in this application may include ordinary media paths, or may also be referred to as non-secure media paths and secure media paths (SMP).
  • Ordinary media channels are media channels under REE, which are used to transmit unprotected media streams.
  • SMP is a media channel under TEE, used to transmit media streams that have certain security requirements, for example, media streams that require watermarking, encryption, prohibition of transcoding, and mechanism recording.
  • Security requirements can be defined as media content usage rules (content usage rules), for example.
  • the hardware modules and memory blocks in SMP should process and transmit related media streams in accordance with media content usage rules.
  • the driver layer in Figure 1A can include REE drivers and TEE drivers. TEE drivers are used to drive hardware modules in SMP to access memory blocks in SMP, and REE drivers are used to drive hardware modules in ordinary media channels to access ordinary media channels. The memory block in.
  • each hardware module shown in FIG. 1A can provide multiple processing channels, where each processing channel can be used in one media channel and process the media stream data of the media channel.
  • a hardware module includes 32 processing channels, then the hardware module can be used in 32 media channels at the same time, and each of the processing channels processes media stream data in one of the 32 media channels.
  • the 32 media channels can include ordinary media channels and SMP. That is, in some embodiments, the TEE and the REE can share the same hardware module. Furthermore, in this scenario, the same hardware module can perform operations in response to instructions from the TEE driver, or perform operations in response to instructions from the REE driver.
  • FIG. 1B For example, two SMPs are running simultaneously under TEE, and media stream 1 transmitted by SMP1 has output protection requirements. For example, media stream 1 output by SMP1 needs to be watermarked, and media stream 2 transmitted by SMP2, for example Does not have output protection requirements.
  • Both secure memory block 1 and hardware module 1 belong to SMP1, and secure memory block 2 belongs to SMP2.
  • one processing channel of the hardware module 1 is used for SMP1, for example, and the other processing channel is used for common media channels, for example, then the hardware module 1 can receive the drive instructions of the TEE driver and the drive instructions of the REE drive.
  • the REE drive controls the hardware module 1 to access the secure memory block 2, then the hardware module 1 will store the media stream 1 with output protection requirements in the secure memory block 2, causing the output protection of the media stream 1 to fail.
  • the graphics processing unit (GPU) module can access the secure memory block and has a copy function, and the GPU module is driven by the REE driver. Therefore, as shown in Figure 1C, even if the GPU module is not used in any media path, the REE driver can control the GPU module to access the secure memory block in SMP3 and copy (copy) the media stream data in the secure memory block.
  • PVR personal video recorder
  • this application provides a secure access method and electronic device.
  • the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP. If the memory block belongs to the same SMP, the electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block. Otherwise, the The hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
  • FIG. 2 illustrates a schematic diagram of a system architecture of an exemplary application environment of the electronic device 10.
  • the electronic device 10 supports TEE.
  • the REE system architecture includes the REE software application layer, the REE software interface adaptation layer, the REE software driver layer, the REE software operating system layer, the REE hardware module, and the REE input and output memory management unit corresponding to the REE hardware module (input output memory management unit, IOMMU) module and REE storage module.
  • the software application in the REE software application layer can control the REE hardware module through the REE software interface adaptation layer, the REE software driver layer and the REE software operating system layer, and access the memory blocks in the REE storage module.
  • the REE software operating system layer, the REE software driver layer, the REE software interface adaptation layer, and the REE software application layer are implemented by software codes. Illustratively, these software codes can be stored in the memory and run. On the processor.
  • the REE software application layer is used to provide the operating environment of the REE software application, and is also used to apply to the REE software operating system layer to allocate the REE hardware module and REE memory block when the REE software application is running, and store the virtual address of the REE memory block.
  • the REE software interface adaptation layer is used to match the driver in the REE software driver layer according to the virtual address accessed by the REE software application layer.
  • the REE software driver layer includes a driver program written for each hardware module, and the driver program drives the corresponding hardware module to access the corresponding REE memory block according to the virtual address.
  • the REE software operating system layer is used to perform REE hardware module resource management, as well as stack management and task scheduling.
  • the REE software operating system layer for example, can configure the REE hardware module 12 to create a common media channel in response to instructions from the REE software application layer.
  • the REE software operating system layer is also used to maintain one or more computer programs and data. When the one or more computer programs are running, they can implement the functions of each software layer on the REE side.
  • the data is used to provide support for the operation of the one or more computer programs.
  • the REE IOMMU module corresponds to the REE hardware module one to one.
  • the REE IOMMU module is used to convert the virtual address of the memory block into the physical address of the corresponding memory block, and further, perform unsafe access to the memory block indicated by the corresponding physical address.
  • the REE storage module may include, but is not limited to, double data rate (DDR) memory, flash memory (Flash), static random access memory (SRAM), etc., which are not limited in this application.
  • DDR double data rate
  • flash flash memory
  • SRAM static random access memory
  • the REE storage module includes multiple memory blocks, and each memory block has a different physical address.
  • the TEE system architecture includes TEE software application layer, TEE software interface adaptation layer, TEE software driver layer, TEE software operating system layer, TEE hardware module, TEE IOMMU module corresponding to TEE hardware module, and TEE storage module.
  • the TEE software operating system layer, the TEE software driver layer, the TEE software interface adaptation layer, and the TEE software application layer are implemented by software codes.
  • these software codes can be stored in the memory and run on the processor. on.
  • the software application in the TEE software application layer can control the TEE hardware module through the TEE software interface adaptation layer, the TEE software driver layer, and the TEE software operating system layer, and access the memory block in the TEE storage module. It should be understood that the basic interaction process between the software layers is similar to the REE side, and will not be detailed here.
  • the TEE system architecture also includes a session management module, a memory management module, and a policy management module, where the session management module, the memory management module, and the policy management module are implemented by software code and run on the processor .
  • the session management module, the memory management module, and the policy management module run on the TEE software driver layer, for example. In other embodiments, the session management module, the memory management module, and the policy management module run on the TEE software operating system layer, for example. In some other embodiments, some modules of the session management module, the memory management module, and the policy management module run on the TEE software driver layer, and other modules run on the TEE software operating system layer.
  • the strategy management module is used to maintain the strategy table referred to below in this manual, that is, the third corresponding relationship referred to below.
  • the session management module is used to correspondingly store the channel identifier of the SMP and the TEE hardware module information and secure memory block information belonging to the SMP to obtain the first correspondence involved in the following.
  • the memory management module is used to maintain the physical address and virtual address mapping table of each memory block in the TEE storage module, and then, in the process of configuring the secure memory block in the TEE system architecture, the memory management module is also used to configure the secure memory block Memory identification (tag), then, the memory identification of the secure memory block, the path identifier of the SMP to which the corresponding secure memory block belongs, and the corresponding relationship between the virtual address and physical address of the corresponding secure memory block form a mapping relationship to obtain the The mapping table corresponding to the secure memory block, that is, the second correspondence involved in the following.
  • the session management module may also be used to detect the hardware module and the secure memory block according to the above series of correspondences to determine whether the corresponding hardware module has access rights to the secure memory block.
  • the memory management module is also used to set the identification register in the IOMMU module according to the memory identity identification of the secure memory block to set the access authority of the hardware module to the secure memory block.
  • setting the identification registers summarized by the IOMMU module can be specifically completed by the memory management module.
  • the TEE IOMMU module corresponds to the TEE hardware module one to one.
  • the TEE IOMMU module includes an identification register, and the identification in the identification register is used to authenticate the TEE hardware module's access authority to the memory block. For example, when the TEE IOMMU module contains the first memory identity, the TEE hardware module can access the memory block indicated by the first memory identity. Similarly, when the TEE IOMMU module does not contain the memory identity, the TEE hardware module cannot access the second The memory block indicated by the memory identifier.
  • the specific implementation form of the identification register is described in the following embodiments.
  • the TEE storage module may include multiple secure memory blocks, and each secure memory block can be identified by a physical address.
  • the TEE software driver layer may set the memory identity of the memory block according to the instruction of the software application in the TEE software application layer and the third correspondence.
  • the processor running each software layer of REE and the processor running each software layer of TEE may be physically the same processor.
  • the processor implements the functions of each software layer of the REE.
  • the processor runs in the TEE mode, the processor implements the functions of each software layer of the TEE.
  • the processor may be, for example, a system-level chip control logic unit, a microprocessor, a microcontroller (micro-controller unit, MCU), a central processing unit (CPU), a digital signal processing (digital signal processing, DSP) ), graphics processing unit (GPU), field programmable gate array (FPGA), application specific integrated circuit (ASIC), etc., which are not limited in this application.
  • the REE hardware module and the TEE hardware module shown in FIG. 2 may include, for example, a demux module (demux), a hardware decryption module, a hardware encryption module, a hardware decoding module (decoder), a video decoding module (VDEC), and hardware Communication module, hardware graphics processing module (video processor, VPSS), hardware display module (video display, VDP), analog to digital converter (analog to digital converter, ADC), digital to analog converter (digital to analog converter, DAC),
  • the communication interface, radio frequency unit, microelectronic mechanical module, etc. are not limited in this application.
  • both the hardware decryption module and the hardware encryption module include a cipher.
  • the REE hardware module and the TEE hardware module can be implemented by two processing channels in the same hardware module.
  • Both the REE storage module and the TEE storage module may include but are not limited to DDR memory, flash memory (Flash), SRAM, etc., which are not limited in this application.
  • the REE memory module and the TEE memory module are isolated from each other, so that ordinary memory blocks and secure memory blocks are isolated from each other.
  • the physical address (physical address) described in the embodiment shown in FIG. 2 can be: storing information in a byte as a unit in the storage module. In order to correctly store or obtain information, each byte unit has a unique memory block address.
  • the physical address can also be called the actual address or the absolute address.
  • the physical address can be addressed in the storage module through the address bus, and is the address where the data is actually stored.
  • the virtual address described in the embodiment illustrated in FIG. 2 may be a logical address used by application software to access the memory block. Virtual addresses do not actually store data, but need to be mapped to actual physical addresses to obtain data.
  • the mapping relationship between the virtual address and the physical address may be stored in a memory management unit (MMU), for example, and the MMU implements the translation of the virtual address into a physical address. Virtual addresses between different application software are mapped to different physical addresses to achieve memory isolation.
  • MMU memory management unit
  • access involved in this application includes read operation and write operation
  • access authority includes read operation authority and write operation authority
  • the software and hardware of the REE system architecture and the software and hardware of the TEE system architecture illustrated in FIG. 2 may be located in the same system on chip (SOC).
  • the REE software application layer, the REE software interface adaptation layer, the REE software driver layer, the REE software operating system layer, the REE hardware module, the REE IOMMU module, and the TEE software application layer and TEE software interface shown in FIG. 2 The adaptation layer, TEE software driver layer, TEE software operating system layer, TEE hardware module, and TEE IOMMU module are located in the same SOC, and the REE storage module and TEE storage module can be independent of the SOC.
  • FIG. 2 is only a schematic description, and does not constitute a specific limitation on the electronic device 10.
  • the electronic device 10 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the secure access method described in this application is implemented in the TEE. Accordingly, the secure access method described in this application is executed by at least one of the software, hardware, and combination of software and hardware on the TEE side of the electronic device 10 .
  • the method 100 includes the following steps:
  • Step S101 Determine the target hardware module and the target memory block according to the detection request.
  • the detection request is used to trigger the electronic device 10 to detect whether the target hardware module and the target memory block have the permission to be accessed, and whether the target hardware module has the access permission to the target memory block.
  • the detection request is generated by the TEE software driver layer.
  • the TEE software driver layer may receive an instruction from the TEE software application layer to call the target hardware module to access the target memory block. Then, the TEE software driver layer may generate the detection request and send the request to the session management module. Test request.
  • the detection request is generated by the target hardware module.
  • the target hardware module may receive an instruction to access the target memory block from the REE driver module, and then the target hardware module generates the detection request, and sends the detection request to the session management module.
  • the detection request may include the module identity of the target hardware module and the memory identity of the target memory block.
  • the module identification may include the module identification of the target hardware module.
  • the module identity identifier may further include the module identifier of the target hardware module and the processing channel identifier of the target hardware module, and the processing channel identifier indicates the channel occupied by the target hardware module.
  • the memory identity identifier may be set when the memory management module configures the target memory block.
  • the implementation form of the module identity and the memory identity are, for example, handles.
  • a handle can be described as an identifier that is used to identify an object or item.
  • the object or item can be, for example, a module, task, instance, block of memory, control ( control) resources (resource), etc.
  • the detection request may include the handle of the target hardware module and the handle of the target memory block.
  • the handle of the target memory block may include the memory identity identifier of the target memory block and the address of the target memory block, and the address may be, for example, the virtual address of the target memory block.
  • Step S102 Determine whether the target hardware module and the target memory block belong to the same media path.
  • step S103 is executed.
  • the media path in this embodiment refers to SMP
  • the SMP is created by application software.
  • the created SMP may include at least one SMP.
  • each SMP in the at least one SMP corresponds to a path identifier
  • each path identifier is unique
  • each path identifier indicates a corresponding SMP.
  • the path identifier can be described as SID (session identify), for example.
  • the session management module can obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the media corresponding to the target memory block. path. Then, the session management module can determine whether the first path identifier and the second path identifier are the same. If the first path identifier and the second path identifier are the same, determine that the target hardware module and the target memory block belong to the same media path; if the first path identifier Different from the second path identifier, it is determined that the target hardware module and the target memory block do not belong to the same media path.
  • step S102 is only an implementation example of step S102 in a conventional scenario. In other implementation scenarios, this application can implement step S102 in other ways.
  • the session management module can determine whether the target hardware module and the target memory block belong to the target media channel.
  • the target media path may be any SMP in the created SMP, and the path identifier of the target media path may be described as the target path identifier.
  • the session management module may obtain the first path identifier of the target hardware module and the second path identifier of the target memory block.
  • the first path identifier indicates the media path corresponding to the target hardware module
  • the second path identifier indicates the media corresponding to the target memory block. path.
  • the session management module can detect whether the first path identifier and the second path identifier are the same as the target path identifier. If the first path identifier is the same as the target path identifier, and the second path identifier is the same as the target path identifier, determine the target hardware module and The target memory block belongs to the target media channel.
  • the target media path needs to access the data stream in the memory block by calling the hardware module to achieve the processing task, it is first necessary to determine whether the target hardware module and the target memory block belong to the target media path. If both the target hardware module and the target memory block belong The target media channel can further determine whether the target hardware module has access rights to the target memory block; otherwise, it means that the current access request is illegal. For example, the access request may be cross-media channel access, or the target media channel is not allowed The target hardware module is called, or the target memory block cannot be accessed.
  • the electronic device 10 may, for example, adopt the following at least two optional implementation manners to execute "obtain the first path identifier of the target hardware module and the second path identifier of the target memory block".
  • the session management module may obtain the module identity of the target hardware module, and then determine the first path identity corresponding to the module identity in the first correspondence.
  • the session management module can obtain the memory identity of the target memory block, and determine the second path identity corresponding to the memory identity in the first correspondence.
  • the module identity identifier includes, for example, the module identifier of the target hardware module and the processing channel identifier of the target hardware module.
  • the first corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier.
  • One path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block.
  • the same path identifier corresponds to at least One hardware module and at least one memory block belong to the media channel indicated by the channel identifier. It can be understood that all the path identifiers in the first correspondence relationship indicate SMP.
  • the first corresponding relationship may be established when the electronic device 10 creates the SMP. For the embodiments of creating the SMP, please refer to the following description of this specification.
  • the first correspondence may be as shown in Table 1.
  • the "passage 01” and “passage 02” in Table 1 are both the pass mark.
  • “(Module A, processing channel 01)” is the module identity of hardware module 01, where “module A” is the module identifier of hardware module 01, and “processing channel 01” is the identifier of the processing channel occupied by hardware module 01. The meanings of other module identities in Table 1 are similar, and will not be repeated here.
  • “(Virtual address 01, first identifier)” is the handle of memory block 01, where "virtual address 01” is the virtual address of memory block 01, and “first identifier” is the memory identity identifier of memory block 01. The meanings of other memory handles in Table 1 are similar, and will not be repeated here.
  • the hardware module 01 indicated by “(module A, processing channel 01)”, the hardware module 02 indicated by “(module B, processing channel 10)", and the hardware module indicated by “(module C, processing channel 32)” The hardware module 03, and the memory block 01 indicated by “(virtual address 01, first identifier)", and the memory block 02 indicated by “(virtual address 02, second identifier)” belong to the SMP indicated by the path identifier "path 01".
  • Block 05 belongs to the SMP indicated by the path identifier "path 02".
  • the handle of the target hardware module is, for example, (module A, processing channel 01), and the handle of the target memory block is, for example, (virtual address 02, second identification).
  • the target hardware module and the target memory block belong to the same media path, that is, the SMP indicated by "path 01".
  • the handle of the target hardware module is, for example, (module D, processing channel 15), and the handle of the target memory block is, for example, (virtual address 02, second identification).
  • the target hardware module belongs to the "path”
  • the target memory block belongs to the SMP indicated by "Path 01"
  • the target hardware module and the target memory block do not belong to the same media path.
  • Table 1 is only a schematic example, and should not constitute a limitation to the first correspondence described in this application. In other implementation manners, the implementation form of the first correspondence relationship and the expression manner of various identities are not limited to those shown in Table 1. No more details here.
  • the session management module may obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence. Furthermore, the session management module can obtain the target address to be accessed according to the memory identity of the target memory block, and then transmit the target address to the memory management module. The memory management module may determine the second path identifier corresponding to the target memory block in the second correspondence, and then the memory management module may transmit the second path identifier to the session management module.
  • the target address may be a virtual address of the target memory block, for example.
  • the second correspondence includes the correspondence between the address of the memory block and the channel identifier of the media channel to which the corresponding memory block belongs.
  • the information contained in the second correspondence is, for example, attribute information corresponding to a memory block, and the attribute information of the memory block may be implemented in the form of a mapping table.
  • the attribute information of the memory block may also include the memory type of the memory block.
  • the second correspondence may include the address of the memory block, the type of the memory block, and the channel identifier of the media channel to which the corresponding memory block belongs.
  • mapping table of a memory block is shown in Table 2.
  • Table 2 is the attribute information mapping table of memory block 01
  • virtual address 01 refers to the virtual address corresponding to memory block 01
  • physical address 01 refers to the physical address corresponding to memory block 01
  • path 01 refers to the media path to which memory block 01 belongs
  • the first identifier means that the memory identity identifier of the memory block 01 is set as the first identifier.
  • the memory management module may set the identification register in the IOMMU according to the first identification to set the access authority of the hardware module corresponding to the IOMMU to the memory block 01.
  • Table 2 is only a schematic example, and should not constitute a limitation to the second correspondence described in this application. In other implementation manners, the implementation form of the second correspondence relationship may be different from Table 2. No more details here.
  • the session management module needs to detect whether the target hardware module and the target memory block belong to the same SMP, so as to avoid the hardware module of the first SMP under TEE from accessing the second SMP.
  • the secure memory block can improve the security of SMP.
  • Step S103 When the target hardware module and the target memory block belong to the same media path, it is determined whether the target hardware module has access authority to the target memory block.
  • step S104 is executed.
  • the access authority of any hardware module to the memory block is set during the creation of the SMP, and will not be detailed here.
  • the step of determining whether the target hardware module has access authority to the target memory block may be performed by the session management module.
  • the session management module can obtain the module identity of the target hardware module and the memory identity of the target memory block.
  • the session management module layer can read the third correspondence from the memory area corresponding to the policy management module, and then the session management The module detects whether there is an access authority identifier corresponding to the module identity identifier and the memory identity identifier in the third correspondence relationship, if the third correspondence relationship is set with the access authority identifier corresponding to the module identity identifier and the memory identity identifier ,
  • the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • the module identity is, for example, the module identity of the target hardware module.
  • the third correspondence relationship is preset and stored in the memory area corresponding to the policy management module, and includes the correspondence relationship between the module identity identifier, the memory identity identifier, and the access authority identifier.
  • the third correspondence relationship may include a correspondence relationship between a module identifier, a memory identifier, and an access authority identifier. Exemplarily, the third correspondence is shown in Table 3.
  • Table 3 shows four types of memory identification identifiers.
  • Read identifier means that the hardware module indicated by the module identifier in Table 3 has read operation authority for the memory block of the type indicated in the column.
  • Write identifier refers to the table If the hardware module indicated by the module identification in this column has the write operation authority to the memory block of the indicated type in the column, the same applies,
  • read identification and write identification means that the hardware module indicated by the module identification in the column in Table 3
  • the memory blocks of the listed types have read operation permissions and write operation permissions.
  • the hardware module indicated by module A has read operation authority for the memory block indicated by the first identifier; the hardware module indicated by module B has read operation authority and write operation authority for the memory block indicated by the first identifier; the hardware module indicated by module A
  • the memory block indicated by the second identifier has the write operation permission, which will not be listed here in this application.
  • Table 3 is only a schematic example, and should not constitute a limitation to the third correspondence described in this application.
  • the third correspondence may also include more or fewer correspondences between memory identity identifiers, module identifiers, and access authority identifiers. No more details here.
  • each hardware module has a certain function, and different hardware modules can handle different types of media streams correspondingly.
  • the function of the demultiplexing module is to descramble the TS
  • the function of the hardware display module is to display the video corresponding to the video data.
  • the relevant technical personnel can set the type of memory block corresponding to the type of the stored media stream, and then, according to the operation authority of each hardware module to the corresponding type of media stream, set the access authority of the corresponding hardware module to the corresponding type of memory block .
  • relevant technicians may determine the identity of the memory block storing the TS as the first identity to identify, and the identity of the memory block storing the video data as the second identity.
  • the multiplex distribution module has read operation authority and write operation authority for the first identifier, and the multiplex distribution module does not have any access authority for the second identifier.
  • the hardware display module has read operation authority for the second identifier, but does not have any access authority for the first identifier.
  • the relevant technicians correspondingly store the module identification, the first identification, and the read identification and the write identification of the multiplexed module in the third correspondence relationship, and correspond to the module identification, the second identification and the read identification of the hardware display module Stored in the third correspondence. Therefore, if the access authority identifier corresponding to the module identity identifier and the memory identity identifier is not set in the third correspondence, it means that the target hardware module does not have access authority to the target memory block.
  • the hardware module and the IOMMU module have a one-to-one correspondence.
  • the target hardware module corresponds to the target IOMMU module.
  • the target IOMMU module includes an identification register.
  • the identification register includes at least one memory identity that the target hardware module has access rights to.
  • the memory identity of the target memory block can be obtained, and then it is determined whether the at least one memory identity includes the memory identity, and when the at least one memory identity with access permission includes In the case of the memory identity identifier, the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  • the identification register includes a read identification register and a write identification register.
  • the read identification register includes at least one memory identification with read operation authority
  • the write identification register includes at least one memory identification with write operation authority.
  • the access authority includes read operation authority and write operation authority. Therefore, determining whether the target hardware module has access authority to the target memory block may include: determining the at least one memory identity with read operation authority Whether the identifier includes the memory identity identifier, and when the at least one memory identity identifier with read operation permission includes the memory identity identifier, the target hardware module has the read operation permission on the target memory block. Alternatively, it is determined whether the at least one memory identity with write operation permission includes the memory identity, and when the at least one memory identity with write operation permission includes the memory identity, the target hardware module pairs The target memory block has write permission.
  • the bitmap of the memory identity can be maintained in the identification register, for example, the bitmap of the memory identity can include 64 bits, and each of the 64 bits of the bitmap uniquely indicates one kind Memory type, for example, the 21st bit in the bitmap indicates memory type 21.
  • the value of the field of each memory identification bit can indicate whether the hardware module has access rights to this type of memory. This application may describe the value of the field as indicating whether the identification register contains the corresponding memory identification.
  • the field value "1" is an enable value, indicating that the hardware module has access rights to the type of memory indicated by the corresponding bit, that is, the identification register contains the corresponding memory identity; the field value "0" is forbidden
  • the access value indicates that the hardware module has no access authority to the type of memory indicated by the corresponding bit, that is, the identification register does not contain the corresponding memory identification.
  • the field value "0" is the enable value, indicating that the hardware module has access rights to the type of memory indicated by the corresponding bit, that is, the identification register contains the corresponding memory identity;
  • the field value "1" is The access prohibited value indicates that the hardware module has no access authority to the type of memory indicated by the corresponding bit, that is, the identification register does not contain the corresponding memory identification.
  • the initial values of the 64-bit fields shown in FIG. 4 may all be forbidden values.
  • the TEE memory management module 2122 may modify the field values of some bits in the bitmap from the forbidden values as required. Is the enable value. No more details here.
  • the identification register may include a read operation authority identification register and a write operation authority identification register, the bitmap in the read operation authority identification register and the bitmap in the write operation authority identification register are shown in Figure 4, respectively.
  • the field value of the bit in the bitmap of the operation authority identification register indicates whether the hardware module has read authority for the type of memory block indicated by the corresponding bit.
  • the bit field value in the bitmap of the write operation authority identification register indicates whether the hardware module has write authority for the type of memory block indicated by the corresponding bit.
  • the memory identity identifier of the target memory block is 21, and the 21st bit in the bitmap of the read operation authority identification register is, for example, the enable value "1", indicating that the target hardware module has read operation authority to the target memory block.
  • the 21st bit in the bitmap of the write operation authority identification register is, for example, the access prohibited value "0", indicating that the target hardware module has no write operation authority to the target memory block.
  • FIG. 4 is only a schematic implementation manner, and does not limit the identification register described in the present application. In other implementation manners, the identification register may also be implemented in other implementation manners, which is not limited in this application.
  • the electronic device 10 detects the access authority of the target hardware module to the target memory block, thereby being able to avoid access to hardware modules that have no access authority to the media stream in the target memory block.
  • the media stream in the target memory block can in turn improve the security of SMP.
  • Step S104 When the target hardware module has access authority to the target memory block, the target hardware module accesses the target memory block.
  • step S103 when the target hardware module has read operation authority to the target memory block, the target hardware module reads the media stream data in the target memory block.
  • the target hardware module has the write operation authority to the target memory block, the target hardware module writes media stream data into the target memory block.
  • the electronic device before the hardware module accesses the secure memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP, thereby avoiding cross-SMP cross access of the hardware module. If the hardware module and the corresponding secure memory block belong to the same SMP, the electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block. The secure memory block, otherwise, the hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
  • the embodiment shown in FIG. 3 takes the use process of SMP as an example to introduce the secure access method of this application. According to the description of the foregoing embodiments, the settings of some correspondences and the like in the embodiment shown in FIG. 3 are completed in the stage of creating the SMP. The implementation process of creating SMP involved in this application is introduced below.
  • the application software running in the TEE software application layer can transmit a request to create a media path to the TEE software driver layer.
  • the media path to be created in this embodiment is an SMP.
  • the TEE software driver layer driver can generate the path identifier of the SMP to be created, such as "path 01".
  • the driver TEE software driver layer can configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block.
  • the TEE software driver layer correspondingly stores the path identifier, the module identifier of the at least one hardware module, and the memory identifier of the at least one memory block, and obtains that the first correspondence shown in Table 1 includes the path 01 Correspondence.
  • the at least one hardware module and the at least one memory block constitute the media path.
  • the at least one hardware module includes, for example, a target hardware module.
  • configuring at least one memory block by the TEE software driver layer may include: the TEE software driver layer may allocate at least one secure memory block according to a request of the application software, and further, set each of the at least one secure memory block according to the third correspondence relationship. The memory identity of a secure memory block. Then, the TEE software driver layer may set the attribute information of each secure memory block in at least one secure memory block, so that the virtual address, memory identity identifier, and channel identifier 01 of each secure memory block correspond to obtain the second correspondence.
  • the TEE software driver layer can also obtain at least one memory identity that each hardware module has access rights in the at least one hardware module from the third correspondence, and then assign at least one memory identity that the corresponding hardware module has access rights to , Set in the IOMMU identification register corresponding to the corresponding hardware module.
  • the TEE software driver layer may obtain at least one memory identity with access permission of the target hardware module from the third correspondence, and then set the at least one memory identity with access permission in the identity register of the target IOMMU.
  • the TEE software driver layer obtains from the third correspondence relationship at least one memory identity that the target hardware module has access rights to, and then corresponds to the memory identity in the corresponding register of the target IOMMU The field value is changed from the forbidden field value to the enabled value.
  • the electronic device 10 is in the SMP creation stage, that is, the corresponding relationship between the path identifier of the SMP and the hardware module and secure memory block belonging to the SMP is established, and each hardware module in the SMP is bound to the hardware The safe memory block associated with the module.
  • SMP provides a data basis for detecting the relationship between the target hardware module and the target secure memory block, and whether the target hardware module has access rights to the target secure memory block. Furthermore, the safety of SMP is improved.
  • FIG. 5 provides a structural diagram of an electronic device 20, and the electronic device 20 supports TEE.
  • the TEE side of the electronic device 20 includes: a software part and a hardware part.
  • the software part includes TEE application, session management module (session manager), memory management module (memory manager), policy management module (policy manager) and TEE driver module.
  • the software part is a functional module implemented by software instructions or software codes, and these software instructions or software codes run on the processor to implement corresponding functions.
  • the hardware part includes demux, hardware decoder, VPSS and VDP, and IOMMU corresponding to each hardware module.
  • the hardware part also includes TEE storage module. Among them, the identification register corresponding to the read operation authority and the identification register corresponding to the write operation authority are set in each IOMMU.
  • the TEE application runs on the TEE software application layer of the electronic device 10.
  • the session management module, the memory management module, the policy management module and the TEE driver module run on the TEE software driver layer of the electronic device 10.
  • the strategy table (that is, the third correspondence) described in this embodiment may be as shown in Table 4.
  • the first memory identity identifier in the first column and the second memory identity identifier in the second column indicate the same memory identity type.
  • the first memory identity can be used as a software-level identity for this type of memory to facilitate the call and management of the session manager, and the second memory identity can be used as an identification register indicating that this type of memory block is in the IOMMU The corresponding bit in.
  • the third column is the module identifier.
  • the hardware module indicated by the module identifier has access authority to the memory blocks of the type indicated in the first and second columns, and the corresponding access authority is marked by the access authority identifier in the fourth column.
  • the audio digital signal processing (AudioDSP) shown in Table 4 is a kind of demux, and the stream cipher belongs to the hardware decryption module or the hardware encryption module.
  • the fifth column is the media channel intent identifier, which is used to indicate the intention of the media channel to which the hardware module and the memory block belong.
  • the first memory identification "video elementary stream data memory” is used for the session management module to manage and call this type of memory block, and the memory block indicated by "video elementary stream data memory” is IOMMU's identification register corresponds to the 21st bit in the bitmap.
  • the hardware module indicated by demux has the read operation authority and the write operation authority for the memory block whose type is "video elementary stream data memory” or the tag is "21".
  • the hardware module indicated by demux can be used in SMP intended to "watch”.
  • FIG. 5 is only an exemplary description of the electronic device of this application, and does not constitute any limitation to the electronic device involved in this application.
  • the electronic device involved in this application may include more or fewer hardware modules. Accordingly, the electronic device involved in this application may include hardware modules with other functions.
  • the functional software of the electronic device can also adopt other forms of expression. No more details here.
  • FIG. 6A illustrates a signaling interaction diagram of a method 200 for creating SMP.
  • the SMP creation method 200 (hereinafter referred to as the method 200) includes the following steps:
  • Step S201 The TEE application sends a request for creating a first SMP to the session management module.
  • Step S202 the session management module generates a path identifier "SID01".
  • SID01 is used to identify the first SMP to be created.
  • Step S203 the session management module occupies the demux module.
  • the session management module is called by the TEE application to occupy the demux module.
  • the session management module can occupy the processing channel 20 of the demux module.
  • the session management module can generate a handle of the demux module, and store the handle corresponding to the path identifier "SID01".
  • the handle includes the module identification demux and the processing channel 20.
  • the TEE application can also call the session management module to occupy other hardware modules that make up the first SMP, such as decoder, VPSS, and VDP, and store the handles of other hardware modules corresponding to "SID01". No more details here.
  • Step S204 the memory management module configures the first secure memory.
  • the TEE application calls the memory management module to configure the first secure memory.
  • the TEE application calls the memory management module, it can send "SID01" to the memory management module.
  • the memory management module can allocate any secure memory in the TEE storage module as the first secure memory. Then, the memory management module can allocate the first memory identity and the second memory identity to the first secure memory according to the intention of the first SMP and the policy table shown in Table 4.
  • the first memory identity of the first secure memory is, for example, "video elementary stream data memory”
  • the second memory identity of the first secure memory is, for example, "21”.
  • the memory management module uses "21" and "SID01" as the attribute information of the first secure memory, and establishes a mapping table of "21", "SID01” and the virtual address of the first secure memory.
  • the mapping table is shown in Table 2, which is not detailed here.
  • the memory management module may also generate a handle to the first secure memory, and the handle of the first secure memory includes, for example, the first memory identification "video elementary stream data memory" of the first secure memory and the virtual address of the first secure memory.
  • Step S205 The memory management module sends the handle of the first secure memory to the session management module.
  • the session management module may store the handle of the first secure memory corresponding to "SID01".
  • the TEE application can also call the memory management module to configure the second secure memory and the third secure memory, generate the handle of the second secure memory and the handle of the third secure memory, and then, similarly transfer the handle of the second secure memory and the third secure memory.
  • the handle of the safe memory is sent to the session management module.
  • the session management module stores the handle of the second secure memory and the handle of the third secure memory corresponding to "SID01" to form a first corresponding relationship. No more details here.
  • the second secure memory is, for example, "video frame data memory”, and the corresponding tag is "24";
  • the third secure memory is, for example, "video display data memory”, and the corresponding tag is "25”.
  • Step S206 the memory management module sets the access authority of the demux module to the first memory block.
  • the memory management module sets the identification register in the IOMMU corresponding to the demux module to set the access authority of the demux module to the first secure memory.
  • the memory management module can modify the value of the 21st field of the read operation authority identification register in the IOMMU to "1", and change the value of the 21st field of the write operation authority identification register in the IOMMU Modify it to "1".
  • the memory management module can also set the field values of the tag of the second secure memory and the tag of the third secure memory in the identification register of the IOMMU to set the access authority of the demux module to the second secure memory and the third secure memory.
  • the memory management module can also set other hardware modules to access the first secure memory, the second secure memory, and the third secure memory, respectively. No more details here.
  • the decoder module has read operation authority for the first secure memory, and has read operation authority and write operation authority for the second secure memory; for example, the VPSS module has read operation authority for the second secure memory and has read operation authority for the third secure memory. It has read operation authority and write operation authority; for example, the VDP module has read operation authority for the third secure memory.
  • the electronic device 20 may also create a second SMP, a third SMP, etc., and the creation process of the second SMP and the third SMP are similar to the method 200, and will not be described in detail here.
  • FIG. 6B illustrates a signaling interaction diagram of a method 300 for transmitting a secure media stream.
  • the method 300 for transmitting secure media streams includes the following steps:
  • Step S301 the session management module receives the detection request.
  • the detection request in this embodiment is sent by the demux module, for example.
  • the detection request includes, for example, the demux module identifier and the handle of the third secure memory.
  • Step S302 The session management module determines that the demux module and the third secure memory belong to the same SMP according to the first correspondence.
  • the session management module can obtain the SID01 corresponding to the demux module from the first correspondence, and the session management module can obtain the SID01 corresponding to the third secure memory handle from the first correspondence. Based on this, the session management module determines the demux module and the third Secure memory is the first SMP.
  • Step S303 The session management module determines according to the policy table that the demux module has no access authority to the third secure memory.
  • the session management module can traverse Table 4, and furthermore, it can be determined that the corresponding relationship between the demux module and the "video display data memory" is not set in Table 4, thereby determining that the demux module has no access authority to the third secure memory. Furthermore, the session management module may not send any instructions to the TEE driver module, so that the TEE driver module does not trigger the demux module to access the third secure memory.
  • step S303 is an optional step. Even if step S303 is not executed, after step S302, if the demux module accesses the third secure memory, the tag "25" field in the IOMMU identification register corresponding to the demux module The value is "0", so that the demux module still cannot access the third secure memory.
  • FIG. 6A and FIG. 6B are only schematic descriptions, and do not limit the technical solution of the present application.
  • the SMP involved may be other SMPs, and the hardware modules and memory blocks to be detected may also be other blocks, which will not be described in detail here.
  • the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP, if the hardware module and the corresponding secure memory block belong to the same SMP , The electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block; otherwise, the hardware module cannot access the secure memory block. Secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
  • the solutions of the secure access method provided in this application are introduced from the perspective of the physical structure of the electronic device hardware, the software architecture, and the actions performed by each software and hardware.
  • Those skilled in the art should easily realize that in combination with the establishment of the correspondence relationship described in the embodiments disclosed herein and the processing steps of performing detection according to the correspondence relationship, this application can not only be implemented in the form of hardware or a combination of hardware and computer software . Whether certain functions are executed by hardware or computer software-driven hardware depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each of the above specific applications, but such implementation should not be considered as going beyond the scope of the embodiments of the present application.
  • the above-mentioned electronic device 10 and the electronic device 20 may implement the above-mentioned functions in the form of functional modules.
  • the electronic device 70 may include a determination module 701, a judgment module 702, and a calling module 703.
  • the electronic device 70 can be used to execute part of the non-IOMMU security access method in any of the embodiments illustrated in FIG. 3, FIG. 6A, and FIG. 6B.
  • the determining module 701 is used to determine the target hardware module and the target memory block according to the detection request; the determining module 702 is used to determine whether the target hardware module and the target memory block belong to the same media path; the determining module 701 is also used to When the target hardware module and the target memory block belong to the same media path, determine whether the target hardware module has access rights to the target memory block; call the module 703 for access to the target memory block when the target hardware module When authorized, call the target hardware module to access the target memory block.
  • the electronic device 70 provided in the present application can provide the function of detecting whether the target hardware module and the target memory block belong to the same media channel, and whether the target hardware module has access rights to the target memory block, so that the target hardware module Before being triggered and the target memory block, double detection is performed, so that the target memory block can be safely accessed.
  • the electronic device 70 may also include an acquisition module, a detection module, a generation module, a configuration module, and an establishment module.
  • the above modules are used to implement different functions.
  • the acquiring module is configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module.
  • the second path identifier indicates the media path corresponding to the target memory block.
  • the obtaining module is used to obtain a request for creating a media path.
  • the detection module is used to detect whether the first path identifier and the second path identifier are the same.
  • the detection module is used to detect whether the third correspondence relationship is set with the module.
  • the identity identifier and the access authority identifier corresponding to the memory identifier, and the third correspondence relationship includes the corresponding relationship between the module identifier, the memory identifier, and the access authority identifier.
  • the generating module is also used to generate the path identifier of the media path.
  • the configuration module is also used to configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one memory block Compose the media channel.
  • the establishing module is further configured to establish the first correspondence relationship according to the path identifier, the module identity of the at least one hardware module, and the memory identity of the at least one memory block.
  • each module in the electronic device 70 For other functions of each module in the electronic device 70, reference may be made to the related descriptions in the embodiments corresponding to the method 100 to the method 300, which will not be repeated here.
  • the electronic device 71 includes a processor 711, a target hardware module 712, a target IOMMU 713, and a target memory block 714.
  • the target memory block 714 may be configured to store secure media streams.
  • the target hardware module 712 may be configured to access a memory block to write media stream data to the accessed memory block or to read media stream data from the accessed memory block.
  • the processor 711 can execute the configuration of the hardware module and the memory block in the method 100 to the method 300, and the detection of the permissions of the target hardware module 712 and the target memory block 714.
  • the target IOMMU 713 can be coupled with an identification register 715.
  • the identification register 715 contains the memory identification of the memory block that the target hardware module 712 can access.
  • the target IOMMU 713 can determine whether the target hardware module 712 can access the target according to the configuration in the identification register 715.
  • the memory block 714 performs authentication.
  • the processor 711 may be configured to determine the target hardware module 712 and the target memory block 714 according to the detection request.
  • the processor 711 may also be used to determine whether the target hardware module 712 and the target memory block 714 belong to the same media path, and when the target hardware module 712 and the target memory block 714 belong to the same media path, determine the target Whether the hardware module 712 has access authority to the target memory block 714.
  • the target hardware module 712 is configured to access the target memory block 714 when the target hardware module 712 has access authority to the target memory block 714.
  • the target hardware module 712 after the target hardware module 712 receives an instruction to access the target memory block 714, it can obtain the memory identity of the target memory block 714. Then, the target IOMMU 713 searches for the memory identity in the read operation authority identification register and the write operation authority identification register of the target IOMMU 713, and then determines whether the target IOMMU 713 has read operation authority and the target memory block 714 according to the search result. / Or write operation permission.
  • the processor 711 in FIG. 7B can implement the functions of each software layer of the TEE in FIG. 2, the target hardware module 712 can implement the functions of the TEE hardware module in FIG. 2, and the target IOMMU 713 can implement the diagram For the function of the TEE IOMMU module in 2, the target memory block 714 can be equivalent to any secure memory block in FIG. 2.
  • the processor 711 in FIG. 7B can implement the functions of the software part in FIG. 5, the target hardware module 712 may be equivalent to any hardware module shown in FIG. 5, and the target IOMMU 71 is determined according to the target hardware module 712,
  • the target memory block 714 can be equivalent to any secure memory block in FIG. 5.
  • the application also provides a computer storage medium corresponding to the electronic device.
  • the computer storage medium provided in any device can store a program. When the program is executed, the security provided by the method 100 to the method 300 can be implemented. Access some or all of the steps in each embodiment of the processing method.
  • the storage medium in any device can be a magnetic disk, an optical disc, a read-only memory (read-only memory, ROM), or a random access memory (random access memory, RAM), etc.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices.
  • the computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instruction can be passed from a website, computer, server, or message center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a message storage device such as a server or a message center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, rather than the implementation process of the embodiment. Constitute any limitation.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Storage Device Security (AREA)

Abstract

Disclosed are a secure access method and an electronic device. The secure access method comprises: determining a target hardware module and a target buffer block according to a detection request; determining whether the target hardware module and the target buffer block belong to the same media path; when the target hardware module and the target buffer block belong to the same media path, determining whether the target hardware module has access rights to the target buffer block; and when the target hardware module has the access rights to the target buffer block, invoking the target hardware module to access the target buffer block. It can be seen that, by using the technical solution of the present application, an electronic device performs dual detection on a hardware module and a buffer block before the hardware module accesses the buffer block, such that the buffer block can be accessed securely, thereby avoiding the leakage of a secure media stream from a secure buffer block, and improving the security of an SMP.

Description

安全访问方法及电子设备Safe access method and electronic equipment 技术领域Technical field
本申请涉及多媒体技术领域,尤其涉及一种安全访问方法及电子设备。This application relates to the field of multimedia technology, in particular to a secure access method and electronic equipment.
背景技术Background technique
媒体通路是媒体流的传输路径。一条媒体通路由至少一个硬件模块和至少一个内存(buffer)组成,该至少一个硬件模块中的每个硬件模块可以访问该至少一个内存中的任一内存。安全媒体通路(secure media path,SMP)是传输存在安全要求的媒体流的传输路径,本申请将存在安全要求的媒体流称为安全媒体流。为保证安全媒体流在传输过程中满足安全要求,非安全环境下的应用对SMP中的内存通常没有访问权限,本申请将SMP中的内存称为安全内存块。The media path is the transmission path of the media stream. A media path is composed of at least one hardware module and at least one memory (buffer), and each hardware module in the at least one hardware module can access any memory in the at least one memory. A secure media path (SMP) is a transmission path for transmitting media streams with security requirements. In this application, media streams with security requirements are referred to as secure media streams. In order to ensure that the secure media stream meets the security requirements during the transmission process, applications in a non-secure environment generally do not have access rights to the memory in the SMP. This application refers to the memory in the SMP as a secure memory block.
然而,在实际使用中,安全媒体流仍然会从安全内存块中被泄露。可见,现有SMP安全性较差。However, in actual use, the secure media stream will still be leaked from the secure memory block. It can be seen that the existing SMP has poor security.
发明内容Summary of the invention
本申请提供了一种安全访问方法及电子设备,以解决现有SMP安全性差的问题。This application provides a secure access method and electronic equipment to solve the problem of poor security of existing SMPs.
第一方面,本申请提供了一种安全访问方法,该方法包括:根据检测请求确定目标硬件模块和目标内存块;判断该目标硬件模块和该目标内存块是否属于同一条媒体通路;在该目标硬件模块和该目标内存块属于同一条媒体通路时,确定该目标硬件模块对该目标内存块是否有访问权限;在该目标硬件模块对该目标内存块有访问权限时,调用该目标硬件模块访问该目标内存块。In the first aspect, this application provides a secure access method, which includes: determining a target hardware module and a target memory block according to a detection request; determining whether the target hardware module and the target memory block belong to the same media path; When the hardware module and the target memory block belong to the same media path, determine whether the target hardware module has access rights to the target memory block; when the target hardware module has access rights to the target memory block, call the target hardware module to access The target memory block.
其中,本申请在TEE侧执行。例如,在硬件模块访问内存块之前,本申请中的电子设备首先检测该硬件模块与该硬件模块待访问的内存块是否属于同一SMP,从而能够避免第一SMP的硬件模块访问第二SMP的安全内存。当该硬件模块和相应内存块属于同一SMP时,电子设备进一步检测该硬件模块对该内存块是否有访问权限。当该硬件模块对该内存块有访问权限时,该硬件模块按照访问权限访问该内存块,从而能够规避没有访问权限的硬件模块访问安全内存中的数据而导致安全媒体流的泄露。可见,采用本实现方式,电子设备先检测硬件模块和内存块是否属于同一条媒体通路,在属于同一条媒体通路时再检测硬件模块对内存块是否有访问权限,这样一来通过双重检测,硬件模块只能访问属于同一个安全媒体通路且有访问权限的内存块,避免因不同的安全媒体通路交叉访问或者硬件模块访问了没有访问权限的内存块而导致的安全媒体流从安全内存块中泄露,提高SMP访问内存的安全性。Among them, this application is executed on the TEE side. For example, before the hardware module accesses the memory block, the electronic device in this application first detects whether the hardware module and the memory block to be accessed by the hardware module belong to the same SMP, thereby preventing the hardware module of the first SMP from accessing the security of the second SMP RAM. When the hardware module and the corresponding memory block belong to the same SMP, the electronic device further detects whether the hardware module has access rights to the memory block. When the hardware module has access authority to the memory block, the hardware module accesses the memory block in accordance with the access authority, so as to prevent the hardware module without the access authority from accessing the data in the secure memory to cause the leakage of the secure media stream. It can be seen that with this implementation method, the electronic device first detects whether the hardware module and the memory block belong to the same media channel, and when they belong to the same media channel, it then detects whether the hardware module has access rights to the memory block. In this way, through double detection, the hardware Modules can only access memory blocks that belong to the same secure media channel and have access rights, to avoid the leakage of secure media streams from the secure memory blocks caused by cross access of different secure media channels or hardware modules accessing memory blocks without access rights , Improve the security of SMP access to memory.
一种可能的实现方式中,判断该目标硬件模块和该目标内存块是否属于同一条媒体通路,包括:获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路;检测该第一通路标识和该第二通路标识是否相同;在该第一通路标识和该第二通路标识相同时,确定该目标硬件模块和该目标内存块属于同一条媒体通路。其中,本申 请中每条SMP由一个唯一的通路标识表示,进而,电子设备能够根据通路标识,准确的检测目标硬件模块和目标内存块是否属于同一条SMP。In a possible implementation manner, determining whether the target hardware module and the target memory block belong to the same media path includes: obtaining the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first A path identifier indicates the media path corresponding to the target hardware module, the second path identifier indicates the media path corresponding to the target memory block; detecting whether the first path identifier and the second path identifier are the same; in the first path identifier and When the second path identifiers are the same, it is determined that the target hardware module and the target memory block belong to the same media path. Among them, each SMP in this application is represented by a unique path identifier. Furthermore, the electronic device can accurately detect whether the target hardware module and the target memory block belong to the same SMP based on the path identifier.
一种可能的实现方式中,判断该目标硬件模块和该目标内存块是否属于同一条媒体通路,包括:获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路;检测该第一通路标识和该第二通路标识与目标通路标识是否相同,该目标通路标识用于指示目标媒体通路;在该第一通路标识与该目标通路标识相同时,确定该目标硬件模块属于该目标媒体通路;以及在该第二通路标识与该通路标识相同时,确定该目标内存块属于该目标媒体通路。采用本实现方式,电子设备可以判断目标硬件模块和目标内存块是否属于目标媒体通路,当目标硬件模块属于该目标媒体通路时,该目标媒体通路可以调用该目标硬件模块,当目标内存块属于该目标媒体通路时,该目标内存块为该目标媒体通路可以访问的内存块,避免目标媒体通路调用了不属于该目标媒体通路的硬件模块或者访问了不属于该目标媒体通路的内存块。本实施例中,目标媒体通路可以是已创建的SMP中的任意一条SMP。In a possible implementation manner, determining whether the target hardware module and the target memory block belong to the same media path includes: obtaining the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first A path identifier indicates the media path corresponding to the target hardware module, the second path identifier indicates the media path corresponding to the target memory block; it is detected whether the first path identifier and the second path identifier are the same as the target path identifier, the target path The identifier is used to indicate the target media path; when the first path identifier is the same as the target path identifier, determine that the target hardware module belongs to the target media path; and when the second path identifier is the same as the path identifier, determine the target The memory block belongs to the target media channel. With this implementation method, the electronic device can determine whether the target hardware module and the target memory block belong to the target media channel. When the target hardware module belongs to the target media channel, the target media channel can call the target hardware module. When the target media channel is used, the target memory block is a memory block that the target media channel can access, so as to prevent the target media channel from calling a hardware module that does not belong to the target media channel or accessing a memory block that does not belong to the target media channel. In this embodiment, the target media path can be any SMP among the created SMPs.
一种可能的实现方式中,该获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,具体包括:获取该目标硬件模块的模块身份标识,并在第一对应关系中确定与该模块身份标识对应的该第一通路标识;获取该目标内存块的内存身份标识,并在该第一对应关系中确定与该内存身份标识对应的该第二通路标识;其中,该第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于该同一个通路标识指示的媒体通路。其中,第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于该通路标识指示的媒体通路。采用本实现方式,为本申请检测过程的实施提供了数据依据。In a possible implementation, the acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically includes: acquiring the module identity identifier of the target hardware module, and in the first correspondence relationship Determine the first path identifier corresponding to the module identity; obtain the memory identity identifier of the target memory block, and determine the second path identifier corresponding to the memory identity in the first correspondence; wherein, the first A corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier. A path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block. At least one hardware module corresponds to the same path identifier. And at least one memory block belong to the media channel indicated by the same channel identifier. Wherein, the first corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier. One path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block. The same path identifier corresponds to at least One hardware module and at least one memory block belong to the media channel indicated by the channel identifier. This implementation method provides a data basis for the implementation of the detection process of this application.
一种可能的实现方式中,该获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,具体包括:获取该目标硬件模块的模块身份标识,并根据该模块身份标识在第一对应关系中确定与该模块身份标识对应的该第一通路标识,该第一对应关系包括通路标识与模块身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识,同一个通路标识对应的至少一个硬件模块属于该同一个通路标识指示的媒体通路;获取待访问的目标地址,该目标地址指示该目标内存块,根据该目标地址在第二对应关系中确定该目标内存块对应的该第二通路标识,该第二对应关系包括内存块的地址与该内存块所属媒体通路的通路标识的对应关系。采用本实现方式,通过查询硬件模块与媒体通路标识的第一对应关系获得第一通路标识,通过查询内存块与媒体通路的第二对应关系表获得第二通路标识,为本申请提供了一种示例性的获取第一通路标识和第二通路标识的实现方式。In a possible implementation manner, the acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically includes: acquiring the module identity of the target hardware module, and in accordance with the module identity The first corresponding relationship determines the first path identifier corresponding to the module identity, and the first corresponding relationship includes the corresponding relationship between the path identifier and the module identity. One path identifier corresponds to the module identity of at least one hardware module. At least one hardware module corresponding to the path identifier belongs to the media path indicated by the same path identifier; acquires the target address to be accessed, where the target address indicates the target memory block, and determines the target memory block in the second correspondence relationship according to the target address Corresponding to the second channel identifier, the second correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs. With this implementation, the first path identifier is obtained by querying the first correspondence between the hardware module and the media path identifier, and the second path identifier is obtained by querying the second correspondence table between the memory block and the media path, which provides a method for this application An exemplary method for obtaining the first path identifier and the second path identifier.
一种可能的实现方式中,确定该目标硬件模块对该目标内存块是否有访问权限,包括:获取该目标硬件模块的模块身份标识以及该目标内存块的内存身份标识;检测第三对应关系中是否设置有与该模块身份标识和该内存身份标识对应的访问权限标识,该第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系;在该第三对应关系中设 置有与该模块身份标识和该内存身份标识对应的访问权限标识时,确定该目标硬件模块对该目标内存块有该访问权限标识指示的访问权限。可见,采用本实现方式,在目标硬件模块访问目标内存块之前,检测目标硬件模块对目标内存块的访问权限,从而能够规避对目标内存块中的媒体流无访问权限的硬件模块访问目标内存块中的媒体流,进而能够提高SMP的安全性。In a possible implementation manner, determining whether the target hardware module has access rights to the target memory block includes: obtaining the module identity of the target hardware module and the memory identity of the target memory block; detecting the third correspondence relationship Whether there is an access authority identifier corresponding to the module identity identifier and the memory identifier, the third correspondence relationship includes the corresponding relationship between the module identity identifier, the memory identity identifier, and the access authority identifier; in the third correspondence relationship is set with When the module identity identifier and the access authority identifier corresponding to the memory identity identifier, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block. It can be seen that using this implementation method, before the target hardware module accesses the target memory block, the access permission of the target hardware module to the target memory block is detected, so as to avoid the hardware module that has no access permission to the media stream in the target memory block from accessing the target memory block In turn, the media stream can improve the security of SMP.
一种可能的实现方式中,该目标硬件模块对应目标输入输出内存管理单元IOMMU,该目标IOMMU中包括标识寄存器,该标识寄存器中包括至少一个有访问权限的内存身份标识,该确定该目标硬件模块对该目标内存块是否有访问权限,包括:获取该目标内存块的内存身份标识;确定该至少一个有访问权限的内存身份标识中是否包括该内存身份标识;当该至少一个有访问权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有该访问权限标识指示的访问权限。可见,采用本实现方式,通过在IOMMU模块中设置标识寄存器,鉴别硬件模块对内存块的访问权限,操作简单,易于实现,且鉴权效果较好。In a possible implementation manner, the target hardware module corresponds to the target input-output memory management unit IOMMU, the target IOMMU includes an identification register, and the identification register includes at least one memory identity identifier with access rights, and the target hardware module is determined Whether the target memory block has access authority includes: obtaining the memory identity of the target memory block; determining whether the at least one memory identity with access authority includes the memory identity; when the at least one memory identity with access authority When the memory identity is included in the identity, it is determined that the target hardware module has the access authority indicated by the access authority to the target memory block. It can be seen that by adopting this implementation method, by setting the identification register in the IOMMU module, the access authority of the hardware module to the memory block is identified, the operation is simple, easy to implement, and the authentication effect is better.
一种可能的实现方式中,该访问权限包括读操作权限和写操作权限,该标识寄存器包括读标识寄存器和写标识寄存器,该读标识寄存器中包括至少一个有读操作权限的内存身份标识,该写标识寄存器中包括至少一个有写操作权限的内存身份标识。采用本实现方式,能够分别设置硬件模块对内存块的读操作权限和写操作权限,从而能够准确的鉴权。In a possible implementation manner, the access authority includes a read operation authority and a write operation authority, the identification register includes a read identification register and a write identification register, and the read identification register includes at least one memory identification identifier with read operation authority. The write identification register includes at least one memory identification with write operation authority. By adopting this implementation method, the read operation authority and the write operation authority of the hardware module to the memory block can be respectively set, thereby enabling accurate authentication.
一种可能的实现方式中,确定该目标硬件模块对该目标内存块是否有访问权限,包括:确定该至少一个有读操作权限的内存身份标识中是否包括该内存身份标识;当该至少一个有读操作权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有读操作权限;或者,确定该至少一个有写操作权限的内存身份标识中是否有该内存身份标识;当该至少一个有写操作权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有写操作权限。采用本实现方式,能够分别检测硬件模块对内存块的读操作权限和写操作权限,从而能够准确的鉴权。In a possible implementation, determining whether the target hardware module has access rights to the target memory block includes: determining whether the at least one memory identity with read operation permission includes the memory identity; when the at least one has When the memory identity of the read operation permission includes the memory identity, it is determined that the target hardware module has read operation permission for the target memory block; or, it is determined whether the memory identity is included in the at least one memory identity with the write operation permission Identification; when the at least one memory identity with write operation authority includes the memory identity, it is determined that the target hardware module has write operation authority for the target memory block. By adopting this implementation method, the read operation authority and the write operation authority of the hardware module to the memory block can be detected respectively, thereby enabling accurate authentication.
一种可能的实现方式中,在根据检测请求确定目标硬件模块和目标内存块之前,还包括:获取创建媒体通路的请求;生成该媒体通路的通路标识;配置至少一个硬件模块和至少一个内存块,得到该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识,该至少一个硬件模块和该至少一个内存块组成该媒体通路;根据该通路标识、该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识建立该第一对应关系。采用本实现方式,在创建SMP阶段,即建立好SMP的通路标识与属于该SMP的硬件模块和安全内存块的对应关系,并绑定该SMP中每个硬件模块与该硬件模块相关的安全内存块。从而,在使用SMP过程中,为检测目标硬件模块与目标安全内存块的关系,以及目标硬件模块对目标安全内存块是否具备访问权限,提供数据依据。In a possible implementation manner, before determining the target hardware module and the target memory block according to the detection request, the method further includes: obtaining a request to create a media path; generating a path identifier of the media path; configuring at least one hardware module and at least one memory block , Obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one memory block form the media path; according to the path identifier, the module of the at least one hardware module The identity identifier and the memory identity identifier of the at least one memory block establish the first correspondence relationship. Using this implementation method, in the stage of creating SMP, the corresponding relationship between the path identifier of the SMP and the hardware module and secure memory block belonging to the SMP is established, and each hardware module in the SMP is bound to the secure memory related to the hardware module Piece. Thus, in the process of using SMP, it provides a data basis for detecting the relationship between the target hardware module and the target secure memory block, and whether the target hardware module has access rights to the target secure memory block.
一种可能的实现方式中,在配置至少一个硬件模块和至少一个内存块之后,还包括:从该第三对应关系中获取该目标硬件模块具有访问权限的至少一个内存身份标识;将该具有访问权限的至少一个内存身份标识设置在该目标IOMMU的标识寄存器中。采用本实现方式,通过设置目标IOMMU中的标识寄存器,设置目标硬件模块对目标内存块的访问权限,从而能够通过硬件层面配置目标硬件模块对目标内存块的访问权限,提高SMP的安全性。In a possible implementation manner, after configuring at least one hardware module and at least one memory block, the method further includes: obtaining from the third correspondence relationship at least one memory identity that the target hardware module has access rights; At least one memory identity of the authority is set in the identity register of the target IOMMU. With this implementation method, by setting the identification register in the target IOMMU, the access authority of the target hardware module to the target memory block is set, so that the access authority of the target hardware module to the target memory block can be configured at the hardware level, and the security of the SMP is improved.
一种可能的实现方式中,在配置至少一个硬件模块和至少一个内存块之后,还包括: 将至少一个内存块中每个内存块的虚拟地址、该内存块的内存身份标识和该通道标识对应存储,得到该第二对应关系。采用本实现方式,在创建SMP阶段,即建立好SMP的通路标识与属于该SMP的安全内存块的第二对应关系,从而,在使用SMP过程中,可以通过第二对应关系实现检测目标内存块是否属于目标媒体通路。In a possible implementation manner, after configuring at least one hardware module and at least one memory block, it further includes: mapping the virtual address of each memory block in the at least one memory block, the memory identity identifier of the memory block, and the channel identifier Store to obtain the second correspondence. With this implementation method, in the SMP creation stage, the second correspondence between the path identifier of the SMP and the secure memory block belonging to the SMP is established. Therefore, in the process of using the SMP, the target memory block can be detected through the second correspondence. Whether it belongs to the target media channel.
第二方面,本申请提供了一种电子设备,该电子设备包括处理器,目标硬件模块和目标内存块,其中,该处理器,用于根据检测请求确定该目标硬件模块和该目标内存块;该处理器,还用于判断该目标硬件模块和该目标内存块是否属于同一条媒体通路;该处理器,还用于在该目标硬件模块和该目标内存块属于同一条媒体通路时,确定该目标硬件模块对该目标内存块是否有访问权限;该目标硬件模块,用于在该目标硬件模块对该目标内存块有访问权限时,访问该目标内存块。In a second aspect, this application provides an electronic device that includes a processor, a target hardware module, and a target memory block, where the processor is configured to determine the target hardware module and the target memory block according to a detection request; The processor is also used to determine whether the target hardware module and the target memory block belong to the same media path; the processor is also used to determine whether the target hardware module and the target memory block belong to the same media path Whether the target hardware module has access authority to the target memory block; the target hardware module is used to access the target memory block when the target hardware module has access authority to the target memory block.
应当理解,该电子设备可以为一种处理器芯片,此时,该电子设备中的该处理器为处理器芯片中的一个处理器核或者中央处理单元。It should be understood that the electronic device may be a processor chip. In this case, the processor in the electronic device is a processor core or a central processing unit in the processor chip.
一种可能的实现方式中,该处理器,还用于获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路;该处理器,还用于检测该第一通路标识和该第二通路标识是否相同;该处理器,还用于在该第一通路标识和该第二通路标识相同时,确定该目标硬件模块和该目标内存块属于同一条媒体通路。In a possible implementation manner, the processor is further configured to obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module , The second path identifier indicates the media path corresponding to the target memory block; the processor is also used to detect whether the first path identifier and the second path identifier are the same; the processor is also used to When the identifier is the same as the second path identifier, it is determined that the target hardware module and the target memory block belong to the same media path.
一种可能的实现方式中,该处理器,还用于获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路;该处理器,还用于检测该第一通路标识和该第二通路标识与目标通路标识是否相同,该目标通路标识用于指示目标媒体通路;该处理器,还用于在该第一通路标识与该目标通路标识相同时,确定该目标硬件模块属于该目标媒体通路;该处理器,还用于在该第二通路标识与该通路标识相同时,确定该目标内存块属于该目标媒体通路。In a possible implementation manner, the processor is further configured to obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module , The second path identifier indicates the media path corresponding to the target memory block; the processor is also used to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate the target Media path; the processor is also used for determining that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier; the processor is also used for determining that the second path identifier is the same as the target path identifier When the path identifiers are the same, it is determined that the target memory block belongs to the target media path.
一种可能的实现方式中,该处理器,还用于获取该目标硬件模块的模块身份标识,并在第一对应关系中确定与该模块身份标识对应的该第一通路标识;该处理器,还用于获取该目标内存块的内存身份标识,并在该第一对应关系中确定与该内存身份标识对应的该第二通路标识;其中,该第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于该同一个通路标识指示的媒体通路。In a possible implementation manner, the processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence; the processor, It is also used to obtain the memory identity identifier of the target memory block, and determine the second path identifier corresponding to the memory identifier in the first correspondence relationship; wherein, the first correspondence relationship includes the path identifier and the module identity identifier and Correspondence of the memory identity identifier, a path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and at least one hardware module and at least one memory block corresponding to the same path identifier belong to the same path Identifies the indicated media path.
一种可能的实现方式中,该处理器,还用于获取该目标硬件模块的模块身份标识,并根据该模块身份标识在第一对应关系中确定与该模块身份标识对应的该第一通路标识,该第一对应关系包括通路标识与模块身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识,同一个通路标识对应的至少一个硬件模块属于该同一个通路标识指示的媒体通路;该处理器,还用于获取待访问的目标地址,该目标地址指示该目标内存块,根据该目标地址在第二对应关系中确定该目标内存块对应的该第二通路标识,该第二对应关系包括内存块的地址与该内存块所属媒体通路的通路标识的对应关系。In a possible implementation manner, the processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence according to the module identity The first correspondence relationship includes the correspondence relationship between the path identifier and the module identity identifier, one path identifier corresponds to the module identifier of at least one hardware module, and at least one hardware module corresponding to the same path identifier belongs to the media path indicated by the same path identifier The processor is also used to obtain the target address to be accessed, the target address indicates the target memory block, and the second path identifier corresponding to the target memory block is determined in the second correspondence according to the target address, and the second The correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
一种可能的实现方式中,该处理器,还用于获取该目标硬件模块的模块身份标识以及 该目标内存块的内存身份标识;该处理器,还用于检测第三对应关系中是否设置有与该模块身份标识和该内存身份标识对应的访问权限标识,该第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系;该处理器,还用于在该第三对应关系中设置有与该模块身份标识和该内存身份标识对应的访问权限标识时,确定该目标硬件模块对该目标内存块有该访问权限标识指示的访问权限。In a possible implementation, the processor is also used to obtain the module identity of the target hardware module and the memory identity of the target memory block; the processor is also used to detect whether the third correspondence is set The access authority identifier corresponding to the module identity identifier and the memory identity identifier, and the third correspondence relationship includes the corresponding relationship between the module identity identifier, the memory identity identifier, and the access authority identifier; the processor is also used for setting the third correspondence relationship When the access authority identifier corresponding to the module identity identifier and the memory identifier is set in the module, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
一种可能的实现方式中,该电子设备还包括目标输入输出内存管理单元IOMMU,该目标IOMMU与该目标硬件模块对应,该目标IOMMU中包括标识寄存器,该标识寄存器中包括至少一个有访问权限的内存身份标识,其中,该目标IOMMU,用于获取该目标内存块的内存身份标识,并确定该至少一个有访问权限的内存身份标识中是否包括该内存身份标识;该目标IOMMU,还用于在该至少一个有访问权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有该访问权限标识指示的访问权限。In a possible implementation manner, the electronic device further includes a target input-output memory management unit IOMMU, the target IOMMU corresponds to the target hardware module, the target IOMMU includes an identification register, and the identification register includes at least one access authority Memory identity, where the target IOMMU is used to obtain the memory identity of the target memory block, and to determine whether the at least one memory identity with access rights includes the memory identity; the target IOMMU is also used to When the at least one memory identity identifier with access authority includes the memory identity identifier, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
一种可能的实现方式中,该访问权限包括读操作权限和写操作权限,该标识寄存器包括读标识寄存器和写标识寄存器,该读标识寄存器中包括至少一个有读操作权限的内存身份标识,该写标识寄存器中包括至少一个有写操作权限的内存身份标识。In a possible implementation manner, the access authority includes a read operation authority and a write operation authority, the identification register includes a read identification register and a write identification register, and the read identification register includes at least one memory identification identifier with read operation authority. The write identification register includes at least one memory identification with write operation authority.
一种可能的实现方式中,该目标IOMMU,还用于确定该至少一个有读操作权限的内存身份标识中是否包括该内存身份标识,并在该至少一个有读操作权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有读操作权限;该目标IOMMU,还用于确定该至少一个有写操作权限的内存身份标识中是否有该内存身份标识,并在该至少一个有读操作权限的内存身份标识中包括该内存身份标识时,确定该目标硬件模块对该目标内存块有写操作权限。In a possible implementation manner, the target IOMMU is also used to determine whether the at least one memory identity with read operation permission includes the memory identity, and the at least one memory identity with read operation permission includes When the memory identity is identified, it is determined that the target hardware module has the read operation permission for the target memory block; the target IOMMU is also used to determine whether the memory identity is present in the at least one memory identity with write operation permission, and When the at least one memory identity with read operation permission includes the memory identity, it is determined that the target hardware module has write operation permission on the target memory block.
一种可能的实现方式中,该处理器,还用于获取创建媒体通路的请求;该处理器,还用于生成该媒体通路的通路标识;该处理器,还用于配置至少一个硬件模块和至少一个内存块,得到该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识,该至少一个硬件模块和该至少一个内存块组成该媒体通路;该处理器,还用于根据该通路标识、该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识建立该第一对应关系。In a possible implementation, the processor is also used to obtain a request to create a media path; the processor is also used to generate a path identifier of the media path; the processor is also used to configure at least one hardware module and At least one memory block, the module identity of the at least one hardware module and the memory identity of the at least one memory block are obtained, the at least one hardware module and the at least one memory block form the media path; the processor is also used for The path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block establish the first correspondence relationship.
一种可能的实现方式中,该处理器,还用于从该第三对应关系中获取该目标硬件模块具有访问权限的至少一个内存身份标识;该处理器,还用于将该具有访问权限的至少一个内存身份标识配置在该目标IOMMU的标识寄存器中。In a possible implementation manner, the processor is further configured to obtain at least one memory identity that the target hardware module has access permission from the third correspondence; the processor is further configured to At least one memory identity is configured in the identity register of the target IOMMU.
其中,第二方面及第二方面各实现方式产生的技术效果,与第一方面和第一方面各实现方式产生的技术效果相同,此处不再赘述。Among them, the technical effects produced by the second aspect and the implementation manners of the second aspect are the same as the technical effects produced by the implementation manners of the first aspect and the first aspect, and will not be repeated here.
第三方面,本申请还提供了一种装置,该装置包括:确定模块,用于根据检测请求确定目标硬件模块和目标内存块;判断模块,用于判断该目标硬件模块和该目标内存块是否属于同一条媒体通路;该确定模块,还用于在该目标硬件模块和该目标内存块属于同一条媒体通路时,确定该目标硬件模块对该目标内存块是否有访问权限;调用模块,用于在该目标硬件模块对该目标内存块有访问权限时,调用该目标硬件模块访问该目标内存块。In a third aspect, the present application also provides a device, the device includes: a determining module for determining a target hardware module and a target memory block according to a detection request; a determining module for determining whether the target hardware module and the target memory block are Belong to the same media path; the determining module is also used to determine whether the target hardware module has access rights to the target memory block when the target hardware module and the target memory block belong to the same media path; the calling module is used to When the target hardware module has access authority to the target memory block, the target hardware module is called to access the target memory block.
一种可能的实现方式中,该装置还包括获取模块和检测模块,其中,该获取模块,用于获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路; 该检测模块,用于检测该第一通路标识和该第二通路标识是否相同;该确定模块,还用于在该第一通路标识和该第二通路标识相同时,确定该目标硬件模块和该目标内存块属于同一条媒体通路。In a possible implementation manner, the device further includes an acquisition module and a detection module. The acquisition module is configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first The path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the media path corresponding to the target memory block; the detection module is used to detect whether the first path identifier and the second path identifier are the same; the determination The module is also used to determine that the target hardware module and the target memory block belong to the same media path when the first path identifier and the second path identifier are the same.
一种可能的实现方式中,该获取模块,还用于获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路;该检测模块,还用于检测该第一通路标识和该第二通路标识与目标通路标识是否相同,该目标通路标识用于指示目标媒体通路;该确定模块,还用于在该第一通路标识与该目标通路标识相同时,确定该目标硬件模块属于该目标媒体通路;该确定模块,还用于在该第二通路标识与该通路标识相同时,确定该目标内存块属于该目标媒体通路。In a possible implementation manner, the acquiring module is further configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module , The second path identifier indicates the media path corresponding to the target memory block; the detection module is also used to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate the target Media path; the determining module is also used to determine that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier; the determining module is also used to determine whether the second path identifier is the same as the target media path When the path identifiers are the same, it is determined that the target memory block belongs to the target media path.
一种可能的实现方式中,该获取模块,还用于获取该目标硬件模块的模块身份标识,并在第一对应关系中确定与该模块身份标识对应的该第一通路标识;该获取模块,还用于获取该目标内存块的内存身份标识,并在该第一对应关系中确定与该内存身份标识对应的该第二通路标识;其中,该第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于该同一个通路标识指示的媒体通路。In a possible implementation manner, the acquisition module is further configured to acquire the module identity of the target hardware module, and determine the first path identifier corresponding to the module identity in the first correspondence; the acquisition module, It is also used to obtain the memory identity of the target memory block, and determine the second path identity corresponding to the memory identity in the first corresponding relationship; wherein, the first corresponding relationship includes the path identity and the module identity and Correspondence of the memory identity identifier, a path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and at least one hardware module and at least one memory block corresponding to the same path identifier belong to the same path Identifies the indicated media path.
一种可能的实现方式中,该获取模块,还用于获取该目标硬件模块的模块身份标识,并根据该模块身份标识在第一对应关系中确定与该模块身份标识对应的该第一通路标识,该第一对应关系包括通路标识与模块身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识,同一个通路标识对应的至少一个硬件模块属于该同一个通路标识指示的媒体通路;该获取模块,还用于获取待访问的目标地址,该目标地址指示该目标内存块,根据该目标地址在第二对应关系中确定该目标内存块对应的该第二通路标识,该第二对应关系包括内存块的地址与该内存块所属媒体通路的通路标识的对应关系。In a possible implementation manner, the acquisition module is further configured to acquire the module identity of the target hardware module, and determine the first path identifier corresponding to the module identity in the first correspondence according to the module identity The first correspondence relationship includes the correspondence relationship between the path identifier and the module identity identifier, one path identifier corresponds to the module identifier of at least one hardware module, and at least one hardware module corresponding to the same path identifier belongs to the media path indicated by the same path identifier The acquisition module is also used to acquire the target address to be accessed, the target address indicates the target memory block, and the second path identifier corresponding to the target memory block is determined in the second correspondence according to the target address, and the second The correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
一种可能的实现方式中,该获取模块,还用于获取该目标硬件模块的模块身份标识以及该目标内存块的内存身份标识;该检测模块,还用于检测第三对应关系中是否设置有与该模块身份标识和该内存身份标识对应的访问权限标识,该第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系;该确定模块,还用于在该第三对应关系中设置有与该模块身份标识和该内存身份标识对应的访问权限标识时,确定该目标硬件模块对该目标内存块有该访问权限标识指示的访问权限。In a possible implementation manner, the acquisition module is also used to acquire the module identity of the target hardware module and the memory identity of the target memory block; the detection module is also used to detect whether the third correspondence is set The access authority identifier corresponding to the module identity and the memory identity, the third correspondence includes the correspondence between the module identity, the memory identity, and the access authority identifier; the determining module is also used in the third correspondence When the access authority identifier corresponding to the module identity identifier and the memory identifier is set in the module, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
一种可能的实现方式中,该装置还包括生成模块,配置模块和建立模块,其中,该获取模块,还用于获取创建媒体通路的请求;该生成模块,还用于生成该媒体通路的通路标识;该配置模块,还用于配置至少一个硬件模块和至少一个内存块,得到该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识,该至少一个硬件模块和该至少一个内存块组成该媒体通路;该建立模块,还用于根据该通路标识、该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识建立该第一对应关系。In a possible implementation manner, the device further includes a generation module, a configuration module, and an establishment module, wherein the acquisition module is also used to acquire a request to create a media path; the generation module is also used to generate a path of the media path Identification; the configuration module is also used to configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one The memory block forms the media path; the establishing module is further configured to establish the first correspondence relationship according to the path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block.
一种可能的实现方式中,该获取模块,还用于从该第三对应关系中获取该目标硬件模块具有访问权限的至少一个内存身份标识;该配置模块,还用于将该具有访问权限的至少一个内存身份标识配置在目标IOMMU的标识寄存器中,其中,该目标IOMMU与该目标硬件 模块对应。In a possible implementation manner, the obtaining module is also used to obtain at least one memory identity that the target hardware module has access permission from the third correspondence; the configuration module is also used to obtain the access permission At least one memory identity is configured in the identity register of the target IOMMU, where the target IOMMU corresponds to the target hardware module.
其中,第三方面及第三方面各实现方式产生的技术效果,与第一方面和第一方面各实现方式产生的技术效果相同,此处不再赘述。Among them, the technical effects produced by the third aspect and the implementation manners of the third aspect are the same as those produced by the implementation manners of the first aspect and the first aspect, and will not be repeated here.
第四方面,本申请提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机或处理器上运行时,使得计算机或处理器执行第一方面或第一方面任意可能的设计中的方法。In a fourth aspect, this application provides a computer-readable storage medium with instructions stored in the computer-readable storage medium, which when run on a computer or processor, cause the computer or processor to execute the first aspect or the first aspect. In terms of any possible design method.
第五方面,本申请提供了一种包含指令的计算机程序产品,当该指令在计算机或处理器上运行时,使得该计算机或处理器执行如上述第一方面或者及第一方面任意可能的设计中的方法。In the fifth aspect, this application provides a computer program product containing instructions that, when the instructions run on a computer or processor, cause the computer or processor to perform any possible design as in the first aspect or any possible design in the first aspect. Method in.
采用本申请的技术方案,在硬件模块访问内存块之前,电子设备检测该硬件模块与相应安全内存块是否属于同一SMP,若该硬件模块与相应安全内存块属于同一SMP,电子设备进一步检测该硬件模块是否具备访问该安全内存块的权限,若该硬件模块具备访问该安全内存块的权限,该硬件模块才能够访问该安全内存块,否则,该硬件模块无法访问该安全内存块。这样使得安全内存块能够被安全访问,从而能够避免安全媒体流从安全内存块中泄露,提高SMP的安全性。Using the technical solution of this application, before the hardware module accesses the memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP. If the hardware module and the corresponding secure memory block belong to the same SMP, the electronic device further detects the hardware Whether the module has the authority to access the secure memory block, if the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block; otherwise, the hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
附图说明Description of the drawings
为了更清楚地说明本申请的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solution of the present application more clearly, the following will briefly introduce the drawings needed in the embodiments. Obviously, for those of ordinary skill in the art, without paying creative labor, Other drawings can be obtained from these drawings.
图1A是本申请提供的一种典型电子设备的系统架构图;FIG. 1A is a system architecture diagram of a typical electronic device provided by this application;
图1B是本申请提供的SMP的第一种示例性应用场景示意图;FIG. 1B is a schematic diagram of the first exemplary application scenario of SMP provided in this application;
图1C是本申请提供的SMP的第二种示例性应用场景示意图;FIG. 1C is a schematic diagram of a second exemplary application scenario of SMP provided in this application;
图2是本申请提供的电子设备10的示例性应用环境的系统架构示意图;2 is a schematic diagram of the system architecture of an exemplary application environment of the electronic device 10 provided by the present application;
图3是本申请提供的安全访问方法100的示例性方法流程图;FIG. 3 is an exemplary method flowchart of the secure access method 100 provided by the present application;
图4是本申请提供的标识寄存器中位图的示例性示意图;Fig. 4 is an exemplary schematic diagram of a bitmap in the identification register provided by the present application;
图5是本申请提供的电子设备20的示例性结构示意图;FIG. 5 is a schematic diagram of an exemplary structure of an electronic device 20 provided in the present application;
图6A是本申请提供的SMP创建方法200的示例性信令交互图;FIG. 6A is an exemplary signaling interaction diagram of the SMP creation method 200 provided by this application;
图6B是本申请提供的安全媒体流的传输方法300的示例性信令交互图;FIG. 6B is an exemplary signaling interaction diagram of the secure media stream transmission method 300 provided by the present application;
图7A是本申请提供的电子设备70的示例性结构示意图;FIG. 7A is a schematic diagram of an exemplary structure of an electronic device 70 provided in the present application;
图7B是本申请提供的电子设备71的示例性结构示意图;FIG. 7B is a schematic diagram of an exemplary structure of an electronic device 71 provided by the present application;
图7C是本申请基于图7B提供的检测访问权限的示例性场景示意图。FIG. 7C is a schematic diagram of an exemplary scenario for detecting access permissions provided in FIG. 7B based on the present application.
具体实施方式Detailed ways
下面将结合本申请中的附图,对本申请中的技术方案进行清楚地描述。The technical solutions in this application will be clearly described below in conjunction with the drawings in this application.
本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,尽管在以下实施例中可能采用术语第一、第二等来描述某一类对象,但所述对象不应限于这些术语。这些术语仅用来将该类对象的具体 对象进行区分。例如,以下实施例中可能采用术语第一、第二等来描述通路标识,但通路标识不应限于这些术语。这些术语仅用来将不同对象对应的通路标识进行区分。以下实施例中可能采用术语第一、第二等来描述的其他类对象同理,此处不再赘述。另外,在以下实施例的描述中,“多个”是指两个或两个以上。The terms used in the following embodiments of the application are only for the purpose of describing specific embodiments, and are not intended to limit the application. As used in the specification and appended claims of this application, the singular expressions "a", "an", "said", "above", "the" and "this" are intended to also Including plural expressions, unless the context clearly indicates to the contrary. It should also be understood that although the terms first, second, etc. may be used in the following embodiments to describe a certain type of object, the object should not be limited to these terms. These terms are only used to distinguish specific objects of this class of objects. For example, in the following embodiments, the terms first, second, etc. may be used to describe the path identification, but the path identification should not be limited to these terms. These terms are only used to distinguish the corresponding path identifiers of different objects. In the following embodiments, the terms first, second, etc. may be used to describe other types of objects in the same way, which will not be repeated here. In addition, in the description of the following embodiments, "plurality" means two or more.
本申请描述的架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请所提供的技术方案的限定,本领域普通技术人员可知,随着架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The architecture and business scenarios described in this application are intended to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in this application. Those of ordinary skill in the art will know that as the architecture evolves and new With the emergence of business scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
以下对本申请的实施场景进行介绍。The following describes the implementation scenarios of this application.
本申请可以应用于支持音频、视频输入/输出的电子设备,该电子设备例如是智能手机、智能机顶盒、智能电视、监控、计算机、平板电脑等。This application can be applied to electronic devices supporting audio and video input/output, such as smart phones, smart set-top boxes, smart TVs, surveillance, computers, tablet computers, etc.
图1A示出了一种典型的电子设备的系统架构。该系统架构包括:应用层、驱动层、操作系统层、硬件模块和存储模块。应用层用于运行应用软件,例如腾讯、优酷等。驱动层包括针对各个硬件模块编写的驱动程序,该驱动程序用于驱动相对应的硬件模块访问内存块。操作系统层负责内存管理、堆栈管理、任务调度管理等。应用层的应用软件在运行时,可以向操作系统层申请分配内存块,并获取所分配的内存块的虚拟地址。所分配的内存块用于存储应用软件运行过程中的数据,例如下述的各种媒体流数据。驱动层可以驱动硬件模块根据内存块的虚拟地址访问相应内存块。Figure 1A shows the system architecture of a typical electronic device. The system architecture includes: application layer, driver layer, operating system layer, hardware module and storage module. The application layer is used to run application software, such as Tencent, Youku, etc. The driver layer includes a driver program written for each hardware module, and the driver program is used to drive the corresponding hardware module to access the memory block. The operating system layer is responsible for memory management, stack management, task scheduling management, etc. When the application software of the application layer is running, it can apply to the operating system layer to allocate a memory block and obtain the virtual address of the allocated memory block. The allocated memory block is used to store data during the running of the application software, such as the following various media stream data. The driver layer can drive the hardware module to access the corresponding memory block according to the virtual address of the memory block.
应用软件运行过程中所传输的媒体流也可以称为媒体数据流,包括传输流(transport stream,TS)和基本流(elementary stream,ES)等不同形式的媒体数据流。媒体流包括音频流和/或视频流。The media stream transmitted during the running of the application software may also be referred to as a media data stream, including different forms of media data streams such as transport stream (TS) and elementary stream (ES). Media streams include audio streams and/or video streams.
应用软件在传输媒体流之前,可以根据该应用软件的意图以及对媒体流的处理过程,创建媒体通路,该媒体通路是应用软件在电子设备上处理媒体流的路径,该处理过程包括但不限于播放、录制、转码和转发等,相应的,媒体通路例如可以包括录制通路,播放通路和转码通路。媒体通路包括进行音视频处理所用到的资源,例如一系列的硬件模块和内存等。Before the application software transmits the media stream, it can create a media path according to the intention of the application software and the processing process of the media stream. The media path is the path through which the application software processes the media stream on the electronic device. The processing process includes but is not limited to Play, record, transcode, and forward, etc. Correspondingly, the media path may include, for example, a recording path, a playback path, and a transcoding path. The media path includes the resources used for audio and video processing, such as a series of hardware modules and memory.
结合图1A,示例性的,应用软件可以向操作系统层申请占用硬件模块1、硬件模块2和硬件模块3,并向操作系统层申请分配内存块1和内存块2。硬件模块1、硬件模块2和硬件模块3,以及内存块1和内存块2例如可以组成一条媒体通路,媒体流在该媒体通路上的传输流程例如是:硬件模块1到内存块1,内存块1到硬件模块2,硬件模块2到内存块2,内存块2到硬件模块3。在实际操作中,驱动层接收该应用软件的指令,然后,驱动该媒体通路中相应的硬件模块对相应内存块执行访问操作。With reference to FIG. 1A, by way of example, application software may apply to the operating system layer to occupy hardware module 1, hardware module 2 and hardware module 3, and apply to the operating system layer to allocate memory block 1 and memory block 2. Hardware module 1, hardware module 2, and hardware module 3, as well as memory block 1 and memory block 2, for example, can form a media channel, and the transmission process of the media stream on the media channel is, for example: hardware module 1 to memory block 1, memory block 1 to hardware module 2, hardware module 2 to memory block 2, and memory block 2 to hardware module 3. In actual operation, the driver layer receives instructions from the application software, and then drives the corresponding hardware modules in the media path to perform access operations on the corresponding memory blocks.
图1A所示的电子设备例如可以支持可信执行环境(trusted execution environment,TEE)与普通执行环境(rich execution environment,REE)。TEE与REE相对应,TEE用于为受保护的应用软件提供受保护的执行环境,REE用于为不受保护的应用软件提供执行环境。TEE与REE之间内存(buffer)隔离,即REE中的应用软件不允许访问TEE中的内存。The electronic device shown in FIG. 1A may, for example, support a trusted execution environment (TEE) and a rich execution environment (REE). TEE corresponds to REE. TEE is used to provide a protected execution environment for protected application software, and REE is used to provide an execution environment for unprotected application software. The memory (buffer) between TEE and REE is isolated, that is, the application software in REE is not allowed to access the memory in TEE.
相应的,本申请涉及的媒体通路可以包括普通媒体通路,或者也可称为非安全媒体通路和安全媒体通路(secure media path,SMP)。普通媒体通路是REE下的媒体通路,用 于传输不受保护的媒体流。SMP是TEE下的媒体通路,用于传输存在一定安全要求的媒体流,例如,需要加水印,需要加密,禁止转码,机制录制等要求的媒体流。“安全要求”例如可以被定义为媒体内容使用规则(content usage rules)。相应的,SMP中的硬件模块和内存块应当按照媒体内容使用规则处理并传输相关媒体流。基于此,图1A中的驱动层可以包括REE驱动和TEE驱动,TEE驱动用于驱动SMP中的硬件模块访问SMP中的内存块,REE驱动用于驱动普通媒体通路中的硬件模块访问普通媒体通路中的内存块。Correspondingly, the media paths involved in this application may include ordinary media paths, or may also be referred to as non-secure media paths and secure media paths (SMP). Ordinary media channels are media channels under REE, which are used to transmit unprotected media streams. SMP is a media channel under TEE, used to transmit media streams that have certain security requirements, for example, media streams that require watermarking, encryption, prohibition of transcoding, and mechanism recording. "Security requirements" can be defined as media content usage rules (content usage rules), for example. Correspondingly, the hardware modules and memory blocks in SMP should process and transmit related media streams in accordance with media content usage rules. Based on this, the driver layer in Figure 1A can include REE drivers and TEE drivers. TEE drivers are used to drive hardware modules in SMP to access memory blocks in SMP, and REE drivers are used to drive hardware modules in ordinary media channels to access ordinary media channels. The memory block in.
本申请将SMP所传输的媒体流称为“安全媒体流”,将应用于SMP的内存块称为“安全内存块”。本申请下述各实施例将直接引用术语“安全媒体流”和术语“安全内存块”,对于术语“安全媒体流”和术语“安全内存块”的含义不再赘述。This application refers to the media stream transmitted by SMP as "secure media stream", and the memory block applied to SMP as "secure memory block". The following embodiments of this application will directly quote the term "secure media stream" and the term "secure memory block", and the meaning of the term "secure media stream" and the term "secure memory block" will not be repeated.
实际使用中,图1A中示意的每个硬件模块可以提供多条处理通道,其中每条处理通道可以用于一条媒体通路中,并处理该媒体通路的媒体流数据。例如一个硬件模块包括32条处理通道,那么,该硬件模块可以同时被用在32条媒体通路中,并且,其中每条处理通道处理32条媒体通路中一条媒体通路中的媒体流数据。其中,该32条媒体通路可以包括普通媒体通路和SMP。即,一些实施例中,TEE和REE可以共用同一硬件模块,进而,该场景下,同一硬件模块可以响应TEE驱动的指令执行操作,也可以响应REE驱动的指令执行操作。In actual use, each hardware module shown in FIG. 1A can provide multiple processing channels, where each processing channel can be used in one media channel and process the media stream data of the media channel. For example, a hardware module includes 32 processing channels, then the hardware module can be used in 32 media channels at the same time, and each of the processing channels processes media stream data in one of the 32 media channels. Among them, the 32 media channels can include ordinary media channels and SMP. That is, in some embodiments, the TEE and the REE can share the same hardware module. Furthermore, in this scenario, the same hardware module can perform operations in response to instructions from the TEE driver, or perform operations in response to instructions from the REE driver.
基于此,如图1B所示,例如TEE下有两条SMP在同时运行,SMP1传输的媒体流1具备输出保护要求,例如,SMP1输出的媒体流1需要添加水印,SMP2传输的媒体流2例如不具备输出保护要求。安全内存块1和硬件模块1均属于SMP1,安全内存块2属于SMP2。图1B示意的场景中,硬件模块1的一条处理通道例如用于SMP1,另一条处理通道例如用于普通媒体通路,那么,硬件模块1可以接收TEE驱动的驱动指令和REE驱动的驱动指令。基于此,若REE驱动控制硬件模块1访问安全内存块2,那么,硬件模块1则会将具备输出保护要求的媒体流1存储到安全内存块2中,从而导致媒体流1的输出保护失效。另外,图形处理单元(graphics processing unit,GPU)模块可以访问安全内存块,且具有拷贝功能,而GPU模块的驱动是REE驱动。所以,如图1C所示,即使GPU模块未用在任何媒体通路中,REE驱动也可以控制GPU模块访问SMP3中的安全内存块,并拷贝(copy)安全内存块中的媒体流数据,进而可以利用个人视频录像机(personal video recorder,PVR)的录制功能中设置TEE侧到REE侧的拷贝通道,将SMP3传输的安全媒体流拷贝到REE侧,从而导致SMP3传输的安全媒体流从安全内存块中被泄露。Based on this, as shown in Figure 1B, for example, two SMPs are running simultaneously under TEE, and media stream 1 transmitted by SMP1 has output protection requirements. For example, media stream 1 output by SMP1 needs to be watermarked, and media stream 2 transmitted by SMP2, for example Does not have output protection requirements. Both secure memory block 1 and hardware module 1 belong to SMP1, and secure memory block 2 belongs to SMP2. In the scenario shown in FIG. 1B, one processing channel of the hardware module 1 is used for SMP1, for example, and the other processing channel is used for common media channels, for example, then the hardware module 1 can receive the drive instructions of the TEE driver and the drive instructions of the REE drive. Based on this, if the REE drive controls the hardware module 1 to access the secure memory block 2, then the hardware module 1 will store the media stream 1 with output protection requirements in the secure memory block 2, causing the output protection of the media stream 1 to fail. In addition, the graphics processing unit (GPU) module can access the secure memory block and has a copy function, and the GPU module is driven by the REE driver. Therefore, as shown in Figure 1C, even if the GPU module is not used in any media path, the REE driver can control the GPU module to access the secure memory block in SMP3 and copy (copy) the media stream data in the secure memory block. Use the recording function of the personal video recorder (PVR) to set the copy channel from the TEE side to the REE side to copy the secure media stream transmitted by SMP3 to the REE side, resulting in the secure media stream transmitted by SMP3 from the secure memory block Was leaked.
基于上述,本申请提供了一种安全访问方法及电子设备,在硬件模块被触发访问安全内存块之前,电子设备检测该硬件模块与相应安全内存块是否属于同一SMP,若该硬件模块与相应安全内存块属于同一SMP,电子设备进一步检测该硬件模块是否具备访问该安全内存块的权限,若该硬件模块具备访问该安全内存块的权限,该硬件模块才能够访问该安全内存块,否则,该硬件模块无法访问该安全内存块。这样使得安全内存块能够被安全访问,从而能够避免安全媒体流从安全内存块中泄露,提高SMP的安全性。Based on the above, this application provides a secure access method and electronic device. Before the hardware module is triggered to access the secure memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP. If the memory block belongs to the same SMP, the electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block. Otherwise, the The hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
以下对本申请涉及的电子设备的软硬件结构进行介绍。The software and hardware structure of the electronic equipment involved in this application is introduced below.
图2示意了电子设备10的一种示例性应用环境的系统架构示意图。电子设备10支持TEE。以下结合图2分别对REE系统架构和TEE系统架构进行介绍。FIG. 2 illustrates a schematic diagram of a system architecture of an exemplary application environment of the electronic device 10. The electronic device 10 supports TEE. The following describes the REE system architecture and TEE system architecture with reference to Figure 2.
REE系统架构包括REE软件应用层、REE软件接口适配层、REE软件驱动层、REE软件操作系统层、REE硬件模块、与REE硬件模块对应的REE输入输出内存管理单元(input output memory management unit,IOMMU)模块和REE存储模块。REE软件应用层中的软件应用可以通过REE软件接口适配层、REE软件驱动层和REE软件操作系统层控制REE硬件模块,对REE存储模块中的内存块进行访问操作。其中,应当理解,REE软件操作系统层、REE软件驱动层、REE软件接口适配层和REE软件应用层等是由软件代码实现的,示例性的,这些软件代码可以存储在存储器中,并运行在处理器上。The REE system architecture includes the REE software application layer, the REE software interface adaptation layer, the REE software driver layer, the REE software operating system layer, the REE hardware module, and the REE input and output memory management unit corresponding to the REE hardware module (input output memory management unit, IOMMU) module and REE storage module. The software application in the REE software application layer can control the REE hardware module through the REE software interface adaptation layer, the REE software driver layer and the REE software operating system layer, and access the memory blocks in the REE storage module. Among them, it should be understood that the REE software operating system layer, the REE software driver layer, the REE software interface adaptation layer, and the REE software application layer are implemented by software codes. Illustratively, these software codes can be stored in the memory and run. On the processor.
其中,REE软件应用层用于提供REE软件应用的运行环境,还用于当REE软件应用运行时向REE软件操作系统层申请分配REE硬件模块和REE内存块,并存储REE内存块的虚拟地址。Among them, the REE software application layer is used to provide the operating environment of the REE software application, and is also used to apply to the REE software operating system layer to allocate the REE hardware module and REE memory block when the REE software application is running, and store the virtual address of the REE memory block.
REE软件接口适配层用于根据REE软件应用层访问的虚拟地址匹配REE软件驱动层中的驱动程序。The REE software interface adaptation layer is used to match the driver in the REE software driver layer according to the virtual address accessed by the REE software application layer.
REE软件驱动层中包括针对各个硬件模块编写的驱动程序,该驱动程序根据虚拟地址驱动相应的硬件模块访问相应REE内存块。The REE software driver layer includes a driver program written for each hardware module, and the driver program drives the corresponding hardware module to access the corresponding REE memory block according to the virtual address.
REE软件操作系统层用于执行REE硬件模块资源管理,还用于堆栈管理和任务调度等。REE软件操作系统层例如可以响应REE软件应用层指令配置REE硬件模块12创建普通媒体通路。此外,REE软件操作系统层还用于维护一个或多个计算机程序以及数据,该一个或多个计算机程序运行时,能够实现REE侧各软件层的功能。该数据用于为该一个或多个计算机程序的运行提供支持。The REE software operating system layer is used to perform REE hardware module resource management, as well as stack management and task scheduling. The REE software operating system layer, for example, can configure the REE hardware module 12 to create a common media channel in response to instructions from the REE software application layer. In addition, the REE software operating system layer is also used to maintain one or more computer programs and data. When the one or more computer programs are running, they can implement the functions of each software layer on the REE side. The data is used to provide support for the operation of the one or more computer programs.
REE IOMMU模块与REE硬件模块一一对应。REE IOMMU模块用于将内存块的虚拟地址转换为相应内存块的物理地址,进而,对相应物理地址指示的内存块进行非安全访问。The REE IOMMU module corresponds to the REE hardware module one to one. The REE IOMMU module is used to convert the virtual address of the memory block into the physical address of the corresponding memory block, and further, perform unsafe access to the memory block indicated by the corresponding physical address.
示例性的,REE存储模块可以包括但不限于双倍速率(double data rate,DDR)存储器、闪存(Flash)、静态随机存取存储器(static random access memory,SRAM)等,本申请不作限定。REE存储模块包括多个内存块,每个内存块具有不同的物理地址。Exemplarily, the REE storage module may include, but is not limited to, double data rate (DDR) memory, flash memory (Flash), static random access memory (SRAM), etc., which are not limited in this application. The REE storage module includes multiple memory blocks, and each memory block has a different physical address.
TEE系统架构包括TEE软件应用层、TEE软件接口适配层、TEE软件驱动层、TEE软件操作系统层、TEE硬件模块、与TEE硬件模块对应的TEE IOMMU模块和TEE存储模块。其中,TEE软件操作系统层、TEE软件驱动层、TEE软件接口适配层和TEE软件应用层等是由软件代码实现的,示例性的,这些软件代码可以存储在存储器中,并运行在处理器上。The TEE system architecture includes TEE software application layer, TEE software interface adaptation layer, TEE software driver layer, TEE software operating system layer, TEE hardware module, TEE IOMMU module corresponding to TEE hardware module, and TEE storage module. Among them, the TEE software operating system layer, the TEE software driver layer, the TEE software interface adaptation layer, and the TEE software application layer are implemented by software codes. Illustratively, these software codes can be stored in the memory and run on the processor. on.
其中,TEE软件应用层中的软件应用可以通过TEE软件接口适配层、TEE软件驱动层和TEE软件操作系统层控制TEE硬件模块,对TEE存储模块中的内存块进行访问操作。应理解,各软件层之间的基本交互过程与REE侧类似,此处不再详述。Among them, the software application in the TEE software application layer can control the TEE hardware module through the TEE software interface adaptation layer, the TEE software driver layer, and the TEE software operating system layer, and access the memory block in the TEE storage module. It should be understood that the basic interaction process between the software layers is similar to the REE side, and will not be detailed here.
此外,本申请中,TEE系统架构还包括会话管理模块、内存管理模块和策略管理模块,其中,该会话管理模块、该内存管理模块和该策略管理模块由软件代码实现,并运行在处理器上。In addition, in this application, the TEE system architecture also includes a session management module, a memory management module, and a policy management module, where the session management module, the memory management module, and the policy management module are implemented by software code and run on the processor .
一些实施例中,该会话管理模块、该内存管理模块和该策略管理模块例如运行在TEE软件驱动层。另一些实施例中,该会话管理模块、该内存管理模块和该策略管理模块例如运行在TEE软件操作系统层。其他一些实施例中,该会话管理模块、该内存管理模块和该策略管理模块中的部分模块运行在TEE软件驱动层,其他模块运行在TEE软件操作系统层。In some embodiments, the session management module, the memory management module, and the policy management module run on the TEE software driver layer, for example. In other embodiments, the session management module, the memory management module, and the policy management module run on the TEE software operating system layer, for example. In some other embodiments, some modules of the session management module, the memory management module, and the policy management module run on the TEE software driver layer, and other modules run on the TEE software operating system layer.
其中,该策略管理模块用于维护本说明书下文中涉及的策略表,也即下文中涉及的第 三对应关系。在该TEE系统架构创建SMP过程中,该会话管理模块用于对应存储SMP的通道标识以及属于该SMP的TEE硬件模块信息和安全内存块信息,得到下文中涉及的第一对应关系。该内存管理模块用于维护TEE存储模块中每个内存块物理地址和虚拟地址映射表,进而,在TEE系统架构配置安全内存块过程中,该内存管理模块还用于将配置该安全内存块的内存身份标识(tag),然后,将该安全内存块的内存身份标识,相应安全内存块所属的SMP的通路标识,和相应安全内存块的虚拟地址和物理地址的对应关系形成映射关系,得到该安全内存块对应的映射表,也即下文中涉及的第二对应关系。Among them, the strategy management module is used to maintain the strategy table referred to below in this manual, that is, the third corresponding relationship referred to below. In the process of creating the SMP by the TEE system architecture, the session management module is used to correspondingly store the channel identifier of the SMP and the TEE hardware module information and secure memory block information belonging to the SMP to obtain the first correspondence involved in the following. The memory management module is used to maintain the physical address and virtual address mapping table of each memory block in the TEE storage module, and then, in the process of configuring the secure memory block in the TEE system architecture, the memory management module is also used to configure the secure memory block Memory identification (tag), then, the memory identification of the secure memory block, the path identifier of the SMP to which the corresponding secure memory block belongs, and the corresponding relationship between the virtual address and physical address of the corresponding secure memory block form a mapping relationship to obtain the The mapping table corresponding to the secure memory block, that is, the second correspondence involved in the following.
进一步的,在传输安全媒体流的过程中,该会话管理模块还可以用于根据上述一系列对应关系对硬件模块和安全内存块进行检测,以确定相应硬件模块对安全内存块是否具备访问权限。相应实施例详见本说明书下文的描述,此处不再详述。Further, in the process of transmitting the secure media stream, the session management module may also be used to detect the hardware module and the secure memory block according to the above series of correspondences to determine whether the corresponding hardware module has access rights to the secure memory block. The corresponding embodiments are detailed in the following description of this specification, which will not be described in detail here.
此外,该内存管理模块还用于根据安全内存块的内存身份标识设置IOMMU模块中标识寄存器,以设置硬件模块对安全内存块的访问权限。示例性的,设置IOMMU模块汇总的标识寄存器具体可以由内存管理模块来完成,相应实施例详见本说明书下文的描述,此处不再详述。In addition, the memory management module is also used to set the identification register in the IOMMU module according to the memory identity identification of the secure memory block to set the access authority of the hardware module to the secure memory block. Exemplarily, setting the identification registers summarized by the IOMMU module can be specifically completed by the memory management module. For the corresponding embodiments, please refer to the description below in this specification for details, and will not be detailed here.
TEE IOMMU模块与TEE硬件模块一一对应。TEE IOMMU模块包括标识寄存器,该标识寄存器中的标识用于TEE硬件模块对内存块访问权限的鉴权。例如,TEE IOMMU模块中包含第一内存身份标识时,TEE硬件模块可以访问第一内存身份标识指示的内存块,同理,TEE IOMMU模块中不包含内存身份标识时,TEE硬件模块不能访问第二内存身份标识指示的内存块。标识寄存器的具体实现形式详见下述实施例的描述。The TEE IOMMU module corresponds to the TEE hardware module one to one. The TEE IOMMU module includes an identification register, and the identification in the identification register is used to authenticate the TEE hardware module's access authority to the memory block. For example, when the TEE IOMMU module contains the first memory identity, the TEE hardware module can access the memory block indicated by the first memory identity. Similarly, when the TEE IOMMU module does not contain the memory identity, the TEE hardware module cannot access the second The memory block indicated by the memory identifier. The specific implementation form of the identification register is described in the following embodiments.
TEE存储模块可以包括多个安全内存块,每个安全内存块可以通过物理地址标识。示例性的,在安全内存块被配置为一条SMP的安全内存块之后,TEE软件驱动层可以根据TEE软件应用层中软件应用的指令以及第三对应关系设置该内存块的内存身份标识。The TEE storage module may include multiple secure memory blocks, and each secure memory block can be identified by a physical address. Exemplarily, after the secure memory block is configured as an SMP secure memory block, the TEE software driver layer may set the memory identity of the memory block according to the instruction of the software application in the TEE software application layer and the third correspondence.
可以理解的是,一些实施例中,运行REE各软件层的处理器,和运行TEE各软件层的处理器,在物理上可以是同一个处理器,当该处理器运行在REE模式下时,该处理器实现REE各软件层的功能,当该处理器运行在TEE模式下时,该处理器实现TEE各软件层的功能。该处理器可以为例如系统级芯片控制逻辑单元、微处理器、微控制器(micro-controller unit,MCU)、中央处理器(central process unit,CPU)、数字信号处理器(digital signal processing,DSP)、图形处理单元(graphics processing unit,GPU)、现场可编程门阵列(field programmable gate array,FPGA)、专用集成电路(application specific integrated circuit,ASIC)等,本申请不作限定。It is understandable that, in some embodiments, the processor running each software layer of REE and the processor running each software layer of TEE may be physically the same processor. When the processor is running in REE mode, The processor implements the functions of each software layer of the REE. When the processor runs in the TEE mode, the processor implements the functions of each software layer of the TEE. The processor may be, for example, a system-level chip control logic unit, a microprocessor, a microcontroller (micro-controller unit, MCU), a central processing unit (CPU), a digital signal processing (digital signal processing, DSP) ), graphics processing unit (GPU), field programmable gate array (FPGA), application specific integrated circuit (ASIC), etc., which are not limited in this application.
图2中示意的REE硬件模块和TEE硬件模块例如均可以包括多路分配模块(demux)、硬件解密模块、硬件加密模块、硬件解码模块(decoder)、视频解码模块(video decoder,VDEC)、硬件通信模块、硬件图形处理模块(video processor,VPSS)、硬件显示模块(video display,VDP)、模数转换器(analog to digital converter,ADC)、数模转换器(digital to analog converter,DAC)、通讯接口、射频单元以及微电子机械模块等,本申请不作限定。其中,硬件解密模块和硬件加密模块中均包含密码块(cipher)。本实施例中,REE硬件模块和TEE硬件模块可以由同一个硬件模块中的两条处理通道实现。The REE hardware module and the TEE hardware module shown in FIG. 2 may include, for example, a demux module (demux), a hardware decryption module, a hardware encryption module, a hardware decoding module (decoder), a video decoding module (VDEC), and hardware Communication module, hardware graphics processing module (video processor, VPSS), hardware display module (video display, VDP), analog to digital converter (analog to digital converter, ADC), digital to analog converter (digital to analog converter, DAC), The communication interface, radio frequency unit, microelectronic mechanical module, etc. are not limited in this application. Among them, both the hardware decryption module and the hardware encryption module include a cipher. In this embodiment, the REE hardware module and the TEE hardware module can be implemented by two processing channels in the same hardware module.
REE存储模块和TEE存储模块均可以包括但不限于DDR存储器、闪存(Flash)、SRAM等,本申请不作限定。REE存储模块和TEE存储模块相互隔离,进行使得普通内存块和安 全内存块相互隔离。Both the REE storage module and the TEE storage module may include but are not limited to DDR memory, flash memory (Flash), SRAM, etc., which are not limited in this application. The REE memory module and the TEE memory module are isolated from each other, so that ordinary memory blocks and secure memory blocks are isolated from each other.
图2示意的实施例中所述的物理地址(physical address)可以为:在存储模块里以字节为单位存储信息,为正确地存放或取得信息,每一个字节单元具有的唯一的内存块地址。物理地址也可称为实际地址或绝对地址。物理地址是可以通过地址总线在存储模块中寻址的,是数据实际存储的地址。The physical address (physical address) described in the embodiment shown in FIG. 2 can be: storing information in a byte as a unit in the storage module. In order to correctly store or obtain information, each byte unit has a unique memory block address. The physical address can also be called the actual address or the absolute address. The physical address can be addressed in the storage module through the address bus, and is the address where the data is actually stored.
图2示意的实施例中所述的虚拟地址可以为:应用软件访问内存块所使用的逻辑地址。虚拟地址并不实际存储数据,而是需要映射到实际的物理地址上来获取数据。虚拟地址和物理地址的映射关系例如可以存储在内存管理单元(memory management unit,MMU)中,并由MMU实现将虚拟地址翻译成物理地址。不同应用软件之间的虚拟地址映射到不同的物理地址,以实现内存隔离。The virtual address described in the embodiment illustrated in FIG. 2 may be a logical address used by application software to access the memory block. Virtual addresses do not actually store data, but need to be mapped to actual physical addresses to obtain data. The mapping relationship between the virtual address and the physical address may be stored in a memory management unit (MMU), for example, and the MMU implements the translation of the virtual address into a physical address. Virtual addresses between different application software are mapped to different physical addresses to achieve memory isolation.
此外,本申请涉及的“访问”包括读操作和写操作,相应的,“访问权限”包括读操作权限和写操作权限。In addition, the "access" involved in this application includes read operation and write operation, and correspondingly, "access authority" includes read operation authority and write operation authority.
一些实施例中,图2示意的REE系统架构的软硬件和TEE系统架构的软硬件可以位于同一片上系统(system on chip,SOC)中。另一些实施例中,图2示意的REE软件应用层、REE软件接口适配层、REE软件驱动层、REE软件操作系统层、REE硬件模块、REE IOMMU模块,以及TEE软件应用层、TEE软件接口适配层、TEE软件驱动层、TEE软件操作系统层、TEE硬件模块、TEE IOMMU模块,位于同一SOC中,REE存储模块和TEE存储模块可以独立于SOC之外。In some embodiments, the software and hardware of the REE system architecture and the software and hardware of the TEE system architecture illustrated in FIG. 2 may be located in the same system on chip (SOC). In other embodiments, the REE software application layer, the REE software interface adaptation layer, the REE software driver layer, the REE software operating system layer, the REE hardware module, the REE IOMMU module, and the TEE software application layer and TEE software interface shown in FIG. 2 The adaptation layer, TEE software driver layer, TEE software operating system layer, TEE hardware module, and TEE IOMMU module are located in the same SOC, and the REE storage module and TEE storage module can be independent of the SOC.
可以理解的是,图2仅是一种示意性描述,并不构成对电子设备10的具体限定。在本申请另一些实施例中,电子设备10可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that FIG. 2 is only a schematic description, and does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
以下结合电子设备10,对本申请的安全访问方法进行介绍。The following describes the secure access method of the present application in conjunction with the electronic device 10.
可以理解的是,本申请所述的安全访问方法在TEE中实施,相应的,本申请所述的安全访问方法由电子设备10中TEE侧的软件,硬件,以及软硬件结合中至少一种执行。It is understandable that the secure access method described in this application is implemented in the TEE. Accordingly, the secure access method described in this application is executed by at least one of the software, hardware, and combination of software and hardware on the TEE side of the electronic device 10 .
参见图3,图3示意了一种安全访问方法100(以下简称方法100)。方法100包括以下步骤:Refer to Figure 3, which illustrates a secure access method 100 (hereinafter referred to as method 100). The method 100 includes the following steps:
步骤S101,根据检测请求确定目标硬件模块和目标内存块。Step S101: Determine the target hardware module and the target memory block according to the detection request.
其中,检测请求用于触发电子设备10检测目标硬件模块和目标内存块是否具备被访问的权限,以及目标硬件模块对目标内存块是否具备访问权限。The detection request is used to trigger the electronic device 10 to detect whether the target hardware module and the target memory block have the permission to be accessed, and whether the target hardware module has the access permission to the target memory block.
一些实施例中,该检测请求由TEE软件驱动层生成。示例性的,本实施例中,TEE软件驱动层可以从TEE软件应用层接收调用目标硬件模块访问目标内存块的指令,然后,TEE软件驱动层可以生成该检测请求,并向会话管理模块发送该检测请求。另一些实施例中,该检测请求由该目标硬件模块生成。示例性的,本实施例中,该目标硬件模块可以从REE驱动模块接收访问目标内存块的指令,然后,该目标硬件模块生成该检测请求,并向会话管理模块发送该检测请求。In some embodiments, the detection request is generated by the TEE software driver layer. Exemplarily, in this embodiment, the TEE software driver layer may receive an instruction from the TEE software application layer to call the target hardware module to access the target memory block. Then, the TEE software driver layer may generate the detection request and send the request to the session management module. Test request. In other embodiments, the detection request is generated by the target hardware module. Exemplarily, in this embodiment, the target hardware module may receive an instruction to access the target memory block from the REE driver module, and then the target hardware module generates the detection request, and sends the detection request to the session management module.
在一种可选的情况中,该检测请求可以包括目标硬件模块的模块身份标识以及目标内存块的内存身份标识。一些实施例中,该模块身份标识可以包括该目标硬件模块的模块标 识。另一些实施例中,该模块身份标识还可以包括该目标硬件模块的模块标识和该目标硬件模块的处理通道标识,该处理通道标识指示该目标硬件模块被占用的通道。一些实施例中,内存身份标识可以是内存管理模块配置该目标内存块时所设置。In an optional situation, the detection request may include the module identity of the target hardware module and the memory identity of the target memory block. In some embodiments, the module identification may include the module identification of the target hardware module. In other embodiments, the module identity identifier may further include the module identifier of the target hardware module and the processing channel identifier of the target hardware module, and the processing channel identifier indicates the channel occupied by the target hardware module. In some embodiments, the memory identity identifier may be set when the memory management module configures the target memory block.
示例性的,模块身份标识和内存身份标识的实现形式例如均是句柄(handle)。句柄可以描述为一种标识符,该标识符用于标识对象或者项目,对象或者项目例如可以是模块(module),任务(task),实例(instance),内存块(block of memory),控件(control)资源(resource)等。相应的,该检测请求可以包括目标硬件模块的句柄以及目标内存块的句柄。可选的,目标内存块的句柄中可以包括目标内存块的内存身份标识和该目标内存块的地址,该地址例如可以是目标内存块的虚拟地址。Exemplarily, the implementation form of the module identity and the memory identity are, for example, handles. A handle can be described as an identifier that is used to identify an object or item. The object or item can be, for example, a module, task, instance, block of memory, control ( control) resources (resource), etc. Correspondingly, the detection request may include the handle of the target hardware module and the handle of the target memory block. Optionally, the handle of the target memory block may include the memory identity identifier of the target memory block and the address of the target memory block, and the address may be, for example, the virtual address of the target memory block.
步骤S102,判断目标硬件模块和目标内存块是否属于同一条媒体通路。Step S102: Determine whether the target hardware module and the target memory block belong to the same media path.
若目标硬件模块和目标内存块不属于同一条媒体通路,说明当前试图通过目标硬件模块访问目标内存块的访问请求是非法的,不执行任何操作,或者输出报警信息。若目标硬件模块和目标内存块属于同一条媒体通路,执行步骤S103。If the target hardware module and the target memory block do not belong to the same media path, it means that the current access request to access the target memory block through the target hardware module is illegal, and no operation is performed, or an alarm message is output. If the target hardware module and the target memory block belong to the same media path, step S103 is executed.
其中,本实施例所述的媒体通路是指SMP,该SMP由应用软件触发创建。本实施例中,已创建的SMP可以包括至少一条。Wherein, the media path in this embodiment refers to SMP, and the SMP is created by application software. In this embodiment, the created SMP may include at least one SMP.
本申请中,该至少一条SMP中的每条SMP分别对应一个通路标识,每个通路标识均唯一,每个通路标识指示相应的SMP。通路标识例如可以描述为SID(session identify)。通路标识的设置过程以及通路标识与SMP的标识关系的建立,详见本说明书下述实施例的描述,此处不再详述。In this application, each SMP in the at least one SMP corresponds to a path identifier, each path identifier is unique, and each path identifier indicates a corresponding SMP. The path identifier can be described as SID (session identify), for example. For the setting process of the path identification and the establishment of the identification relationship between the path identification and the SMP, please refer to the description of the following embodiments of this specification for details, which will not be detailed here.
进一步的,会话管理模块可以获取目标硬件模块的第一通路标识和目标内存块的第二通路标识,第一通路标识指示目标硬件模块对应的媒体通路,第二通路标识指示目标内存块对应的媒体通路。然后,会话管理模块可以判断第一通路标识和第二通路标识是否相同,若第一通路标识和第二通路标识相同,确定目标硬件模块和目标内存块属于同一条媒体通路;若第一通路标识和第二通路标识不相同,确定目标硬件模块和目标内存块不属于同一条媒体通路。Further, the session management module can obtain the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the media corresponding to the target memory block. path. Then, the session management module can determine whether the first path identifier and the second path identifier are the same. If the first path identifier and the second path identifier are the same, determine that the target hardware module and the target memory block belong to the same media path; if the first path identifier Different from the second path identifier, it is determined that the target hardware module and the target memory block do not belong to the same media path.
可以理解的是,上述仅是常规场景下步骤S102的实施示例。在其他实施场景下,本申请可以采用其他方式实施步骤S102。It is understandable that the foregoing is only an implementation example of step S102 in a conventional scenario. In other implementation scenarios, this application can implement step S102 in other ways.
例如,一种实施场景中,会话管理模块可以判断目标硬件模块和目标内存块是否属于目标媒体通路。本实施例中,目标媒体通路可以是已创建的SMP中的任意一条SMP,目标媒体通路的通路标识可以描述为目标通路标识。For example, in an implementation scenario, the session management module can determine whether the target hardware module and the target memory block belong to the target media channel. In this embodiment, the target media path may be any SMP in the created SMP, and the path identifier of the target media path may be described as the target path identifier.
具体的,会话管理模块可以获取目标硬件模块的第一通路标识和目标内存块的第二通路标识,第一通路标识指示目标硬件模块对应的媒体通路,第二通路标识指示目标内存块对应的媒体通路。然后,会话管理模块可以检测第一通路标识和第二通路标识是否与目标通路标识相同,若第一通路标识与目标通路标识相同,且第二通路标识与目标通路标识相同,确定目标硬件模块和目标内存块属于该目标媒体通路。若第一通路标识与目标通路标识不相同,确定目标硬件模块不属于目标媒体通路。同理,若第二通路标识与目标通路标识不相同,确定目标内存块中不属于目标媒体通路。当目标媒体通路需要通过调用硬件模块访问内存块中的数据流以实现处理任务时,首先需要分别判断目标硬件模块和目标内存块是否属于该目标媒体通路,如果目标硬件模块和目标内存块均属于该目标媒体通路,才 进一步判断目标硬件模块对目标内存块有没有访问权限;否则,说明当前访问请求是不合法的,例如该访问请求有可能为跨媒体通路访问,或者说明目标媒体通路不可以调用目标硬件模块,或者不可以访问目标内存块。Specifically, the session management module may obtain the first path identifier of the target hardware module and the second path identifier of the target memory block. The first path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the media corresponding to the target memory block. path. Then, the session management module can detect whether the first path identifier and the second path identifier are the same as the target path identifier. If the first path identifier is the same as the target path identifier, and the second path identifier is the same as the target path identifier, determine the target hardware module and The target memory block belongs to the target media channel. If the first path identifier is not the same as the target path identifier, it is determined that the target hardware module does not belong to the target media path. Similarly, if the second path identifier is different from the target path identifier, it is determined that the target memory block does not belong to the target media path. When the target media path needs to access the data stream in the memory block by calling the hardware module to achieve the processing task, it is first necessary to determine whether the target hardware module and the target memory block belong to the target media path. If both the target hardware module and the target memory block belong The target media channel can further determine whether the target hardware module has access rights to the target memory block; otherwise, it means that the current access request is illegal. For example, the access request may be cross-media channel access, or the target media channel is not allowed The target hardware module is called, or the target memory block cannot be accessed.
进一步的,电子设备10例如可以采用以下至少两种可选的实施方式执行“获取目标硬件模块的第一通路标识和目标内存块的第二通路标识”。Further, the electronic device 10 may, for example, adopt the following at least two optional implementation manners to execute "obtain the first path identifier of the target hardware module and the second path identifier of the target memory block".
可选实施方式一:结合步骤S101的描述,会话管理模块可以获取目标硬件模块的模块身份标识,然后,在第一对应关系中确定与该模块身份标识对应的第一通路标识。同理,会话管理模块可以获取目标内存块的内存身份标识,并在第一对应关系中确定与内存身份标识对应的第二通路标识。可选的,本实施例中,该模块身份标识例如包括该目标硬件模块的模块标识和该目标硬件模块的处理通道标识。Optional Embodiment 1: In combination with the description of step S101, the session management module may obtain the module identity of the target hardware module, and then determine the first path identity corresponding to the module identity in the first correspondence. In the same way, the session management module can obtain the memory identity of the target memory block, and determine the second path identity corresponding to the memory identity in the first correspondence. Optionally, in this embodiment, the module identity identifier includes, for example, the module identifier of the target hardware module and the processing channel identifier of the target hardware module.
其中,第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于所述通路标识指示的媒体通路。可以理解的是,第一对应关系中通路标识指示的均是SMP。该第一对应关系可以是电子设备10在创建SMP时建立,创建SMP的实施例详见本说明书下文的描述。Wherein, the first corresponding relationship includes the corresponding relationship between the path identifier and the module identifier and the memory identifier. One path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block. The same path identifier corresponds to at least One hardware module and at least one memory block belong to the media channel indicated by the channel identifier. It can be understood that all the path identifiers in the first correspondence relationship indicate SMP. The first corresponding relationship may be established when the electronic device 10 creates the SMP. For the embodiments of creating the SMP, please refer to the following description of this specification.
示例性的,第一对应关系可以如表1所示。Exemplarily, the first correspondence may be as shown in Table 1.
表1Table 1
Figure PCTCN2019090478-appb-000001
Figure PCTCN2019090478-appb-000001
其中,表1中“通路01”和“通路02”均是通路标识。“(模块A,处理通道01)”是硬件模块01的模块身份标识,其中,“模块A”是硬件模块01的模块标识,“处理通道01”是硬件模块01被占用的处理通道的标识。表1中其他模块身份标识的含义与之相似,此处不再赘述。“(虚拟地址01,第一标识)”是内存块01的句柄,其中,“虚拟地址01”是内存块01的虚拟地址,“第一标识”是内存块01的内存身份标识。表1中其他内存句柄的含义与之相似,此处不再赘述。Among them, the "passage 01" and "passage 02" in Table 1 are both the pass mark. "(Module A, processing channel 01)" is the module identity of hardware module 01, where "module A" is the module identifier of hardware module 01, and "processing channel 01" is the identifier of the processing channel occupied by hardware module 01. The meanings of other module identities in Table 1 are similar, and will not be repeated here. "(Virtual address 01, first identifier)" is the handle of memory block 01, where "virtual address 01" is the virtual address of memory block 01, and "first identifier" is the memory identity identifier of memory block 01. The meanings of other memory handles in Table 1 are similar, and will not be repeated here.
如表1所示,“(模块A,处理通道01)”指示的硬件模块01,“(模块B,处理通道10)”指示的硬件模块02,“(模块C,处理通道32)”指示的硬件模块03,以及“(虚拟地址01,第一标识)”指示的内存块01,“(虚拟地址02,第二标识)”指示的内存块02,属于通路标识“通路01”指示的SMP。同理,“(模块A,处理通道20)”指示的硬件模块04,“(模块D,处理通道15)”指示的硬件模块05,“(模块E,处理通道30)”指示的硬件模块06,以及“(虚拟地址03,第一标识)”指示的内存块03,“(虚拟地址04,第三标识)”指示的内存块004,“(虚拟地址05,第四标识)”指示的内存块05,属于通路标识“通路02” 指示的SMP。As shown in Table 1, the hardware module 01 indicated by "(module A, processing channel 01)", the hardware module 02 indicated by "(module B, processing channel 10)", and the hardware module indicated by "(module C, processing channel 32)" The hardware module 03, and the memory block 01 indicated by "(virtual address 01, first identifier)", and the memory block 02 indicated by "(virtual address 02, second identifier)" belong to the SMP indicated by the path identifier "path 01". Similarly, the hardware module 04 indicated by "(module A, processing channel 20)", the hardware module 05 indicated by "(module D, processing channel 15)", and the hardware module 06 indicated by "(module E, processing channel 30)" , And memory block 03 indicated by "(virtual address 03, first identification)", memory block 004 indicated by "(virtual address 04, third identification)", and memory indicated by "(virtual address 05, fourth identification)" Block 05 belongs to the SMP indicated by the path identifier "path 02".
结合表1示意的第一对应关系,一些实施例中,目标硬件模块的句柄例如是(模块A,处理通道01),目标内存块的句柄例如是(虚拟地址02,第二标识),根据表1可知,目标硬件模块和目标内存块属于同一条媒体通路,即“通路01”指示的SMP。另一些实施例中,目标硬件模块的句柄例如是(模块D,处理通道15),目标内存块的句柄例如是(虚拟地址02,第二标识),根据表1可知,目标硬件模块属于“通路02”指示的SMP,目标内存块属于“通路01”指示的SMP,可见,目标硬件模块和目标内存块不属于同一条媒体通路。With reference to the first correspondence shown in Table 1, in some embodiments, the handle of the target hardware module is, for example, (module A, processing channel 01), and the handle of the target memory block is, for example, (virtual address 02, second identification). 1 It can be seen that the target hardware module and the target memory block belong to the same media path, that is, the SMP indicated by "path 01". In other embodiments, the handle of the target hardware module is, for example, (module D, processing channel 15), and the handle of the target memory block is, for example, (virtual address 02, second identification). According to Table 1, the target hardware module belongs to the "path" The SMP indicated by "02", the target memory block belongs to the SMP indicated by "Path 01", it can be seen that the target hardware module and the target memory block do not belong to the same media path.
可以理解的是,表1仅是示意性示例,不应对本申请所述的第一对应关系构成限制。在另一些实现方式中,第一对应关系的实现形式,各类身份标识的表达方式等,均不限于表1所示。此处不再详述。It can be understood that Table 1 is only a schematic example, and should not constitute a limitation to the first correspondence described in this application. In other implementation manners, the implementation form of the first correspondence relationship and the expression manner of various identities are not limited to those shown in Table 1. No more details here.
可选实施方式二:会话管理模块可以获取目标硬件模块的模块身份标识,并在第一对应关系中确定与模块身份标识对应的第一通路标识。进而,会话管理模块可以根据目标内存块的内存身份标识获取待访问的目标地址,然后,将该目的地址传输到内存管理模块。内存管理模块可以在第二对应关系中确定所述目标内存块对应的所述第二通路标识,然后,内存管理模块可以将该第二通路标识传输给会话管理模块。可选的,该目标地址例如可以是目标内存块的虚拟地址。Optional implementation manner 2: The session management module may obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in the first correspondence. Furthermore, the session management module can obtain the target address to be accessed according to the memory identity of the target memory block, and then transmit the target address to the memory management module. The memory management module may determine the second path identifier corresponding to the target memory block in the second correspondence, and then the memory management module may transmit the second path identifier to the session management module. Optionally, the target address may be a virtual address of the target memory block, for example.
其中,第二对应关系包括内存块的地址与相应内存块所属媒体通路的通路标识的对应关系。一些实施例中,第二对应关系所包含的信息例如是一个内存块对应的属性信息,该内存块的属性信息可以以映射表的形式实现。内存块的属性信息还可以包括该内存块的内存类型,基于此,第二对应关系可以包括内存块的地址,内存块的类型,以及相应内存块所属媒体通路的通路标识。The second correspondence includes the correspondence between the address of the memory block and the channel identifier of the media channel to which the corresponding memory block belongs. In some embodiments, the information contained in the second correspondence is, for example, attribute information corresponding to a memory block, and the attribute information of the memory block may be implemented in the form of a mapping table. The attribute information of the memory block may also include the memory type of the memory block. Based on this, the second correspondence may include the address of the memory block, the type of the memory block, and the channel identifier of the media channel to which the corresponding memory block belongs.
示例性的,一个内存块的映射表如表2所示。Exemplarily, a mapping table of a memory block is shown in Table 2.
表2Table 2
Figure PCTCN2019090478-appb-000002
Figure PCTCN2019090478-appb-000002
其中,表2是内存块01的属性信息映射表,虚拟地址01是指内存块01对应的虚拟地址,物理地址01是指内存块01对应的物理地址,通路01是指内存块01所属媒体通路的通路标识,第一标识是指内存块01的内存身份标识被设置为第一标识。内存管理模块可以根据该第一标识设置IOMMU中的标识寄存器,以设置IOMMU对应的硬件模块对内存块01的访问权限。Among them, Table 2 is the attribute information mapping table of memory block 01, virtual address 01 refers to the virtual address corresponding to memory block 01, physical address 01 refers to the physical address corresponding to memory block 01, and path 01 refers to the media path to which memory block 01 belongs The first identifier means that the memory identity identifier of the memory block 01 is set as the first identifier. The memory management module may set the identification register in the IOMMU according to the first identification to set the access authority of the hardware module corresponding to the IOMMU to the memory block 01.
可以理解的是,表2仅是示意性示例,不应对本申请所述的第二对应关系构成限制。在另一些实现方式中,第二对应关系的实现形式可以不同于表2。此处不再详述。It can be understood that Table 2 is only a schematic example, and should not constitute a limitation to the second correspondence described in this application. In other implementation manners, the implementation form of the second correspondence relationship may be different from Table 2. No more details here.
根据本步骤的描述可知,在目标硬件模块访问目标内存块之前,会话管理模块需要检测目标硬件模块和目标内存块是否属于同一SMP,从而能够规避TEE下第一SMP的硬件模块访问第二SMP种的安全内存块,进而能够提高SMP的安全性。According to the description of this step, before the target hardware module accesses the target memory block, the session management module needs to detect whether the target hardware module and the target memory block belong to the same SMP, so as to avoid the hardware module of the first SMP under TEE from accessing the second SMP. The secure memory block can improve the security of SMP.
步骤S103,在目标硬件模块和目标内存块属于同一媒体通路时,确定目标硬件模块对目标内存块是否有访问权限。Step S103: When the target hardware module and the target memory block belong to the same media path, it is determined whether the target hardware module has access authority to the target memory block.
若目标硬件模块对目标内存块无访问权限,不执行任何操作,或者输出报警信息。若目标硬件模块对目标内存块有访问权限,执行步骤S104。If the target hardware module has no access authority to the target memory block, no operation is performed or an alarm message is output. If the target hardware module has access authority to the target memory block, step S104 is executed.
其中,任一硬件模块对内存块的访问权限在创建SMP过程中设置,此处不再详述。Among them, the access authority of any hardware module to the memory block is set during the creation of the SMP, and will not be detailed here.
一些实施例中,确定目标硬件模块对目标内存块是否有访问权限的步骤,可以由会话管理模块执行。例如,会话管理模块可以获取目标硬件模块的模块身份标识以及目标内存块的内存身份标识,然后,会话管理模块层可以从策略管理模块对应的内存区域中读取第三对应关系,然后,会话管理模块检测第三对应关系中是否设置有与该模块身份标识和该内存身份标识对应的访问权限标识,若第三对应关系中设置有与该模块身份标识和该内存身份标识对应的访问权限标识时,该目标硬件模块对该目标内存块有所述访问权限标识指示的访问权限。可选的,本实施例中,模块身份标识例如是目标硬件模块的模块标识。In some embodiments, the step of determining whether the target hardware module has access authority to the target memory block may be performed by the session management module. For example, the session management module can obtain the module identity of the target hardware module and the memory identity of the target memory block. Then, the session management module layer can read the third correspondence from the memory area corresponding to the policy management module, and then the session management The module detects whether there is an access authority identifier corresponding to the module identity identifier and the memory identity identifier in the third correspondence relationship, if the third correspondence relationship is set with the access authority identifier corresponding to the module identity identifier and the memory identity identifier , The target hardware module has the access authority indicated by the access authority identifier for the target memory block. Optionally, in this embodiment, the module identity is, for example, the module identity of the target hardware module.
根据图2对应的实施例的描述,第三对应关系被预先设置并存储在策略管理模块对应的内存区域中,包括模块身份标识、内存身份标识和访问权限标识的对应关系。一些实施例中,第三对应关系可以包括模块标识、内存身份标识和访问权限标识的对应关系。示例性的,第三对应关系如表3所示。According to the description of the embodiment corresponding to FIG. 2, the third correspondence relationship is preset and stored in the memory area corresponding to the policy management module, and includes the correspondence relationship between the module identity identifier, the memory identity identifier, and the access authority identifier. In some embodiments, the third correspondence relationship may include a correspondence relationship between a module identifier, a memory identifier, and an access authority identifier. Exemplarily, the third correspondence is shown in Table 3.
表3table 3
内存身份标识Memory identity 模块标识Module ID 访问权限标识Access authority identification
第一标识First logo 模块AModule A 读标识Read logo
第一标识First logo 模块BModule B 读标识和写标识Read mark and write mark
第二标识Second mark 模块AModule A 写标识Write logo
第三标识Third mark 模块CModule C 写标识Write logo
第三标识Third mark 模块DModule D 读标识Read logo
第四标识Fourth logo 模块BModule B 读标识和写标识Read mark and write mark
其中,表3示意了四种内存身份标识,“读标识”是指表3中该列模块标识示意的硬件模块对该列示意的类型的内存块具备读操作权限,“写标识”是指表3中该列模块标识示意的硬件模块对该列示意的类型的内存块具备写操作权限的,同理,“读标识和写标识”是指表3中该列模块标识示意的硬件模块对该列示意的类型的内存块具备读操作权限和写操作权限。例如,模块A指示的硬件模块对第一标识指示的内存块具备读操作权限;模块B指示的硬件模块对第一标识指示的内存块具备读操作权限和写操作权限;模块A指示的硬件模块对第二标识指示的内存块具备写操作权限,本申请此处不再一一列举。Among them, Table 3 shows four types of memory identification identifiers. "Read identifier" means that the hardware module indicated by the module identifier in Table 3 has read operation authority for the memory block of the type indicated in the column. "Write identifier" refers to the table If the hardware module indicated by the module identification in this column has the write operation authority to the memory block of the indicated type in the column, the same applies, "read identification and write identification" means that the hardware module indicated by the module identification in the column in Table 3 The memory blocks of the listed types have read operation permissions and write operation permissions. For example, the hardware module indicated by module A has read operation authority for the memory block indicated by the first identifier; the hardware module indicated by module B has read operation authority and write operation authority for the memory block indicated by the first identifier; the hardware module indicated by module A The memory block indicated by the second identifier has the write operation permission, which will not be listed here in this application.
可以理解的是,表3仅是示意性示例,不应对本申请所述的第三对应关系构成限制。在另一些实现方式中,第三对应关系中还可以包括更多或者更少的内存身份标识,模块标识,以及访问权限标识的对应关系。此处不再详述。It is understandable that Table 3 is only a schematic example, and should not constitute a limitation to the third correspondence described in this application. In other implementation manners, the third correspondence may also include more or fewer correspondences between memory identity identifiers, module identifiers, and access authority identifiers. No more details here.
根据图2中对硬件模块的描述可知,每个硬件模块具备一定的功能,并且,不同硬件模块可以对应处理的不同类型的媒体流。例如,多路分配模块的功能是对TS执行解扰,硬件显示模块的功能是显示视频数据对应的视频。基于此,相关技术人员可以根据所存储媒体流的类型对应设置内存块的类型,进而,根据每个硬件模块对相应类型的媒体流的操作权限,设置相应硬件模块对相应类型内存块的访问权限。例如,相关技术人员可以将存储TS的内存块的身份标识确定为第一标识来标识,将存储视频数据的内存块的身份标识 确定为第二标识。相应的,多路分配模块对第一标识具备读操作权限和写操作权限,多路分配模块对第二标识不具备任何访问权限。同理,硬件显示模块对第二标识具备读操作权限,而对第一标识不具备任何访问权限。相应的,相关技术人员将多路分配模块的模块标识,第一标识,以及读标识和写标识对应存储在第三对应关系中,并将硬件显示模块的模块标识,第二标识以及读标识对应存储在第三对应关系中。所以,若第三对应关系中未设置与该模块身份标识和该内存身份标识对应的访问权限标识,则说明目标硬件模块对目标内存块不具备访问权限。According to the description of the hardware modules in Figure 2, each hardware module has a certain function, and different hardware modules can handle different types of media streams correspondingly. For example, the function of the demultiplexing module is to descramble the TS, and the function of the hardware display module is to display the video corresponding to the video data. Based on this, the relevant technical personnel can set the type of memory block corresponding to the type of the stored media stream, and then, according to the operation authority of each hardware module to the corresponding type of media stream, set the access authority of the corresponding hardware module to the corresponding type of memory block . For example, relevant technicians may determine the identity of the memory block storing the TS as the first identity to identify, and the identity of the memory block storing the video data as the second identity. Correspondingly, the multiplex distribution module has read operation authority and write operation authority for the first identifier, and the multiplex distribution module does not have any access authority for the second identifier. In the same way, the hardware display module has read operation authority for the second identifier, but does not have any access authority for the first identifier. Correspondingly, the relevant technicians correspondingly store the module identification, the first identification, and the read identification and the write identification of the multiplexed module in the third correspondence relationship, and correspond to the module identification, the second identification and the read identification of the hardware display module Stored in the third correspondence. Therefore, if the access authority identifier corresponding to the module identity identifier and the memory identity identifier is not set in the third correspondence, it means that the target hardware module does not have access authority to the target memory block.
此外,根据图2的描述可知,硬件模块和IOMMU模块一一对应,基于此,目标硬件模块对应目标IOMMU模块。进一步的,目标IOMMU模块中包括标识寄存器,示例性的,所述标识寄存器中包括目标硬件模块有访问权限的至少一个内存身份标识。基于此,示例性的,可以获取目标内存块的内存身份标识,然后,确定所述至少一个内存身份标识中是否包括所述内存身份标识,当所述至少一个有访问权限的内存身份标识中包括所述内存身份标识时,目标硬件模块对目标内存块有所述访问权限标识指示的访问权限。In addition, according to the description of FIG. 2, it can be seen that the hardware module and the IOMMU module have a one-to-one correspondence. Based on this, the target hardware module corresponds to the target IOMMU module. Further, the target IOMMU module includes an identification register. Illustratively, the identification register includes at least one memory identity that the target hardware module has access rights to. Based on this, exemplary, the memory identity of the target memory block can be obtained, and then it is determined whether the at least one memory identity includes the memory identity, and when the at least one memory identity with access permission includes In the case of the memory identity identifier, the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
进一步的,由于访问权限包括读操作权限和写操作权限,所以,所述标识寄存器包括读标识寄存器和写标识寄存器。相应的,所述读标识寄存器中包括至少一个有读操作权限的内存身份标识,所述写标识寄存器中包括至少一个有写操作权限的内存身份标识。Further, since the access authority includes a read operation authority and a write operation authority, the identification register includes a read identification register and a write identification register. Correspondingly, the read identification register includes at least one memory identification with read operation authority, and the write identification register includes at least one memory identification with write operation authority.
此外,根据上述实施例的描述,访问权限包括读操作权限和写操作权限,所以,目标硬件模块确定对目标内存块是否有访问权限,可以包括:确定所述至少一个有读操作权限的内存身份标识中是否包括所述内存身份标识,当所述至少一个有读操作权限的内存身份标识中包括所述内存身份标识时,目标硬件模块对目标内存块有读操作权限。或者,确定所述至少一个有写操作权限的内存身份标识中是否有所述内存身份标识,当所述至少一个有写操作权限的内存身份标识中包括所述内存身份标识时,目标硬件模块对目标内存块有写操作权限。In addition, according to the description of the foregoing embodiment, the access authority includes read operation authority and write operation authority. Therefore, determining whether the target hardware module has access authority to the target memory block may include: determining the at least one memory identity with read operation authority Whether the identifier includes the memory identity identifier, and when the at least one memory identity identifier with read operation permission includes the memory identity identifier, the target hardware module has the read operation permission on the target memory block. Alternatively, it is determined whether the at least one memory identity with write operation permission includes the memory identity, and when the at least one memory identity with write operation permission includes the memory identity, the target hardware module pairs The target memory block has write permission.
可见,采用本实现方式,通过在IOMMU模块中设置标识寄存器,鉴别硬件模块对内存块的访问权限,操作简单,易于实现,且具有好的鉴权效果。It can be seen that by adopting this implementation method, by setting the identification register in the IOMMU module, the access authority of the hardware module to the memory block is identified, which is simple to operate, easy to implement, and has a good authentication effect.
示例性的,如图4所示,标识寄存器中例如可以维护内存身份标识的位图,内存身份标识的位图例如可以包括64位,该位图的64位中的每一位唯一指示一种内存类型,例如,该位图中的第21位指示内存类型21。每一个内存身份标识位的字段的值可以指示硬件模块对该类型的内存是否具备访问权限,本申请可以将字段的值描述为指示该标识寄存器是否包含相应内存身份标识。在一些实施例中,例如,字段值“1”是使能值,指示硬件模块对相应位指示的类型的内存具备访问权限,也即标识寄存器包含相应内存身份标识;字段值“0”是禁止访问值,指示硬件模块对相应位指示的类型的内存无访问权限,也即标识寄存器不包含相应内存身份标识。在另一些实施例中,例如,字段值“0”是使能值,指示硬件模块对相应位指示的类型的内存具备访问权限,也即标识寄存器包含相应内存身份标识;字段值“1”是禁止访问值,指示硬件模块对相应位指示的类型的内存无访问权限,也即标识寄存器不包含相应内存身份标识。Exemplarily, as shown in FIG. 4, the bitmap of the memory identity can be maintained in the identification register, for example, the bitmap of the memory identity can include 64 bits, and each of the 64 bits of the bitmap uniquely indicates one kind Memory type, for example, the 21st bit in the bitmap indicates memory type 21. The value of the field of each memory identification bit can indicate whether the hardware module has access rights to this type of memory. This application may describe the value of the field as indicating whether the identification register contains the corresponding memory identification. In some embodiments, for example, the field value "1" is an enable value, indicating that the hardware module has access rights to the type of memory indicated by the corresponding bit, that is, the identification register contains the corresponding memory identity; the field value "0" is forbidden The access value indicates that the hardware module has no access authority to the type of memory indicated by the corresponding bit, that is, the identification register does not contain the corresponding memory identification. In other embodiments, for example, the field value "0" is the enable value, indicating that the hardware module has access rights to the type of memory indicated by the corresponding bit, that is, the identification register contains the corresponding memory identity; the field value "1" is The access prohibited value indicates that the hardware module has no access authority to the type of memory indicated by the corresponding bit, that is, the identification register does not contain the corresponding memory identification.
可选的,图4示意的64位的字段的初始值可以均是禁止访问值,在创建SMP阶段,TEE内存管理模块2122可以根据需求将该位图中一些位的字段值由禁止访问值修改为使能值。此处不再详述。Optionally, the initial values of the 64-bit fields shown in FIG. 4 may all be forbidden values. During the creation of the SMP, the TEE memory management module 2122 may modify the field values of some bits in the bitmap from the forbidden values as required. Is the enable value. No more details here.
进一步的,标识寄存器可以包括读操作权限的标识寄存器和写操作权限的标识寄存器,读操作权限的标识寄存器中的位图和写操作权限的标识寄存器中的位图分别如图4所示,读操作权限标识寄存器的位图中位的字段值,指示硬件模块对相应位指示的类型的内存块是否具备读权限。写操作权限标识寄存器的位图中位的字段值,指示硬件模块对相应位指示的类型的内存块的是否具备写权限。示例性的,目标内存块的内存身份标识例如是21,读操作权限标识寄存器的位图中的第21位例如是使能值“1”,指示目标硬件模块对目标内存块有读操作权限。写操作权限标识寄存器的位图中的第21位例如是禁止访问值“0”,指示目标硬件模块对目标内存块没有写操作权限。Further, the identification register may include a read operation authority identification register and a write operation authority identification register, the bitmap in the read operation authority identification register and the bitmap in the write operation authority identification register are shown in Figure 4, respectively. The field value of the bit in the bitmap of the operation authority identification register indicates whether the hardware module has read authority for the type of memory block indicated by the corresponding bit. The bit field value in the bitmap of the write operation authority identification register indicates whether the hardware module has write authority for the type of memory block indicated by the corresponding bit. Exemplarily, the memory identity identifier of the target memory block is 21, and the 21st bit in the bitmap of the read operation authority identification register is, for example, the enable value "1", indicating that the target hardware module has read operation authority to the target memory block. The 21st bit in the bitmap of the write operation authority identification register is, for example, the access prohibited value "0", indicating that the target hardware module has no write operation authority to the target memory block.
可以理解的是,图4仅是示意性实施方式,对本申请所述标识寄存器的不构成限制。在其他实现方式中,标识寄存器也可以采用其他实现方式实现,本申请对此不做限制。It can be understood that FIG. 4 is only a schematic implementation manner, and does not limit the identification register described in the present application. In other implementation manners, the identification register may also be implemented in other implementation manners, which is not limited in this application.
根据本步骤的描述可知,在目标硬件模块访问目标内存块之前,电子设备10检测目标硬件模块对目标内存块的访问权限,从而能够规避对目标内存块中的媒体流无访问权限的硬件模块访问目标内存块中的媒体流,进而能够提高SMP的安全性。According to the description of this step, before the target hardware module accesses the target memory block, the electronic device 10 detects the access authority of the target hardware module to the target memory block, thereby being able to avoid access to hardware modules that have no access authority to the media stream in the target memory block. The media stream in the target memory block can in turn improve the security of SMP.
步骤S104,在目标硬件模块对目标内存块有访问权限时,目标硬件模块访问目标内存块。Step S104: When the target hardware module has access authority to the target memory block, the target hardware module accesses the target memory block.
其中,结合对步骤S103的描述,在目标硬件模块对目标内存块有读操作权限时,目标硬件模块读取目标内存块中的媒体流数据。在目标硬件模块对目标内存块有写操作权限时,目标硬件模块向目标内存块中写入媒体流数据。Wherein, in conjunction with the description of step S103, when the target hardware module has read operation authority to the target memory block, the target hardware module reads the media stream data in the target memory block. When the target hardware module has the write operation authority to the target memory block, the target hardware module writes media stream data into the target memory block.
可见,采用本申请的技术方案,硬件模块访问安全内存块之前,电子设备检测该硬件模块与相应安全内存块是否属于同一SMP,从而能够规避硬件模块跨SMP交叉访问。若该硬件模块与相应安全内存块属于同一SMP,电子设备进一步检测该硬件模块是否具备访问该安全内存块的权限,若该硬件模块具备访问该安全内存块的权限,该硬件模块才能够访问该安全内存块,否则,该硬件模块无法访问该安全内存块。这样使得安全内存块能够被安全访问,从而能够避免安全媒体流从安全内存块中泄露,提高SMP的安全性。It can be seen that, with the technical solution of the present application, before the hardware module accesses the secure memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP, thereby avoiding cross-SMP cross access of the hardware module. If the hardware module and the corresponding secure memory block belong to the same SMP, the electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block. The secure memory block, otherwise, the hardware module cannot access the secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
图3所示的实施例是以SMP的使用过程为示例,对本申请的安全访问方法进行的介绍。根据上述各实施例的描述,图3所示的实施例中一些对应关系等的设置,在创建SMP阶段完成。以下对本申请涉及的创建SMP的实施过程进行介绍。The embodiment shown in FIG. 3 takes the use process of SMP as an example to introduce the secure access method of this application. According to the description of the foregoing embodiments, the settings of some correspondences and the like in the embodiment shown in FIG. 3 are completed in the stage of creating the SMP. The implementation process of creating SMP involved in this application is introduced below.
结合图2示意的电子设备10,TEE软件应用层中运行的应用软件,可以向TEE软件驱动层传输创建媒体通路的请求,当然,本实施例待创建媒体通路是SMP。然后,TEE软件驱动层驱动可以生成该待创建SMP的通路标识,例如“通路01”。进而,驱动TEE软件驱动层可以配置至少一个硬件模块以及至少一个内存块,得到所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识。然后,TEE软件驱动层将所述通路标识、所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识对应存储,得到表1示意的第一对应关系中包括通路01的对应关系。其中,所述至少一个硬件模块和所述至少一个内存块组成所述媒体通路。可选的,所述至少一个硬件模块中例如包括目标硬件模块。With reference to the electronic device 10 shown in FIG. 2, the application software running in the TEE software application layer can transmit a request to create a media path to the TEE software driver layer. Of course, the media path to be created in this embodiment is an SMP. Then, the TEE software driver layer driver can generate the path identifier of the SMP to be created, such as "path 01". Furthermore, the driver TEE software driver layer can configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block. Then, the TEE software driver layer correspondingly stores the path identifier, the module identifier of the at least one hardware module, and the memory identifier of the at least one memory block, and obtains that the first correspondence shown in Table 1 includes the path 01 Correspondence. Wherein, the at least one hardware module and the at least one memory block constitute the media path. Optionally, the at least one hardware module includes, for example, a target hardware module.
示例性的,TEE软件驱动层配置至少一个内存块可以包括:TEE软件驱动层可以根据 应用软件的请求分配至少一个安全内存块,进而,根据第三对应关系设置该至少一个安全内存块中的每一个安全内存块的内存身份标识。然后,TEE软件驱动层可以设置至少一个安全内存块中的每一个安全内存块的属性信息,使得每一个安全内存块的虚拟地址、内存身份标识和通道标识01对应,得到第二对应关系。Exemplarily, configuring at least one memory block by the TEE software driver layer may include: the TEE software driver layer may allocate at least one secure memory block according to a request of the application software, and further, set each of the at least one secure memory block according to the third correspondence relationship. The memory identity of a secure memory block. Then, the TEE software driver layer may set the attribute information of each secure memory block in at least one secure memory block, so that the virtual address, memory identity identifier, and channel identifier 01 of each secure memory block correspond to obtain the second correspondence.
进一步的,TEE软件驱动层还可以从第三对应关系中获取至少一个硬件模块中每个硬件模块具有访问权限的至少一个内存身份标识,然后,将相应硬件模块具有访问权限的至少一个内存身份标识,设置在相应硬件模块对应的IOMMU标识寄存器中。例如,TEE软件驱动层可以从第三对应关系中获取目标硬件模块具有访问权限的至少一个内存身份标识,然后,将具有访问权限的至少一个内存身份标识设置在目标IOMMU的标识寄存器中。Further, the TEE software driver layer can also obtain at least one memory identity that each hardware module has access rights in the at least one hardware module from the third correspondence, and then assign at least one memory identity that the corresponding hardware module has access rights to , Set in the IOMMU identification register corresponding to the corresponding hardware module. For example, the TEE software driver layer may obtain at least one memory identity with access permission of the target hardware module from the third correspondence, and then set the at least one memory identity with access permission in the identity register of the target IOMMU.
示例性的,结合图4示意的实施例,TEE软件驱动层在从第三对应关系中获取目标硬件模块具有访问权限的至少一个内存身份标识之后,将目标IOMMU中相应寄存器中内存身份标识对应的字段值,由禁止访问字段值修改为使能值。Exemplarily, in conjunction with the embodiment illustrated in FIG. 4, the TEE software driver layer obtains from the third correspondence relationship at least one memory identity that the target hardware module has access rights to, and then corresponds to the memory identity in the corresponding register of the target IOMMU The field value is changed from the forbidden field value to the enabled value.
可见,采用本实现方式,电子设备10在创建SMP阶段,即建立好SMP的通路标识与属于该SMP的硬件模块和安全内存块的对应关系,并绑定该SMP中每个硬件模块与该硬件模块相关的安全内存块。从而,在使用SMP过程中,为检测目标硬件模块与目标安全内存块的关系,以及目标硬件模块对目标安全内存块是否具备访问权限,提供数据依据。进而,提高SMP的安全性。It can be seen that using this implementation method, the electronic device 10 is in the SMP creation stage, that is, the corresponding relationship between the path identifier of the SMP and the hardware module and secure memory block belonging to the SMP is established, and each hardware module in the SMP is bound to the hardware The safe memory block associated with the module. Thus, in the process of using SMP, it provides a data basis for detecting the relationship between the target hardware module and the target secure memory block, and whether the target hardware module has access rights to the target secure memory block. Furthermore, the safety of SMP is improved.
以下结合实例对本申请的技术方案进行描述。The technical solution of the present application will be described below in conjunction with examples.
图5提供了一种电子设备20的架构图,电子设备20支持TEE。电子设备20的TEE侧包括:软件部分和硬件部分。软件部分包括TEE应用,会话管理模块(session manager),内存管理模块(memory manager),策略管理模块(policy manager)和TEE驱动模块。应当理解,软件部分为由软件指令或者软件代码实现的功能模块,这些软件指令或软件代码运行在处理器上以实现相应的功能。硬件部分包括多路分配模块(demux),硬件解码模块(decoder),VPSS和VDP,以及与各硬件模块一一对应的IOMMU。硬件部分还包括TEE存储模块。其中,每个IOMMU中均设置读操作权限对应的标识寄存器和写操作权限对应的标识寄存器。FIG. 5 provides a structural diagram of an electronic device 20, and the electronic device 20 supports TEE. The TEE side of the electronic device 20 includes: a software part and a hardware part. The software part includes TEE application, session management module (session manager), memory management module (memory manager), policy management module (policy manager) and TEE driver module. It should be understood that the software part is a functional module implemented by software instructions or software codes, and these software instructions or software codes run on the processor to implement corresponding functions. The hardware part includes demux, hardware decoder, VPSS and VDP, and IOMMU corresponding to each hardware module. The hardware part also includes TEE storage module. Among them, the identification register corresponding to the read operation authority and the identification register corresponding to the write operation authority are set in each IOMMU.
本实施例中,TEE应用运行在电子设备10中的TEE软件应用层,本实施例中,会话管理模块,内存管理模块,策略管理模块和TEE驱动模块例如运行在电子设备10的TEE软件驱动层。示例性的,本实施例所述的策略表(即第三对应关系)可以如表4所示。In this embodiment, the TEE application runs on the TEE software application layer of the electronic device 10. In this embodiment, the session management module, the memory management module, the policy management module and the TEE driver module run on the TEE software driver layer of the electronic device 10. . Exemplarily, the strategy table (that is, the third correspondence) described in this embodiment may be as shown in Table 4.
表4Table 4
Figure PCTCN2019090478-appb-000003
Figure PCTCN2019090478-appb-000003
Figure PCTCN2019090478-appb-000004
Figure PCTCN2019090478-appb-000004
其中,表4中位于同一列的各类信息存在对应关系,以下以任意一列信息为例对表4中的信息含义,及对应关系进行介绍。Among them, various types of information in the same column in Table 4 have corresponding relationships. The following uses any column of information as an example to introduce the meaning of the information in Table 4 and the corresponding relationships.
位于第一列的第一内存身份标识和第二列的第二内存身份标识指示同一种内存身份类型。第一内存身份标识可以用作该类型内存的软件层面的身份标识,以便于会话管理模块(session manager)调用和管理,第二内存身份标识可以用作指示该类型的内存块在IOMMU的标识寄存器中对应的位。The first memory identity identifier in the first column and the second memory identity identifier in the second column indicate the same memory identity type. The first memory identity can be used as a software-level identity for this type of memory to facilitate the call and management of the session manager, and the second memory identity can be used as an identification register indicating that this type of memory block is in the IOMMU The corresponding bit in.
第三列为模块标识,该模块标识指示的硬件模块对第一列和第二列示意的类型的内存块具备访问权限,且相应访问权限由第四列的访问权限标识标志。需要指出的是,表4中示意的音频数字信号处理模块(audio digital signal processing,AudioDSP)是demux的一种,流cipher属于硬件解密模块或者硬件加密模块,表4中其他硬件模块标识指示的硬件模块可以参考图2示意的实施例中对硬件模块的描述,此处不再赘述。The third column is the module identifier. The hardware module indicated by the module identifier has access authority to the memory blocks of the type indicated in the first and second columns, and the corresponding access authority is marked by the access authority identifier in the fourth column. It should be pointed out that the audio digital signal processing (AudioDSP) shown in Table 4 is a kind of demux, and the stream cipher belongs to the hardware decryption module or the hardware encryption module. The hardware indicated by the other hardware module identifiers in Table 4 For the modules, reference may be made to the description of the hardware modules in the embodiment illustrated in FIG. 2, which is not repeated here.
第五列为媒体通路意图标识,该媒体通路意图标识用于指示硬件模块和内存块所属的媒体通路的意图。The fifth column is the media channel intent identifier, which is used to indicate the intention of the media channel to which the hardware module and the memory block belong.
例如,以表4中第一列为例,第一内存身份标识“视频基本流数据内存”用于会话管理模块管理和调用该类型的内存块,“视频基本流数据内存”指示的内存块在IOMMU的标识寄存器中对应位图中的第21位。demux指示的硬件模块对类型为“视频基本流数据内存”,或者tag是“21”的内存块具备读操作权限和写操作权限。demux指示的硬件模能够用于意图为“观看”的SMP中。For example, taking the first column in Table 4 as an example, the first memory identification "video elementary stream data memory" is used for the session management module to manage and call this type of memory block, and the memory block indicated by "video elementary stream data memory" is IOMMU's identification register corresponds to the 21st bit in the bitmap. The hardware module indicated by demux has the read operation authority and the write operation authority for the memory block whose type is "video elementary stream data memory" or the tag is "21". The hardware module indicated by demux can be used in SMP intended to "watch".
可以理解的是,图5仅是对本申请电子设备的一种示例性描述,对本申请涉及的电子设备不构成任何限制。在其他一些实施例中,本申请涉及的电子设备可以包括更多或者更少的硬件模块,相应的,本申请涉及的电子设备可以包括其他功能的硬件模块。此外,电子设备的各功能软件也可以采用其他表现形式。此处不再详述。It can be understood that FIG. 5 is only an exemplary description of the electronic device of this application, and does not constitute any limitation to the electronic device involved in this application. In some other embodiments, the electronic device involved in this application may include more or fewer hardware modules. Accordingly, the electronic device involved in this application may include hardware modules with other functions. In addition, the functional software of the electronic device can also adopt other forms of expression. No more details here.
图6A示意了一种SMP创建方法200的信令交互图。SMP创建方法200(以下简称方法200)包括如下步骤:FIG. 6A illustrates a signaling interaction diagram of a method 200 for creating SMP. The SMP creation method 200 (hereinafter referred to as the method 200) includes the following steps:
步骤S201,TEE应用向会话管理模块发送创建第一SMP的请求。Step S201: The TEE application sends a request for creating a first SMP to the session management module.
步骤S202,会话管理模块生成通路标识“SID01”。Step S202, the session management module generates a path identifier "SID01".
其中,SID01用于标识该待创建的第一SMP。Among them, SID01 is used to identify the first SMP to be created.
步骤S203,会话管理模块占用demux模块。Step S203, the session management module occupies the demux module.
其中,会话管理模块受TEE应用调用占用demux模块。会话管理模块可以占用demux模块的处理通道20。Among them, the session management module is called by the TEE application to occupy the demux module. The session management module can occupy the processing channel 20 of the demux module.
然后,会话管理模块可以生成demux模块的句柄,并将该句柄与通路标识“SID01”对应存储。该句柄包括模块标识demux和处理通道20。Then, the session management module can generate a handle of the demux module, and store the handle corresponding to the path identifier "SID01". The handle includes the module identification demux and the processing channel 20.
实际实现过程中,TEE应用还可以调用会话管理模块占用组成第一SMP的其他硬件模块,例如,decoder,VPSS和VDP,并将其他硬件模块的句柄与“SID01”对应存储。此处不再详述。In the actual implementation process, the TEE application can also call the session management module to occupy other hardware modules that make up the first SMP, such as decoder, VPSS, and VDP, and store the handles of other hardware modules corresponding to "SID01". No more details here.
步骤S204,内存管理模块配置第一安全内存。Step S204, the memory management module configures the first secure memory.
其中,TEE应用调用内存管理模块配置第一安全内存,TEE应用在调用内存管理模块时,可以将“SID01”发送到内存管理模块。Among them, the TEE application calls the memory management module to configure the first secure memory. When the TEE application calls the memory management module, it can send "SID01" to the memory management module.
内存管理模块可以在TEE存储模块中分配任意安全内存作为第一安全内存。然后,内存管理模块可以根据第一SMP的意图和表4示意的策略表,为第一安全内存分配第一内存身份标识和第二内存身份标识。第一安全内存的第一内存身份标识例如是“视频基本流数据内存”,相应的,第一安全内存的第二内存身份标识例如是“21”。进而,内存管理模块将该“21”和“SID01”作为第一安全内存的属性信息,建立“21”,“SID01”和第一安全内存的虚拟地址的映射表。该映射表如表2所示,此处不详述。The memory management module can allocate any secure memory in the TEE storage module as the first secure memory. Then, the memory management module can allocate the first memory identity and the second memory identity to the first secure memory according to the intention of the first SMP and the policy table shown in Table 4. The first memory identity of the first secure memory is, for example, "video elementary stream data memory", and correspondingly, the second memory identity of the first secure memory is, for example, "21". Furthermore, the memory management module uses "21" and "SID01" as the attribute information of the first secure memory, and establishes a mapping table of "21", "SID01" and the virtual address of the first secure memory. The mapping table is shown in Table 2, which is not detailed here.
此外,内存管理模块还可以生成第一安全内存的句柄,第一安全内存的句柄中例如包括第一安全内存的第一内存身份标识“视频基本流数据内存”和第一安全内存的虚拟地址。In addition, the memory management module may also generate a handle to the first secure memory, and the handle of the first secure memory includes, for example, the first memory identification "video elementary stream data memory" of the first secure memory and the virtual address of the first secure memory.
步骤S205,内存管理模块将第一安全内存的句柄发送到会话管理模块。Step S205: The memory management module sends the handle of the first secure memory to the session management module.
其中,会话管理模块可以将第一安全内存的句柄与“SID01”对应存储。Wherein, the session management module may store the handle of the first secure memory corresponding to "SID01".
示例性的,TEE应用还可以调用内存管理模块配置第二安全内存和第三安全内存,生成第二安全内存的句柄和第三安全内存的句柄,然后,同样将第二安全内存的句柄和第三安全内存的句柄发送到会话管理模块。进而,会话管理模块将第二安全内存的句柄和第三 安全内存的句柄与“SID01”对应存储,组成第一对应关系。此处不再详述。Exemplarily, the TEE application can also call the memory management module to configure the second secure memory and the third secure memory, generate the handle of the second secure memory and the handle of the third secure memory, and then, similarly transfer the handle of the second secure memory and the third secure memory. 3. The handle of the safe memory is sent to the session management module. Furthermore, the session management module stores the handle of the second secure memory and the handle of the third secure memory corresponding to "SID01" to form a first corresponding relationship. No more details here.
示例性的,第二安全内存例如是“视频帧数据内存”,对应的tag是“24”;第三安全内存例如是“视频显示数据内存”,对应的tag是“25”。Exemplarily, the second secure memory is, for example, "video frame data memory", and the corresponding tag is "24"; the third secure memory is, for example, "video display data memory", and the corresponding tag is "25".
步骤S206,内存管理模块设置demux模块对第一内存块的访问权限。Step S206, the memory management module sets the access authority of the demux module to the first memory block.
其中,内存管理模块设置demux模块对应的IOMMU中的标识寄存器,以设置demux模块对第一安全内存的访问权限。例如,结合图4和表4,内存管理模块可以将IOMMU中的读操作权限标识寄存器的第21位字段值修改为“1”,以及将IOMMU中的写操作权限标识寄存器的第21位字段值修改为“1”。Among them, the memory management module sets the identification register in the IOMMU corresponding to the demux module to set the access authority of the demux module to the first secure memory. For example, in conjunction with Figure 4 and Table 4, the memory management module can modify the value of the 21st field of the read operation authority identification register in the IOMMU to "1", and change the value of the 21st field of the write operation authority identification register in the IOMMU Modify it to "1".
相应的,内存管理模块还可以设置IOMMU的标识寄存器中第二安全内存的tag和第三安全内存的tag的字段值,以设置demux模块对第二安全内存和第三安全内存的访问权限。此外,内存管理模块还可以设置其他硬件模块分别对第一安全内存第二安全内存和第三安全内存的访问权限。此处不再详述。Correspondingly, the memory management module can also set the field values of the tag of the second secure memory and the tag of the third secure memory in the identification register of the IOMMU to set the access authority of the demux module to the second secure memory and the third secure memory. In addition, the memory management module can also set other hardware modules to access the first secure memory, the second secure memory, and the third secure memory, respectively. No more details here.
本实施例中,decoder模块例如对第一安全内存具有读操作权限,对第二安全内存具有读操作权限和写操作权限;VPSS模块例如对第二安全内存具有读操作权限,对第三安全内存具有读操作权限和写操作权限;VDP模块例如对第三安全内存具有读操作权限。In this embodiment, the decoder module has read operation authority for the first secure memory, and has read operation authority and write operation authority for the second secure memory; for example, the VPSS module has read operation authority for the second secure memory and has read operation authority for the third secure memory. It has read operation authority and write operation authority; for example, the VDP module has read operation authority for the third secure memory.
可以理解的是,电子设备20还可以创建第二SMP,第三SMP等,第二SMP和第三SMP等的创建过程,与方法200相似,此处不再详述。It is understandable that the electronic device 20 may also create a second SMP, a third SMP, etc., and the creation process of the second SMP and the third SMP are similar to the method 200, and will not be described in detail here.
传输安全媒体流Transport secure media stream
图6B示意了一种安全媒体流的传输方法300的信令交互图。安全媒体流的传输方法300(以下简称方法300)包括如下步骤:FIG. 6B illustrates a signaling interaction diagram of a method 300 for transmitting a secure media stream. The method 300 for transmitting secure media streams (hereinafter referred to as the method 300) includes the following steps:
步骤S301,会话管理模块接收检测请求。Step S301, the session management module receives the detection request.
其中,本实施例中的检测请求例如由demux模块发送。该检测请求中例如包括demux模块标识和第三安全内存的句柄。Wherein, the detection request in this embodiment is sent by the demux module, for example. The detection request includes, for example, the demux module identifier and the handle of the third secure memory.
步骤S302,会话管理模块根据第一对应关系确定demux模块与第三安全内存属于同一SMP。Step S302: The session management module determines that the demux module and the third secure memory belong to the same SMP according to the first correspondence.
其中,会话管理模块可以从第一对应关系中获取demux模块对应SID01,且会话管理模块可以从第一对应关系中获取第三安全内存句柄对应SID01,基于此,会话管理模块确定demux模块与第三安全内存均属于第一SMP。Among them, the session management module can obtain the SID01 corresponding to the demux module from the first correspondence, and the session management module can obtain the SID01 corresponding to the third secure memory handle from the first correspondence. Based on this, the session management module determines the demux module and the third Secure memory is the first SMP.
步骤S303,会话管理模块根据策略表确定demux模块对第三安全内存无访问权限。Step S303: The session management module determines according to the policy table that the demux module has no access authority to the third secure memory.
其中,会话管理模块可以遍历表4,进而,可以确定表4中并未设置demux模块与“视频显示数据内存”的对应关系,从而确定demux模块对第三安全内存无访问权限。进而,会话管理模块可以不向TEE驱动模块发送任何指令,以使TEE驱动模块不去触发demux模块访问第三安全内存。Among them, the session management module can traverse Table 4, and furthermore, it can be determined that the corresponding relationship between the demux module and the "video display data memory" is not set in Table 4, thereby determining that the demux module has no access authority to the third secure memory. Furthermore, the session management module may not send any instructions to the TEE driver module, so that the TEE driver module does not trigger the demux module to access the third secure memory.
当然,本实施例中,步骤S303是可选步骤,即使不执行步骤S303,在步骤S302之后,若demux模块访问第三安全内存,demux模块对应的IOMMU的标识寄存器中,tag“25”的字段值是“0”,使得demux模块依然无法访问第三安全内存。Of course, in this embodiment, step S303 is an optional step. Even if step S303 is not executed, after step S302, if the demux module accesses the third secure memory, the tag "25" field in the IOMMU identification register corresponding to the demux module The value is "0", so that the demux module still cannot access the third secure memory.
可以理解的是,图6A和图6B仅是示意性描述,对本申请的技术方案不构成限制。在其他一些实施例中,涉及的SMP可以是其他SMP,待检测的硬件模块和内存块也可 以是其他块,此处不再详述。It can be understood that FIG. 6A and FIG. 6B are only schematic descriptions, and do not limit the technical solution of the present application. In some other embodiments, the SMP involved may be other SMPs, and the hardware modules and memory blocks to be detected may also be other blocks, which will not be described in detail here.
另外,本说明书并未示出本申请适用的全部实施场景,在其他实施场景下,采用基于本申请技术思想的其他实施手段,同样属于本申请的保护范畴。In addition, this specification does not show all implementation scenarios applicable to this application. In other implementation scenarios, other implementation methods based on the technical ideas of this application are also adopted, which also belong to the protection scope of this application.
综合上述,本申请提供的安全访问方法,在硬件模块被触发访问安全内存块之前,电子设备检测该硬件模块与相应安全内存块是否属于同一SMP,若该硬件模块与相应安全内存块属于同一SMP,电子设备进一步检测该硬件模块是否具备访问该安全内存块的权限,若该硬件模块具备访问该安全内存块的权限,该硬件模块才能够访问该安全内存块,否则,该硬件模块无法访问该安全内存块。这样使得安全内存块能够被安全访问,从而能够避免安全媒体流从安全内存块中泄露,提高SMP的安全性。In summary, in the secure access method provided by this application, before the hardware module is triggered to access the secure memory block, the electronic device detects whether the hardware module and the corresponding secure memory block belong to the same SMP, if the hardware module and the corresponding secure memory block belong to the same SMP , The electronic device further detects whether the hardware module has the authority to access the secure memory block. If the hardware module has the authority to access the secure memory block, the hardware module can access the secure memory block; otherwise, the hardware module cannot access the secure memory block. Secure memory block. In this way, the secure memory block can be safely accessed, thereby preventing the secure media stream from leaking from the secure memory block, and improving the security of the SMP.
上述实施例中从电子设备硬件实体结构,软件架构,以及各软、硬件所执行的动作的角度对本申请提供的安全访问方法的各方案进行了介绍。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的对应关系的建立以及根据对应关系执行检测的处理步骤,本申请不仅能够以硬件或硬件和计算机软件的结合形式来实现。某些功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对上述每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。In the foregoing embodiments, the solutions of the secure access method provided in this application are introduced from the perspective of the physical structure of the electronic device hardware, the software architecture, and the actions performed by each software and hardware. Those skilled in the art should easily realize that in combination with the establishment of the correspondence relationship described in the embodiments disclosed herein and the processing steps of performing detection according to the correspondence relationship, this application can not only be implemented in the form of hardware or a combination of hardware and computer software . Whether certain functions are executed by hardware or computer software-driven hardware depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each of the above specific applications, but such implementation should not be considered as going beyond the scope of the embodiments of the present application.
例如,上述电子设备10和电子设备20可以通过功能模块的形式来实现上述部分的功能。如图7A所示,电子设备70可以包括确定模块701、判断模块702和调用模块703。该电子设备70可用于执行上述图3、图6A以及图6B示意的任意实施例中非IOMMU执行的安全访问方法的部分。For example, the above-mentioned electronic device 10 and the electronic device 20 may implement the above-mentioned functions in the form of functional modules. As shown in FIG. 7A, the electronic device 70 may include a determination module 701, a judgment module 702, and a calling module 703. The electronic device 70 can be used to execute part of the non-IOMMU security access method in any of the embodiments illustrated in FIG. 3, FIG. 6A, and FIG. 6B.
例如:确定模块701用于根据检测请求确定目标硬件模块和目标内存块;判断模块702,用于判断该目标硬件模块和该目标内存块是否属于同一条媒体通路;该确定模块701,还用于在该目标硬件模块和该目标内存块属于同一条媒体通路时,确定该目标硬件模块对该目标内存块是否有访问权限;调用模块703,用于在该目标硬件模块对该目标内存块有访问权限时,调用该目标硬件模块访问该目标内存块。For example: the determining module 701 is used to determine the target hardware module and the target memory block according to the detection request; the determining module 702 is used to determine whether the target hardware module and the target memory block belong to the same media path; the determining module 701 is also used to When the target hardware module and the target memory block belong to the same media path, determine whether the target hardware module has access rights to the target memory block; call the module 703 for access to the target memory block when the target hardware module When authorized, call the target hardware module to access the target memory block.
由此可见,本申请提供的电子设备70,能够提供检测目标硬件模块和目标内存块是否属于同一媒体通路,以及目标硬件模块是否有对目标内存块的访问权限的功能,从而能够在目标硬件模块被触发和目标内存块之前,执行双重检测,进而,使得目标内存块能够被安全访问。It can be seen that the electronic device 70 provided in the present application can provide the function of detecting whether the target hardware module and the target memory block belong to the same media channel, and whether the target hardware module has access rights to the target memory block, so that the target hardware module Before being triggered and the target memory block, double detection is performed, so that the target memory block can be safely accessed.
可选的,该电子设备70还可以包括获取模块,检测模块,生成模块,配置模块和建立模块。在不同的实施例中,上述各模块用于实现不同的功能。Optionally, the electronic device 70 may also include an acquisition module, a detection module, a generation module, a configuration module, and an establishment module. In different embodiments, the above modules are used to implement different functions.
例如,一些实施例中,该获取模块,用于获取该目标硬件模块的第一通路标识和该目标内存块的第二通路标识,该第一通路标识指示该目标硬件模块对应的媒体通路,该第二通路标识指示该目标内存块对应的媒体通路,另一些实施例中,该获取模块,用于获取创建媒体通路的请求。一些实施例中,该检测模块,用于检测该第一通路标识和该第二通路标识是否相同,另一些实施例中,该检测模块,用于检测第三对应关系中是否设置有与该模块身份标识和该内存身份标识对应的访问权限标识,该第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系。For example, in some embodiments, the acquiring module is configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, and the first path identifier indicates the media path corresponding to the target hardware module. The second path identifier indicates the media path corresponding to the target memory block. In other embodiments, the obtaining module is used to obtain a request for creating a media path. In some embodiments, the detection module is used to detect whether the first path identifier and the second path identifier are the same. In other embodiments, the detection module is used to detect whether the third correspondence relationship is set with the module. The identity identifier and the access authority identifier corresponding to the memory identifier, and the third correspondence relationship includes the corresponding relationship between the module identifier, the memory identifier, and the access authority identifier.
此外,该生成模块,还用于生成该媒体通路的通路标识。该配置模块,还用于配置至少一个硬件模块和至少一个内存块,得到该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识,该至少一个硬件模块和该至少一个内存块组成该媒体通路。该建立模块,还用于根据该通路标识、该至少一个硬件模块的模块身份标识和该至少一个内存块的内存身份标识建立该第一对应关系。In addition, the generating module is also used to generate the path identifier of the media path. The configuration module is also used to configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the at least one memory block Compose the media channel. The establishing module is further configured to establish the first correspondence relationship according to the path identifier, the module identity of the at least one hardware module, and the memory identity of the at least one memory block.
电子设备70中各模块的其他功能,可以参考方法100至方法300对应的实施例中的相关描述,此处不再赘述。For other functions of each module in the electronic device 70, reference may be made to the related descriptions in the embodiments corresponding to the method 100 to the method 300, which will not be repeated here.
可以理解的是,以上各个模块的划分仅仅是一种逻辑功能的划分,实际实现时,该以上各模块的功能可以集成到处理器实现。如图7B所示,电子设备71包括处理器711,目标硬件模块712,目标IOMMU 713和目标内存块714。该目标内存块714可以被配置为存储安全媒体流。目标硬件模块712可以被配置为访问内存块,以向所访问的内存块中写入媒体流数据,或者从所访问的内存块中读取媒体流数据。处理器711可以执行方法100至方法300中硬件模块和内存块的配置,以及对目标硬件模块712和目标内存块714权限的检测。目标IOMMU 713中可以耦合标识寄存器715,该标识寄存器715包含目标硬件模块712能够访问的内存块的内存身份标识,目标IOMMU 713可以根据标识寄存器715中的配置,对目标硬件模块712能否访问目标内存块714进行鉴权。It can be understood that the division of each of the above modules is only a division of logic functions, and in actual implementation, the functions of the above modules can be integrated into the processor for implementation. As shown in FIG. 7B, the electronic device 71 includes a processor 711, a target hardware module 712, a target IOMMU 713, and a target memory block 714. The target memory block 714 may be configured to store secure media streams. The target hardware module 712 may be configured to access a memory block to write media stream data to the accessed memory block or to read media stream data from the accessed memory block. The processor 711 can execute the configuration of the hardware module and the memory block in the method 100 to the method 300, and the detection of the permissions of the target hardware module 712 and the target memory block 714. The target IOMMU 713 can be coupled with an identification register 715. The identification register 715 contains the memory identification of the memory block that the target hardware module 712 can access. The target IOMMU 713 can determine whether the target hardware module 712 can access the target according to the configuration in the identification register 715. The memory block 714 performs authentication.
例如,该处理器711可以用于根据检测请求确定该目标硬件模块712和该目标内存块714。该处理器711还可以用于判断该目标硬件模块712和该目标内存块714是否属于同一条媒体通路,并在该目标硬件模块712和该目标内存块714属于同一条媒体通路时,确定该目标硬件模块712对该目标内存块714是否有访问权限。该目标硬件模块712,用于在该目标硬件模块712对该目标内存块714有访问权限时,访问该目标内存块714。For example, the processor 711 may be configured to determine the target hardware module 712 and the target memory block 714 according to the detection request. The processor 711 may also be used to determine whether the target hardware module 712 and the target memory block 714 belong to the same media path, and when the target hardware module 712 and the target memory block 714 belong to the same media path, determine the target Whether the hardware module 712 has access authority to the target memory block 714. The target hardware module 712 is configured to access the target memory block 714 when the target hardware module 712 has access authority to the target memory block 714.
此外,示例性的,参见图7C,目标硬件模块712接收到访问目标内存块714的指令后,可以获取目标内存块714的内存身份标识。然后,目标IOMMU 713分别在该目标IOMMU 713的读操作权限标识寄存器和写操作权限标识寄存器中查找内存身份标识,进而,根据查找结果确定目标IOMMU 713对该目标内存块714是否有读操作权限和/或写操作权限。In addition, for example, referring to FIG. 7C, after the target hardware module 712 receives an instruction to access the target memory block 714, it can obtain the memory identity of the target memory block 714. Then, the target IOMMU 713 searches for the memory identity in the read operation authority identification register and the write operation authority identification register of the target IOMMU 713, and then determines whether the target IOMMU 713 has read operation authority and the target memory block 714 according to the search result. / Or write operation permission.
具体内容可以参考方法100至方法300对应的实施例中的相关描述,此处不再赘述。For specific content, reference may be made to related descriptions in the embodiments corresponding to method 100 to method 300, and details are not repeated here.
可以理解的是,一些实施例中,图7B该的处理器711可以实现图2中TEE各软件层的功能,目标硬件模块712可以实现图2中TEE硬件模块的功能,目标IOMMU 713可以实现图2中TEE IOMMU模块的功能,目标内存块714可以等同于图2中的任意安全内存块。另一些实施例中,图7B该的处理器711可以实现图5中软件部分的功能,目标硬件模块712可以等同于图5中示意的任一硬件模块,目标IOMMU 71根据目标硬件模块712确定,目标内存块714可以等同于图5中的任意安全内存块。It is understandable that, in some embodiments, the processor 711 in FIG. 7B can implement the functions of each software layer of the TEE in FIG. 2, the target hardware module 712 can implement the functions of the TEE hardware module in FIG. 2, and the target IOMMU 713 can implement the diagram For the function of the TEE IOMMU module in 2, the target memory block 714 can be equivalent to any secure memory block in FIG. 2. In other embodiments, the processor 711 in FIG. 7B can implement the functions of the software part in FIG. 5, the target hardware module 712 may be equivalent to any hardware module shown in FIG. 5, and the target IOMMU 71 is determined according to the target hardware module 712, The target memory block 714 can be equivalent to any secure memory block in FIG. 5.
具体实现中,对应电子设备本申请还分别提供一种计算机存储介质,其中,设置 在任意设备中的计算机存储介质可存储有程序,该程序执行时,可实施包括方法100至方法300提供的安全访问处理方法的各实施例中的部分或全部步骤。任意设备中的存储介质均可为磁碟、光盘、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(random access memory,RAM)等。In specific implementation, the application also provides a computer storage medium corresponding to the electronic device. The computer storage medium provided in any device can store a program. When the program is executed, the security provided by the method 100 to the method 300 can be implemented. Access some or all of the steps in each embodiment of the processing method. The storage medium in any device can be a magnetic disk, an optical disc, a read-only memory (read-only memory, ROM), or a random access memory (random access memory, RAM), etc.
本领域技术任何还可以了解到本申请实施例列出的各种说明性逻辑块(illustrative logical block)和步骤(step)可以通过电子硬件、电脑软件,或两者的结合进行实现。这样的功能是通过硬件还是软件来实现取决于特定的应用和整个系统的设计要求。本领域技术人员可以对于每种特定的应用,可以使用各种方法实现该的功能,但这种实现不应被理解为超出本申请实施例保护的范围。Anyone skilled in the art can also understand that the various illustrative logical blocks and steps listed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. Whether such a function is realized by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art can use various methods to implement the function for each specific application, but such implementation should not be understood as going beyond the protection scope of the embodiments of the present application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或报文中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或报文中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、报文中心等报文存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the application is generated in whole or in part. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be passed from a website, computer, server, or message center. Wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or message center. The computer-readable storage medium may be any available medium that can be accessed by a computer or a message storage device such as a server or a message center integrated with one or more available media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对实施例的实施过程构成任何限定。It should be understood that in various embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, rather than the implementation process of the embodiment. Constitute any limitation.
本说明书的各个部分均采用递进的方式进行描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点介绍的都是与其他实施例不同之处。尤其,对于装置和系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例部分的说明即可。Each part of this specification is described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application also intends to include these modifications and variations.

Claims (25)

  1. 一种安全访问方法,其特征在于,所述方法包括:A secure access method, characterized in that the method includes:
    根据检测请求确定目标硬件模块和目标内存块;Determine the target hardware module and target memory block according to the detection request;
    判断所述目标硬件模块和所述目标内存块是否属于同一条媒体通路;Judging whether the target hardware module and the target memory block belong to the same media path;
    在所述目标硬件模块和所述目标内存块属于同一条媒体通路时,确定所述目标硬件模块对所述目标内存块是否有访问权限;When the target hardware module and the target memory block belong to the same media path, determining whether the target hardware module has access authority to the target memory block;
    在所述目标硬件模块对所述目标内存块有访问权限时,调用所述目标硬件模块访问所述目标内存块。When the target hardware module has access authority to the target memory block, calling the target hardware module to access the target memory block.
  2. 如权利要求1所述的方法,其特征在于,判断所述目标硬件模块和所述目标内存块是否属于同一条媒体通路,包括:8. The method of claim 1, wherein determining whether the target hardware module and the target memory block belong to the same media path comprises:
    获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;Acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the target The media channel corresponding to the memory block;
    检测所述第一通路标识和所述第二通路标识是否相同;Detecting whether the first path identifier and the second path identifier are the same;
    在所述第一通路标识和所述第二通路标识相同时,确定所述目标硬件模块和所述目标内存块属于同一条媒体通路。When the first path identifier and the second path identifier are the same, it is determined that the target hardware module and the target memory block belong to the same media path.
  3. 如权利要求1所述的方法,其特征在于,判断所述目标硬件模块和所述目标内存块是否属于同一条媒体通路,包括:8. The method of claim 1, wherein determining whether the target hardware module and the target memory block belong to the same media path comprises:
    获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;Acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicates the media path corresponding to the target hardware module, and the second path identifier indicates the target The media channel corresponding to the memory block;
    检测所述第一通路标识和所述第二通路标识与目标通路标识是否相同,所述目标通路标识用于指示目标媒体通路;Detecting whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate a target media path;
    在所述第一通路标识与所述目标通路标识相同时,确定所述目标硬件模块属于所述目标媒体通路;以及When the first path identifier is the same as the target path identifier, determining that the target hardware module belongs to the target media path; and
    在所述第二通路标识与所述通路标识相同时,确定所述目标内存块属于所述目标媒体通路。When the second path identifier is the same as the path identifier, it is determined that the target memory block belongs to the target media path.
  4. 如权利要求2或3所述的方法,其特征在于,所述获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,具体包括:The method according to claim 2 or 3, wherein said acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically comprises:
    获取所述目标硬件模块的模块身份标识,并在第一对应关系中确定与所述模块身份标识对应的所述第一通路标识;Acquiring the module identity of the target hardware module, and determining the first path identity corresponding to the module identity in the first correspondence;
    获取所述目标内存块的内存身份标识,并在所述第一对应关系中确定与所述内存身份标识对应的所述第二通路标识;Acquiring the memory identity identifier of the target memory block, and determining the second path identifier corresponding to the memory identity identifier in the first correspondence relationship;
    其中,所述第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于所述同一个通路标识指示的媒体通路。Wherein, the first corresponding relationship includes the corresponding relationship between the path identifier, the module identifier and the memory identifier, one path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and the same path identifier corresponds to At least one hardware module and at least one memory block of both belong to the media channel indicated by the same channel identifier.
  5. 如权利要求2或3所述的方法,其特征在于,所述获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,具体包括:The method according to claim 2 or 3, wherein said acquiring the first path identifier of the target hardware module and the second path identifier of the target memory block specifically comprises:
    获取所述目标硬件模块的模块身份标识,并根据所述模块身份标识在第一对应关系中确定与所述模块身份标识对应的所述第一通路标识,所述第一对应关系包括通路标识与模块身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识,同一个通路标识对应的至少一个硬件模块属于所述同一个通路标识指示的媒体通路;Obtain the module identity of the target hardware module, and determine the first path identifier corresponding to the module identity in a first corresponding relationship according to the module identity, and the first corresponding relationship includes the path identifier and Correspondence between the module IDs, one path ID corresponds to the module ID of at least one hardware module, and at least one hardware module corresponding to the same path ID belongs to the media path indicated by the same path ID;
    获取待访问的目标地址,所述目标地址指示所述目标内存块,根据所述目标地址在第二对应关系中确定所述目标内存块对应的所述第二通路标识,所述第二对应关系包括内存块的地址与所述内存块所属媒体通路的通路标识的对应关系。Acquire a target address to be accessed, where the target address indicates the target memory block, and determine the second path identifier corresponding to the target memory block in a second correspondence relationship according to the target address, the second correspondence relationship The correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs is included.
  6. 如权利要求1所述的方法,其特征在于,确定所述目标硬件模块对所述目标内存块是否有访问权限,包括:8. The method of claim 1, wherein determining whether the target hardware module has access authority to the target memory block comprises:
    获取所述目标硬件模块的模块身份标识以及所述目标内存块的内存身份标识;Acquiring the module identity of the target hardware module and the memory identity of the target memory block;
    检测第三对应关系中是否设置有与所述模块身份标识和所述内存身份标识对应的访问权限标识,所述第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系;Detecting whether an access authority identifier corresponding to the module identity identifier and the memory identity identifier is set in the third correspondence relationship, and the third correspondence relationship includes the corresponding relationship between the module identifier, the memory identity identifier, and the access authority identifier;
    在所述第三对应关系中设置有与所述模块身份标识和所述内存身份标识对应的访问权限标识时,确定所述目标硬件模块对所述目标内存块有所述访问权限标识指示的访问权限。When the access authority identifier corresponding to the module identity identifier and the memory identifier is set in the third correspondence relationship, it is determined that the target hardware module has access to the target memory block indicated by the access authority identifier Permissions.
  7. 如权利要求1或6所述的方法,其特征在于,所述目标硬件模块对应目标输入输出内存管理单元IOMMU,所述目标IOMMU中包括标识寄存器,所述标识寄存器中包括至少一个有访问权限的内存身份标识,所述确定所述目标硬件模块对所述目标内存块是否有访问权限,包括:The method according to claim 1 or 6, wherein the target hardware module corresponds to a target input and output memory management unit IOMMU, the target IOMMU includes an identification register, and the identification register includes at least one access authority The memory identity identifier, said determining whether the target hardware module has access authority to the target memory block, includes:
    获取所述目标内存块的内存身份标识;Acquiring the memory identity of the target memory block;
    确定所述至少一个有访问权限的内存身份标识中是否包括所述内存身份标识;Determining whether the at least one memory identity with access permission includes the memory identity;
    当所述至少一个有访问权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有所述访问权限标识指示的访问权限。When the at least one memory identity identifier with access authority includes the memory identity identifier, it is determined that the target hardware module has the access authority indicated by the access authority identifier for the target memory block.
  8. 如权利要求7所述的方法,其特征在于,The method of claim 7, wherein:
    所述访问权限包括读操作权限和写操作权限,所述标识寄存器包括读标识寄存器和写标识寄存器,所述读标识寄存器中包括至少一个有读操作权限的内存身份标识,所述写标识寄存器中包括至少一个有写操作权限的内存身份标识。The access authority includes a read operation authority and a write operation authority, the identification register includes a read identification register and a write identification register, the read identification register includes at least one memory identification identifier with read operation authority, and the write identification register Including at least one memory identifier with write operation permission.
  9. 如权利要求8所述的方法,其特征在于,确定所述目标硬件模块对所述目标内存块是否有访问权限,包括:The method according to claim 8, wherein determining whether the target hardware module has access authority to the target memory block comprises:
    确定所述至少一个有读操作权限的内存身份标识中是否包括所述内存身份标识;Determining whether the at least one memory identity with read operation permission includes the memory identity;
    当所述至少一个有读操作权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有读操作权限;或者,When the at least one memory identity with read operation permission includes the memory identity, it is determined that the target hardware module has read operation permission on the target memory block; or,
    确定所述至少一个有写操作权限的内存身份标识中是否有所述内存身份标识;Determining whether the at least one memory identity with write operation permission has the memory identity;
    当所述至少一个有读操作权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有写操作权限。When the at least one memory identity identifier with read operation authority includes the memory identity identifier, it is determined that the target hardware module has write operation authority to the target memory block.
  10. 如权利要求1至9中任一项所述的方法,其特征在于,在根据检测请求确定目标硬件模块和目标内存块之前,还包括:The method according to any one of claims 1 to 9, wherein before determining the target hardware module and the target memory block according to the detection request, the method further comprises:
    获取创建媒体通路的请求;Obtain a request to create a media channel;
    生成所述媒体通路的通路标识;Generating a path identifier of the media path;
    配置至少一个硬件模块和至少一个内存块,得到所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识,所述至少一个硬件模块和所述至少一个内存块组成所述媒体通路;Configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, and the at least one hardware module and the at least one memory block form the Media access
    根据所述通路标识、所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识建立所述第一对应关系。The first correspondence relationship is established according to the path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block.
  11. 如权利要求10所述的方法,其特征在于,在配置至少一个硬件模块和至少一个内存块之后,还包括:The method of claim 10, wherein after configuring at least one hardware module and at least one memory block, the method further comprises:
    从所述第三对应关系中获取所述目标硬件模块具有访问权限的至少一个内存身份标识;Acquiring, from the third correspondence, at least one memory identity that the target hardware module has access rights;
    将所述具有访问权限的至少一个内存身份标识配置在所述目标IOMMU的标识寄存器中。The at least one memory identity identifier with access authority is configured in the identifier register of the target IOMMU.
  12. 一种电子设备,其特征在于,所述电子设备包括处理器,目标硬件模块和目标内存块,其中,An electronic device, characterized in that the electronic device includes a processor, a target hardware module and a target memory block, wherein:
    所述处理器,用于根据检测请求确定所述目标硬件模块和所述目标内存块;The processor is configured to determine the target hardware module and the target memory block according to a detection request;
    所述处理器,还用于判断所述目标硬件模块和所述目标内存块是否属于同一条媒体通路;The processor is also used to determine whether the target hardware module and the target memory block belong to the same media path;
    所述处理器,还用于在所述目标硬件模块和所述目标内存块属于同一条媒体通路时,确定所述目标硬件模块对所述目标内存块是否有访问权限;The processor is further configured to determine whether the target hardware module has access authority to the target memory block when the target hardware module and the target memory block belong to the same media path;
    所述目标硬件模块,用于在所述目标硬件模块对所述目标内存块有访问权限时,访问所述目标内存块。The target hardware module is configured to access the target memory block when the target hardware module has access authority to the target memory block.
  13. 如权利要求12所述的电子设备,其特征在于,The electronic device of claim 12, wherein:
    所述处理器,还用于获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;The processor is further configured to obtain a first path identifier of the target hardware module and a second path identifier of the target memory block, where the first path identifier indicates a media path corresponding to the target hardware module, and The second path identifier indicates the media path corresponding to the target memory block;
    所述处理器,还用于检测所述第一通路标识和所述第二通路标识是否相同;The processor is further configured to detect whether the first path identifier and the second path identifier are the same;
    所述处理器,还用于在所述第一通路标识和所述第二通路标识相同时,确定所述目标硬件模块和所述目标内存块属于同一条媒体通路。The processor is further configured to determine that the target hardware module and the target memory block belong to the same media path when the first path identifier and the second path identifier are the same.
  14. 如权利要求12所述的电子设备,其特征在于,The electronic device of claim 12, wherein:
    所述处理器,还用于获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;The processor is further configured to obtain a first path identifier of the target hardware module and a second path identifier of the target memory block, where the first path identifier indicates a media path corresponding to the target hardware module, and The second path identifier indicates the media path corresponding to the target memory block;
    所述处理器,还用于检测所述第一通路标识和所述第二通路标识与目标通路标识是否相同,所述目标通路标识用于指示目标媒体通路;The processor is further configured to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate a target media path;
    所述处理器,还用于在所述第一通路标识与所述目标通路标识相同时,确定所述目标硬件模块属于所述目标媒体通路;The processor is further configured to determine that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier;
    所述处理器,还用于在所述第二通路标识与所述通路标识相同时,确定所述目标 内存块属于所述目标媒体通路。The processor is further configured to determine that the target memory block belongs to the target media path when the second path identifier is the same as the path identifier.
  15. 如权利要求13或14所述的电子设备,其特征在于,The electronic device according to claim 13 or 14, wherein:
    所述处理器,还用于获取所述目标硬件模块的模块身份标识,并在第一对应关系中确定与所述模块身份标识对应的所述第一通路标识;The processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in a first correspondence;
    所述处理器,还用于获取所述目标内存块的内存身份标识,并在所述第一对应关系中确定与所述内存身份标识对应的所述第二通路标识;The processor is further configured to obtain the memory identity identifier of the target memory block, and determine the second path identifier corresponding to the memory identity identifier in the first correspondence relationship;
    其中,所述第一对应关系包括通路标识与模块身份标识和内存身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识和至少一个内存块的内存身份标识,同一个通路标识对应的至少一个硬件模块和至少一个内存块均属于所述同一个通路标识指示的媒体通路。Wherein, the first corresponding relationship includes the corresponding relationship between the path identifier, the module identifier and the memory identifier, one path identifier corresponds to the module identifier of at least one hardware module and the memory identifier of at least one memory block, and the same path identifier corresponds to At least one hardware module and at least one memory block of both belong to the media channel indicated by the same channel identifier.
  16. 如权利要求13或14所述的电子设备,其特征在于,The electronic device according to claim 13 or 14, wherein:
    所述处理器,还用于获取所述目标硬件模块的模块身份标识,并根据所述模块身份标识在第一对应关系中确定与所述模块身份标识对应的所述第一通路标识,所述第一对应关系包括通路标识与模块身份标识的对应关系,一个通路标识对应至少一个硬件模块的模块身份标识,同一个通路标识对应的至少一个硬件模块属于所述同一个通路标识指示的媒体通路;The processor is further configured to obtain the module identity of the target hardware module, and determine the first path identity corresponding to the module identity in a first correspondence according to the module identity, The first correspondence includes the correspondence between the path identifier and the module identity identifier, one path identifier corresponds to the module identifier of at least one hardware module, and at least one hardware module corresponding to the same path identifier belongs to the media path indicated by the same path identifier;
    所述处理器,还用于获取待访问的目标地址,所述目标地址指示所述目标内存块,根据所述目标地址在第二对应关系中确定所述目标内存块对应的所述第二通路标识,所述第二对应关系包括内存块的地址与所述内存块所属媒体通路的通路标识的对应关系。The processor is further configured to obtain a target address to be accessed, the target address indicating the target memory block, and determining the second path corresponding to the target memory block in a second correspondence relationship according to the target address The second correspondence relationship includes the correspondence relationship between the address of the memory block and the channel identifier of the media channel to which the memory block belongs.
  17. 如权利要求12所述的电子设备,其特征在于,The electronic device of claim 12, wherein:
    所述处理器,还用于获取所述目标硬件模块的模块身份标识以及所述目标内存块的内存身份标识;The processor is further configured to obtain the module identity of the target hardware module and the memory identity of the target memory block;
    所述处理器,还用于检测第三对应关系中是否设置有与所述模块身份标识和所述内存身份标识对应的访问权限标识,所述第三对应关系包括模块身份标识、内存身份标识和访问权限标识的对应关系;The processor is further configured to detect whether an access authority identifier corresponding to the module identity identifier and the memory identity identifier is set in a third correspondence relationship, and the third correspondence relationship includes a module identity identifier, a memory identity identifier, and Correspondence of access authority identification;
    所述处理器,还用于在所述第三对应关系中设置有与所述模块身份标识和所述内存身份标识对应的访问权限标识时,确定所述目标硬件模块对所述目标内存块有所述访问权限标识指示的访问权限。The processor is further configured to determine that the target hardware module has access to the target memory block when the access authority identifier corresponding to the module identity identifier and the memory identity identifier is set in the third correspondence relationship. The access authority identifies the access authority indicated.
  18. 如权利要求12或17所述的电子设备,其特征在于,所述电子设备还包括目标输入输出内存管理单元IOMMU,所述目标IOMMU与所述目标硬件模块对应,所述目标IOMMU中包括标识寄存器,所述标识寄存器中包括至少一个有访问权限的内存身份标识,其中,The electronic device according to claim 12 or 17, wherein the electronic device further comprises a target input output memory management unit IOMMU, the target IOMMU corresponds to the target hardware module, and the target IOMMU includes an identification register , The identification register includes at least one memory identification with access authority, where:
    所述目标IOMMU,用于获取所述目标内存块的内存身份标识,并确定所述至少一个有访问权限的内存身份标识中是否包括所述内存身份标识;The target IOMMU is used to obtain the memory identity of the target memory block, and determine whether the memory identity is included in the at least one memory identity with access permission;
    所述目标IOMMU,还用于在所述至少一个有访问权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有所述访问权限标识指示的访问权限。The target IOMMU is further configured to determine that the target hardware module has access to the target memory block indicated by the access authority identifier when the memory identifier is included in the at least one memory identifier with access authority Permissions.
  19. 如权利要求18所述的电子设备,其特征在于,The electronic device of claim 18, wherein:
    所述访问权限包括读操作权限和写操作权限,所述标识寄存器包括读标识寄存器和写标识寄存器,所述读标识寄存器中包括至少一个有读操作权限的内存身份标识,所述写标识寄存器中包括至少一个有写操作权限的内存身份标识。The access authority includes a read operation authority and a write operation authority, the identification register includes a read identification register and a write identification register, the read identification register includes at least one memory identification identifier with read operation authority, and the write identification register Including at least one memory identifier with write operation permission.
  20. 如权利要求19所述的电子设备,其特征在于,The electronic device of claim 19, wherein:
    所述目标IOMMU,还用于确定所述至少一个有读操作权限的内存身份标识中是否包括所述内存身份标识,并在所述至少一个有读操作权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有读操作权限;The target IOMMU is also used to determine whether the at least one memory identity with read operation permission includes the memory identity, and the at least one memory identity with read operation permission includes the memory identity When identifying, it is determined that the target hardware module has the read operation authority to the target memory block;
    所述目标IOMMU,还用于确定所述至少一个有写操作权限的内存身份标识中是否有所述内存身份标识,并在所述至少一个有读操作权限的内存身份标识中包括所述内存身份标识时,确定所述目标硬件模块对所述目标内存块有写操作权限。The target IOMMU is also used to determine whether the memory identity is included in the at least one memory identity with write operation permission, and the memory identity is included in the at least one memory identity with read operation permission When identifying, it is determined that the target hardware module has the write operation authority to the target memory block.
  21. 如权利要求12至20中任一项所述的电子设备,其特征在于,The electronic device according to any one of claims 12 to 20, wherein:
    所述处理器,还用于获取创建媒体通路的请求;The processor is also used to obtain a request to create a media path;
    所述处理器,还用于生成所述媒体通路的通路标识;The processor is also used to generate a path identifier of the media path;
    所述处理器,还用于配置至少一个硬件模块和至少一个内存块,得到所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识,所述至少一个硬件模块和所述至少一个内存块组成所述媒体通路;The processor is further configured to configure at least one hardware module and at least one memory block to obtain the module identity of the at least one hardware module and the memory identity of the at least one memory block, the at least one hardware module and the memory block The at least one memory block forms the media path;
    所述处理器,还用于根据所述通路标识、所述至少一个硬件模块的模块身份标识和所述至少一个内存块的内存身份标识建立所述第一对应关系。The processor is further configured to establish the first correspondence relationship according to the path identifier, the module identity identifier of the at least one hardware module, and the memory identity identifier of the at least one memory block.
  22. 如权利要求21所述的电子设备,其特征在于,The electronic device according to claim 21, wherein:
    所述处理器,还用于从所述第三对应关系中获取所述目标硬件模块具有访问权限的至少一个内存身份标识;The processor is further configured to obtain, from the third correspondence, at least one memory identity that the target hardware module has access rights;
    所述处理器,还用于将所述具有访问权限的至少一个内存身份标识配置在所述目标IOMMU的标识寄存器中。The processor is further configured to configure the at least one memory identity identifier with access authority in the identifier register of the target IOMMU.
  23. 一种装置,其特征在于,所述装置包括:A device, characterized in that the device comprises:
    确定模块,用于根据检测请求确定目标硬件模块和目标内存块;The determining module is used to determine the target hardware module and the target memory block according to the detection request;
    判断模块,用于判断所述目标硬件模块和所述目标内存块是否属于同一条媒体通路;A judging module for judging whether the target hardware module and the target memory block belong to the same media path;
    所述确定模块,还用于在所述目标硬件模块和所述目标内存块属于同一条媒体通路时,确定所述目标硬件模块对所述目标内存块是否有访问权限;The determining module is further configured to determine whether the target hardware module has access authority to the target memory block when the target hardware module and the target memory block belong to the same media path;
    调用模块,用于在所述目标硬件模块对所述目标内存块有访问权限时,调用所述目标硬件模块访问所述目标内存块。The calling module is used for calling the target hardware module to access the target memory block when the target hardware module has access authority to the target memory block.
  24. 如权利要求23所述的装置,其特征在于,所述装置还包括获取模块和检测模块,其中,The device of claim 23, wherein the device further comprises an acquisition module and a detection module, wherein:
    所述获取模块,用于获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;The acquiring module is configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicates the media path corresponding to the target hardware module, and the The second path identifier indicates the media path corresponding to the target memory block;
    所述检测模块,用于检测所述第一通路标识和所述第二通路标识是否相同;The detection module is configured to detect whether the first path identifier and the second path identifier are the same;
    所述确定模块,还用于在所述第一通路标识和所述第二通路标识相同时,确定所 述目标硬件模块和所述目标内存块属于同一条媒体通路。The determining module is further configured to determine that the target hardware module and the target memory block belong to the same media path when the first path identifier and the second path identifier are the same.
  25. 如权利要求23所述的装置,其特征在于,The device of claim 23, wherein:
    所述获取模块,还用于获取所述目标硬件模块的第一通路标识和所述目标内存块的第二通路标识,所述第一通路标识指示所述目标硬件模块对应的媒体通路,所述第二通路标识指示所述目标内存块对应的媒体通路;The acquiring module is further configured to acquire the first path identifier of the target hardware module and the second path identifier of the target memory block, the first path identifier indicating the media path corresponding to the target hardware module, the The second path identifier indicates the media path corresponding to the target memory block;
    所述检测模块,还用于检测所述第一通路标识和所述第二通路标识与目标通路标识是否相同,所述目标通路标识用于指示目标媒体通路;The detection module is further configured to detect whether the first path identifier and the second path identifier are the same as the target path identifier, and the target path identifier is used to indicate a target media path;
    所述确定模块,还用于在所述第一通路标识与所述目标通路标识相同时,确定所述目标硬件模块属于所述目标媒体通路;The determining module is further configured to determine that the target hardware module belongs to the target media path when the first path identifier is the same as the target path identifier;
    所述确定模块,还用于在所述第二通路标识与所述通路标识相同时,确定所述目标内存块属于所述目标媒体通路。The determining module is further configured to determine that the target memory block belongs to the target media path when the second path identifier is the same as the path identifier.
PCT/CN2019/090478 2019-06-10 2019-06-10 Secure access method and electronic device WO2020248088A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/090478 WO2020248088A1 (en) 2019-06-10 2019-06-10 Secure access method and electronic device
CN201980097157.1A CN113906398A (en) 2019-06-10 2019-06-10 Secure access method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/090478 WO2020248088A1 (en) 2019-06-10 2019-06-10 Secure access method and electronic device

Publications (1)

Publication Number Publication Date
WO2020248088A1 true WO2020248088A1 (en) 2020-12-17

Family

ID=73781130

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/090478 WO2020248088A1 (en) 2019-06-10 2019-06-10 Secure access method and electronic device

Country Status (2)

Country Link
CN (1) CN113906398A (en)
WO (1) WO2020248088A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104169891A (en) * 2013-10-29 2014-11-26 华为技术有限公司 Method and device for accessing memory
CN106469124A (en) * 2015-08-20 2017-03-01 深圳市中兴微电子技术有限公司 A kind of memory access control method and device
CN107851161A (en) * 2015-07-20 2018-03-27 英特尔公司 Cryptoguard is carried out to the I/O data of the I/O controllers with DMA abilities
CN109766165A (en) * 2018-11-22 2019-05-17 海光信息技术有限公司 A kind of memory access control method, device, Memory Controller Hub and computer system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104169891A (en) * 2013-10-29 2014-11-26 华为技术有限公司 Method and device for accessing memory
CN107851161A (en) * 2015-07-20 2018-03-27 英特尔公司 Cryptoguard is carried out to the I/O data of the I/O controllers with DMA abilities
CN106469124A (en) * 2015-08-20 2017-03-01 深圳市中兴微电子技术有限公司 A kind of memory access control method and device
CN109766165A (en) * 2018-11-22 2019-05-17 海光信息技术有限公司 A kind of memory access control method, device, Memory Controller Hub and computer system

Also Published As

Publication number Publication date
CN113906398A (en) 2022-01-07

Similar Documents

Publication Publication Date Title
US20180267726A1 (en) Memory space management and memory access control method and apparatus
EP3191994B1 (en) Media decoding control with hardware-protected digital rights management
EP3103051B1 (en) System and process for monitoring malicious access of protected content
JP5181139B2 (en) Computer program, shared object control apparatus, and shared object control method
KR101837678B1 (en) Computing apparatus based on trusted execution environment
US10691404B2 (en) Technologies for protecting audio data with trusted I/O
KR20130007659A (en) Protecting video content using virtualization
US10693631B2 (en) Modifying a content descriptor to facilitate delivery of token-authorized encrypted data
US20130182842A1 (en) System and method for key space division and sub-key derivation for mixed media digital rights management content
US20150113620A1 (en) Proximity based dual authentication for a wireless network
US9515834B2 (en) Content protection continuity through authorized chains of components
WO2017118330A1 (en) Application program data access isolation method and device
US20050228894A1 (en) Inter-device authentication system, inter-device authentication method, communication device, and computer program
WO2021203767A1 (en) Memory access method, system-on-chip, and electronic device
CN114237817A (en) Virtual machine data reading and writing method and related device
US20160162858A1 (en) Screening architectures enabling revocation and update
US9264763B2 (en) Method for generating a communication link between devices, and apparatus for same
WO2020248088A1 (en) Secure access method and electronic device
WO2017128655A1 (en) Method and device for video watermarking
US20200288210A1 (en) Display device and control method therefor
US20120005485A1 (en) Storage device and information processing apparatus
US8707054B2 (en) Establishing a secure memory path in a unitary memory architecture
WO2021184181A1 (en) Secure output method and electronic device
Mohanty et al. Media data protection during execution on mobile platforms–A review
EP2699017B1 (en) Security processing unit with secure connection to head end

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19932364

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19932364

Country of ref document: EP

Kind code of ref document: A1