#include "des_io.h"
#include "axis_pci.h"
#include "axis.h"
Include dependency graph for des_io.c:

Defines | |
| #define | NONCE_SIZE 8 |
| #define | NONCE_OFFSET_1 (0x38+CONTROL_OFFSET) |
| #define | NONCE_OFFSET_2 (0x3C+CONTROL_OFFSET) |
| #define | SECURITY_CONTROL_REGISTER (0x14+CONTROL_OFFSET) |
| #define | CLOCK_STOP (1<<7) |
| #define | VERIFY_OP (1<<3) |
| #define | USE_NONCE (1<<15) |
| #define | VERIFY_BIT (1<<14) |
| #define | HEBER_DES3_BLOCK_SIZE 8 |
| #define | HEBER_DES3_KEY_SIZE 24 |
Functions | |
| void | init_axis_des_hardware_key (struct axis_des_hardware_key *ptr, unsigned char *addr, unsigned char *reg, int index) |
| Function to initalise hardware key structure prior to use. | |
| void | init_axis_des_hardware_channel (struct axis_des_hardware_channel *ptr, unsigned char *reg, unsigned char *buffer, unsigned index) |
| Initalise a DES hardware channel structure. | |
| axis_des_key * | create_des_key (void) |
| Initalises a DES key structure. | |
| crypto_state * | create_crypto_state (struct axis_pci_device_entry *device) |
| creates and initalises a crypto state(session) structure. | |
| void | delete_crypto_state (struct crypto_state *ptr) |
| delete a crypto state(session) structure. | |
| void | delete_des_key (struct axis_des_key *key) |
| deletes a des key | |
| axis_des_op * | create_des_op (struct axis_des_key *key, struct axis_pci_device_entry *dev) |
| creates a DES op structure | |
| void | delete_des_op (struct axis_des_op *op) |
| deletes a DES operation | |
| int | search_for_free_hardware_key (struct axis_pci_device_entry *device) |
| Search for free hardware key slot. | |
| int | get_des_hardware_key (struct axis_pci_device_entry *device, struct axis_des_key *key) |
| Allocates a 3DES key channel. | |
| int | search_for_free_des_channel (struct axis_pci_device_entry *device) |
| Linear search for free DES channel. | |
| int | get_des_channel (struct axis_des_op *op) |
| Finds a free 3DES channel for a 3DES op. | |
| void | write_key (unsigned char *address, unsigned char *key) |
| write key | |
| int | load_des_key (struct axis_des_op *op) |
| Moves a key into hardware. | |
| int | issue_des_operation (struct axis_des_op *op) |
| Sends a DES op to hardware and starts it. | |
| int | free_des_channel (struct axis_des_op *op) |
| Frees a DES channel so another OP can use it. | |
| int | free_des_hardware_key (struct axis_des_op *op) |
| make DES key storage available | |
| void | init_axis_des_core (struct axis_pci_device_entry *device) |
| Performs initalisation of DES structures. | |
| int | dispatch_des_op (struct axis_des_op *op) |
| Performs a single DES operation. | |
| void | do_cryto_op (CRYPTO_OP *user_op, struct crypto_state *state) |
| Interprets user crypto requests. | |
| void | do_security_op (CRYPTO_OP *user_op, struct crypto_state *state) |
| Handles user access to security API. | |
| int | axis_crypto_ioctl (struct inode *inode_ptr, struct file *file_ptr, unsigned int type,unsigned long args) |
| Provides an interface to allow user land to the DES hardware. | |
| int | axis_crypto_open (struct inode *inode_ptr, struct file *file_ptr) |
| open function for 3DES crypto supper | |
| int | axis_crypto_release (struct inode *inode_ptr, struct file *file_ptr) |
| Called by kernel in response to a process closing a device. | |
| int | heber_des3_setkey (void *ctx, const u8 *key, unsigned int keylen, u32 *flags) |
| Creates crypto state so we can export crypto service to kernel crypto api. | |
| void | heber_des3_encrypt (void *ctx, u8 *dst, const u8 *src) |
| Encryption call back for kernel crypto API. | |
| void | heber_des3_decrypt (void *ctx, u8 *dst, const u8 *src) |
| Decryption call back for kernel crypto API. | |
Variables | |
| crypto_alg | heber_des3_alg |
| file_operations | crypto_file_operations |
| Define a file operations structure for cryptographic devices. | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
Provides an interface to allow user land to the DES hardware.
To allow user applications options other then read / write the driver support IOCTL calls the type constants are defined in axis.h DES ops are manipulated via this IOCTL call |
Here is the call graph for this function:

|
||||||||||||
|
open function for 3DES crypto supper
This open is called from the general open after its worked out what type of subdevice user space has requested opens the crypto device and creates and associates a crypto state with it |
Here is the call graph for this function:

|
||||||||||||
|
Called by kernel in response to a process closing a device.
Called by kernel if user application closes device, needs to destroy crypto state associated with open state |
Here is the call graph for this function:

|
|
creates and initalises a crypto state(session) structure.
Creates and zeros a new crypto_state structure |
|
|
Initalises a DES key structure.
Creates and zeros a new axis_des_key structure |
|
||||||||||||
|
creates a DES op structure
Creates a new DES op structure. Used to submit 3DES operations to the 3DES core code |
|
|
delete a crypto state(session) structure.
Deletes a crypto state structure if structure owns a hardware key it frees it |
|
|
deletes a des key
Deletes a crypto state structure if structure owns a hardware key it frees it |
|
|
deletes a DES operation
deletes a DES operation |
|
|
Performs a single DES operation.
Performs a des operation, it gets a key slot loads the key into the slot decrypting it if nessary and then gets a des slot loads the data to be operated on into and issue the command. The operation waits for an interrupt to signal comletion returns the transformed data and frees the DES slot marking the key slot as available for reuse. |
Here is the call graph for this function:

|
||||||||||||
|
Interprets user crypto requests.
Copies data to and from user space and cuts it up into nice easy slices and performs a cryto operation on each slice |
Here is the call graph for this function:

|
||||||||||||
|
Handles user access to security API.
Allows a user space application to access the (encrypted) FPGA Nonce value. The user application submits the encrypted nonce to a trusted third party that decypts the nonce modifies it and returns the encrypted new value. User space then submits this value and we have to issue it to the FPGA |
Here is the call graph for this function:

|
|
Frees a DES channel so another OP can use it.
Free FPGA DES channel after we have finished |
|
|
make DES key storage available
make DES key storage available |
|
|
Finds a free 3DES channel for a 3DES op.
Search for a free DES channel queue if one not available |
Here is the call graph for this function:

|
||||||||||||
|
Allocates a 3DES key channel.
Need to acquire a hardware key channel for the DES op to proceed. Function acquires and locks key prior to returning it. These are a finite resource and the DES operation may need to queue until one becomes free. |
Here is the call graph for this function:

|
||||||||||||||||
|
Decryption call back for kernel crypto API.
Define a crypto algorithm for the Heber DES core This is a lousy way of using the DES core but it is compatible with the current kernel crypto system. The cryto system only calls the algorithm one block at a time rather than block at once. This makes using the system in cbc mode easier but I suspect the cost of setting up the DES transaction will exceed the benefits of using hardware. |
Here is the call graph for this function:

|
||||||||||||||||
|
Encryption call back for kernel crypto API.
Define a crypto algorithm for the Heber DES core This is a lousy way of using the DES core but it is compatible with the current kernel crypto system. The cryto system only calls the algorithm one block at a time rather than block at once. This makes using the system in cbc mode easier but I suspect the cost of setting up the DES transaction will exceed the benefits of using hardware. |
Here is the call graph for this function:

|
||||||||||||||||||||
|
Creates crypto state so we can export crypto service to kernel crypto api.
Converts a crypto api key to one suitable for 3DES stuff |
Here is the call graph for this function:

|
|
Performs initalisation of DES structures.
Performs initalisation of the DES structures in the master structure |
Here is the call graph for this function:

|
||||||||||||||||||||
|
Initalise a DES hardware channel structure.
Initalise a DES hardware channel structure, called as part of the initialisation of a new instance of Axis hardware |
|
||||||||||||||||||||
|
Function to initalise hardware key structure prior to use.
Function to initalise hardware key structure prior to use, called as part of the initialisation of a new instance of Axis hardware |
|
|
Sends a DES op to hardware and starts it.
Despatch data and command to DES hardware wait for interrupt to signal completion |
|
|
Moves a key into hardware.
Load Key into key storage allow for keys being encrypted |
Here is the call graph for this function:

|
|
Linear search for free DES channel.
Simple search for an unused DES channel only call after setting channel lock |
|
|
Search for free hardware key slot.
Simple search for a free hardware key slot. This needs to be called from code protected by the des_key_lock semaphore present in the axis_pci_device master structure. Otherwise a race condition is likely. |
|
||||||||||||
|
write key
Sort out any possible endian problems with key |
|
|
Initial value:
{
ioctl: axis_crypto_ioctl,
open: axis_crypto_open,
release: axis_crypto_release,
}
|
|
|
Initial value: {
.cra_name = "heber_des3",
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = 8 ,
.cra_ctxsize = sizeof(struct crypto_state),
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(heber_des3_alg.cra_list),
.cra_u = { .cipher = {
.cia_min_keysize = 24 ,
.cia_max_keysize = 24 ,
.cia_setkey = heber_des3_setkey,
.cia_encrypt = heber_des3_encrypt,
.cia_decrypt = heber_des3_decrypt } }
}
|
1.3.6