| .. | .. |
|---|
| 9 | 9 | #define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver" |
|---|
| 10 | 10 | #define NX_VERSION "1.0" |
|---|
| 11 | 11 | |
|---|
| 12 | | -static const char nx_driver_string[] = NX_STRING; |
|---|
| 13 | | -static const char nx_driver_version[] = NX_VERSION; |
|---|
| 14 | | - |
|---|
| 15 | 12 | /* a scatterlist in the format PHYP is expecting */ |
|---|
| 16 | 13 | struct nx_sg { |
|---|
| 17 | 14 | u64 addr; |
|---|
| .. | .. |
|---|
| 40 | 37 | u32 fc; |
|---|
| 41 | 38 | u32 mode; |
|---|
| 42 | 39 | u32 triplets; |
|---|
| 43 | | - struct msc_triplet trip[0]; |
|---|
| 40 | + struct msc_triplet trip[]; |
|---|
| 44 | 41 | } __packed; |
|---|
| 45 | 42 | |
|---|
| 46 | 43 | struct alg_props { |
|---|
| .. | .. |
|---|
| 76 | 73 | atomic_t last_error_pid; |
|---|
| 77 | 74 | }; |
|---|
| 78 | 75 | |
|---|
| 79 | | -struct nx_debugfs { |
|---|
| 80 | | - struct dentry *dfs_root; |
|---|
| 81 | | - struct dentry *dfs_aes_ops, *dfs_aes_bytes; |
|---|
| 82 | | - struct dentry *dfs_sha256_ops, *dfs_sha256_bytes; |
|---|
| 83 | | - struct dentry *dfs_sha512_ops, *dfs_sha512_bytes; |
|---|
| 84 | | - struct dentry *dfs_errors, *dfs_last_error, *dfs_last_error_pid; |
|---|
| 85 | | -}; |
|---|
| 86 | | - |
|---|
| 87 | 76 | struct nx_crypto_driver { |
|---|
| 88 | 77 | struct nx_stats stats; |
|---|
| 89 | 78 | struct nx_of of; |
|---|
| 90 | 79 | struct vio_dev *viodev; |
|---|
| 91 | 80 | struct vio_driver viodriver; |
|---|
| 92 | | - struct nx_debugfs dfs; |
|---|
| 81 | + struct dentry *dfs_root; |
|---|
| 93 | 82 | }; |
|---|
| 94 | 83 | |
|---|
| 95 | 84 | #define NX_GCM4106_NONCE_LEN (4) |
|---|
| .. | .. |
|---|
| 156 | 145 | int nx_crypto_ctx_aes_ccm_init(struct crypto_aead *tfm); |
|---|
| 157 | 146 | int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm); |
|---|
| 158 | 147 | int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm); |
|---|
| 159 | | -int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm); |
|---|
| 160 | | -int nx_crypto_ctx_aes_cbc_init(struct crypto_tfm *tfm); |
|---|
| 161 | | -int nx_crypto_ctx_aes_ecb_init(struct crypto_tfm *tfm); |
|---|
| 148 | +int nx_crypto_ctx_aes_ctr_init(struct crypto_skcipher *tfm); |
|---|
| 149 | +int nx_crypto_ctx_aes_cbc_init(struct crypto_skcipher *tfm); |
|---|
| 150 | +int nx_crypto_ctx_aes_ecb_init(struct crypto_skcipher *tfm); |
|---|
| 162 | 151 | int nx_crypto_ctx_sha_init(struct crypto_tfm *tfm); |
|---|
| 163 | 152 | void nx_crypto_ctx_exit(struct crypto_tfm *tfm); |
|---|
| 153 | +void nx_crypto_ctx_skcipher_exit(struct crypto_skcipher *tfm); |
|---|
| 164 | 154 | void nx_crypto_ctx_aead_exit(struct crypto_aead *tfm); |
|---|
| 165 | 155 | void nx_ctx_init(struct nx_crypto_ctx *nx_ctx, unsigned int function); |
|---|
| 166 | 156 | int nx_hcall_sync(struct nx_crypto_ctx *ctx, struct vio_pfo_op *op, |
|---|
| 167 | 157 | u32 may_sleep); |
|---|
| 168 | 158 | struct nx_sg *nx_build_sg_list(struct nx_sg *, u8 *, unsigned int *, u32); |
|---|
| 169 | | -int nx_build_sg_lists(struct nx_crypto_ctx *, struct blkcipher_desc *, |
|---|
| 170 | | - struct scatterlist *, struct scatterlist *, unsigned int *, |
|---|
| 171 | | - unsigned int, u8 *); |
|---|
| 159 | +int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx, const u8 *iv, |
|---|
| 160 | + struct scatterlist *dst, struct scatterlist *src, |
|---|
| 161 | + unsigned int *nbytes, unsigned int offset, u8 *oiv); |
|---|
| 172 | 162 | struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int, |
|---|
| 173 | 163 | struct scatterlist *, unsigned int, |
|---|
| 174 | 164 | unsigned int *); |
|---|
| .. | .. |
|---|
| 177 | 167 | #define NX_DEBUGFS_INIT(drv) nx_debugfs_init(drv) |
|---|
| 178 | 168 | #define NX_DEBUGFS_FINI(drv) nx_debugfs_fini(drv) |
|---|
| 179 | 169 | |
|---|
| 180 | | -int nx_debugfs_init(struct nx_crypto_driver *); |
|---|
| 170 | +void nx_debugfs_init(struct nx_crypto_driver *); |
|---|
| 181 | 171 | void nx_debugfs_fini(struct nx_crypto_driver *); |
|---|
| 182 | 172 | #else |
|---|
| 183 | | -#define NX_DEBUGFS_INIT(drv) (0) |
|---|
| 184 | | -#define NX_DEBUGFS_FINI(drv) (0) |
|---|
| 173 | +#define NX_DEBUGFS_INIT(drv) do {} while (0) |
|---|
| 174 | +#define NX_DEBUGFS_FINI(drv) do {} while (0) |
|---|
| 185 | 175 | #endif |
|---|
| 186 | 176 | |
|---|
| 187 | 177 | #define NX_PAGE_NUM(x) ((u64)(x) & 0xfffffffffffff000ULL) |
|---|
| 188 | 178 | |
|---|
| 189 | | -extern struct crypto_alg nx_cbc_aes_alg; |
|---|
| 190 | | -extern struct crypto_alg nx_ecb_aes_alg; |
|---|
| 179 | +extern struct skcipher_alg nx_cbc_aes_alg; |
|---|
| 180 | +extern struct skcipher_alg nx_ecb_aes_alg; |
|---|
| 191 | 181 | extern struct aead_alg nx_gcm_aes_alg; |
|---|
| 192 | 182 | extern struct aead_alg nx_gcm4106_aes_alg; |
|---|
| 193 | | -extern struct crypto_alg nx_ctr3686_aes_alg; |
|---|
| 183 | +extern struct skcipher_alg nx_ctr3686_aes_alg; |
|---|
| 194 | 184 | extern struct aead_alg nx_ccm_aes_alg; |
|---|
| 195 | 185 | extern struct aead_alg nx_ccm4309_aes_alg; |
|---|
| 196 | 186 | extern struct shash_alg nx_shash_aes_xcbc_alg; |
|---|