Software protection device and method6523119Abstract A method and apparatus for protecting computer software from unauthorized execution or duplication using a hardware key is disclosed. The apparatus comprises a means for communicating with the computer to receive command messages from the computer in the hardware key and to provide response messages to the computer, a memory for storing data for translating command messages into response messages enabling software execution, and a processor coupled to the interface port for translating command messages into response messages using the data stored in the memory. The processor further comprises a memory manager, for logically segmenting the memory storing the data into at least one protected segment, and for controlling access to the protected segment. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
INITIALIZE Initializes client library data
structures and prepare library for
calls, each session requires an
initialized command.
CONFIGURE Determines behavior about the client
library 123, the hardware key 114, or
the linked-in driver 216.
OPEN Establishes a session for the
application, and search for an I/O port
112 with the hardware key 114.
ACCESS Submits a query/read/write/modify
request, download a program or traps,
or reset the hardware key 114.
INQUIRY Returns status and configuration
information about a session.
CLOSE Closes a session created by "OPEN".
TERMINATE De-initializes the client library 123
and prepare for termination.
The CLOSE and OPEN functions are known as A-subclass commands and are transceived through the low level communication path 244. These functions require no encryption and are used for general management of the hardware key 114. API 121 functions for memory and command management are known B-command class commands. These functions employ the dynamic encryption algorithm (CC1 encryption key) and the medium-level virtual communication path 242 and are used for encrypted communication during the running of a protected application. They are submitted to the hardware key 114 with the "access" API and appropriate parameter packet. Memory and command management functions include the following:
READ Reads one or more adjacent cells.
WRITE Writes into one or more adjacent cells.
QUERY Scrambles data with a designated
algorithm descriptor.
IOXCHG Changes data by the associated
procedural trap.
SET/GETLimits Define data/code limits in hardware key
114 EEPROM 134 for use in session.
API 121 functions also include programmatic functions known as C-command class commands. These functions are used to execute programs encrypted by a compiler 200. Execution of these programs requires a CC0 encryption key. These functions are submitted to the hardware key 114 with the "access" API and program packets. These programmatic functions include:
LOADCONTEXT Loads a set of traps and procedures
into the EEPROM 134. This function
operates on context data objects which
contain both code and trap descriptors
encrypted with the CC0 key. This
function also stores code that is
callable by the LOADEX command.
SETALGO Defines a new query algorithm
descriptor.
LOADEX Runs codes, which was encrypted during
development, in RAM 132.
System Operation FIG. 5 is a diagram showing the operational relationships between elements of the hardware key 114. Block 300 represents the boot module, which performs power-up or re-boot operations. The boot module 300 initializes the hardware key 114 system RAM and provides a startup reference for the program logic. The microprocessor 130 is configured to run in a time-sliced manner, so that two separate tasks can run in the device simultaneously. The processor scheduler 308 contains logic required to implement these operations in the microprocessor 130. The main module 304 handles communications between the hardware key 114 and the host computer 100 or any other device to which the hardware key 114 is coupled via I/O port 112. The main module 304 operates in real time to monitor signals entering the hardware key 114 and is capable of controlling the processor scheduler 308 to effectively transfer information to the slave module 306. The main module 304 therefore can operate to monitor all central processing unit (CPU) cycles of the host computer 100, running as fast as possible. Low level communication module 320 handles the low level communication functions previously described. The low level communication module 320 provides separate submodules to interface with a variety of I/O ports 112 including a parallel port submodule 326, a serial port submodule 324 and an Apple.TM. Desktop Bus (ADB) submodule 322. Of course, modules for other I/O ports such as a smart card or PCMCIA interface may be implemented. Further provision is made for diagnostics of the low level communication module 328. Data is transferred to the slave module 306 via RAM 132. The main module 304 transfers data available on the I/O port 112 from and to the slave module 306 via the RAM 132. A RAM status bit is separately allocated within the RAM 132. This RAM status bit provides information to the main module 304 as to whether the slave module 306 is currently operating on a request, so that further requests can be rejected until a response from the slave module 306 has been provided and delivered. If the slave module 306 is not busy working on a request, the RAM status bit notifies the slave module 306 that it has a data packet to work on. These operations are controlled by the ASIC logic module 310. The RAM 132 therefore operates as an I/O buffer which works cooperatively with the processor scheduler 308 to transfer data to and from the main module 304 and the slave module 306. The slave module 306 performs a number of functions, a subset of which are organized into a number of command class modules. The command class dispatcher 330 directs hardware key 114 communications to the command class module as directed by an indicating value stored in the data packet. The command class module orientation of the slave module allows the creation of special firmware to do special purpose processing for different software developer customers. The slave module 306 also comprises shared services which can be accessed by any of the command class modules. The encryption module 348 performs encryption functions as required by the B-command class and the C-command class functions processed by Block 340. These functions decrypt communications and/or code as required for the B-command class or C-command class commands using the CC0 and CC1 encryption-decryption keys stored in secure portions of EEPROM 134. The interpreter 344 steps through decrypted or unencrypted code to perform the functions indicated by the code and translates the results into response messages. The query engines 346 are accessed by the command class modules to perform queries. For example, if a B-command class command is sent from the host computer 100 to the hardware key 114, the low level communications module 320 and the main module 304 receive the message. This message includes header information sufficient to identify it as a B-command class command. If the RAM status bit indicates that the slave module 306 is not busy with another request, the low level communication module 320 accepts this message which it loads in RAM 132. Using the header information, the command class dispatcher 330 identifies the messages as a B-command class command, and supplies the command to the B-C command class module 340. The B-C command class module 340 then accesses the slave module shared services 342 to perform the functions indicated via the command class dispatcher 331. If the message was encrypted with a CC0 key, the encryption module 348 is used to decrypt the message. If the message included an encrypted portion of the application software, this is also decrypted by the encryption module 348. Decryption of both the message and the application software portion is accomplished by the encryption module 348 using the CC0 key and the CC1 key which are securely stored in the EEPROM 134. The B-C command class module 340 then uses the interpreter 344 to perform the indicated functions. The query engine module 346 supports the query/response operations of the B-C command class module 340. The query engines in the query engine module 346 provide an important feature of the present invention because they allow internal information such as algorithm descriptors to be verified without revealing the information itself, and can also be used for authentication purposes. The query engine provide hardware key 114 responses to challenges from the host computer 100. The challenge or query can be either a descriptor based query, or a non-descriptor based query. In both cases, the query engine calculates a response (transformed data stream) to a challenge (an input data stream). The response to a non-descriptor based query depends on the challenge value alone. Accordingly, query engine algorithms are selected to be sufficiently complex as to prevent challenge/response pairs from revealing the underlying query engine algorithms. The response to a descriptor based query depends both on the challenge and a descriptor. The challenge is supplied by the application software program and can be any value. The descriptor consists of two portions: a software user/developer supplied portion and a portion which is supplied by the hardware key 114 vendor. To provide software developer dependency, the descriptor portion supplied by the hardware key 114 vendor includes software developer hardware key 114 specific information. The query engine module 346 can also be made more secure by setting up traps to further confound a potential software hacker. Traps allow a software developer to redefine the requested functions, introducing another element of confusion to prevent probing the hardware key 114 to determine how it operates. For example, the query engine 346 can be configured to respond to a query request by storing a value in an EEPROM 134 cell rather than by returning a response value as would otherwise be expected. Block 338 is a hardware key emulator module. This provides for backward-compatible emulation of a wide variety of hardware keys. For example, prior art hardware keys did not utilize encrypted messages from the host computer 100 to the hardware key 114. The hardware key emulator module 338 allows the communication encryption functions to be bypassed, allowing the hardware key 114 to be backward-compatible with prior art hardware keys, which do not operate with encrypted communications. Backwards-compatibility with other existing hardware keys can be similarly implemented. The slave module 306 also comprises a manufacturing programming interface (MPI) module 332, and a license manager module 334. The MPI module 332 is used to protect customer specific security data. This module provides two modes for two levels of MPI support. The first mode allows programming of algorithms and encryption keys in EEPROM 134 of the hardware key 114. The second mode allows software developers to program data into the hardware key 114. This capability allows software developers to personalize the hardware key 114 for their customers. Access to the first mode is protected by a challenge/response protection method implemented by the firmware of the hardware key 114. For further protection, the contents of the configuration area of the EEPROM 134 is erased whenever this mode is accessed, effectively rendering the hardware key 114 inoperative. This prevents any access to confidential information, even if the challenge/response method is circumvented. The license manager command class module 334 is used to enforce multiple site license limitations. This allows security-related functions of host computer 100 operating as a security server to be implemented in the hardware key, reducing the vulnerability of the server to software hacking techniques. License manager command functions include:
OPC_SRVRESET Frees all licenses. This
command is usually called
after a server boot.
OPC_OPENLIC Requests a base license from
the key. Includes a
transaction identification
number (TRANS_ID)
OPC_GETCNTX Passes a copy of the current
license information to the
server, including BOOT_ID,
TRANS_ID, and LICNSNUM.
These values are encrypted
before being sent to the
server.
OPC_SETCNTX Reloads the license
information back to the
hardware key.
OPN_OPENSUB Issued by clients, and opens
a sublicense. Argument
includes an application
identification (APP_ID) and a
debit number.
READ/WRITE/QUERY These operations can be performed
if a base license is open.
Results from these operations are
CC1 encrypted before being sent to
the host.
OPC_CLOSESUB Issued by clients, and releases
used license. Includes (APP_ID)
and credit number.
OPC_CLOSELIC Issued by clients to release base
license.
License manager command class module 334 variables
include:
HARDLIMIT Maximum base license limit imposed by
hardware key. If set to 0, allows a
single user only.
SOFT_LIMIT Maximum base license set by software
developer
BASE_COUNT Number of base licenses remaining.
This is modified when the server is
reset or when a base license is opened
or closed.
APP_ID Identification numbers for sub-
licenses. This is set by the software
developer.
APP_COUNT Number of sublicenses remaining. This
is modified when the server is reset or
when a base license is opened or
closed.
BITMAP Indicates whether license is open or
closed. This is modified when the
server is reset or when a base license
is opened or closed.
BOOT_ID This value is randomly selected when
server resets.
TRANS_ID Transaction identification set by the
client. This value is modified when a
base license is opened or when the
SET_CNTX command is issued.
FIG. 6 is a flow chart describing the operation of the license manager command class module. In block 402, boot functions are performed as a part of the server startup process. After locating and identifying network hardware keys 114 as a part of the startup process, the server issues an OPC_SRVRESET command. This invalidates any current license context, and generates a random value for BOOT_ID, which becomes the new session identification. Next, all bits in the BITMAP variable are cleared to indicate that there are no open licenses. Finally the values stored in APP_LIMIT and SOFT_LIMIT are stored in APP_COUNT and BASE_COUNT, respectively, indicating that all base licenses and sublicenses are available. As shown in block 404, if a license is desired, the client issues and the hardware key 114 receives an OPC_OPENLIC command with a transaction identification number, TRANS_ID. Block 406 determines if a base license is available. If not, block 408 returns an error message. If at least one base license is available, block 410 changes the transaction identification and all encrypted results thereafter required this new TRANS_ID to receive data. Next, block 412 decrements BASE_COUNT, and block 414 sets a random bit in the BITMAP variable. The address of this bit is later passed to the server as LICNSNUM. In block 416, the hardware key 114 determines if the server has requested license data by issuing an OPC_GETCNTX command. If so, as shown in block 418, the hardware key 114 responds by passing a copy of the current license information to the server. This information includes the BOOT_ID, TRANS_ID, and BITMAP values. In block 420, these values are encrypted before being sent to the server. The present invention is capable of supporting a number of sublicenses. Any client can request one or more sublicenses for a particular application as long as a base license is already opened. Each sublicense has a unique ID (APP_ID) and a limit (APP_LIMIT) which is set by software developers. Block 422 determines whether the software developer has implemented a sublicense management scheme in the hardware key 114. If so, block 424 determines if a base license is open. If a base license is not opened, block 426 returns an error message. If a base license is open, block 428 finds the application identified by APP_ID and determines if the number of open applications (APP_COUNT) is less than the allowed number (APP_LIMIT). If so, block 432 decrements APP_COUNT. READ, WRITE, and QUERY operations can then be performed by a client with an open base license. The results of these operations are encrypted with CC1 encryption before transmission. When a client no longer requires access to the licensed software, the client issues a OPC_CLOSESUB command to the hardware key. Block 434 checks for this command, and when it is received, block 436 checks to determine if a base license is open. If not, block 438 transmits an error message to the server. If a base license is open, block 440 increments the APP_COUNT value. Block 442 responds to a OPC_CLOSELIC command from the client. When this command is received, block 444 checks to determine if a base license is open. Block 446 returns an error message if a base license is not open. If a base license is open, the corresponding bit of the BITMAP variable is cleared, and the BASE_COUNT value is incremented to indicate that another base license has become available. Memory Manager As shown in FIG. 7, the memory manager provides several basic and compound virtual address spaces. These map three physical memory components: RAM 132, internal EEPROM 134 and external EEPROM 164. The memory manager module 318 uses the instructions in the F/W ROM 136 to abstract all storage to these virtual address spaces. Any changes to the size or type of memory used are thus localized and controlled by the memory manager 318. In order to access these virtual address spaces, the memory manager 318 exports a number of macros and a system variable zone, used for parameter passing. The three physical memory zones are mapped into eight segments. These include the user RAM segment 150, the system RAM segment 152, the configuration segment 156, the program code segment 158, the algorithm segment 160, the data segment 162 and the license segment 163. The memory manager provides virtual address spaces for the configuration segment 156, the code segment 150, the algorithm segment 160, the data segment 162 and the license segment 163. The user RAM segment 156 and the system RAM segment 152 are mapped directly by microprocessor commands 350. Compound virtual address spaces are also included forming a continuous address space by concatenating two segment address space thresholds between the code segment 158 and the algorithm segment 160, as well as between the algorithm segment 160 and the data segment 162. In this way, the address space can be programmably configured. To protect the CC0 and CC1 keys, the query engine module 386 algorithms information and for other security reasons, the configuration memory segment 156, the code memory segment 158 and the algorithm memory segment 160 are confined entirely to internal EEPROM 134. Further, all external EEPROM 164 is encrypted. In the preferred embodiment, simple encryption algorithms are utilized for external EEPROM 164 encryption. Complex algorithms would be slow and possibly involve several memory access to read/write a word of data. Complex encryption algorithms would perhaps be more secure, but its primary purpose is to prevent external EEPROM of one key working with a different key. The memory manager 318 provides macros to access each virtual address space. Each virtual address space has two access macros, Rxxxx and Wxxxx where xxxx is name of the address space's name. Rxxxx reads a bit/word from the address space. Using these macros, the memory manager 318 therefore divides the total memory into different sections based on intended usage and provides read/write interfaces to the rest of the firmware for accessing each section. Through this mechanism sensitive areas of the memory are isolated from command functions that a computer hacker could possibly control. In the case of the CC0 and CC1 encryption keys, these are stored in the configuration segment 156 of the EEPROM 134 and are accessed only through configuration read and write functions 352. These functions are used only by those firmware functions that are performing encryption and decryption and are not used by either the interpreter module 344 to access the memory on behalf of the program being interpreted, nor by the event handler when it is asked to read or write user data. Operation The present invention can be used by software developers to implement a wide variety of software protection schemes. First, the software programmer can simply store application-specific data in the hardware key EEPROM 134, and use this data during application execution. Second, the software programmer can encrypt query requests with CC1 encryption and verify responses before allowing application processing to continue. These encrypted queries are decrypted based on algorithm descriptors stored in the EEPROM 134. Third, the software programmer can download pre-CCI-encrypted software program code with a LOADEX command and execute the program code in the hardware key 114 during application run-time. In this case, programs are decrypted and executed in RAM 132. Fourth, the software programmer can store encrypted software program code and multiple traps in the EEPROM (134) with a LOADCONTEXT command. Procedures can be activated in one of two ways. First, the trap can be programmed within the hardware key so that when a particular command is present at the data buffer in the RAM 132, the trap procedure is executed allowing the trap procedure to operate on the data buffer. This capability allows the software programmer to effectively create a custom query engine. Alternatively, the trap can also be activated when a program resident in the RAM 132 calls an EEPROM 134 procedure. The operation of the present invention is shown in FIGS. 8A-8D. FIG. 8A shows the overall operation of the present invention. Block 500 receives data in the hardware key 114. In block 502, a command message is received from the host computer 100 in the hardware key 114. Block 504 generates a response message from the command message and the data stored in the hardware key 114. In block 506 the response message is transmitted from the hardware key 114 to the host computer 100. If more command messages 508 are received, the process begins anew by receiving the additional command messages 502. If no additional command messages are received, the process ends. FIG. 8B shows the operation of the present invention when the data received in the hardware key 114 is a portion of the executable software. First, the executable software portion is received in the hardware key 114. This is depicted in block 510. In block 512, the executable software portion is stored in a protected memory segment of the hardware key 114. FIG. 8C shows how command messages are received from the host computer 100 in the hardware key 114. First, as depicted in block 514, API calls are translated into hardware key 114 commands. If encryption is selected, CC0 or CC1 encryption 518 is implemented. As shown in block 516, if encryption is not desired, CC0 or CC1 encryption is not implemented. Block 520 builds a data packet based on the API calls. Block 522 transmits a data packet to the hardware key 114. The operations performed in generating a response message from the command message in the hardware key data are shown in FIG. 8D. Block 524 determines whether a data packet is available at the hardware key 114. If so, block 526 checks to determine if the slave module 306 is busy. When a data packet is available at the hardware key and the slave module is not busy, block 528 notifies the slave module 306 of the data packet. Block 530 dispatches the data packet to a command class module. Block 532 performs the command class module functions called for in the data packet. The query response handler 534, the interpreter 536, and the encrypt/decryptor 538 modules are accessed in support of performing the command class module functions in block 532. Finally, block 540 stores the result of the command class module functions in EEPROM 134. Hardware Key Programming To use the present invention to protect a software application, the software developer must first program the hardware key 114. Hardware key programming is accomplished with the aid of a developer key 115, which, like the hardware key, includes a processor and a secure memory where critical data such as the CC0 and CC1 keys and query algorithm information may be stored. The operations to program the hardware key 114 are presented in flow chart form in FIG. 9. First, as shown in block 600, the software developer must segment the application program 120 into two segments. One of these segments will remain unencrypted, and the other will be encrypted and stored in the hardware key 114. Generally, after segmenting, the resulting application is a mixture of a plurality of encrypted hardware key binary code instruction sets (corresponding to the encrypted software segment) interspersed in multiple locations within the host binary code (host processor code instructions corresponding to the unencrypted software segment). In segmenting the application program 120, the software developer must decide which functions or data to implement in the hardware key 114. In theory, this could be any function which is necessary for operation of the application program, ordinarily a function with an input-output relationship. Practical considerations may govern the choice of this function, because communications between the host computer 100 and the hardware key 114 and the speed of the microprocessor 130 may result in unacceptable processing and communication delays. For example, the software developer may want to implement a simple function in the hardware key 114 which is activated when queried by the host computer 100. For purposes of illustration, suppose the selected function simply takes two input values, A and B, and adds them together to obtain a third value, C. Further assume that only CC0 encryption is desired. The software developer is provided with a developer key 115 which is communicatively coupled to a developer computer used for development of the application program. The developer computer is similar in all relevant respects to the host computer 100. The developer key 115, which simulates aspects of the hardware key 114, allows the application program compiler to CC0 encrypt the string. The CC0 key or algorithm is protected because only the developer key can perform CC0 encryption, and the CC0 algorithm and key are not discernible from the developer key. Using software supplied with the hardware key the software programmer would define the EEPROM cells which will read the two input parameters A and B. Then, the software programmer codes the function itself, that is, A plus B. Then, the program is compiled, resulting in a string which can be interpreted by the interpreter module 344. As shown in block 602, this string is transmitted to a software developer unique developer key 115, which encrypts the string with the CC0 key, as depicted in block 604. The result is an interpretable string that represents the CC0 encrypted program object file. As indicated in block 606, the software developer receives this encrypted string, and can now store the CC0 encrypted string in the hardware key 114 that is provided to the software end-user so that it may be decrypted and operated during run time. This is indicated by block 626. Alternatively or in addition to this, the software developer may store the CC0 encrypted string in the application program as a data value that can be accessed and operated on by one of the APIs 121. This is indicated by block 610. When a software program is purchased, the end-user is provided a hardware key 114, in which the CC0 and CC1 encryption algorithms and keys are stored. The hardware key 144 is coupled to an I/O port 112 of the host computer 100, and the unencrypted and encrypted CC0 program object files are stored in the host computer 100. As indicated in block 612, when the protected application is run, the A and B parameters described above are stored in the EEPROM 134 using a WRITE API command, followed by a LOADEX command referencing the CC0 encrypted string. In block 614, the hardware key 114 then decrypts the string using the encryption module 348, and the C-command class functions in the slave module 306 to store the software segment instructions in a secure portion of the hardware key 114, as shown in block 616. Next, in block 618, the hardware key 114 performs the required instructions, using the interpreter 344, the query engine 346. The result is stored in the designated area of EEPROM 134, where the application program, using the READ API can access the data and determine whether the application program process should proceed or terminate. If CC1 encryption is desired, the data is encrypted as shown in block 624 before it is provided or transmitted to the host computer 100. The foregoing description of the preferred embodiment of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the invention be limited not by this detailed description, but rather by the claims appended hereto.
|
Same subclass Same class Consider this |
||||||||||
