Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
hash_alg.h File Reference
#include <linux/bitops.h>

Go to the source code of this file.

Data Structures

struct  uint64
 
struct  hash_register
 
struct  hash_state
 
struct  hash_config
 
struct  hash_dma
 
struct  hash_ctx
 
struct  hash_req_ctx
 
struct  hash_device_data
 

Macros

#define HASH_BLOCK_SIZE   64
 
#define HASH_DMA_ALIGN_SIZE   4
 
#define HASH_DMA_PERFORMANCE_MIN_SIZE   1024
 
#define HASH_BYTES_PER_WORD   4
 
#define HASH_HIGH_WORD_MAX_VAL   0xFFFFFFFFUL
 
#define HASH_RESET_CR_VALUE   0x0
 
#define HASH_RESET_STR_VALUE   0x0
 
#define HASH_CSR_COUNT   52
 
#define HASH_RESET_CSRX_REG_VALUE   0x0
 
#define HASH_RESET_CSFULL_REG_VALUE   0x0
 
#define HASH_RESET_CSDATAIN_REG_VALUE   0x0
 
#define HASH_RESET_INDEX_VAL   0x0
 
#define HASH_RESET_BIT_INDEX_VAL   0x0
 
#define HASH_RESET_BUFFER_VAL   0x0
 
#define HASH_RESET_LEN_HIGH_VAL   0x0
 
#define HASH_RESET_LEN_LOW_VAL   0x0
 
#define HASH_CR_RESUME_MASK   0x11FCF
 
#define HASH_CR_SWITCHON_POS   31
 
#define HASH_CR_SWITCHON_MASK   BIT(31)
 
#define HASH_CR_EMPTYMSG_POS   20
 
#define HASH_CR_EMPTYMSG_MASK   BIT(20)
 
#define HASH_CR_DINF_POS   12
 
#define HASH_CR_DINF_MASK   BIT(12)
 
#define HASH_CR_NBW_POS   8
 
#define HASH_CR_NBW_MASK   0x00000F00UL
 
#define HASH_CR_LKEY_POS   16
 
#define HASH_CR_LKEY_MASK   BIT(16)
 
#define HASH_CR_ALGO_POS   7
 
#define HASH_CR_ALGO_MASK   BIT(7)
 
#define HASH_CR_MODE_POS   6
 
#define HASH_CR_MODE_MASK   BIT(6)
 
#define HASH_CR_DATAFORM_POS   4
 
#define HASH_CR_DATAFORM_MASK   (BIT(4) | BIT(5))
 
#define HASH_CR_DMAE_POS   3
 
#define HASH_CR_DMAE_MASK   BIT(3)
 
#define HASH_CR_INIT_POS   2
 
#define HASH_CR_INIT_MASK   BIT(2)
 
#define HASH_CR_PRIVN_POS   1
 
#define HASH_CR_PRIVN_MASK   BIT(1)
 
#define HASH_CR_SECN_POS   0
 
#define HASH_CR_SECN_MASK   BIT(0)
 
#define HASH_STR_DCAL_POS   8
 
#define HASH_STR_DCAL_MASK   BIT(8)
 
#define HASH_STR_DEFAULT   0x0
 
#define HASH_STR_NBLW_POS   0
 
#define HASH_STR_NBLW_MASK   0x0000001FUL
 
#define HASH_NBLW_MAX_VAL   0x1F
 
#define HASH_P_ID0   0xE0
 
#define HASH_P_ID1   0x05
 
#define HASH_P_ID2   0x38
 
#define HASH_P_ID3   0x00
 
#define HASH_CELL_ID0   0x0D
 
#define HASH_CELL_ID1   0xF0
 
#define HASH_CELL_ID2   0x05
 
#define HASH_CELL_ID3   0xB1
 
#define HASH_SET_BITS(reg_name, mask)   writel_relaxed((readl_relaxed(reg_name) | mask), reg_name)
 
#define HASH_CLEAR_BITS(reg_name, mask)   writel_relaxed((readl_relaxed(reg_name) & ~mask), reg_name)
 
#define HASH_PUT_BITS(reg, val, shift, mask)
 
#define HASH_SET_DIN(val, len)   writesl(&device_data->base->din, (val), (len))
 
#define HASH_INITIALIZE
 
#define HASH_SET_DATA_FORMAT(data_format)
 
#define HASH_SET_NBLW(val)
 
#define HASH_SET_DCAL
 

Enumerations

enum  hash_mode { HASH_MODE_CPU, HASH_MODE_DMA }
 
enum  hash_device_id { HASH_DEVICE_ID_0 = 0, HASH_DEVICE_ID_1 = 1 }
 
enum  hash_data_format { HASH_DATA_32_BITS = 0x0, HASH_DATA_16_BITS = 0x1, HASH_DATA_8_BITS = 0x2, HASH_DATA_1_BIT = 0x3 }
 
enum  hash_algo { HASH_ALGO_SHA1 = 0x0, HASH_ALGO_SHA256 = 0x1 }
 
enum  hash_op { COP_SHA1, COP_HMAC_SHA1, HASH_OPER_MODE_HASH = 0x0, HASH_OPER_MODE_HMAC = 0x1 }
 

Functions

int hash_check_hw (struct hash_device_data *device_data)
 
int hash_setconfiguration (struct hash_device_data *device_data, struct hash_config *config)
 
void hash_begin (struct hash_device_data *device_data, struct hash_ctx *ctx)
 
void hash_get_digest (struct hash_device_data *device_data, u8 *digest, int algorithm)
 
int hash_hw_update (struct ahash_request *req)
 
int hash_save_state (struct hash_device_data *device_data, struct hash_state *state)
 
int hash_resume_state (struct hash_device_data *device_data, const struct hash_state *state)
 

Macro Definition Documentation

#define HASH_BLOCK_SIZE   64

Definition at line 13 of file hash_alg.h.

#define HASH_BYTES_PER_WORD   4

Definition at line 16 of file hash_alg.h.

#define HASH_CELL_ID0   0x0D

Definition at line 92 of file hash_alg.h.

#define HASH_CELL_ID1   0xF0

Definition at line 93 of file hash_alg.h.

#define HASH_CELL_ID2   0x05

Definition at line 94 of file hash_alg.h.

#define HASH_CELL_ID3   0xB1

Definition at line 95 of file hash_alg.h.

#define HASH_CLEAR_BITS (   reg_name,
  mask 
)    writel_relaxed((readl_relaxed(reg_name) & ~mask), reg_name)

Definition at line 100 of file hash_alg.h.

#define HASH_CR_ALGO_MASK   BIT(7)

Definition at line 57 of file hash_alg.h.

#define HASH_CR_ALGO_POS   7

Definition at line 56 of file hash_alg.h.

#define HASH_CR_DATAFORM_MASK   (BIT(4) | BIT(5))

Definition at line 63 of file hash_alg.h.

#define HASH_CR_DATAFORM_POS   4

Definition at line 62 of file hash_alg.h.

#define HASH_CR_DINF_MASK   BIT(12)

Definition at line 48 of file hash_alg.h.

#define HASH_CR_DINF_POS   12

Definition at line 47 of file hash_alg.h.

#define HASH_CR_DMAE_MASK   BIT(3)

Definition at line 66 of file hash_alg.h.

#define HASH_CR_DMAE_POS   3

Definition at line 65 of file hash_alg.h.

#define HASH_CR_EMPTYMSG_MASK   BIT(20)

Definition at line 45 of file hash_alg.h.

#define HASH_CR_EMPTYMSG_POS   20

Definition at line 44 of file hash_alg.h.

#define HASH_CR_INIT_MASK   BIT(2)

Definition at line 69 of file hash_alg.h.

#define HASH_CR_INIT_POS   2

Definition at line 68 of file hash_alg.h.

#define HASH_CR_LKEY_MASK   BIT(16)

Definition at line 54 of file hash_alg.h.

#define HASH_CR_LKEY_POS   16

Definition at line 53 of file hash_alg.h.

#define HASH_CR_MODE_MASK   BIT(6)

Definition at line 60 of file hash_alg.h.

#define HASH_CR_MODE_POS   6

Definition at line 59 of file hash_alg.h.

#define HASH_CR_NBW_MASK   0x00000F00UL

Definition at line 51 of file hash_alg.h.

#define HASH_CR_NBW_POS   8

Definition at line 50 of file hash_alg.h.

#define HASH_CR_PRIVN_MASK   BIT(1)

Definition at line 72 of file hash_alg.h.

#define HASH_CR_PRIVN_POS   1

Definition at line 71 of file hash_alg.h.

#define HASH_CR_RESUME_MASK   0x11FCF

Definition at line 39 of file hash_alg.h.

#define HASH_CR_SECN_MASK   BIT(0)

Definition at line 75 of file hash_alg.h.

#define HASH_CR_SECN_POS   0

Definition at line 74 of file hash_alg.h.

#define HASH_CR_SWITCHON_MASK   BIT(31)

Definition at line 42 of file hash_alg.h.

#define HASH_CR_SWITCHON_POS   31

Definition at line 41 of file hash_alg.h.

#define HASH_CSR_COUNT   52

Definition at line 26 of file hash_alg.h.

#define HASH_DMA_ALIGN_SIZE   4

Definition at line 14 of file hash_alg.h.

#define HASH_DMA_PERFORMANCE_MIN_SIZE   1024

Definition at line 15 of file hash_alg.h.

#define HASH_HIGH_WORD_MAX_VAL   0xFFFFFFFFUL

Definition at line 19 of file hash_alg.h.

#define HASH_INITIALIZE
Value:
&device_data->base->cr, \

Definition at line 109 of file hash_alg.h.

#define HASH_NBLW_MAX_VAL   0x1F

Definition at line 85 of file hash_alg.h.

#define HASH_P_ID0   0xE0

Definition at line 88 of file hash_alg.h.

#define HASH_P_ID1   0x05

Definition at line 89 of file hash_alg.h.

#define HASH_P_ID2   0x38

Definition at line 90 of file hash_alg.h.

#define HASH_P_ID3   0x00

Definition at line 91 of file hash_alg.h.

#define HASH_PUT_BITS (   reg,
  val,
  shift,
  mask 
)
Value:
writel_relaxed(((readl(reg) & ~(mask)) | \
(((u32)val << shift) & (mask))), reg)

Definition at line 103 of file hash_alg.h.

#define HASH_RESET_BIT_INDEX_VAL   0x0

Definition at line 33 of file hash_alg.h.

#define HASH_RESET_BUFFER_VAL   0x0

Definition at line 34 of file hash_alg.h.

#define HASH_RESET_CR_VALUE   0x0

Definition at line 22 of file hash_alg.h.

#define HASH_RESET_CSDATAIN_REG_VALUE   0x0

Definition at line 30 of file hash_alg.h.

#define HASH_RESET_CSFULL_REG_VALUE   0x0

Definition at line 29 of file hash_alg.h.

#define HASH_RESET_CSRX_REG_VALUE   0x0

Definition at line 28 of file hash_alg.h.

#define HASH_RESET_INDEX_VAL   0x0

Definition at line 32 of file hash_alg.h.

#define HASH_RESET_LEN_HIGH_VAL   0x0

Definition at line 35 of file hash_alg.h.

#define HASH_RESET_LEN_LOW_VAL   0x0

Definition at line 36 of file hash_alg.h.

#define HASH_RESET_STR_VALUE   0x0

Definition at line 23 of file hash_alg.h.

#define HASH_SET_BITS (   reg_name,
  mask 
)    writel_relaxed((readl_relaxed(reg_name) | mask), reg_name)

Definition at line 97 of file hash_alg.h.

#define HASH_SET_DATA_FORMAT (   data_format)
Value:

Definition at line 115 of file hash_alg.h.

#define HASH_SET_DCAL
Value:
&device_data->base->str, \

Definition at line 125 of file hash_alg.h.

#define HASH_SET_DIN (   val,
  len 
)    writesl(&device_data->base->din, (val), (len))

Definition at line 107 of file hash_alg.h.

#define HASH_SET_NBLW (   val)
Value:
&device_data->base->str, \

Definition at line 120 of file hash_alg.h.

#define HASH_STR_DCAL_MASK   BIT(8)

Definition at line 79 of file hash_alg.h.

#define HASH_STR_DCAL_POS   8

Definition at line 78 of file hash_alg.h.

#define HASH_STR_DEFAULT   0x0

Definition at line 80 of file hash_alg.h.

#define HASH_STR_NBLW_MASK   0x0000001FUL

Definition at line 83 of file hash_alg.h.

#define HASH_STR_NBLW_POS   0

Definition at line 82 of file hash_alg.h.

Enumeration Type Documentation

enum hash_algo

enum hash_algo - Enumeration for selecting between SHA1 or SHA2 algorithm. : Indicates that SHA1 is used. : Indicates that SHA2 (SHA256) is used.

Enumerator:
HASH_ALGO_SHA1 
HASH_ALGO_SHA256 

Definition at line 271 of file hash_alg.h.

enum hash_data_format - HASH data format. : 32 bits data format : 16 bits data format : 8 bits data format. : 1 bit data format.

Enumerator:
HASH_DATA_32_BITS 
HASH_DATA_16_BITS 
HASH_DATA_8_BITS 
HASH_DATA_1_BIT 

Definition at line 259 of file hash_alg.h.

enum hash_device_id - HASH device ID. : Hash hardware with ID 0 : Hash hardware with ID 1

Enumerator:
HASH_DEVICE_ID_0 
HASH_DEVICE_ID_1 

Definition at line 247 of file hash_alg.h.

enum hash_mode
Enumerator:
HASH_MODE_CPU 
HASH_MODE_DMA 

Definition at line 132 of file hash_alg.h.

enum hash_op

enum hash_op - Enumeration for selecting between HASH or HMAC mode. : Indicates usage of normal HASH mode. : Indicates usage of HMAC.

Enumerator:
COP_SHA1 
COP_HMAC_SHA1 
HASH_OPER_MODE_HASH 
HASH_OPER_MODE_HMAC 

Definition at line 281 of file hash_alg.h.

Function Documentation

void hash_begin ( struct hash_device_data device_data,
struct hash_ctx ctx 
)

hash_begin - This routine resets some globals and initializes the hash hardware. : Structure for the hash device. : Hash context.

Definition at line 766 of file hash_core.c.

int hash_check_hw ( struct hash_device_data device_data)

hash_check_hw - This routine checks for peripheral Ids and PCell Ids. :

Definition at line 1261 of file hash_core.c.

void hash_get_digest ( struct hash_device_data device_data,
u8 digest,
int  algorithm 
)

hash_get_digest - Gets the digest. : Pointer to the device structure. : User allocated byte array for the calculated digest. : The algorithm in use.

Definition at line 1287 of file hash_core.c.

int hash_hw_update ( struct ahash_request req)

hash_hw_update - Updates current HASH computation hashing another part of the message. : Byte array containing the message to be hashed (caller allocated).

Definition at line 1086 of file hash_core.c.

int hash_resume_state ( struct hash_device_data device_data,
const struct hash_state device_state 
)

hash_resume_state - Function that resumes the state of an calculation. : Pointer to the device structure. : The state to be restored in the hash hardware

Definition at line 1151 of file hash_core.c.

int hash_save_state ( struct hash_device_data device_data,
struct hash_state device_state 
)

hash_save_state - Function that saves the state of hardware. : Pointer to the device structure. : The strucure where the hardware state should be saved.

Definition at line 1209 of file hash_core.c.

int hash_setconfiguration ( struct hash_device_data device_data,
struct hash_config config 
)

hash_setconfiguration - Sets the required configuration for the hash hardware. : Structure for the hash device. : Pointer to a configuration structure.

Definition at line 698 of file hash_core.c.