Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
nx.c File Reference
#include <crypto/internal/hash.h>
#include <crypto/hash.h>
#include <crypto/aes.h>
#include <crypto/sha.h>
#include <crypto/algapi.h>
#include <crypto/scatterwalk.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/device.h>
#include <linux/of.h>
#include <asm/pSeries_reconfig.h>
#include <asm/hvcall.h>
#include <asm/vio.h>
#include "nx_csbcpb.h"
#include "nx.h"

Go to the source code of this file.

Functions

int nx_hcall_sync (struct nx_crypto_ctx *nx_ctx, struct vio_pfo_op *op, u32 may_sleep)
 
struct nx_sgnx_build_sg_list (struct nx_sg *sg_head, u8 *start_addr, unsigned int len, u32 sgmax)
 
struct nx_sgnx_walk_and_build (struct nx_sg *nx_dst, unsigned int sglen, struct scatterlist *sg_src, unsigned int start, unsigned int src_len)
 
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)
 
void nx_ctx_init (struct nx_crypto_ctx *nx_ctx, unsigned int function)
 
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_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)
 
int nx_crypto_ctx_aes_xcbc_init (struct crypto_tfm *tfm)
 
void nx_crypto_ctx_exit (struct crypto_tfm *tfm)
 
 MODULE_DEVICE_TABLE (vio, nx_crypto_driver_ids)
 
 module_init (nx_init)
 
 module_exit (nx_fini)
 
 MODULE_AUTHOR ("Kent Yoder <[email protected]>")
 
 MODULE_DESCRIPTION (NX_STRING)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (NX_VERSION)
 

Variables

struct nx_crypto_driver nx_driver
 

Function Documentation

MODULE_AUTHOR ( "Kent Yoder <[email protected]>"  )
MODULE_DESCRIPTION ( NX_STRING  )
MODULE_DEVICE_TABLE ( vio  ,
nx_crypto_driver_ids   
)
module_exit ( nx_fini  )
module_init ( nx_init  )
MODULE_LICENSE ( "GPL"  )
MODULE_VERSION ( NX_VERSION  )
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

Initial value:
= {
.viodriver = {
.id_table = nx_crypto_driver_ids,
.probe = nx_probe,
.remove = nx_remove,
.name = NX_NAME,
},
}

Definition at line 700 of file nx.c.