1 /* SPDX-License-Identifier: GPL-2.0 2 * 3 * Copyright (C) 2019 - 2021 4 * 5 * Richard van Schagen <vschagen@icloud.com> 6 * Christian Marangi <ansuelsmth@gmail.com 7 */ 8 #ifndef _EIP93_CIPHER_H_ 9 #define _EIP93_CIPHER_H_ 10 11 #include "eip93-main.h" 12 13 struct eip93_crypto_ctx { 14 struct eip93_device *eip93; 15 u32 flags; 16 struct sa_record *sa_record; 17 u32 sa_nonce; 18 int blksize; 19 dma_addr_t sa_record_base; 20 /* AEAD specific */ 21 unsigned int authsize; 22 unsigned int assoclen; 23 bool set_assoc; 24 enum eip93_alg_type type; 25 }; 26 27 struct eip93_cipher_reqctx { 28 u16 desc_flags; 29 u16 flags; 30 unsigned int blksize; 31 unsigned int ivsize; 32 unsigned int textsize; 33 unsigned int assoclen; 34 unsigned int authsize; 35 dma_addr_t sa_record_base; 36 struct sa_state *sa_state; 37 dma_addr_t sa_state_base; 38 struct eip93_descriptor *cdesc; 39 struct scatterlist *sg_src; 40 struct scatterlist *sg_dst; 41 int src_nents; 42 int dst_nents; 43 struct sa_state *sa_state_ctr; 44 dma_addr_t sa_state_ctr_base; 45 }; 46 47 int check_valid_request(struct eip93_cipher_reqctx *rctx); 48 49 void eip93_unmap_dma(struct eip93_device *eip93, struct eip93_cipher_reqctx *rctx, 50 struct scatterlist *reqsrc, struct scatterlist *reqdst); 51 52 void eip93_skcipher_handle_result(struct crypto_async_request *async, int err); 53 54 int eip93_send_req(struct crypto_async_request *async, 55 const u8 *reqiv, struct eip93_cipher_reqctx *rctx); 56 57 void eip93_handle_result(struct eip93_device *eip93, struct eip93_cipher_reqctx *rctx, 58 u8 *reqiv); 59 60 #endif /* _EIP93_CIPHER_H_ */ 61