Computer system including a transparent and secure file transform mechanism5584023Abstract A computer system including a file transform mechanism, such as encryption, compression, encoding, translation and conversion, a file storage subsystem for storing a file composed of one or more blocks of data, a data storage subsystem for storing blocks of data in first and second logical data areas and a processor for executing instructions implementing a computer operating system in the first logical data area and an application program in the second logical data area. The processor is coupled to the file storage subsystem and the data storage subsystem for transferring a predetermined block of data between the file storage subsystem and the data storage subsystem. The processor includes (1) a transform mechanism, defined within the operating system, for transforming the predetermined block of data in the first logical data area separately from any other block of data; (2) a request mechanism, defined by the application program, for selecting the predetermined block of data to be operated on; and (3) an interface that controls the transfer of the predetermined block of data between the file storage subsystem and the data storage subsystem and between the first and second logical data areas. The interface can determine whether the predetermined block of data is transformed. The interface controls the transfer of the predetermined block of data from the file storage subsystem to the data storage subsystem and between the first and second logical data areas, transforming the data as required. Claims I claim: Description Appendix I found on pages 43 through 76 of the specification as originally filed is now filed microfiche appendix consisting of one microfiche with 36 frames.
TABLE I
______________________________________
Structure of the System-Entry Table
From <sys/systm.h>
______________________________________
extern struct sysent {
char sy.sub.-- narg;
/* total number of arguments */
char sy.sub.-- setjmp;
/* 1 if systrap( ) should
not setjmp( ) */
int (*sy.sub.-- call) ( ) ;
/* handler */
} syset [ ];
extern int nsysent;
/* number of valid entries
in sysent */
______________________________________
The sysent table 34 functions as a dispatch table with each entry in the table corresponding to a different function supported by the operating system. Of particular relevance to the encryption transform embodiment of the present invention, the sysent table 34 includes entries for the open, create, read, write, chmod, fork, statf, seek, exit and ioctl system call procedures generally represented as procedures 36. As is evident from each entry in the sysent table, the system call address of each of the system call procedures is maintained in a respective entry ((*sy.sub.-- call)()) within the sysent table 34. The Unix operating system utilizes a file oriented paradigm in providing operating system services. Consequently, the open, create, read, write, seek, stat and close system call procedures permit logical operation relative to a wide variety of logical data entities, including directories, files, and pipes, for example, that are treated as files referenceable via directories. In turn, directories are maintained on disk as standard files containing specifically structured data. This directory file data includes a pointer to a disk based structure of disk inode entries. Each inode entry stores specifically relevant information describing, among other things, the protection mode, owner, user group and size of a particular data file. A summary of an inode entry, as stored on disk, is provided in Table II.
TABLE II
______________________________________
Structure of a Disk Inode
From <sys/ino.h>
______________________________________
struct dinode
ushort di.sub.-- mode;
/* protection mode, file type */
short di.sub.-- nlink;
/* number links to file */
ushort di.sub.-- uid;
/* owner's user id */
ushort di.sub.-- gid;
/* owner's group id */
off.sub.-- t di.sub.-- size;
/* number bytes in file */
. . .
};
______________________________________
The open and create system call procedures cause the creation of "in-core" inodes in an inode table for each file opened or created. The in-core inode of a file contains much of information held in the disk inode structure. The statf system call procedure can be used to return a structure containing the disk inode mode information. The chmod system call procedure is provided specifically to change the protection mode of disk files. The inode structure maintains a binary coded entry (di.sub.-- mode) defining the file type and protection mode of the disk file. The three least significant octal digits of the mode specify the existent read, write, and execute permissions of the file for the file owner (0x00), the owner's group (00x0), and other (000x), where x represents any octal digit. Another octal digit of the mode entry (x000) is utilized to store additional permissions related information. The remaining bits of the mode are used to define the file type or are reserved. The chmod system call procedure takes, as an argument, a binary representation of the file protection mode (xxxx) and appropriately modifies the mode value stored by the disk inode corresponding to the referenced file. In accordance with the present invention, a transformed file is identified by the presence of an enode data structure appended to a corresponding regular file. As will be discussed in greater detail below, this trailing enode structure includes data defining the transform applied to the file. A specific pre-existing file mode may also be used to indicate the transformed state of a corresponding regular file. In an alternate embodiment of the present invention the selected mode is octal xx0x, where x is any octal digit. This represents an otherwise unlikely file mode since the group permission is defined as without conventional read, write or execute access to the file. Any other mode bit or bit pattern could be used where the same can be seen to have no other significant use. Any logically permitted mode bit or pattern can be used to define, for example, the encryption state of the corresponding regular file consistent with the present invention. Consequently, incompatibilities that might arise either from a redefinition of the mode bits with existing programs that rely on the existing exclusive definition of the mode bits is avoided. Further, as a logically permitted mode, the existing chmod utility program will readily accept and apply the mode value to the corresponding file inode. The seek system call procedure is provided to position the file access pointer within, typically, a file. Subsequent read and write file accesses are performed relative to this pointer. The create and open system call procedures initialize the file access pointer to zero. The fork system call procedure is utilized to create a new process within the control of the operating system. This child process is a logical copy of the parent process. All processes are managed by the operating system through the use of a process table within the kernel space of the operating system. A summary of a process table entry, stored as an element of a process table linked list, is provided in Table III.
TABLE III
______________________________________
Structure of the Process Table
From <sys/proc.h>
______________________________________
typedef struct proc {
char p.sub.-- stat;
/* status of process */
. . .
ushort p.sub.-- uid;
/* real user id */
ushort p.sub.-- suid;
/* saved uid from exec */
int p.sub.-- sid;
/* POSIX session id num */
short p.sub.-- pgrp;
/* proc grp leader name */
short p.sub.-- pid;
/* unique process id*/
short p.sub.-- ppid;
/* process id of parent*/
ushort p.sub.-- sgid;
/* saved gid from exec */
sigset.sub.-- t
p.sub.-- sig;
/* signals pending */
struct proc
*p.sub.-- flink;
/* forward link */
struct proc
*p.sub.-- b1ink;
/* backward link */
. . .
struct proc
*p.sub.-- parent;
/* ptr to parent proc */
struct proc
*p.sub.-- child;
/* ptr 1st child proc */
struct proc
*p.sub.-- sibling;
/* next sibling proc */
. . .
} proc.sub.-- t;
______________________________________
Thus, each entry in the process table represents a structure containing information defining the relevant attributes of the process. Each process has a unique process ID (p.sub.-- pid) and is managed via a separate physical entry within the procedure table. Each entry in the procedure table also includes linking information identifying the parent process (p.sub.-- ppid), if any, of the current process. In completion of a fork system call procedure, the parent process is also provided with, as a return value, the process ID of the newly created or spawned child process. Thus, both the resulting parent and child processes may uniquely identify themselves and their related process. Multi-tasking operating systems, in general, implement multiple procedures as a way of managing the multiple tasks. The newer and more sophisticated operating systems often also implement mechanisms known as threads and lightweight processes as a convenient manner of augmenting the functionality of multiple processes, though without the additional complexity and overhead of full process context management. However, relevant to the present invention, threads and lightweight processes may be treated equivalently to the creation of processes via the fork system call procedure. The exit system call procedure is provided to permit an application program, or the operating system itself, to terminate a process. Termination of a process results in closing of all of the file descriptors associated with the process, including release of the related in-core inodes, and the removal of the corresponding entry from the process table. In closing any existing file descriptors, any corresponding data is first flushed from the kernel buffers associated with the process to the buffer pool and subsequently to disk as appropriate. The disk inode is then also updated. Finally, the ioctl system call procedure is provided for peripheral device specific operation control. In order to accommodate the variety of specific hardware, representing peripheral devices, that can be attached to a computer system 10, the Unix operating system permits device driver control modules to be integrated with the operating system kernel. Typically, each peripheral device is required to have a supporting device driver within the kernel to accommodate the specifics of the hardware implementing the peripheral device. Device drivers will include character device and buffered block mode device system call procedures. Character oriented devices will be typically supported with open, read, write, close and ioctl system call procedures. Where a peripheral device is susceptible to operating with block oriented system call procedures, the device driver will support open, close and strategy system call procedures. The strategy system call procedure is a common entry point for low-level data transfers via the buffer pool as a consequence of read and write buffer system calls subject to the file caching algorithm implemented by the operating system. In order to support the file oriented paradigm of the Unix operating system, a device driver is logically represented within the file system of the operating system by device files. These device files provide defining information specifying that the inode corresponds to either a character or block oriented device of a device driver and, further, the major and minor numbers utilized to identify the specific device driver (major number), and a particular variant of the device driver system call procedures (minor number) used to accommodate minor variations in the hardware or operation of the peripheral device. As with all files, file access permissions are also maintained in the device files, thereby permitting access restrictions to be enforced. In accordance with the preferred embodiment of the present invention, providing for the encryption of data files, a device driver is provided within the kernel of the operating system to support the selective encryption of disk based data files. As shown in FIG. 3, the device driver 38 of the present invention is not specifically related to any particular peripheral device 20. Rather, the capability of including a device driver in the kernel of the operating system is utilized advantageously to permit system call wrapper procedures 40 to be installed functionally between the sysent table 24 of the system call interface and corresponding selected system call procedures 36. This allows the existent system call procedures 36 of the operating system to be transparently modified by encapsulating each of the system call procedures 36 as atomic operations within the corresponding system call wrapper procedures 40. Also included in the device driver 38 of the present invention is an initialization routine 42 that installs the system call wrapper procedures 40 in the functional call path between the sysent system call entries 34 and the corresponding system call procedures 36. During the initialization of the operating system as a whole, a standard initialization call 44 is made by the operating system kernel to each device driver present within the kernel. When the initialization routine 42 of the device driver 38 of the present invention is called, the installation routine 42 scans the sysent table 34 and determines whether the table contains proper entries for each of the system call procedures required by the device driver. Where all of these system call procedures validly exist, the initialization routine 42 substitutes the addresses of the system call wrapper procedures 40 into the corresponding locations within the sysent table 34. The addresses of the original system call procedures are retained for subsequent reference by the device driver 38. Any subsequent system call will be effectively intercepted by the device driver of the present invention. An alpha table is also allocated during the initialization of the device driver. This table is formed as an array of pointers, preferably three pointers per table slot, to alpha table structures. Each table slot is defined, in accordance with the present invention, to uniquely correspond to a slot in the process table of the operating system. All alpha table pointers are initialized to zero. An enode table is then allocated. This table is formed as a pointer array with each pointer pointed to a structure including an "in use" entry and an enode structure. Each table slot is defined, in accordance with the present invention, to uniquely correspond to a slot in the "in core" inode table of the operating system. All enode table pointers are initialized to zero. A device driver flag is then appropriately set to indicate whether the initialization routine completed correctly and that subsequent operation of the device driver in accordance with the present invention is possible. The ioctl system call specific to the device driver of the present invention is issued by a simple application program also specific to the present invention. The application program provides a simple user interface to obtain a password key for validating the encryption and decryption of data files protected by the present invention. This get.sub.-- key application program obtains a user entered password key, opens the character device file of the device driver of the present invention, and then issues a SETKEY ioctl command with the user entered password key as an argument. The ioctl system call procedure of the device driver of the present invention preferably provides for the generation of an alpha table structure and for storing a pointer to that structure in the alpha table. The pointer storage location is chosen as one of the pointer locations within the alpha table slot that logically corresponds to the process table slot of the process that executed the get.sub.-- key application. The slot relationship between the alpha table and process table is such that neither directly references or is referenced by the other. That is, in accordance with the present invention, the control table, alpha, is not linked by pointers in any traceable way from the process table or any other conventional control structure within the kernel of the operating system. Consequently, a substantial degree of security is inherently obtained by the absence of any traceable connection between the process table and the alpha table of the present invention. Further, by establishing the alpha table as a structure defined only within the device driver of the present invention, there are no external symbol references to the location of the alpha table. A further degree of security may be obtained by dynamically allocating the table and table entries upon initialization of the device driver. Consequently, each instantiation of the table as well as the table entries will likely be at different locations within the data space of the kernel. Table IV provides a description of the preferred definition of the alpha table (alpha.sub.-- t) and of each alpha structure (alpha).
TABLE IV
______________________________________
Structure of an Alpha Table Entry
From "alpha.h"
______________________________________
struct alpha.sub.-- t {
/* the alpha table*/
struct alpha
*primary.sub.-- key;
struct alpha
*alternate.sub.-- key;
struct alpha
*working.sub.-- key;
};
struct alpha { /* the alpha structure */
unsigned char
encryptab[256];
/* encrypt. tab */
unsigned char
decryptab[256];
/* decrypt. tab */
int refcnt; /* reference cnt */
struct key cyptkey; /* encrypt. password */
};
struct key {
unsigned char
str[12]; /* password key */
};
______________________________________
The alpha table is an array of pointers to alpha structures. The length of the alpha table, and therefore the number of available alpha slots, is equal to the defined number of process table slots or entries (typically nproc). In many multi-tasking operating systems, the procedure or process table has a predefined static size. However, should the process table permit dynamic allocation of process table entries upon initiation of the operating system, then the device driver of the present invention may scan the process table or otherwise determine the number of process table entries in order to permit dynamic allocation of a corresponding number of alpha table slots. In either case, an equal number of available slots are preferably maintained in both the alpha table and the process table. Consequently, entries in the alpha table may be logically correlated to entries within the process table by reference to slot index offsets and without any direct linking between the two structures. That is, the table index of a slot in the process table will have a corresponding slot in the alpha table at the same index offset. Furthermore, by establishing the alpha table as an array of pointers to structures constituting the structures for each index slot location of the alpha table, an alpha structure may be multiply referenced from the alpha table. This capability permits multiple processes to logically share common encryption access permissions. As will be seen subsequently, this capability facilitates inheritance of the encryption access permissions. Referring now to FIG. 4a, shows a representative depiction of the generation of an encryption control table entry. In response to the SETKEY ioctl system call, the ioctl system call procedure of the preferred device driver of the present invention obtains the entered password key 48 from the user mode space. Assuming that this reference is the first reference to an alpha table slot in response to the SETKEY ioctl system call, an alpha structure will be assigned to the primary key entry of the slot. The alpha structure will also be duplicatively assigned to the working key entry by virtue of being the last alpha structure used relative to this slot. Assuming further that no other process has initialized an alpha structure with the same password obtained by the get.sub.-- key application for the present process, an alpha structure 50 is permanently allocated within the kernel data space. The alpha structure 50 is initialized and a pointer assigned to the alpha primary key entry of the current alpha table slot. The reference count (refcnt) of the alpha structure 50 is set to one. The user provided password key is used in conjunction with a predefined seed table to create, by index value substitution, an encryption table 56 that is stored in the alpha structure 50. The seed table, preferably included as a predefined element of the device driver of the present invention, preferably consists of 256 randomly ordered unique byte values. In the preferred embodiment of the present invention a shuffle function 54 is implemented to generate the process specific encryption table 56. The preferred shuffle function provides for a modulo four progressive recalculation of values based on the byte values of the password key and the seed table.
TABLE V
______________________________________
Pseudo Code of the Preferred Shuffle Function
______________________________________
shuffle(key[12],buf[256]) {
int x, y, idx, encrypted.sub.-- x;
extern seed.sub.-- table[256];
for x = 0 to 255; do
y = x;
for idx = each position in the key string; do
switch(idx % 4) {
case 0: y = y + key[Idx]; break;
case 1: y = y * key[idx]; break;
case 2: y = y / key[idx]; break;
case 3: y = y - key[idx]; break;
}
done
loop
loop
y = y modula 256;
encrypted.sub.-- x = seed.sub.-- table[y];
y = y + i;
until encrypted.sub.-- x != previous encrypted.sub.-- x
until encrypted.sub.-- x != x or no other x available
buf[x] = encrypted.sub.-- x
done
______________________________________
Each entry in the encryption table generated by the shuffle function is checked for uniqueness against prior existing values in the encryption table. If a newly generated value is not unique, another iteration of the shuffle function is performed to generate a new entry. Consequently, the encryption table will yield a set of 256 values that are unique and substantially random, though arithmetically related to the password key. Other specific methods of generating the encryption table may be readily utilized so long as the foregoing two requirements are met. A decryption table 58 is generated based on the encryption table 56 and stored in the alpha structure 50. Preferably a reverse table generation algorithm is applied to the encryption table to generate the decryption table. That is, the decryption table is generated by storing index values at locations within the decryption table selected by the data value stored within the encryption table at the index offset location. In the preferred embodiment of the present invention the algorithm is implemented as shown in Table VI.
TABLE VI
______________________________________
Pseudo Code for the Decryption Table Generation
______________________________________
for (i=0; i < 256; i++) {
decryptab[ encryptab[i] ] = i ;
______________________________________
However, any relationship between the encryption and decryption tables may be used so long as there is an arithmetic identity in the transformation of a data value applied to the encryption table and the resultant value when applied to the decryption table. Finally, the password key is encrypted using the encryption table 56 through a process of index substitution. That is, bytes from the encryption table are selected using respective bytes of the key as indices into the encryption table. Alpha structures, in accordance with the present invention, may both pre-exist when an alpha structure 50 is needed for a new process and may be shared. As before, alpha structures 50 are permanently allocated and maintained in a pool structure within the kernel data space. When a new alpha structure 50 is needed, the alpha structures in the pool are first examined to determine if one has already been initialized with the same password key. That is, a comparison is performed between the entered password key, once encrypted and the encrypted password keys stored by the alpha structures in the pool. If a match is found, then the reference count of the structure is incremented and the structure is assigned to the alpha table slot. If no match is found, then any available alpha structure 50 (reference count zero) from the pool is initialized, as discussed above, for the entered password key. The resultant structure 50 is then assigned to the primary and working key entries of the alpha table slot or, if another alpha structure has already been assigned to the primary key entry, then to the alternate and working key entries. If there is no available alpha structure 50 in the pool, then a new structure is dynamically allocated and placed in the pool. The relationship between process table 62, alpha table 64 and multiple references to alpha structures 66,68 is shown diagrammatically in FIG. 4b. By reference to the process 70 in which the get.sub.-- key application program is executed, the index offset of the process slot 70' in the process table 62 may be known. The same offset value is used to reference a slot 70" within the alpha table 64. An entry within the slot 70" then references an alpha structure 66. Where a new process slot 76' is initialized as a result of a fork system call, as indicated by the arrow 74, corresponding slot 76" is initialized in the alpha table. The alpha structure pointer entries in the slot 76" duplicate the entries in the slot 72". The reference counts of the resulting shared alpha structures 68 are incremented. This sharing of structures 68 results in an effective inheritance of the password keys corresponding to the slot 72". The sharing of alpha structures will also occur when the same password key is entered in independent processes. The alpha structure pool is scanned in initialization of a slot 78". If a matching encrypted password key is found, in structure 68 as shown, then the reference count of the structure 68 is incremented and a pointer to the structure 68 is assigned to an entry in the slot 78". Distinct from the case of inheritance of structures, this sharing of alpha structures is limited to the specific structure that is matched, and not all of the structures associated with another process slot. Referring now to FIG. 4c, the process of encrypting data will be described. In accordance with the preferred embodiment of the present invention, data is encrypted in individual blocks corresponding to the smallest buffered block size supported by the operating system. In the preferred embodiment, as is typical of standard Unix operating system variants, the minimum buffered block size is 256 bytes. Consequently, as shown in FIG. 4c, even an individual data value (byte) 80 being written ultimately out via a buffered write system call procedure will implicitly have an offset corresponding to the beginning of a data block 82. The actual data value being written is utilized, in the preferred embodiment of the present invention, as an index value against the encryption table 56 stored as part of the alpha structure 50. The resultant value and the block offset of the data being written are combined by a modulo 256 adder 84. The resultant byte value 86 is stored in the same block offset location in an encrypted data block 88. In accordance with the preferred embodiment of the present invention the unencrypted and encrypted blocks 82 and 88 are one and the same. The reverse procedure for converting an encrypted data block 88 to an unencrypted data block 82 is shown in FIG. 4d. An encrypted data value 86 is combined with the corresponding block offset value by a modulo 256 subtractor 90 and the resultant value is utilized as an index into the alpha structure decryption table 58. The value thus identified in the decryption table is the unencrypted original data value 80. This data value may then be stored in the buffered block offset location 80 from whence the encrypted data byte was obtained. Consequently, buffered random reads and writes of an encrypted data file at a block level are permitted by operation of the present invention. The entire data file need not even be read into memory or otherwise copied for decryption. Rather, only the specific block containing the file portion requested by an application program, unaware and uninformed of the operation of the present invention, need be decrypted for use by the application program and subsequently re-encrypted in writing back the data. Only the minimum portion of a file required by the application program is at any one time decrypted within the entire memory space of the computer system 10. Furthermore, data pending either a read or write operation to disk 22 or other storage medium persists only in an encrypted state. All data subject to encryption by operation of the present invention is maintained in an encrypted state in the buffer pool. FIG. 5a provides a schematic diagram of the control flow involved in execution of a modified read system call procedure. The read system call wrapper procedure 96 is called from the read entry of the sysent table 34. If the encryption facility of the present invention is enabled and an alpha structure is referenced by the working key entry, the read referenced file is checked for an in-core inode corresponding enode table structure. The enode structure is provided in Table VII.
TABLE VII
______________________________________
Structure of the "enode" Table
______________________________________
struct enode { /* the enode */
unsigned magic1; /* delimiter fixed value */
char magic.sub.-- text;
/* encrypted text */
struct key shadow.sub.-- key;
/* writing key */
short flags; /* transform type & status */
unsigned magic2; /* delimiter fixed value */
struct inCoreEnode { /* the in-core enode */
char inUse;
struct enode
enode;
}
struct enode.sub.-- t {
/* the enode table */
. . .
struct inCoreEnode *inCoreE;
}
______________________________________
The enode table is populated with enode structures corresponding to all opened files. That is, an enode structure is effectively allocated each time a file is opened or created so as to parallel the existence of corresponding in-core inode structures. When a file is opened, any existing enode structure appended to the file is read into the corresponding enode table structure. Otherwise, the enode table structure is left in a null pointer default state. As with the alpha table relationship to the process table, the enode table can be inferentially referenced by an offset value determinable from a reference to the in-core inode table. From the in-core inode identification of a file to be read, thus presuming the existence of both an open in-core inode and a corresponding enode structure, the contents of the identified enode structure can be used to authenticate the encrypted data against the specific encrypted password key held by the read requesting process. Authentication requires first that an enode structure validly existed at the end of the file when the file was opened. Second, one of the encrypted keys associated with the current process must be capable of validly decrypting the code in the magic.sub.-- text character space of the enode structure. That is, the magic.sub.-- text must decrypt into a known data string. If a correct decryption of the magic.sub.-- text is performed using the user's primary key, then the encrypted data can be accessed directly. If the user's alternate key is found to properly decrypt the magic.sub.-- text, the encrypted key stored in the enode structure is obtained and a working key alpha structure is created distinct from the alpha structures identified by the primary and alternate key entries. Thus, transparently to the user, access to the contents of an encrypted file created with a different password key than held by the current user is securely obtained. The read system call procedure 98, is then called to obtain the requested block of data. In the preferred embodiment, this call is preferably integrated at the Unix "readi" file system switch call level, which is one layer below the system call interface layer, to permit file system switch independent operation. The read system call procedure returns the requested data to a buffer typically located in the user data space pre-allocated by the requesting application program. However, the read system call wrapper procedure 96 may access this buffer location while continuing to execute in kernel mode. That is, conventional kernel subroutine calls permit the read system call wrapper procedure to obtain the location of the user space buffer filled as a consequence of the read system call procedure. If the file was authenticated as an encrypted file capable of decryption, the read system call wrapper procedure 96 decrypts the data in the user space read buffer. The decryption of the buffer data is performed by reading bytes of data from the user space read buffer, decrypting the byte of data in accordance with the process described in connection with FIG. 4d, and then writing out the resultant byte of data to the user space read buffer. Once the entire buffer of data has been decrypted, the read system call wrapper procedure returns, permitting a switch out of kernel mode as appropriate to enable the application program to execute and process the unencrypted data present in the user space read buffer. If, however, the current process has entered no password key, or the password key entered is not authenticated, then the decryption of data in the user space read buffer is not performed. Therefore, the user application program only receives encrypted data in accordance with the intended operation of the present invention. Conversely, regardless of the password key entered for a present process, if the file does not have a corresponding enode structure (inCoreEnode is null or not in use) or the data is not from a regular file, and therefore not subject to encryption, the data provided by the read system call procedure 98 is again left unmodified in the user data space read buffer. This unmodified read data is assumed to be unencrypted data in accordance with the intended mode of operation of the present invention. In similar fashion, the write system call wrapper procedure is invoked to implement the functions of the present invention in connection with the writing of data to a regular file. Thus, when a user program invokes a write, specifically integrated as a call to the Unix "writei" file system switch call layer, a the file enode structure and type are examined to determine whether the referenced file may be encrypted. If encryption is possible, then the enode structure data is authenticated, if possible. If authentication succeeds, the write data buffer, again existing in the user data space, is located and the contents of the buffer are encrypted. The encryption procedure used is that discussed in connection with FIG. 4a. Once the write buffer has been encrypted, the ordinary write system call procedure is called to write out the contents of the user data space write buffer. If the write of the buffer would alter the proper existence of the appended enode structure, the enode structure is rewritten to the end of the file. Since the application program still has access to the write data buffer, the user data space data must then be restored to an unencrypted state. Accordingly, the write system call wrapper procedure then decrypts the data in the write buffer utilizing the process described in connection with FIG. 4b. This decryption is performed only if the data was encrypted prior to the execution of the write system call procedure. If the write data file is not identified as being encrypted by the enode structure data or if the file is not a regular file, thereby precluding encryption, the write system call wrapper procedure simply calls the write system call procedure. Unencrypted data is therefore written out to an unencrypted file. The write system call wrapper procedure then returns. When the fork system call wrapper procedure is called, the fork system call procedure is first executed. As expected, this results in a duplication of the parent process and kernel mode execution continuing separately for both the parent and child processes. Each returns to a respective copy of the fork system call wrapper procedure, if the encryption capability of the present invention is enabled. These two kernel mode processes, due to their initial identity, must then test for parent or child status. In the preferred embodiment of the present invention this can be accomplished by each determining if the process has an existing alpha structure assigned. The parent process is the only one of the two processes that may have an allocated alpha structure associated with the process. Therefore, if one or more valid alpha structure entries exist, as may be determined from a non-zero reference count, the corresponding process must be the parent process. The parent process need do nothing and preferably then returns from the fork system call wrapper procedure. Conversely, the child process will copy the entries of the parent alpha table slot to the alpha table slot corresponding to the child process. The child process then increments the reference count in each of the newly referenced alpha structures and, finally, returns from the fork system call wrapper procedure. The exit system call wrapper procedure, when called, determines whether one or more alpha structures are referenced by the alpha table slot of this process. If any referenced structures exist, the reference count of each structure is decremented. The corresponding pointer entry in the alpha table is then set to null. The exit system call procedure is then called. As expected, this system call procedure results in the calling process being terminated in both user and kernel mode and the corresponding slots in the process table being marked as unused. Generally, the return from the exit system call procedure is internal to the kernel. FIG. 5b provides a schematic diagram illustrating the control flow resulting from a chmod system call as modified in accordance with an alternate embodiment of the present invention; specifically, an embodiment that utilizes the mode bits to signify a transform state of a file. When the chmod system call wrapper procedure 100 is called, the disk inode is obtained for the file which is the target of the chmod call. The existing mode of the file is stored for later reference. A determination is then made as to whether the encryption signifying bits of the mode are being changed and, if so, whether the file is a regular file and the process user identification (ID) and inode user ID match. If these encryption conditions are met, the encryption state of the file may be permitted to change. Otherwise, the requested change to the mode is modified to exclude a change of the encryption bit state. The chmod system call procedure 102 is then called. Upon return, the chmod system call wrapper procedure 100 will also simply return either if no change in the encryption state was detected or if the prerequisites for encryption of the file were not met. However, if a change to the encryption state of the file is proper, a determination is made as to whether the file is to be encrypted or decrypted. If a group mode bit was on originally and now all have been set to off, meaning to encrypt, the data blocks of the file are successively read in to a kernel space buffer, encrypted per the process of FIG. 4c, and then written back out to the file. A copy of the enode structure is then appended to the file using the current working key as the basis for the encryption of the source text stored as the magic.sub.-- text field of the enode structure. If the file was identified as encrypted originally and a group mode bit has been set on, then each block of file data is read into a kernel buffer, decrypted in accordance with the process of FIG. 4d, and then written back out to the file. The enode structure is stripped and discarded. In either case, once the file has been converted in its entirety consistent with the new state of the group encryption mode, the chmod system call wrapper procedure returns. The preferred embodiment of the present invention, however, does not rely on the mode bits, but rather on the presence of the enode structure appended to a regular file. A regular file is initially transformed by operation of an application program (set.sub.-- transform) specific to the present invention. This program, when executed, obtains the name of an explicitly identified file to be transformed. This file name is provided by way of a set.sub.-- mode ioctl call to the device driver of the present invention. The identified file is then transformed using the encryption process described above in relation to the chmod wrapper procedure, though without the necessity of testing the state of the mode bits. Conversely, an explicitly identified file can be untransformed by making a reset.sub.-- mode ioctl call with the name of the file. The identified file is then decrypted using the decryption process described above in relation to the chmod wrapper procedure, though again without the necessity of testing the state of the mode bits. Finally, a number of related system call wrapper procedures are provided to further support the transparency of the encryption mechanism. The open and create system call procedures must be intercepted by wrapper procedures to prevent the truncation of the referenced file, in addition to the allocation of enode structures. A parameter to the open system call procedure can specify that the file is to be opened and immediately truncated to a zero file length. The open system call wrapper procedure, however, Upon determining that the referenced file is encrypted and the open call requests truncation, requires authentication of the password keys held by the calling process. Likewise, the create system call wrapper procedure, on determining that the referenced file preexists and is encrypted, first requires authentication before the create system call procedure is called. A failure of authentication in either case returns an access error to the calling procedure. Seek and status (statf) system call wrapper procedures are provided to effectively hide the existence of the enode structure data. Where a referenced file is determined to be encrypted and authentication of a password key of the calling procedure succeeds, the seek system call procedure will artificially reduce the size of the referenced file by the size of the enode structure. This allows seek operations relative to the end of file or that extend beyond the end of file to be properly handled. Similarly, the file size returned by the status system call procedure is artificially reduced by the size of the enode structure. As can be seen from the foregoing, a flexible filesystem extension mechanism, particularly capable of implementing a transparent transform capability including a highly secure file encryption system, has been described broadly in connection with inter-networked and multi-tasking operating systems and specifically in regard to a Unix operating system. Based on the foregoing discussion of the preferred embodiments of the present invention, persons of ordinary skill in the art will readily appreciate that further modifications, adaptations and extensions can be applied to the invention disclosed herein. Accordingly, the present invention may be practiced, within the scope of the appended claims, other than as specifically described above.
|
Same subclass Same class Consider this |
||||||||||
