/* SPDX-License-Identifier: GPL-2.0-only */ /* * sun4i-ss.h - hardware cryptographic accelerator for Allwinner A20 SoC * * Copyright (C) 2013-2015 Corentin LABBE <clabbe.montjoie@gmail.com> * * Support AES cipher with 128,192,256 bits keysize. * Support MD5 and SHA1 hash algorithms. * Support DES and 3DES * * You could find the datasheet in Documentation/arch/arm/sunxi.rst
*/
/* * struct ss_variant - Describe SS hardware variant * @sha1_in_be: The SHA1 digest is given by SS in BE, and so need to be inverted.
*/ struct ss_variant { bool sha1_in_be;
};
struct sun4i_ss_ctx { conststruct ss_variant *variant; void __iomem *base; int irq; struct clk *busclk; struct clk *ssclk; struct reset_control *reset; struct device *dev; struct resource *res; char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */ char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */
spinlock_t slock; /* control the use of the device */ #ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG
u32 seed[SS_SEED_LEN / BITS_PER_LONG]; #endif struct dentry *dbgfs_dir; struct dentry *dbgfs_stats;
};
struct sun4i_cipher_req_ctx {
u32 mode;
u8 backup_iv[AES_BLOCK_SIZE]; struct skcipher_request fallback_req; // keep at the end
};
struct sun4i_req_ctx {
u32 mode;
u64 byte_count; /* number of bytes "uploaded" to the device */
u32 hash[5]; /* for storing SS_IVx register */ char buf[64]; unsignedint len; int flags;
};
int sun4i_hash_crainit(struct crypto_tfm *tfm); void sun4i_hash_craexit(struct crypto_tfm *tfm); int sun4i_hash_init(struct ahash_request *areq); int sun4i_hash_update(struct ahash_request *areq); int sun4i_hash_final(struct ahash_request *areq); int sun4i_hash_finup(struct ahash_request *areq); int sun4i_hash_digest(struct ahash_request *areq); int sun4i_hash_export_md5(struct ahash_request *areq, void *out); int sun4i_hash_import_md5(struct ahash_request *areq, constvoid *in); int sun4i_hash_export_sha1(struct ahash_request *areq, void *out); int sun4i_hash_import_sha1(struct ahash_request *areq, constvoid *in);
int sun4i_ss_cbc_aes_encrypt(struct skcipher_request *areq); int sun4i_ss_cbc_aes_decrypt(struct skcipher_request *areq); int sun4i_ss_ecb_aes_encrypt(struct skcipher_request *areq); int sun4i_ss_ecb_aes_decrypt(struct skcipher_request *areq);
int sun4i_ss_cbc_des_encrypt(struct skcipher_request *areq); int sun4i_ss_cbc_des_decrypt(struct skcipher_request *areq); int sun4i_ss_ecb_des_encrypt(struct skcipher_request *areq); int sun4i_ss_ecb_des_decrypt(struct skcipher_request *areq);
int sun4i_ss_cbc_des3_encrypt(struct skcipher_request *areq); int sun4i_ss_cbc_des3_decrypt(struct skcipher_request *areq); int sun4i_ss_ecb_des3_encrypt(struct skcipher_request *areq); int sun4i_ss_ecb_des3_decrypt(struct skcipher_request *areq);
int sun4i_ss_cipher_init(struct crypto_tfm *tfm); void sun4i_ss_cipher_exit(struct crypto_tfm *tfm); int sun4i_ss_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, unsignedint keylen); int sun4i_ss_des_setkey(struct crypto_skcipher *tfm, const u8 *key, unsignedint keylen); int sun4i_ss_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, unsignedint keylen); int sun4i_ss_prng_generate(struct crypto_rng *tfm, const u8 *src, unsignedint slen, u8 *dst, unsignedint dlen); int sun4i_ss_prng_seed(struct crypto_rng *tfm, const u8 *seed, unsignedint slen);
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.