2 * Copyright (C) 2012-2017 ARM Limited or its affiliates.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 ARM CryptoCell Cipher Crypto API
21 #ifndef __SSI_CIPHER_H__
22 #define __SSI_CIPHER_H__
24 #include <linux/kernel.h>
25 #include <crypto/algapi.h>
26 #include "ssi_driver.h"
27 #include "ssi_buffer_mgr.h"
30 /* Crypto cipher flags */
31 #define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0)
32 #define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1)
33 #define CC_CRYPTO_CIPHER_KEY_KFDE2 (1 << 2)
34 #define CC_CRYPTO_CIPHER_KEY_KFDE3 (1 << 3)
35 #define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4)
37 #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3)
40 struct blkcipher_req_ctx
{
41 struct async_gen_req_ctx gen_ctx
;
42 enum ssi_req_dma_buf_type dma_buf_type
;
47 u8
*backup_info
; /*store iv for generated IV flow*/
49 struct mlli_params mlli_params
;
54 int ssi_ablkcipher_alloc(struct ssi_drvdata
*drvdata
);
56 int ssi_ablkcipher_free(struct ssi_drvdata
*drvdata
);
58 #ifndef CRYPTO_ALG_BULK_MASK
60 #define CRYPTO_ALG_BULK_DU_512 0x00002000
61 #define CRYPTO_ALG_BULK_DU_4096 0x00004000
62 #define CRYPTO_ALG_BULK_MASK (CRYPTO_ALG_BULK_DU_512 |\
63 CRYPTO_ALG_BULK_DU_4096)
64 #endif /* CRYPTO_ALG_BULK_MASK */
67 #ifdef CRYPTO_TFM_REQ_HW_KEY
69 static inline bool ssi_is_hw_key(struct crypto_tfm
*tfm
)
71 return (crypto_tfm_get_flags(tfm
) & CRYPTO_TFM_REQ_HW_KEY
);
76 struct arm_hw_key_info
{
81 static inline bool ssi_is_hw_key(struct crypto_tfm
*tfm
)
86 #endif /* CRYPTO_TFM_REQ_HW_KEY */
89 #endif /*__SSI_CIPHER_H__*/