Embodiment
For technological means, creation characteristic that the utility model is realized, reach purpose and effect is easy to understand, below in conjunction with embodiment, further set forth the utility model.
Referring to Fig. 1, the utility model carries out writing in the movable storage device after the hardware encryption to data by encrypting adapter, and movable storage device leaves the encryption adapter just becomes the equipment that can read for a short time, thereby plays privacy functions.Encrypt adapter between main frame and movable storage device, major function is: before data write movable storage device, the firmware program that utilization embeds was encrypted it, changed data content, and during sense data, firmware program is carried out decrypting process, restoring data.Handle by hardware encipher, break away from the movable storage device internal data structure of encrypting adapter and no longer met usual standard, can not normally read use, so just reach the purpose of information privacy.
Referring to Fig. 2, in the present embodiment, that control chip adopts is the USB2.0 interface chip CY7C68013 of Cypress company, and its input/output terminal is connected with the debug i/f circuit of USB2.0 interface circuit, ide interface circuit, CF card interface circuit and RS232 serial ports (DB9) mode; It also is connected with peripheral circuit, and peripheral circuit comprises clock circuit, power circuit and the reset circuit that is connected with CY7C68013 chip the corresponding interface.The CY7C68013 chip is 100 pin chips in the present embodiment.
Referring to Fig. 3, because the CY7C68013 chip is+the 3.3V power supply that usb bus voltage is+5V, so also will be through a voltage transformation, what present embodiment adopted is the conversion that the TPS7333 chip carries out voltage, the TPS7333 chip can+the 5V input voltage is transformed to+3.3V exports.The RESET signal is provided by reset circuit, and power supply can be provided by VBUS and two kinds of approach of external power supply, and CFVCC is used to provide the power supply of movable storage device.Clock circuit and reset circuit are available circuit, and this place repeats no more.
The VID of equipment and PID are stored among the EEPROM of I2C interface, send to main frame in device enumeration.In addition, main firmware program of the present utility model finally is burnt among the EEPROM.Therefore, the I2C interface can be used.EEPROM is connected with CY7C68013's, A0, A1, A2 is 3 address wires, can be used for indicating the different EEPROM that is connected on the same I2CC bus, and SCL is the clock signal of I2C, SDA is the data line of I2C, and these two lines all need the pull-up resistor through 1 kilohm to be connected to the 3.3V power supply.
Referring to Fig. 4, it is passable with regard to sill that the USB2.0 interface circuit only need connect 4 lines of USB interface.The left side is the USB joint of a standard, and what use on the general device is the Type B head.Two signal wires of D+ and D-are connected respectively to the DPLUS and the DMINUS pin of CY7C68013 chip.
Referring to Fig. 5 and Fig. 6, central circuit of the present utility model can be selected different interface circuits according to the difference of using storage medium, and the utility model has provided ide interface circuit and CF card interface circuit.Four signal wires of ide interface are connected respectively to DIOW, DIOR, CS1 and the DA2 pin of CY7C68013 chip.The P1.4 of CF card, P1.5, P1.6 and four signal wires of P1.4 are connected respectively to CY7C68013 chip-CE, RDT/BUST, WR and OE pin.When making circuit, reserves two kinds of interfaces, but two kinds of interfaces can not use simultaneously, can select use.
At present, the mode of data encryption has two kinds, both can finish by software, also can finish with special hardware cryptographic engine.The encryption and decryption process of data needs the calculating process of large amount of complex, adopts software mode, carries out relevant software processes code by CPU and finishes.And the employing hardware mode, then CPU need not to participate in the encryption and decryption process of data, and as long as CPU gives CPU needing ciphered data to send to hardware cryptographic engine after the encryption, just finish ciphering process; Deciphering also is same principle, simply gives hardware cryptographic engine the needs decrypted data, and CPU is given in crypto engine deciphering back loopback, has just simply finished the process of data decryption.The encryption of data, deciphering, CPU need not to participate in.Compare with traditional software cryptography, the principal feature of hardware encipher is: anti-deciphering intensity height, stability and better compatible.
What the utility model adopted is the hardware encryption mode, and according to the system works pattern, encryption can not change data length.Therefore the plaintext length of cryptographic algorithm should equal ciphertext length, and native system is selected the cryptographic algorithm of DES algorithm as system.
The DES password is actually further developing of Lucifer password.It is a kind of block cipher that adopts the conventional cryptography method.Its algorithm is symmetrical, not only can be used for encrypting but also can be used for deciphering.The suction parameter of DES algorithm has three: Key, and Data, Mode, wherein Key is totally 64 of 8 bytes, is the working key of DES algorithm; Data also is 64 of 8 bytes, is to want encrypted or decrypted data; Mode is the working method of DES, has two kinds: encrypt or deciphering.
The DES algorithm is work like this: for encrypting, then go a data Data to encrypt with Key as Mode, generate the output result of the password form (64) of Data as DES; Be deciphering as Mode, then go deciphering, be reduced to the output result of the plain code form (64) of Data as DES the data Data of password form with Key.At the two ends of communication network, both sides arrange consistent Key, with Key core data are carried out des encryption at source point, deposit or be transferred to terminal point with the password form then, data are decrypted code data with same Key after arriving the destination, have just reproduced the core data of plain code form.Guaranteed that like this, just core data is in security and reliability.
Firmware program is a more complicated, need use a large amount of functions, but its basic structure is simple relatively, and comprise following 3 processes: initialization comprises the initialization of processor and peripheral circuit; Principal function comprises and finishes the code that meets the equipment particular requirement; Interrupt Process comprises the program code of handling various interruptions.A part is mainly finished by the firmware frame program, and a part is handled by specific program, will introduce process in detail below:
The firmware frame program:
EZ_USB firmware frame program is all internal state variable of initialization at first, invoke user initialization function T D InitQ () then, and initialization usb bus equipment interface is non-configuration status then, and opens interruption simultaneously.After the task when finishing, EZ_USB receives that the solid state of SETUP bag program structure framework just begins to carry out Task Distribution.Task Distribution is exactly repeatedly to carry out following processes successively: invoke user function T D_POLL () at first; Detect whether the device request of standard is arranged then, if having, then execution command is made corresponding operation; Whether detect USB nuclear at last has USB to hang up incident.If there is USB to hang up incident, invoke user program PD_Suspend then, when TD_Supend () is returned as true time, USB nuclear detects whether the incident of restarting is arranged.If do not have USB to hang up incident, then make processor be in suspended state.When having detected the incident of restarting, USB examines invoke user program TD_Resume (), and continues execution in step (3).When TD_Supend () is returned as fictitious time, then continue to detect USB and examine whether USB hang-up incident is arranged.
The encrypt and decrypt specific program:
Referring to Fig. 7 and Fig. 8, the specific program purpose is: realize the data ciphering and deciphering function.Concrete way is that use encipheror (encrypt_code ()) and decrypted program (decrypt_codeU) change the data among the corresponding FIFOBUF, and then deliver to main frame or deposit hard disk in when computing machine is carried out operation such as read-write to movable storage device.
Behind system initialization, ((TD_Poll ()) finishes following work: at first whether send buffer EP2FIFOBUF has data to the USB interface oracle listener; Check then whether data are CBW command header (checkCBW ()); Carry out the CBW command block and handle (ProcessCBW ()).
The following function of CBW command block handling procedure ProcessCBW () wherein:
Handle CBW command header (proceaaCBWHeader ());
The soil of configuration ID E interface is made sequential
Order into ide interface read-write to handle (generaZIDEInCommand (), generalIDEOutCommand ()) according to CBW.In function generalIDEInCommand (), mainly handle according to the parameter of IDE read command by ideReadCommand (cmd); In function generalIDEOutCommand (), mainly handle according to the parameter of IDE write order by ideWriteCommand (cmd).
To computing machine return data or state (aendUSBS).Comprised key component of the present utility model in the IDE reading and writing program circuit, i.e. deciphering, encrypted code (referring to Fig. 7 and Fig. 8).
Wherein,, in the writePI016Q function, start GPIF respectively, realize data write automatically at readPI016Q.This is a key in the middle of the Code Design, also is that distinguishing feature one GPIF of this chip is able to programme.Realize the ide interface data write by hardware, can improve data throughput rate greatly, reduce taking the CPU sequential.
More than show and described ultimate principle of the present utility model and principal character and advantage of the present utility model.The technician of the industry should understand; the utility model is not restricted to the described embodiments; that describes in the foregoing description and the instructions just illustrates principle of the present utility model; under the prerequisite that does not break away from the utility model spirit and scope; the utility model also has various changes and modifications, and these changes and improvements all fall in claimed the utility model scope.The claimed scope of the utility model is defined by appending claims and equivalent thereof.