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"
29 /* Crypto cipher flags */
30 #define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0)
31 #define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1)
32 #define CC_CRYPTO_CIPHER_KEY_KFDE2 (1 << 2)
33 #define CC_CRYPTO_CIPHER_KEY_KFDE3 (1 << 3)
34 #define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4)
36 #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)
38 struct blkcipher_req_ctx {
39 struct async_gen_req_ctx gen_ctx;
40 enum ssi_req_dma_buf_type dma_buf_type;
45 u8 *backup_info; /*store iv for generated IV flow*/
47 struct mlli_params mlli_params;
50 int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata);
52 int ssi_ablkcipher_free(struct ssi_drvdata *drvdata);
54 #ifndef CRYPTO_ALG_BULK_MASK
56 #define CRYPTO_ALG_BULK_DU_512 0x00002000
57 #define CRYPTO_ALG_BULK_DU_4096 0x00004000
58 #define CRYPTO_ALG_BULK_MASK (CRYPTO_ALG_BULK_DU_512 |\
59 CRYPTO_ALG_BULK_DU_4096)
60 #endif /* CRYPTO_ALG_BULK_MASK */
62 #ifdef CRYPTO_TFM_REQ_HW_KEY
64 static inline bool ssi_is_hw_key(struct crypto_tfm *tfm)
66 return (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_HW_KEY);
71 struct arm_hw_key_info {
76 static inline bool ssi_is_hw_key(struct crypto_tfm *tfm)
81 #endif /* CRYPTO_TFM_REQ_HW_KEY */
83 #endif /*__SSI_CIPHER_H__*/