Loading drivers/char/hw_random/Makefile +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o ifneq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_HW_RANDOM_MSM) += msm_rng.o fips_drbg.o ctr_drbg.o msm_fips_selftest.o endif obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o drivers/crypto/msm/Makefile +2 −6 Original line number Diff line number Diff line ifeq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCEDEV) += qcedev_fips.o endif ifneq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCEDEV) += qcedev.o ifeq ($(CONFIG_CRYPTO_DEV_QCE50), y) obj-$(CONFIG_CRYPTO_DEV_QCE) += qce50.o Loading @@ -13,9 +11,7 @@ endif ifdef CONFIG_COMPAT obj-$(CONFIG_CRYPTO_DEV_QCE) += compat_qcedev.o endif ifeq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCRYPTO) += qcrypto_fips.o endif obj-$(CONFIG_CRYPTO_DEV_QCRYPTO) += qcrypto.o obj-$(CONFIG_CRYPTO_DEV_OTA_CRYPTO) += ota_crypto.o endif obj-$(CONFIG_CRYPTO_DEV_QCOM_ICE) += ice.o drivers/md/dm-req-crypt.c +29 −6 Original line number Diff line number Diff line Loading @@ -116,6 +116,17 @@ struct req_dm_split_req_io { struct request *clone; }; #ifdef CONFIG_FIPS_ENABLE static struct qcrypto_func_set dm_qcrypto_func; #else static struct qcrypto_func_set dm_qcrypto_func = { qcrypto_cipher_set_device_hw, qcrypto_cipher_set_flag, qcrypto_get_num_engines, qcrypto_get_engine_list }; #endif static void req_crypt_cipher_complete (struct crypto_async_request *req, int err); static void req_cryptd_split_req_queue_cb Loading Loading @@ -522,7 +533,7 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io) (*engine_cursor)++; (*engine_cursor) %= engine_list_total; err = qcrypto_cipher_set_device_hw(req, engine.ce_device, err = (dm_qcrypto_func.cipher_set)(req, engine.ce_device, engine.hw_instance); if (err) { DMERR("%s qcrypto_cipher_set_device_hw failed with err %d\n", Loading @@ -534,7 +545,7 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io) init_completion(&result.completion); qcrypto_cipher_set_flag(req, (dm_qcrypto_func.cipher_flag)(req, QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B); crypto_ablkcipher_clear_flags(tfm, ~0); crypto_ablkcipher_setkey(tfm, NULL, KEY_SIZE_XTS); Loading Loading @@ -745,7 +756,7 @@ static void req_cryptd_split_req_queue_cb(struct work_struct *work) engine = io->engine; err = qcrypto_cipher_set_device_hw(req, engine->ce_device, err = (dm_qcrypto_func.cipher_set)(req, engine->ce_device, engine->hw_instance); if (err) { DMERR("%s qcrypto_cipher_set_device_hw failed with err %d\n", Loading @@ -753,7 +764,7 @@ static void req_cryptd_split_req_queue_cb(struct work_struct *work) goto ablkcipher_req_alloc_failure; } init_completion(&result.completion); qcrypto_cipher_set_flag(req, (dm_qcrypto_func.cipher_flag)(req, QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B); crypto_ablkcipher_clear_flags(tfm, ~0); Loading Loading @@ -1171,7 +1182,7 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) num_engines_fde = num_engines_pfe = 0; mutex_lock(&engine_list_mutex); num_engines = qcrypto_get_num_engines(); num_engines = (dm_qcrypto_func.get_num_engines)(); if (!num_engines) { DMERR(KERN_INFO "%s qcrypto_get_num_engines failed\n", __func__); Loading @@ -1187,7 +1198,7 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto ctr_exit; } qcrypto_get_engine_list(num_engines, eng_list); (dm_qcrypto_func.get_engine_list)(num_engines, eng_list); for (i = 0; i < num_engines; i++) { if (eng_list[i].ce_device == FDE_KEY_ID) Loading Loading @@ -1257,6 +1268,18 @@ static int req_crypt_iterate_devices(struct dm_target *ti, return fn(ti, dev, start_sector_orig, ti->len, data); } void set_qcrypto_func_dm(void *dev, void *flag, void *engines, void *engine_list) { dm_qcrypto_func.cipher_set = dev; dm_qcrypto_func.cipher_flag = flag; dm_qcrypto_func.get_num_engines = engines; dm_qcrypto_func.get_engine_list = engine_list; } EXPORT_SYMBOL(set_qcrypto_func_dm); static struct target_type req_crypt_target = { .name = "req-crypt", .version = {1, 0, 0}, Loading include/linux/qcrypto.h +10 −1 Original line number Diff line number Diff line /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -51,5 +51,14 @@ int qcrypto_cipher_set_device_hw(struct ablkcipher_request *req, unsigned int fde_pfe, unsigned int hw_inst); struct qcrypto_func_set { int (*cipher_set)(struct ablkcipher_request *req, unsigned int fde_pfe, unsigned hw_inst); int (*cipher_flag)(struct ablkcipher_request *req, unsigned int flags); int (*get_num_engines)(void); void (*get_engine_list)(size_t num_engines, struct crypto_engine_entry *arr); }; #endif /* _DRIVERS_CRYPTO_MSM_QCRYPTO_H */ include/uapi/linux/compat_qcedev.h +4 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ extern long compat_qcedev_ioctl(struct file *file, _IO(QCEDEV_IOC_MAGIC, 8) #define COMPAT_QCEDEV_IOCTL_GET_CMAC_REQ \ _IOWR(QCEDEV_IOC_MAGIC, 9, struct compat_qcedev_sha_op_req) #define COMPAT_QCEDEV_IOCTL_UPDATE_FIPS_STATUS \ _IOWR(QCEDEV_IOC_MAGIC, 10, enum fips_status) #define COMPAT_QCEDEV_IOCTL_QUERY_FIPS_STATUS \ _IOR(QCEDEV_IOC_MAGIC, 11, enum fips_status) #endif /* CONFIG_COMPAT */ #endif /* _UAPI_COMPAT_QCEDEV__H */ Loading
drivers/char/hw_random/Makefile +3 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o ifneq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_HW_RANDOM_MSM) += msm_rng.o fips_drbg.o ctr_drbg.o msm_fips_selftest.o endif obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
drivers/crypto/msm/Makefile +2 −6 Original line number Diff line number Diff line ifeq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCEDEV) += qcedev_fips.o endif ifneq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCEDEV) += qcedev.o ifeq ($(CONFIG_CRYPTO_DEV_QCE50), y) obj-$(CONFIG_CRYPTO_DEV_QCE) += qce50.o Loading @@ -13,9 +11,7 @@ endif ifdef CONFIG_COMPAT obj-$(CONFIG_CRYPTO_DEV_QCE) += compat_qcedev.o endif ifeq ($(CONFIG_FIPS_ENABLE), y) obj-$(CONFIG_CRYPTO_DEV_QCRYPTO) += qcrypto_fips.o endif obj-$(CONFIG_CRYPTO_DEV_QCRYPTO) += qcrypto.o obj-$(CONFIG_CRYPTO_DEV_OTA_CRYPTO) += ota_crypto.o endif obj-$(CONFIG_CRYPTO_DEV_QCOM_ICE) += ice.o
drivers/md/dm-req-crypt.c +29 −6 Original line number Diff line number Diff line Loading @@ -116,6 +116,17 @@ struct req_dm_split_req_io { struct request *clone; }; #ifdef CONFIG_FIPS_ENABLE static struct qcrypto_func_set dm_qcrypto_func; #else static struct qcrypto_func_set dm_qcrypto_func = { qcrypto_cipher_set_device_hw, qcrypto_cipher_set_flag, qcrypto_get_num_engines, qcrypto_get_engine_list }; #endif static void req_crypt_cipher_complete (struct crypto_async_request *req, int err); static void req_cryptd_split_req_queue_cb Loading Loading @@ -522,7 +533,7 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io) (*engine_cursor)++; (*engine_cursor) %= engine_list_total; err = qcrypto_cipher_set_device_hw(req, engine.ce_device, err = (dm_qcrypto_func.cipher_set)(req, engine.ce_device, engine.hw_instance); if (err) { DMERR("%s qcrypto_cipher_set_device_hw failed with err %d\n", Loading @@ -534,7 +545,7 @@ static void req_cryptd_crypt_write_convert(struct req_dm_crypt_io *io) init_completion(&result.completion); qcrypto_cipher_set_flag(req, (dm_qcrypto_func.cipher_flag)(req, QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B); crypto_ablkcipher_clear_flags(tfm, ~0); crypto_ablkcipher_setkey(tfm, NULL, KEY_SIZE_XTS); Loading Loading @@ -745,7 +756,7 @@ static void req_cryptd_split_req_queue_cb(struct work_struct *work) engine = io->engine; err = qcrypto_cipher_set_device_hw(req, engine->ce_device, err = (dm_qcrypto_func.cipher_set)(req, engine->ce_device, engine->hw_instance); if (err) { DMERR("%s qcrypto_cipher_set_device_hw failed with err %d\n", Loading @@ -753,7 +764,7 @@ static void req_cryptd_split_req_queue_cb(struct work_struct *work) goto ablkcipher_req_alloc_failure; } init_completion(&result.completion); qcrypto_cipher_set_flag(req, (dm_qcrypto_func.cipher_flag)(req, QCRYPTO_CTX_USE_PIPE_KEY | QCRYPTO_CTX_XTS_DU_SIZE_512B); crypto_ablkcipher_clear_flags(tfm, ~0); Loading Loading @@ -1171,7 +1182,7 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) num_engines_fde = num_engines_pfe = 0; mutex_lock(&engine_list_mutex); num_engines = qcrypto_get_num_engines(); num_engines = (dm_qcrypto_func.get_num_engines)(); if (!num_engines) { DMERR(KERN_INFO "%s qcrypto_get_num_engines failed\n", __func__); Loading @@ -1187,7 +1198,7 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto ctr_exit; } qcrypto_get_engine_list(num_engines, eng_list); (dm_qcrypto_func.get_engine_list)(num_engines, eng_list); for (i = 0; i < num_engines; i++) { if (eng_list[i].ce_device == FDE_KEY_ID) Loading Loading @@ -1257,6 +1268,18 @@ static int req_crypt_iterate_devices(struct dm_target *ti, return fn(ti, dev, start_sector_orig, ti->len, data); } void set_qcrypto_func_dm(void *dev, void *flag, void *engines, void *engine_list) { dm_qcrypto_func.cipher_set = dev; dm_qcrypto_func.cipher_flag = flag; dm_qcrypto_func.get_num_engines = engines; dm_qcrypto_func.get_engine_list = engine_list; } EXPORT_SYMBOL(set_qcrypto_func_dm); static struct target_type req_crypt_target = { .name = "req-crypt", .version = {1, 0, 0}, Loading
include/linux/qcrypto.h +10 −1 Original line number Diff line number Diff line /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -51,5 +51,14 @@ int qcrypto_cipher_set_device_hw(struct ablkcipher_request *req, unsigned int fde_pfe, unsigned int hw_inst); struct qcrypto_func_set { int (*cipher_set)(struct ablkcipher_request *req, unsigned int fde_pfe, unsigned hw_inst); int (*cipher_flag)(struct ablkcipher_request *req, unsigned int flags); int (*get_num_engines)(void); void (*get_engine_list)(size_t num_engines, struct crypto_engine_entry *arr); }; #endif /* _DRIVERS_CRYPTO_MSM_QCRYPTO_H */
include/uapi/linux/compat_qcedev.h +4 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ extern long compat_qcedev_ioctl(struct file *file, _IO(QCEDEV_IOC_MAGIC, 8) #define COMPAT_QCEDEV_IOCTL_GET_CMAC_REQ \ _IOWR(QCEDEV_IOC_MAGIC, 9, struct compat_qcedev_sha_op_req) #define COMPAT_QCEDEV_IOCTL_UPDATE_FIPS_STATUS \ _IOWR(QCEDEV_IOC_MAGIC, 10, enum fips_status) #define COMPAT_QCEDEV_IOCTL_QUERY_FIPS_STATUS \ _IOR(QCEDEV_IOC_MAGIC, 11, enum fips_status) #endif /* CONFIG_COMPAT */ #endif /* _UAPI_COMPAT_QCEDEV__H */