Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
nx.h File Reference

Go to the source code of this file.

Data Structures

struct  nx_sg
 
struct  msc_triplet
 
struct  max_sync_cop
 
struct  alg_props
 
struct  nx_of
 
struct  nx_stats
 
struct  nx_debugfs
 
struct  nx_crypto_driver
 
struct  nx_gcm_priv
 
struct  nx_ccm_priv
 
struct  nx_xcbc_priv
 
struct  nx_ctr_priv
 
struct  nx_crypto_ctx
 

Macros

#define NX_NAME   "nx-crypto"
 
#define NX_STRING   "IBM Power7+ Nest Accelerator Crypto Driver"
 
#define NX_VERSION   "1.0"
 
#define NX_PAGE_SIZE   (4096)
 
#define NX_MAX_SG_ENTRIES   (NX_PAGE_SIZE/(sizeof(struct nx_sg)))
 
#define NX_OF_FLAG_MAXSGLEN_SET   (1)
 
#define NX_OF_FLAG_STATUS_SET   (2)
 
#define NX_OF_FLAG_MAXSYNCCOP_SET   (4)
 
#define NX_OF_FLAG_MASK_READY
 
#define NX_GCM4106_NONCE_LEN   (4)
 
#define NX_GCM_CTR_OFFSET   (12)
 
#define NX_CCM_AES_KEY_LEN   (16)
 
#define NX_CCM4309_AES_KEY_LEN   (19)
 
#define NX_CCM4309_NONCE_LEN   (3)
 
#define NX_DEBUGFS_INIT(drv)   (0)
 
#define NX_DEBUGFS_FINI(drv)   (0)
 
#define NX_PAGE_NUM(x)   ((u64)(x) & 0xfffffffffffff000ULL)
 
#define SCATTERWALK_TO_SG   1
 
#define SCATTERWALK_FROM_SG   0
 

Enumerations

enum  nx_status { NX_DISABLED, NX_WAITING, NX_OKAY }
 

Functions

struct nx_sg __attribute ((packed))
 
int nx_crypto_ctx_aes_ccm_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_aes_gcm_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_aes_xcbc_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_aes_ctr_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_aes_cbc_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_aes_ecb_init (struct crypto_tfm *tfm)
 
int nx_crypto_ctx_sha_init (struct crypto_tfm *tfm)
 
void nx_crypto_ctx_exit (struct crypto_tfm *tfm)
 
void nx_ctx_init (struct nx_crypto_ctx *nx_ctx, unsigned int function)
 
int nx_hcall_sync (struct nx_crypto_ctx *ctx, struct vio_pfo_op *op, u32 may_sleep)
 
struct nx_sgnx_build_sg_list (struct nx_sg *, u8 *, unsigned int, u32)
 
int nx_build_sg_lists (struct nx_crypto_ctx *, struct blkcipher_desc *, struct scatterlist *, struct scatterlist *, unsigned int, u8 *)
 
struct nx_sgnx_walk_and_build (struct nx_sg *, unsigned int, struct scatterlist *, unsigned int, unsigned int)
 

Variables

u64 addr
 
u32 rsvd
 
u32 len
 
enum nx_status __attribute
 
struct msc_triplet __packed
 
struct crypto_alg nx_cbc_aes_alg
 
struct crypto_alg nx_ecb_aes_alg
 
struct crypto_alg nx_gcm_aes_alg
 
struct crypto_alg nx_gcm4106_aes_alg
 
struct crypto_alg nx_ctr_aes_alg
 
struct crypto_alg nx_ctr3686_aes_alg
 
struct crypto_alg nx_ccm_aes_alg
 
struct crypto_alg nx_ccm4309_aes_alg
 
struct shash_alg nx_shash_aes_xcbc_alg
 
struct shash_alg nx_shash_sha512_alg
 
struct shash_alg nx_shash_sha256_alg
 
struct nx_crypto_driver nx_driver
 

Macro Definition Documentation

#define NX_CCM4309_AES_KEY_LEN   (19)

Definition at line 101 of file nx.h.

#define NX_CCM4309_NONCE_LEN   (3)

Definition at line 102 of file nx.h.

#define NX_CCM_AES_KEY_LEN   (16)

Definition at line 100 of file nx.h.

#define NX_DEBUGFS_FINI (   drv)    (0)

Definition at line 171 of file nx.h.

#define NX_DEBUGFS_INIT (   drv)    (0)

Definition at line 170 of file nx.h.

#define NX_GCM4106_NONCE_LEN   (4)

Definition at line 92 of file nx.h.

#define NX_GCM_CTR_OFFSET   (12)

Definition at line 93 of file nx.h.

#define NX_MAX_SG_ENTRIES   (NX_PAGE_SIZE/(sizeof(struct nx_sg)))

Definition at line 20 of file nx.h.

#define NX_NAME   "nx-crypto"

Definition at line 5 of file nx.h.

#define NX_OF_FLAG_MASK_READY
Value:
NX_OF_FLAG_STATUS_SET | \
NX_OF_FLAG_MAXSYNCCOP_SET)

Definition at line 51 of file nx.h.

#define NX_OF_FLAG_MAXSGLEN_SET   (1)

Definition at line 48 of file nx.h.

#define NX_OF_FLAG_MAXSYNCCOP_SET   (4)

Definition at line 50 of file nx.h.

#define NX_OF_FLAG_STATUS_SET   (2)

Definition at line 49 of file nx.h.

#define NX_PAGE_NUM (   x)    ((u64)(x) & 0xfffffffffffff000ULL)

Definition at line 174 of file nx.h.

#define NX_PAGE_SIZE   (4096)

Definition at line 19 of file nx.h.

#define NX_STRING   "IBM Power7+ Nest Accelerator Crypto Driver"

Definition at line 6 of file nx.h.

#define NX_VERSION   "1.0"

Definition at line 7 of file nx.h.

#define SCATTERWALK_FROM_SG   0

Definition at line 191 of file nx.h.

#define SCATTERWALK_TO_SG   1

Definition at line 190 of file nx.h.

Enumeration Type Documentation

enum nx_status
Enumerator:
NX_DISABLED 
NX_WAITING 
NX_OKAY 

Definition at line 22 of file nx.h.

Function Documentation

struct nx_sg __attribute ( (packed)  )
struct nx_sg* nx_build_sg_list ( struct nx_sg sg_head,
u8 start_addr,
unsigned int  len,
u32  sgmax 
)
read

nx_build_sg_list - build an NX scatter list describing a single buffer

: pointer to the first scatter list element to build : pointer to the linear buffer : length of the data at : the largest number of scatter list elements we're allowed to create

This function will start writing nx_sg elements at and keep writing them until all of the data from is described or until sgmax elements have been written. Scatter list elements will be created such that none of the elements describes a buffer that crosses a 4K boundary.

Definition at line 93 of file nx.c.

int nx_build_sg_lists ( struct nx_crypto_ctx nx_ctx,
struct blkcipher_desc desc,
struct scatterlist dst,
struct scatterlist src,
unsigned int  nbytes,
u8 iv 
)

nx_build_sg_lists - walk the input scatterlists and build arrays of NX scatterlists based on them.

: NX crypto context for the lists we're building : the block cipher descriptor for the operation : destination scatterlist : source scatterlist : length of data described in the scatterlists : destination for the iv data, if the algorithm requires it

This is common code shared by all the AES algorithms. It uses the block cipher walk routines to traverse input and output scatterlists, building corresponding NX scatterlists

Definition at line 206 of file nx.c.

int nx_crypto_ctx_aes_cbc_init ( struct crypto_tfm tfm)

Definition at line 596 of file nx.c.

int nx_crypto_ctx_aes_ccm_init ( struct crypto_tfm tfm)

Definition at line 578 of file nx.c.

int nx_crypto_ctx_aes_ctr_init ( struct crypto_tfm tfm)

Definition at line 590 of file nx.c.

int nx_crypto_ctx_aes_ecb_init ( struct crypto_tfm tfm)

Definition at line 602 of file nx.c.

int nx_crypto_ctx_aes_gcm_init ( struct crypto_tfm tfm)

Definition at line 584 of file nx.c.

int nx_crypto_ctx_aes_xcbc_init ( struct crypto_tfm tfm)

Definition at line 613 of file nx.c.

void nx_crypto_ctx_exit ( struct crypto_tfm tfm)

nx_crypto_ctx_exit - destroy a crypto api context

: the crypto transform pointer for the context

As crypto API contexts are destroyed, this exit hook is called to free the memory associated with it.

Definition at line 627 of file nx.c.

int nx_crypto_ctx_sha_init ( struct crypto_tfm tfm)

Definition at line 608 of file nx.c.

void nx_ctx_init ( struct nx_crypto_ctx nx_ctx,
unsigned int  function 
)

nx_ctx_init - initialize an nx_ctx's vio_pfo_op struct

: the nx context to initialize : the function code for the op

Definition at line 261 of file nx.c.

int nx_hcall_sync ( struct nx_crypto_ctx nx_ctx,
struct vio_pfo_op *  op,
u32  may_sleep 
)

Routines supporting the Power 7+ Nest Accelerators driver

Copyright (C) 2011-2012 International Business Machines Inc.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 only.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Author: Kent Yoder yoder.nosp@m.1@us.nosp@m..ibm..nosp@m.com nx_hcall_sync - make an H_COP_OP hcall for the passed in op structure

: the crypto context handle : PFO operation struct to pass in : flag indicating the request can sleep

Make the hcall, retrying while the hardware is busy. If we cannot yield the thread, limit the number of retries to 10 here.

Definition at line 54 of file nx.c.

struct nx_sg* nx_walk_and_build ( struct nx_sg nx_dst,
unsigned int  sglen,
struct scatterlist sg_src,
unsigned int  start,
unsigned int  src_len 
)
read

nx_walk_and_build - walk a linux scatterlist and build an nx scatterlist

: pointer to the first nx_sg element to write : max number of nx_sg entries we're allowed to write : pointer to the source linux scatterlist to walk : number of bytes to fast-forward past at the beginning of : number of bytes to walk in

Definition at line 145 of file nx.c.

Variable Documentation

struct mpsc_tx_desc __attribute
u64 addr

Definition at line 18 of file nx.h.

u32 len

Definition at line 20 of file nx.h.

struct crypto_alg nx_cbc_aes_alg

Definition at line 121 of file nx-aes-cbc.c.

struct crypto_alg nx_ccm4309_aes_alg

Definition at line 445 of file nx-aes-ccm.c.

struct crypto_alg nx_ccm_aes_alg

Definition at line 423 of file nx-aes-ccm.c.

struct crypto_alg nx_ctr3686_aes_alg

Definition at line 156 of file nx-aes-ctr.c.

struct crypto_alg nx_ctr_aes_alg

Definition at line 135 of file nx-aes-ctr.c.

Definition at line 700 of file nx.c.

struct crypto_alg nx_ecb_aes_alg

Definition at line 120 of file nx-aes-ecb.c.

struct crypto_alg nx_gcm4106_aes_alg

Definition at line 331 of file nx-aes-gcm.c.

struct crypto_alg nx_gcm_aes_alg

Definition at line 310 of file nx-aes-gcm.c.

struct shash_alg nx_shash_aes_xcbc_alg

Definition at line 217 of file nx-aes-xcbc.c.

struct shash_alg nx_shash_sha256_alg

Definition at line 226 of file nx-sha256.c.

struct shash_alg nx_shash_sha512_alg

Definition at line 245 of file nx-sha512.c.

__be16 rsvd

Definition at line 19 of file nx.h.