Commit Graph

24 Commits

Author SHA1 Message Date
William Clark 6020dafcf1 msm: crypto: Modify crypto libraries for FIPS139-2 Certificate
Modify header files by adding data strcture and MACROs to support
certification related self-tests and integrity tests.
Add data structure qcrypto_func_set in qcrpto.h, and use it in
dm-req-crypt.c, to support qualcomm crypto library as a dynamic
loadable kernel module (for the FIPS certificate requirement).

Change-Id: I9e60374b93014b5783559820de2056168fb73bbd
Acked-by: Jing Deng <jingd@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: William Clark <wclark@codeaurora.org>
2015-03-14 00:15:28 -07:00
Dinesh K Garg ac77931ced md: dm-req-crypt: Change HW FDE to use AES 128
Change encryption algorithm for HW FDE to use AES 128

Change-Id: I3294a42e58c260738c1e77bd9406c1877e19ba28
Acked-by: Baranidharan Muthukumaran <bmuthuku@qti.qualcomm.com>
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2015-01-29 21:45:49 -08:00
Dinesh K Garg 7a4756618d md: dm-req-crypt: Reduce the max hw_sectors for dm-req-crypt queue
Split IO requests for dm-req-crypt to improve encryption performance
of smaller file sizes.

Change-Id: I4e0a6f011e92accf7f797d4a37b0640185cbe175
Acked-by: Baranidharan Muthukumaran <bmuthuku@qti.qualcomm.com>
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2015-01-29 21:43:58 -08:00
Dinesh K Garg d4e4400e72 dm: dm-req-crypt: Split read requests to reduce decryption latency
Split an IO into multiple requests so the the crypto accelerators
can be exercized in parallel to reduce latency.

Change-Id: I24b15568b5afd375ad39bf3b74f60743f0e1dde9
Acked-by: Baranidharan Muthukumaran <bmuthuku@qti.qualcomm.com>
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2015-01-14 12:20:01 -08:00
Dinesh K Garg f281aa1822 md: Adding support of ICE in dm-req-crypt
Storage hardware can have embedded crypto engine which can greatly
reduce degradation in IO performance if crypto operations are performed
on data. Added support in dm-req-crypt so that it can work either in
transparent mode or crypto mode. In transparent mode, dm-req-crypt will
not perform any crypto operation by itself. In crypto mode, dm-req-crypt
will perform crypto operation on data using a seperate crypto engine
(SW based CE or HW based CE).

Change-Id: I8f27840899566c1a608ca13ce6b7480c9866fb6a
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-12-06 01:09:49 -08:00
Dinesh K Garg 8be3bfa1fa md: dm-req-crypt Recalculate nr_phys_segments
Recalculate nr_phys_segments after pages are allocated
for write requests. Move _req_crypt_io_pool allocation
and de-allocation to ctr and dtr instead of driver init
and exit.

Change-Id: I8576dce1f7c9bc39dcc975762562fb84a349bba7
Acked-by: Baranidharan Muthukumaran <bmuthuku@qti.qualcomm.com>
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-10-31 12:07:48 -07:00
Dinesh K Garg 66b2ca9d3a md: dm-req-crypt: Initialize global variables in constructor
dm-req-crypt was not initializing number of engines available for
crypto operation. Hence, number of engines were getting accumulated
everytime a device based of dm-req-crypt was created. This caused
crash in qcrypto module while retrieving the crypto engine.

Change-Id: I06b5b296a80ae4f9f6bfd024222be9f47a29bfce
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-10-30 10:34:35 -07:00
Amir Samuelov 812c6796d0 dm: dm-req-crypt: fix null pointer reference
When dm_get_device(&dev) fails the "dev" variable is NULL,
so calling dm_put_device(dev) crash the device.

[  125.744115] [<ffffffc000837ecc>] dm_put_device+0x14/0x58
[  125.749408] [<ffffffc000843794>] req_crypt_dtr+0xa8/0xbc
[  125.754696] [<ffffffc000843bc0>] req_crypt_ctr+0x418/0x440
[  125.760176] [<ffffffc0008387fc>] dm_table_add_target+0x24c/0x2f8
[  125.766167] [<ffffffc00083bfac>] table_load+0x27c/0x2b0
[  125.771377] [<ffffffc00083b90c>] ctl_ioctl+0x3a8/0x448
[  125.776496] [<ffffffc00083b9bc>] dm_ctl_ioctl+0x10/0x20
[  125.781706] [<ffffffc000301cd0>] vfs_ioctl+0x20/0x3c
[  125.786648] [<ffffffc000302618>] do_vfs_ioctl+0x49c/0x568
[  125.792031] [<ffffffc000302740>] SyS_ioctl+0x5c/0x88

Change-Id: Icef2841b1aede259ee0f697f21b1976cd4485991
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-10-12 12:07:59 +03:00
Linux Build Service Account 35a37bc8a1 Merge "dm-req-crypt: check argc before access argv[5]" 2014-10-06 22:52:47 -07:00
Linux Build Service Account b3634c8a61 Merge "md: dm-req-crypt: add message when mapping completed" 2014-09-29 07:55:18 -07:00
Dinesh K Garg 95f503fcba md: dm-req-crypt does not release the device
dm-req-crypt does not release the device which it got during
construction of dm-req-crypt based node. This causes issue if
dm-req-crypt based device is created and destroyed without
rebooting the device.

Change-Id: Ifeb1210a6e1cf365b8a656556082806a24f3e582
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-09-24 09:12:43 -07:00
Amir Samuelov e7706d9c92 md: dm-req-crypt: add message when mapping completed
Add info message when mapping a block-device to
the dm-req-crypt device-mapper target.
This is the first step before this driver can be used for
encryption of a block device.
It is called once per power-up when disk-encryption is enabled.

Change-Id: I51866b95cbe77d1a3d39fcd5d5d5297c78950fa2
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-09-21 13:11:37 +03:00
Zhen Kong ef7f7bef08 dm-req-crypt: Remove high priority flag from workqueue
Remove WQ_HIGHPRI flag for the workqueue. WQ_HIGHPRI and
WQ_UNBOUND flags cannot be used together.

Change-Id: I4ca4eb6596552866049ea6402e492f463eeaed2c
Acked-by: Baranidharan Muthukumaran <bmuthuku@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-09-09 12:38:07 -07:00
William Clark 4d60bae866 dm: dm-req-crypt: Add multi-core crypto support
Add support for multiple crypto instances, ping-pong between
available crypto instances to increase performance

Change-Id: I562d77bf0f70ce6cab173dae18bc40fc5e766ba1
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-08-22 13:34:01 -07:00
Amir Samuelov a262d0c39c dm-req-crypt: check argc before access argv[5]
for backward compatibility, argc == 5 is allowed.
however, check argc >= 6 before access argv[5].

Change-Id: Ib7baf741b302110bb170b8c915bfa3dbb223f606
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-08-17 14:18:28 +03:00
Amir Samuelov 70b031848c platform: msm: fix PFT for 64-bit
Fix compile warning for 64-bit platform.

Change-Id: Ie19f331a893f3265eef70e70945e1edd3268c4b0
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-07-06 13:51:12 +03:00
Amir Samuelov 8307869921 platform: msm: fix PFT when using direct-io
When read/write a file using dircet-io (O_DIRECT),
we can't get the inode from a bio by walking the path
bio->bi_io_vec->bv_page->mapping->host
since the page is anonymous and not mapped.
On the other more typical cases when not using O_DIRECT,
the page cache is used and the bv_page is available.

Change-Id: I349cad54a978ed9919f960d55f0f95c1e53262e5
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-06-23 21:38:40 +03:00
AnilKumar Chimata 02a4f15149 crypto: msm: Move qcrypto.h header file
Move header file from architecture folder to include/linux
folder.

Change-Id: I20a653b272ec21419706cb02bc7c1beac20802eb
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-06 04:04:23 +05:30
Amir Samuelov da92eea47b dm: dm-req-crypt: add support for Per-File-Encryption
Support Per-File-Encryption (PFE) based on file tagging.
The Per-File-Tagger (PFT) reports if a file should be encrypted or not.
The Per-File-Encryption can be used after Full-Disk-Encryption (FDE) was
completed or without FDE.
The PFE and FDE uses different keys, which are managed by the Trust-Zone.

Change-Id: I727ef11e252649f895a5e3f8a49ca848cea50795
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2014-06-03 09:55:10 +03:00
Dinesh K Garg 40acb5587b Setting correct HW crypto driver instance for FDE
HW crypto provides different instance for different use cases.
Dm-req-crypt should use the one for full disk encryption use case.

Change-Id: I22d3f6ab1dd6f83b0d5b83a681236719e2340934
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-05-15 14:48:36 -07:00
Dinesh K Garg def50e6b5e dm: Clean up dm-req-crypt
dm-req-crypt defines optional functions from device mapper. These
functions are not required for dm-req-crypt. dm-req-crypt has few
memory de-allocation issues. This change removes unnecessary
functions and fixes memory deallocation issues as well.

Change-Id: Id36bd13989940ce41571a8a10277730048df6f6d
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-04-14 21:49:31 -07:00
Dinesh K Garg d9b69c0618 dm: Adding support of AES 256 bits in dm-req-crypt
dm-req-crypt currently uses AES 128 bit. Updating dm-req-crypt
to use AES 256 bit instead.

Change-Id: I2e8a4484b25496d53f1f9aa83ec6c0ed7b947901
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-02-26 11:27:03 -08:00
Dinesh K Garg 4aab49333d dm: updating crypto algorithm used by dm-req-crypt
dm-req-crypt uses AES-XTS algorithm implemented by HW crypto
engine. Crypto driver renamed the aes-xts algorithm to avoid
conflict with SW based implementation of AES-XTS. dm-req-crypt
must use the new name for AES-XTS provided by crypto driver.

Change-Id: I286b6435af33fd64673c7c1af4bb2447f3115868
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-02-03 09:28:19 -08:00
Dinesh K Garg e6304b0351 dm: Request based dm-crypt
dm-crypt provides bios based device mapper module. dm-crypt
operates on packets with 512 bytes size which is not effiicent
way for HW based crypto blocks. dm-req-crypt is developed to
address this. dm-req-crypt works on requests which carry upto
512KB of data for unmerged requests.

Change-Id: I7d6a63d516dc2dbe80f46c06dd0722847d55bc9f
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-01-18 14:11:36 -08:00