A hardware security module (HSM) is a physical computing device that safeguards and manages digital keys for strong authentication and provides crypto processing. A HSM adapter is an PCIe adapter that addresses stringent security requirements of, for non-limiting examples, SaaS applications, ecommerce payment systems and Enterprise, Banking and Government security applications especially as they migrate to the public or private cloud. In some embodiments, HSM adapter is FIPS 140-2 Level 3 certified and uses tamper-resistant detection circuitry and strong enclosures to protect all the information stored on the HSM adapter.
Using the HSM adapter, however, requires applications and driver(s) to communicate across the PCIe bus, which is insecure and allows an attacker to gain access to and manipulate the flow of information between the applications, drivers and the HSM adapter at various points. Consequently, a user is not guaranteed that the applications and the drivers are secure and the user cannot trust them to handle sensitive information. There is a need for a secure environment that allows users to be able to run their applications securely within the HSM adapter and to be able to communicate with the HSM adapter without worrying about the security of their applications.
The foregoing examples of the related art and limitations related therewith are intended to be illustrative and not exclusive. Other limitations of the related art will become apparent upon a reading of the specification and a study of the drawings.
Aspects of the present disclosure are best understood from the following detailed description when read with the accompanying figures. It is noted that, in accordance with the standard practice in the industry, various features are not drawn to scale. In fact, the dimensions of the various features may be arbitrarily increased or reduced for clarity of discussion.
The following disclosure provides many different embodiments, or examples, for implementing different features of the subject matter. Specific examples of components and arrangements are described below to simplify the present disclosure. These are, of course, merely examples and are not intended to be limiting. In addition, the present disclosure may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed.
A new approach is proposed that contemplates systems and methods to support a secure machine environment on a HSM adapter, which enables an end user of the HSM adapter to run its own security sensitive applications securely within the HSM adapter and to gain access to its security measures. Here, the secure machine environment is an operating system (OS) environment on the HSM adapter that allows the user to run a secure machine for its applications. During operation, the secure machine receives commands from an application running on a host outside of the HSM adapter and executes a security sensitive application within the secure machine environment. The secure machine is configured to process all sensitive information of the security sensitive application via one or more secure machine processes/threads, while the applications running on the host only deal with non-sensitive information. The secure machine then sends a response back to the application running on the host following execution of the security sensitive application within the secure machine environment.
Under the proposed secure machine environment on the HSM adapter, a security sensitive application running in the secure machine environment on the HSM adapter is signed using the private key of its user/owner to ensure its integrity. The code for the security sensitive application running in the secure machine environment is protected and is not exposed outside of the secure machine environment. As such, the user can implement its own private algorithms in the application running in the secure machine environment with full confidence that no other third party can access the code for the application. In addition, the application running in the secure machine environment can be stopped or started only by a privileged user authenticated under strict authentication protocols (e.g., FIPS 140-2 security level 3) enforced by the HSM adapter.
In the example of
In the example of
In the example of
In the example of
In order to be able to utilize the secure machine environment 104, the user needs to implement the code of its security sensitive applications 110 in C/C++ and compile the code to obtain the ELF files of the secure machine package 120 capable of being executed by the secure machine 106 on the HSM adapter 102. The user then digitally signs the ELF files and other files to be present on the HSM adapter 102 to create the secure machine package 120 for the secure machine 106 to run. Once the secure machine package 120 is created, it can be inserted by a partition Crypto Officer (pCO) and run on the HSM adapter 102. Here, pCO is a type of role (a user or a group of users who can perform certain actions) that allows managing a single partition such as creating, deleting users etc. In some embodiments, all secure machine packages 120 run within their own directories and they can access files within these directories only and run the applications 110 only from within these directories.
In some embodiments, the secure machine package 120 is sent to the HSM adapter 102 across PCIe, which can only be done when the secure machine 106 has been “created” by a master Crypto Officer (mCO), which is a type of role that allows managing partitions within a single HSM adapter 102 such as creating, deleting, resizing partitions etc. The HSM firmware 116 then verifies that the package 120 has been signed by the pCO's private key. Note that the secure machine package 120 only needs to be loaded once until either the mCO “destroys” the secure machine environment 104 or the pCO “unloads” the secure machine package 120. Unloading the secure machine package 120 automatically stops the secure machine 106 and removes the secure machine package contents for the partition, which allows loading of another secure machine package in the secure machine environment 104.
In some embodiments, the secure machine 106 is configured to receive commands from the applications 111 (with no security sensitive code) running on the host 108 across the PCIe bus, send responses (of executing security sensitive application 110 on the secure machine 106) back to the applications 110 on the host 108 across the PCIe bus, and receive commands directly to and from the HSM firmware 116 in the FIPS boundary 114. These type of operations are discussed in details below. Note that, in some embodiments, every command sent or received to from outside of the secure machine environment 104 is logged in an audit log along with the session handle used by the secure machine 106 to perform the operation, wherein the audit log is used to verify if the secure machine 106 is running properly.
In some embodiments, the secure machine 106 is configured to register a plurality of opcodes that its processes/threads may receive with secure machine driver 118 of the HSM adapter 102 as shown by the example of
Once an opcode has been registered, the thread/process that has registered it will have to implement a receive loop (secure machine receive function), which performs a system call to the secure machine driver 118 to check for received packet as shown by the example of the flowchart of
In some embodiments, the secure machine 106 can only send an response to the host 108 with the request receive id received when an application 111 from the host 108 sends a command to the secure machine 106. When the response is sent, this rx_id is used to redirect the response to the correct application 111 on the host 108 waiting for the response. In some embodiments, the secure machine 106 can only respond to messages that the applications 110 on the host 108 have initiated but cannot initiate a message to the applications 110 on the host 108.
In some embodiments, the secure machine 106 is configured to send commands to the HSM firmware 116 in the FIPS boundary 114 via security Application Program Interface (API) of the HSM adapter 102, wherein the security API is modified to allow quick porting of existing applications 110 on the host 108 to run in the secure machine environment 104. All commands allowed to a pCU can be performed by the secure machine 106 with the exception of the following commands: app initialize, open session, login, logout, close session and app shutdown.
In some embodiments, the secure machine 106 can be booted up by starting the initializing ELF in the current secure machine environment 104, wherein the initialization process also spawns other processes/threads to perform other tasks of booting the secure machine 106. Note that the secure machine 106 can only be booted once the mCO has started the secure machine environment 104 and the pCO has loaded a secure machine package 120 in the secure machine environment 104.
In some embodiments, the secure machine 106 can be shut down together with all of its child processes and threads that it has started. the secure machine 106 first sends a command to the initialization process, and waits for the processes to exit themselves. On timeout, if the processes have not exited, another command is issued to all the processes and threads, which will only return until all of the secure machine processes have been shut down.
When a pCU intends to access the secure machine 106, the pCU has to login to the HSM firmware 116 in the FIPS boundary 114 to confirm his/her credentials, wherein the session handle is passed along to the secure machine process. Only after the pCU has logged in, the secure machine process will be able to receive commands and send responses from the HSM firmware 116 and across the PCIe bus. Once the login is complete, the secure machine 106 is completely functioning for the pCU and its applications 110 running on the secure machine 106. When the pCU has logged out of the secure machine 106, the secure machine driver 118 will let the secure machine 106 know that the pCU has logged out and the session handle used by the secure machine 106 will no longer be valid. The secure machine process will not send/receive any commands to the HSM firmware 116 until a pCU does another login.
In some embodiments, the HSM adapter 102 is configured to allow a single partition to support multiple pCUs. Specifically, the secure machine 106 needs at least one pCU to login to be able to interact with the HSM firmware 116 or receive commands across the PCIe bus. If multiple pCUs login, each login command and the session handle will be passed along to the secure machine 106 so that it can use these session handles in whichever way it wants. When any of the pCUs logs out, the secure machine 106 will be informed about this and the session handle corresponding to that particular pCU will no longer be valid. When the last pCU logs out, the secure machine 106 will no longer be able to send or receive any packets from outside without a pCU logging in.
Even though the secure machine 106 gets full access to library and system calls of the HSM adapter 102, the HSM adapter 102 is configured to enforce a number of restrictions on secure machine processes so that they can safely run within the confines of the secure machine environment 104 without affecting the software running within the FIPS boundary 114 on the HSM adapter 102. Note that all of these permissions and restrictions are inherited and therefore is applicable to every process and thread spawned by the secure machine processes.
For a non-limiting example, since the secure machine process runs with a non-zero UID (user id), referred to as secure machine UID, restricted permissions are necessary. Here, the UID is a user identifier used to determine which system resources a user can access on the HSM adapter 102. In some embodiments, the HSM adapter 102 is configured to grant the permissions on certain paths of the secure machine process based on the UID. Specifically, the secure machine process runs with its working directory as/home/secure machine/cwd, and the secure machine UID is the owner of this directory. All the secure machine package contents are present in home/secure_machine/bin/, which is also owned by the secure machine UID. The HSM adapter 102 is configured to allow the secure machine UID to read, write and execute anything within these directories, which are referred to as SMdir. The directories (and all their subdirectories and files) to which the secure machine UID can only read and execute are referred to as binlibdir. The directories (and all their subdirectories and files) to which the secure machine UID can read but are not executable are referred to as pfsdir (for pseudo filesystem). Once the secure machine initialization process has been launched, the initialization process can launch other processes from all the above directories.
In some embodiments, the secure machine environment 104 runs within a Busybox environment, and hence the secure machine 106 can make use of all the Busybox functionalities such as running shell script or performing an 1s, mkdir command etc. Here, BusyBox is software that provides several stripped-down Unix tools in a single executable file. It runs in a variety of POSIX environments including but not limited to Linux, Android, FreeBSD and others, such as proprietary kernels, although many of the tools it provides are designed to work with interfaces provided by the Linux kernel. It was specifically created for embedded operating systems with very limited resources.
In some embodiments, the entire filesystem 122 of the HSM adapter 102 is of type initramfs, which is a type of filesystem called initial RAM file system, where the entire filesystem runs from within RAM and all the changes made within the filesystem 120 are lost after reboot and the entire filesystem 122 returns back to its initial state. Since the secure machine environment 104 runs with the initramfs filesystem 122, no file created or changed will be part of a permanent storage. The secure machine process can create/read/write/delete its own per-partition blocks, which are part of the HSM adapter's NAND flash storage and hence it will be retained as long as the partition exists. The blocks can be also marked as sharable with the host 108 enabling another application 110 to retrieve the blocks across the PCIe bus.
In some embodiments, the HSM adapter 102 enables debugging of the secure machine 106 and its processes by generating a secure machine system log (syslog) using the log_err( ) log_print( ) and log_debug( ) API. Note that debugging needs to be enabled while creating the secure machine package 120 for the application 110 to be able to retrieve to the debug log. These logs can be extracted out from the HSM adapter 102 by a pCU of that partition.
In cases where a signal is received by a secure machine process, the signal number is captured and written to the SM syslog before passing it on to the secure machine process. In certain cases, a register dump is generated to ease debugging via one of the following signals: SIGILL (illegal instruction), SIGSEGV (segmentation fault), SIGFPE (floating point exception), SIGBUS (bus error), and SIGSYS (bad argument to system call).
In some embodiments, when debug is enabled for the secure machine 106 and its processes, the HSM adapter 102 is configured to generate a core dump file upon receiving any of the signals which cause a core dump (including all the signals discussed above). Here, the core dump includes state of the memory of a computer program at a specific time, generally when the program has crashed The core dump of a crashed secure machine process can be extracted by the pCO to examine what exactly caused a crash if debugging is enabled while generating the secure machine package 120.
In the example of
The methods and system described herein may be at least partially embodied in the form of computer-implemented processes and apparatus for practicing those processes. The disclosed methods may also be at least partially embodied in the form of tangible, non-transitory machine readable storage media encoded with computer program code. The media may include, for example, RAMs, ROMs, CD-ROMs, DVD-ROMs, BD-ROMs, hard disk drives, flash memories, or any other non-transitory machine-readable storage medium, wherein, when the computer program code is loaded into and executed by a computer, the computer becomes an apparatus for practicing the method. The methods may also be at least partially embodied in the form of a computer into which computer program code is loaded and/or executed, such that, the computer becomes a special purpose computer for practicing the methods. When implemented on a general-purpose processor, the computer program code segments configure the processor to create specific logic circuits. The methods may alternatively be at least partially embodied in a digital signal processor formed of application specific integrated circuits for performing the methods.
The foregoing description of various embodiments of the claimed subject matter has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the claimed subject matter to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. Embodiments were chosen and described in order to best describe the principles of the invention and its practical application, thereby enabling others skilled in the relevant art to understand the claimed subject matter, the various embodiments and with various modifications that are suited to the particular use contemplated.
This application claims the benefit of U.S. Provisional Patent Application No. 62/220,175, filed Sep. 17, 2015, and entitled “Secure Machine for Hardware Security Module (HSM) Adapter,” which is incorporated herein in its entirety by reference.
Number | Date | Country | |
---|---|---|---|
62220175 | Sep 2015 | US |