| .. | .. |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | #define CCM_B0_SIZE 16 |
|---|
| 43 | 43 | #define CCM_AAD_FIELD_SIZE 2 |
|---|
| 44 | | -#define T6_MAX_AAD_SIZE 511 |
|---|
| 44 | +// 511 - 16(For IV) |
|---|
| 45 | +#define T6_MAX_AAD_SIZE 495 |
|---|
| 45 | 46 | |
|---|
| 46 | 47 | |
|---|
| 47 | 48 | /* Define following if h/w is not dropping the AAD and IV data before |
|---|
| .. | .. |
|---|
| 159 | 160 | return crypto_aead_ctx(tfm); |
|---|
| 160 | 161 | } |
|---|
| 161 | 162 | |
|---|
| 162 | | -static inline struct chcr_context *c_ctx(struct crypto_ablkcipher *tfm) |
|---|
| 163 | +static inline struct chcr_context *c_ctx(struct crypto_skcipher *tfm) |
|---|
| 163 | 164 | { |
|---|
| 164 | | - return crypto_ablkcipher_ctx(tfm); |
|---|
| 165 | + return crypto_skcipher_ctx(tfm); |
|---|
| 165 | 166 | } |
|---|
| 166 | 167 | |
|---|
| 167 | 168 | static inline struct chcr_context *h_ctx(struct crypto_ahash *tfm) |
|---|
| .. | .. |
|---|
| 171 | 172 | |
|---|
| 172 | 173 | struct ablk_ctx { |
|---|
| 173 | 174 | struct crypto_skcipher *sw_cipher; |
|---|
| 174 | | - struct crypto_cipher *aes_generic; |
|---|
| 175 | 175 | __be32 key_ctx_hdr; |
|---|
| 176 | 176 | unsigned int enckey_len; |
|---|
| 177 | 177 | unsigned char ciph_mode; |
|---|
| .. | .. |
|---|
| 185 | 185 | dma_addr_t b0_dma; |
|---|
| 186 | 186 | unsigned int b0_len; |
|---|
| 187 | 187 | unsigned int op; |
|---|
| 188 | | - short int aad_nents; |
|---|
| 189 | | - short int src_nents; |
|---|
| 190 | | - short int dst_nents; |
|---|
| 191 | 188 | u16 imm; |
|---|
| 192 | 189 | u16 verify; |
|---|
| 190 | + u16 txqidx; |
|---|
| 191 | + u16 rxqidx; |
|---|
| 193 | 192 | u8 iv[CHCR_MAX_CRYPTO_IV_LEN + MAX_SCRATCH_PAD_SIZE]; |
|---|
| 194 | 193 | u8 *scratch_pad; |
|---|
| 195 | 194 | }; |
|---|
| .. | .. |
|---|
| 224 | 223 | |
|---|
| 225 | 224 | struct __aead_ctx { |
|---|
| 226 | 225 | struct chcr_gcm_ctx gcm[0]; |
|---|
| 227 | | - struct chcr_authenc_ctx authenc[0]; |
|---|
| 226 | + struct chcr_authenc_ctx authenc[]; |
|---|
| 228 | 227 | }; |
|---|
| 229 | 228 | |
|---|
| 230 | 229 | struct chcr_aead_ctx { |
|---|
| .. | .. |
|---|
| 236 | 235 | u8 nonce[4]; |
|---|
| 237 | 236 | u16 hmac_ctrl; |
|---|
| 238 | 237 | u16 mayverify; |
|---|
| 239 | | - struct __aead_ctx ctx[0]; |
|---|
| 238 | + struct __aead_ctx ctx[]; |
|---|
| 240 | 239 | }; |
|---|
| 241 | 240 | |
|---|
| 242 | 241 | struct hmac_ctx { |
|---|
| .. | .. |
|---|
| 248 | 247 | struct __crypto_ctx { |
|---|
| 249 | 248 | struct hmac_ctx hmacctx[0]; |
|---|
| 250 | 249 | struct ablk_ctx ablkctx[0]; |
|---|
| 251 | | - struct chcr_aead_ctx aeadctx[0]; |
|---|
| 250 | + struct chcr_aead_ctx aeadctx[]; |
|---|
| 252 | 251 | }; |
|---|
| 253 | 252 | |
|---|
| 254 | 253 | struct chcr_context { |
|---|
| 255 | 254 | struct chcr_dev *dev; |
|---|
| 256 | | - unsigned char tx_qidx; |
|---|
| 257 | | - unsigned char rx_qidx; |
|---|
| 258 | | - unsigned char tx_chan_id; |
|---|
| 259 | | - unsigned char pci_chan_id; |
|---|
| 260 | | - struct __crypto_ctx crypto_ctx[0]; |
|---|
| 255 | + unsigned char rxq_perchan; |
|---|
| 256 | + unsigned char txq_perchan; |
|---|
| 257 | + unsigned int ntxq; |
|---|
| 258 | + unsigned int nrxq; |
|---|
| 259 | + struct completion cbc_aes_aio_done; |
|---|
| 260 | + struct __crypto_ctx crypto_ctx[]; |
|---|
| 261 | 261 | }; |
|---|
| 262 | 262 | |
|---|
| 263 | 263 | struct chcr_hctx_per_wr { |
|---|
| .. | .. |
|---|
| 282 | 282 | u8 *skbfr; |
|---|
| 283 | 283 | /* SKB which is being sent to the hardware for processing */ |
|---|
| 284 | 284 | u64 data_len; /* Data len till time */ |
|---|
| 285 | + u16 txqidx; |
|---|
| 286 | + u16 rxqidx; |
|---|
| 285 | 287 | u8 reqlen; |
|---|
| 286 | 288 | u8 partial_hash[CHCR_HASH_MAX_DIGEST_SIZE]; |
|---|
| 287 | 289 | u8 bfr1[CHCR_HASH_MAX_BLOCK_SIZE_128]; |
|---|
| 288 | 290 | u8 bfr2[CHCR_HASH_MAX_BLOCK_SIZE_128]; |
|---|
| 289 | 291 | }; |
|---|
| 290 | 292 | |
|---|
| 291 | | -struct chcr_blkcipher_req_ctx { |
|---|
| 293 | +struct chcr_skcipher_req_ctx { |
|---|
| 292 | 294 | struct sk_buff *skb; |
|---|
| 293 | 295 | struct scatterlist *dstsg; |
|---|
| 294 | 296 | unsigned int processed; |
|---|
| 295 | 297 | unsigned int last_req_len; |
|---|
| 298 | + unsigned int partial_req; |
|---|
| 296 | 299 | struct scatterlist *srcsg; |
|---|
| 297 | 300 | unsigned int src_ofst; |
|---|
| 298 | 301 | unsigned int dst_ofst; |
|---|
| 299 | 302 | unsigned int op; |
|---|
| 300 | 303 | u16 imm; |
|---|
| 301 | 304 | u8 iv[CHCR_MAX_CRYPTO_IV_LEN]; |
|---|
| 305 | + u8 init_iv[CHCR_MAX_CRYPTO_IV_LEN]; |
|---|
| 306 | + u16 txqidx; |
|---|
| 307 | + u16 rxqidx; |
|---|
| 308 | + struct skcipher_request fallback_req; // keep at the end |
|---|
| 302 | 309 | }; |
|---|
| 303 | 310 | |
|---|
| 304 | 311 | struct chcr_alg_template { |
|---|
| 305 | 312 | u32 type; |
|---|
| 306 | 313 | u32 is_registered; |
|---|
| 307 | 314 | union { |
|---|
| 308 | | - struct crypto_alg crypto; |
|---|
| 315 | + struct skcipher_alg skcipher; |
|---|
| 309 | 316 | struct ahash_alg hash; |
|---|
| 310 | 317 | struct aead_alg aead; |
|---|
| 311 | 318 | } alg; |
|---|
| .. | .. |
|---|
| 322 | 329 | unsigned short op_type); |
|---|
| 323 | 330 | void chcr_add_aead_dst_ent(struct aead_request *req, |
|---|
| 324 | 331 | struct cpl_rx_phys_dsgl *phys_cpl, |
|---|
| 325 | | - unsigned int assoclen, |
|---|
| 326 | 332 | unsigned short qid); |
|---|
| 327 | | -void chcr_add_aead_src_ent(struct aead_request *req, struct ulptx_sgl *ulptx, |
|---|
| 328 | | - unsigned int assoclen); |
|---|
| 329 | | -void chcr_add_cipher_src_ent(struct ablkcipher_request *req, |
|---|
| 333 | +void chcr_add_aead_src_ent(struct aead_request *req, struct ulptx_sgl *ulptx); |
|---|
| 334 | +void chcr_add_cipher_src_ent(struct skcipher_request *req, |
|---|
| 330 | 335 | void *ulptx, |
|---|
| 331 | 336 | struct cipher_wr_param *wrparam); |
|---|
| 332 | | -int chcr_cipher_dma_map(struct device *dev, struct ablkcipher_request *req); |
|---|
| 333 | | -void chcr_cipher_dma_unmap(struct device *dev, struct ablkcipher_request *req); |
|---|
| 334 | | -void chcr_add_cipher_dst_ent(struct ablkcipher_request *req, |
|---|
| 337 | +int chcr_cipher_dma_map(struct device *dev, struct skcipher_request *req); |
|---|
| 338 | +void chcr_cipher_dma_unmap(struct device *dev, struct skcipher_request *req); |
|---|
| 339 | +void chcr_add_cipher_dst_ent(struct skcipher_request *req, |
|---|
| 335 | 340 | struct cpl_rx_phys_dsgl *phys_cpl, |
|---|
| 336 | 341 | struct cipher_wr_param *wrparam, |
|---|
| 337 | 342 | unsigned short qid); |
|---|