Commit Graph

815 Commits

Author SHA1 Message Date
Dinesh K Garg dc372e1c88 crypto: qcom: ufs data abort after suspend-resume
When device resumes after suspend, UFS driver calls ICE driver to
resume. As part of resume, ICE driver enables ICE. If UFS driver
has some requests going on when ICE enabled is called, it would cause
UFS to abort. Similarly, ICE driver was enabling ICE just before first
crypto operation. This might cause UFS data abort as UFS requests
might be in flight when ICE enabled is called. ICE enabled is moved to
initialization of ICE. Since ICE HW needs reinit after power collapse,
enabled ICE from ICE reset as well.

Change-Id: I439b83edff3f44fdbfe57f341fd92285c603f516
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-12-11 10:50:11 -08:00
Dinesh K Garg 384ae0057b crypto: qcom: Add support for Inline Crypto Engine
Storage hardware can have embedded crypto engine which can greatly
reduce degradation in IO performance if crypto operations are performed
on data. Adding support for Inline Crypto Engine (ICE).

Change-Id: I73ded1326c68e63aa3320ea9c9c6dfaaf2d95cbf
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
Signed-off-by: Noa Rubens <noag@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
2014-12-05 09:37:20 -08:00
Zhen Kong cdb95811f0 crypto: msm: Add mutex in qce_open and qce_close
Add mutex in qce_open and qce_close to prevent the situation where
iounmap was called by one thread while another one is accessing the
HW CE register with another ioremap.

Change-Id: Iba47834a950a213d8c2b982b3a988020a2ef3338
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-12-02 17:08:13 -08:00
Linux Build Service Account 5c4a901f6f Merge "crypto: msm: Fix clk initialization" 2014-11-27 21:53:19 -08:00
Mona Hossain d00d19b139 crypto: msm: Fix clk initialization
Return clk_get error for core_src_clk
Remove enabling other clks for targets that need only core_src_clk

Change-Id: I4749b9f9fff1d6057dbc46aa1bd4c7e50a801ed8
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2014-11-25 14:35:56 -08:00
Joonwoo Park 4944cd99d2 mdm9640: rename msmzirc to mdm9640
Introduce mdm9640 as the official name for msmzirc.

Update msm-tsens and clock-a7 bindings to make checkpatch happy along with
renaming.

Change-Id: I364cc0feab4cf4a1bac03dc08eec0214e09f40f7
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
2014-11-24 18:27:32 -08:00
William Clark db79f7382b crypto: Kconfig: zirc: Add Hardware crypto module
Add hardware crypto module for zirc target

Change-Id: Ic919f43fb5569a0e58adf855c01552c2511e4966
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-11-18 17:32:23 -08:00
AnilKumar Chimata 6cc52967be crypto: msm: Remove lock/unlock APIs used in shared CE HW scenario
This was needed to allow sharing of the CE hardware in cases where
BAM locking mechanism did not function, which is not valid for the
recent targets. So removing the corresponding code from the driver.

Change-Id: Iad617f822be0aa2c0221b95e6eca4f45f2fc931a
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-11-12 15:37:56 +05:30
Venkatesh Yadav Abbarapu 9a51935a67 crypto: Kconfig: fsm9010: Add hardware crypto module
Add hardware crypto module for fsm9010 target.

Change-Id: I368065fb235079b97fcf6754d9f2831d4059641a
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
2014-10-30 09:51:49 +05:30
Mallikarjuna Reddy Amireddy 528bd3077e qcedev: msm: Remove gating of zero length packets for authentication
Crypto drivers has zero length checks during the parameters validation,
which results in failures for zero length input. This patch update
the checks in crypto drivers to support SHA1/SHA256/HMAC/CMAC zero
length input data.

Change-Id: Ic58385d78b7bc5839674f118e1935361d8e5563d
Signed-off-by: Mallikarjuna Reddy Amireddy <mamire@codeaurora.org>
2014-10-21 16:44:26 +05:30
Mallikarjuna Reddy Amireddy daae47365c crypto: msm: Add new parameter to pass ce frequency
Crypto operating frequency varies from target to target. So platform
specific data needs to provide the value.

Change-Id: Icea908e958453444ba5a8e882664c8ca43e305e4
Signed-off-by: Mallikarjuna Reddy Amireddy <mamire@codeaurora.org>
2014-10-08 10:38:49 +05:30
Linux Build Service Account e4ef12792a Merge "crypto: msm: check potential integer overflow" 2014-10-07 15:00:44 -07:00
William Clark 9f71e2ebb4 crypto: msm: check potential integer overflow
According to the specification of AEAD, AEAD request crypt length is
not a fixed maximum and associated length is also same. This could
lead to potential integer overflow, thus allocating less memory. So
we need to check potential integer overflow on AEAD request length.

CRs-Fixed: 726872
Change-Id: Ie7708000bfd8c57e2fba8e02230a7ce9cdc9634c
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-10-02 11:17:17 -07:00
Linux Build Service Account e527b90e50 Merge "crypto: msm: Fix clock disable warnings" 2014-09-29 07:55:24 -07:00
AnilKumar Chimata 61bae48b4a crypto: msm: Fix clock disable warnings
One of the crypto clocks is not enabled during device open
path but disabled in the return/closed path results in clk
warnings. This patch fixes the issue with clock flags.

Change-Id: Ic602e93e38fc0242696c4b2d43c892daf7fd123b
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-09-26 20:22:08 +05:30
Kishan Kumar 01033d20d5 ARM: dts: msm: Rename msmferrum to msm8909
Rename all device tree files and usages of msmferrum
to its official name msm8909.

Change-Id: Ie17e62046ed8b9626a59e393076a3ff00934c0fe
Signed-off-by: Kishan Kumar <kishank@codeaurora.org>
2014-09-24 20:49:38 +05:30
Linux Build Service Account 4579b78d59 Merge "crypto: Kconfig: msmferrum: Add Hardware crypto module" 2014-09-23 19:48:46 -07:00
AnilKumar Chimata 37177ee8a7 crypto: Kconfig: msmferrum: Add Hardware crypto module
Add hardware crypto module for msmferrum target.

Change-Id: I6ab2e4d3f4299cb49f21a1c1686f0d796de45aa1
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-09-23 23:15:19 +05:30
AnilKumar Chimata ce9093354d crypto: msm: Fix crypto core clock issue
Crypto core clock enablement is removed from the code to add the support
on msm8994 target as per the clock management, which results in crypto
driver init failure. This patch enables the crypto core clk based on the
flag passed by device tree data.

Change-Id: Ia32bfbc49de8adc5e54e835927c5bd53d7e2a208
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-09-23 21:02:34 +05:30
Linux Build Service Account b311c42ee3 Merge "crypto: msm: Make changes to the reaper timer" 2014-09-15 21:03:32 -07:00
Zhen Kong 868b90af1b crypto: msm: Make changes to the reaper timer
Change the periodical reaper timer to on-demand basis. The reaper timer
is only set to disable clock after the clock is enabled, and it is
removed when there is no crypto operations. So that we can prevent the
timers from unnecessarily waking up the CPU from power collapse. The
timer interval is changed to 1 second.

CRs-Fixed: 719848
Change-Id: I88901653b779315de558a33ec6d92979c0176e28
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-09-08 16:19:16 -07:00
Arnd Bergmann 68344064b7 crypto: ux500 - make interrupt mode plausible
commit e1f8859ee265fc89bd21b4dca79e8e983a044892 upstream.

The interrupt handler in the ux500 crypto driver has an obviously
incorrect way to access the data buffer, which for a while has
caused this build warning:

../ux500/cryp/cryp_core.c: In function 'cryp_interrupt_handler':
../ux500/cryp/cryp_core.c:234:5: warning: passing argument 1 of '__fswab32' makes integer from pointer without a cast [enabled by default]
     writel_relaxed(ctx->indata,
     ^
In file included from ../include/linux/swab.h:4:0,
                 from ../include/uapi/linux/byteorder/big_endian.h:12,
                 from ../include/linux/byteorder/big_endian.h:4,
                 from ../arch/arm/include/uapi/asm/byteorder.h:19,
                 from ../include/asm-generic/bitops/le.h:5,
                 from ../arch/arm/include/asm/bitops.h:340,
                 from ../include/linux/bitops.h:33,
                 from ../include/linux/kernel.h:10,
                 from ../include/linux/clk.h:16,
                 from ../drivers/crypto/ux500/cryp/cryp_core.c:12:
../include/uapi/linux/swab.h:57:119: note: expected '__u32' but argument is of type 'const u8 *'
 static inline __attribute_const__ __u32 __fswab32(__u32 val)

There are at least two, possibly three problems here:
a) when writing into the FIFO, we copy the pointer rather than the
   actual data we want to give to the hardware
b) the data pointer is an array of 8-bit values, while the FIFO
   is 32-bit wide, so both the read and write access fail to do
   a proper type conversion
c) This seems incorrect for big-endian kernels, on which we need to
   byte-swap any register access, but not normally FIFO accesses,
   at least the DMA case doesn't do it either.

This converts the bogus loop to use the same readsl/writesl pair
that we use for the two other modes (DMA and polling). This is
more efficient and consistent, and probably correct for endianess.

The bug has existed since the driver was first merged, and was
probably never detected because nobody tried to use interrupt mode.
It might make sense to backport this fix to stable kernels, depending
on how the crypto maintainers feel about that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-crypto@vger.kernel.org
Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-05 16:28:35 -07:00
AnilKumar Chimata 103dc788c5 crypto: msm: Check the return value of cmdlistinfo
The functions _ce_get_cipher_cmdlistinfo() and _ce_get_hash_cmdlistinfo()
may return NULL and dereferencing it. This patch fixes the issue with the
proper checks in the driver.

Change-Id: I491d66b0c69347e2cc484160c20655bdd113d67b
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-09-05 16:23:50 -07:00
Linux Build Service Account ccd59794df Merge "Merge upstream tag 'v3.10.49' into msm-3.10" 2014-08-24 10:53:27 -07:00
Ian Maund 6440f462f9 Merge upstream tag 'v3.10.49' into msm-3.10
* commit 'v3.10.49': (529 commits)
  Linux 3.10.49
  ACPI / battery: Retry to get battery information if failed during probing
  x86, ioremap: Speed up check for RAM pages
  Score: Modify the Makefile of Score, remove -mlong-calls for compiling
  Score: The commit is for compiling successfully.
  Score: Implement the function csum_ipv6_magic
  score: normalize global variables exported by vmlinux.lds
  rtmutex: Plug slow unlock race
  rtmutex: Handle deadlock detection smarter
  rtmutex: Detect changes in the pi lock chain
  rtmutex: Fix deadlock detector for real
  ring-buffer: Check if buffer exists before polling
  drm/radeon: stop poisoning the GART TLB
  drm/radeon: fix typo in golden register setup on evergreen
  ext4: disable synchronous transaction batching if max_batch_time==0
  ext4: clarify error count warning messages
  ext4: fix unjournalled bg descriptor while initializing inode bitmap
  dm io: fix a race condition in the wake up code for sync_io
  Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
  clk: spear3xx: Use proper control register offset
  ...

In addition to bringing in upstream commits, this merge also makes minor
changes to mainitain compatibility with upstream:

The definition of list_next_entry in qcrypto.c and ipa_dp.c has been
removed, as upstream has moved the definition to list.h. The implementation
of list_next_entry was identical between the two.

irq.c, for both arm and arm64 architecture, has had its calls to
__irq_set_affinity_locked updated to reflect changes to the API upstream.

Finally, as we have removed the sleep_length member variable of the
tick_sched struct, all changes made by upstream commit ec804bd do not
apply to our tree and have been removed from this merge. Only
kernel/time/tick-sched.c is impacted.

Change-Id: I63b7e0c1354812921c94804e1f3b33d1ad6ee3f1
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-08-20 13:23:09 -07:00
William Clark 249c33273d crypto: msm: Add multi-core crypto support
Add support for multiple crypto instances, new apis are added
to provide information on the crypto instances available.
Crypto uses RPM to enable clocks, this has the fix to rename
the clocks to use the npa node.

Change-Id: Ia568b9ee82235aa686713b039725d27492f4a8e7
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-08-19 13:48:36 -07:00
Zhen Kong 4a6863a7e9 crypto: msm: Don't enable crypto clock in PM resume
If a PM suspend happens right after resume, crypto driver returns
-EBUSY, since reaper worker thread has not kicked in. The suspend
can only succeed after timer kicks in to disable crypto clock and
free bus.
The solution is as the following. Don't enable crypto
clock and allocate bus bandwidth when entering resume if
there is no outstanding crypto requests. The next crypto
operation will enable crypto clock then. Further more, this patch
shortens the reaper timer from 1 second to 200 ms.

Change-Id: I116cf1454b020ee2886c8bf6696b6411a5df83b6
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-08-07 11:24:06 -07:00
Zhen Kong a9ec115eae crypto: msm: change timer operation to fix timer list corruption
remove the dulplicate init_timer operation in _qcrypto_resume and
replace add_timer with mod_timer to resolve timer list corruption.

Change-Id: I206016686be568ce2eefc41ea74d34639a8b04e5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-08-07 11:24:00 -07:00
Linux Build Service Account 110f3df623 Merge "crypto: msm: multiple device support for FIPS" 2014-07-14 18:10:26 -07:00
Linux Build Service Account 90202ecaa9 Merge "crypto: msm: add suspend/resume callback for qcedev driver" 2014-07-11 18:10:56 -07:00
Dinesh K Garg 4f438baa29 crypto: msm: multiple device support for FIPS
FIPS self tests are failing in case of multiple
qcrypto devices under DTSI file. This is bug fix
to avoid this faillure.

Change-Id: I7811002fba5980ec3637d1891a008a33574fe2d0
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-07-10 17:52:29 -07:00
Linux Build Service Account bf0c00eefc Merge "crypto: msm: Remove bw_reaper_timer while in suspend mode" 2014-07-09 20:08:18 -07:00
William Clark 7183f51f4f crypto: msm: add suspend/resume callback for qcedev driver
Make chanegs to add suspend/resume callback for qcedev driver, and
disable ce clocks when entering suspend and re-enable clocks in resume.

Change-Id: Ibeab1e7cb531af79ae973d7ff0d0ed2d776f6d6f
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-07-09 17:52:37 -07:00
William Clark 241469a654 crypto: msm: Remove bw_reaper_timer while in suspend mode
Remove bw_reaper_timer timer while in suspend mode. Otherwise, it
may cause power regression than normal.

Change-Id: I5cab2b75baf96e08c7f7a179fdd15509bd919a69
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: William Clark <wclark@codeaurora.org>
2014-07-09 09:56:22 -07:00
Dinesh K Garg ea1413ce0d crypto: msm: Compilation flag in Kconfig For FIPS
Added a FIPS_ENABLE flag under drivers/crypto/Kconfig
which will be enabled/disabled according to defconfig
file selection of CONFIG_FIPS_ENABLE

Change-Id: I9297357d623da108313258f768477f742dad24a3
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-06-30 18:22:01 -07:00
Dinesh K Garg 073bc4bbec crypto: msm: Add support for FIPS complience
FIPS140-2 certification asks to do a Power on Known Answer tests on each
algorithm which is getting certified. This patch implements the self tests
and hardcoded test vectors.  Also, we need to verify the integrity of
kernel as soon as it boots up. This patch also adds an ioctl for
integrity test along with ioctl to query FIPS status (pass / fail) from
user land.
also, The piece of code is added for FIPS compliance DRBG under
drivers/char/hw_random

Change-Id: Ib5f4872e7c88161b29ac526eef7e3fbc674456f7
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
2014-06-30 18:17:43 -07:00
Linux Build Service Account 24a2ea4718 Merge "crypto: msm: Fix SHA-1/256 zero length input data issue" 2014-06-30 09:38:43 -07:00
AnilKumar Chimata 8c65c916b6 crypto: msm: Fix SHA-1/256 zero length input data issue
Crypto module generating wrong hash value for zero length input data
using SHA1 and SHA256 functions. This patch fixes the issue to generate
proper hash value.

Change-Id: I795969cf2d3e3887064d56e35cbb488937051ac8
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-27 18:54:24 +05:30
AnilKumar Chimata 6f917d1c55 crypto: msm: ota: fix f9 failure
Recent changes in qce50 driver cause inconsitency between ota_crypto
dirver and qce50 driver on the f9 completion callback. Fix the
inconsistency.

Change-Id: I5547a37a4061ec5df107923f80ff18687b66aaf3
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-27 11:56:52 +05:30
Linux Build Service Account 8e1d480309 Merge "crypto: Kconfig: msm8994: Add Hardware crypto module" 2014-06-20 02:51:25 -07:00
Linux Build Service Account 4c6404d764 Merge "crypto: msm: Add 64bit support to crypto drivers" 2014-06-20 02:51:23 -07:00
AnilKumar Chimata cab2dff988 crypto: Kconfig: msm8994: Add Hardware crypto module
Add hardware crypto module for msm8994 target.

Change-Id: I6248c4bd362b2357ccc30fe0060d77a722eaa4da
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-19 17:33:57 +05:30
AnilKumar Chimata 76a0b19319 crypto: msm: Add 64bit support to crypto drivers
Add 64bit support to crypto drivers.

Change-Id: I519ae5a79bf5df0ebbb5fbe810d8edcda87a2836
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-19 17:33:56 +05:30
Venkatesh Yadav Abbarapu 17b516313d crypto: msm: ota: check zero length request
Check zero length request.

Change-Id: I53f26d3df813c3dbd07258e14557cccb028a606f
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
2014-06-18 18:40:50 +05:30
Zhen Kong 99c0ef017e crypto: msm: Add ablkcipher fallback for aes ctr, ecb, and cbc mode
Add ablkcipher fallback for aes ctr,ecb,cbc mode. Crypto 5 does
not support aes 192.

Change-Id: I2a0984c5f071a0e6e27ee7bd5b0c146104a20fea
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-06-13 10:07:43 -07:00
Horia Geanta d1ae1920b5 crypto: caam - add allocation failure handling in SPRINTFCAT macro
commit 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 upstream.

GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.

Cc: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-07 13:25:39 -07: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
AnilKumar Chimata fe7fb50508 crypto: msm: Fix Crypto BAM issue for 64bit
Fixes the crypto BAM issue while running the qcedev_test from usersapce.
BAM command descriptors opcode wrongly going to Crypto BAM hardware. This
patch corrects the issue by seting the opcode to zero.

Also fixes CMAC IOCTL definition with proper struct type.

Change-Id: Ie4195ccd128a8faa98f16ad5ca45ac9bcaef17b9
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-06-06 04:04:23 +05:30
Linux Build Service Account cfd4a34195 Merge "crypto: msm: ota: check potential integer overflow on ioctl" 2014-05-31 19:43:56 -07:00
Zhen Kong 51b091e9be crypto: msm: fix aes counter issue
Counter Mask registers are not initialized for 128 bits of counter.
As the result, some test vector of aes(ctr) may fail.

Change-Id: Iccf83aff737d253fa8f8110684e40491bcee7035
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-05-28 12:27:48 -07:00
Venkatesh Yadav Abbarapu ee1f52a90a crypto: msm: ota: check potential integer overflow on ioctl
Integer addition and multiplication of two 16 bits integer may overflow.
Add overflow checking and prevention in the driver. The stats counters
are changed from 32 bits to 64 bits as well.

Change-Id: Icf243d8e5f375d19ce850c2b21664b74ce58612f
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
2014-05-28 18:11:52 +05:30
Zhen Kong 4b17c6922b crypto: msm: Add aead hmac-sha256 support
Add support for authenc(hmac(sha256), cbc(des)) and authenc(hmac(sha256),
cbc(aes)) and authenc(hmac(sha256), cbc(des3_ede))

Remove dead code of #ifdef CRYPTO_AEAD_AES_CTR #endif
block in qcrypto and AEAD aes/des/3des ECB mode in qce50. They will
never happen for aead operations.

Stats are cleaned up. Three groups of stats for ABLK, AEAD, and AHASH
operations are managed, and displayed in each group.

Change-Id: I0797c6b3b6596e831b1fb61aa8d4342f19c2b095
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-04-29 14:12:53 -07:00
Zhen Kong 5b6885dc58 crypto: msm: re-work qcrypto driver clk and bus management
This patch re-works bus scaling and clk management to respond to
the actual crypto engine usage. The driver suspend/resume are
integrated with overall driver clk and bus management.

Furthermore, two functions are added to the low level crypto driver. Low
level crypto driver is informed to save and restored hardware context if
necessary across PM suspend/resume.

Change-Id: Ic906e0c7e96dee847253d6ef57341d1a38e294cf
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-04-22 13:41:47 -07:00
Hariprasad Dhalinarasimha 7c0c638ccf crypto:msm: Remove excess logging in qce50
During device probe, device tree is called & the
device tree details are logged - these logs
are now truncated.

Change-Id: I0a6f45cbd4717ded1ef515e3e76452397826d240
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
2014-04-04 15:41:36 -07:00
Zhen Kong 81512a464d crypto: msm: add dynamic engine assignment support
This patch provides dynamic engine assignment for better performance.

A platform may configure to support multiple crypto engines.
Crypto engine assignment to a tranformer(tfm) can be dynamic. Engine
assignment is deferred until a request of a tfm is served. In contrary,
for static assignment, a crypto engine is statically assigned to a
transformer.

This patch supports both schemes.  A transformer can issue multiple
asynchronous requests in parallel. In case of static assignment, requests
of the same tfm are served in sequence by the same engine. In case of
dynamic assignment, requests can be issued in parallel to different
hardware engines.

There is a requirement as such, "for any tfm, ablkcipher, aead, or ahash,
they must return results in the order they were given."
In case of dynamic assignment, the order of completion from different
hardware engines may not be in the same order as requests issued.
Driver needs to re-sequence the order of response for a tfm to meet
the requirement.

Change-Id: I26495c1df0e44a5276989c33a19fddb5b107cb13
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-04-03 12:07:13 -07:00
Linux Build Service Account b198cb9af1 Merge "Merge upstream linux-stable v3.10.28 into msm-3.10" 2014-03-26 23:36:07 -07:00
Ian Maund f1b32d4e47 Merge upstream linux-stable v3.10.28 into msm-3.10
The following commits have been reverted from this merge, as they are
known to introduce new bugs and are currently incompatible with our
audio implementation. Investigation of these commits is ongoing, and
they are expected to be brought in at a later time:

86e6de7 ALSA: compress: fix drain calls blocking other compress functions (v6)
16442d4 ALSA: compress: fix drain calls blocking other compress functions

This merge commit also includes a change in block, necessary for
compilation. Upstream has modified elevator_init_fn to prevent race
conditions, requring updates to row_init_queue and test_init_queue.

* commit 'v3.10.28': (1964 commits)
  Linux 3.10.28
  ARM: 7938/1: OMAP4/highbank: Flush L2 cache before disabling
  drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
  serial: amba-pl011: use port lock to guard control register access
  mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
  md/raid5: Fix possible confusion when multiple write errors occur.
  md/raid10: fix two bugs in handling of known-bad-blocks.
  md/raid10: fix bug when raid10 recovery fails to recover a block.
  md: fix problem when adding device to read-only array with bitmap.
  drm/i915: fix DDI PLLs HW state readout code
  nilfs2: fix segctor bug that causes file system corruption
  thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only
  ftrace/x86: Load ftrace_ops in parameter not the variable holding it
  SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
  writeback: Fix data corruption on NFS
  hwmon: (coretemp) Fix truncated name of alarm attributes
  vfs: In d_path don't call d_dname on a mount point
  staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()
  staging: comedi: addi_apci_1032: fix subdevice type/flags bug
  mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully
  GFS2: Increase i_writecount during gfs2_setattr_chown
  perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h
  perf scripting perl: Fix build error on Fedora 12
  ARM: 7815/1: kexec: offline non panic CPUs on Kdump panic
  Linux 3.10.27
  sched: Guarantee new group-entities always have weight
  sched: Fix hrtimer_cancel()/rq->lock deadlock
  sched: Fix cfs_bandwidth misuse of hrtimer_expires_remaining
  sched: Fix race on toggling cfs_bandwidth_used
  x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround
  netfilter: nf_nat: fix access to uninitialized buffer in IRC NAT helper
  SCSI: sd: Reduce buffer size for vpd request
  intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters.
  mac80211: move "bufferable MMPDU" check to fix AP mode scan
  ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS
  ACPI / TPM: fix memory leak when walking ACPI namespace
  mfd: rtsx_pcr: Disable interrupts before cancelling delayed works
  clk: exynos5250: fix sysmmu_mfc{l,r} gate clocks
  clk: samsung: exynos5250: Add CLK_IGNORE_UNUSED flag for the sysreg clock
  clk: samsung: exynos4: Correct SRC_MFC register
  clk: clk-divider: fix divisor > 255 bug
  ahci: add PCI ID for Marvell 88SE9170 SATA controller
  parisc: Ensure full cache coherency for kmap/kunmap
  drm/nouveau/bios: make jump conditional
  ARM: shmobile: mackerel: Fix coherent DMA mask
  ARM: shmobile: armadillo: Fix coherent DMA mask
  ARM: shmobile: kzm9g: Fix coherent DMA mask
  ARM: dts: exynos5250: Fix MDMA0 clock number
  ARM: fix "bad mode in ... handler" message for undefined instructions
  ARM: fix footbridge clockevent device
  net: Loosen constraints for recalculating checksum in skb_segment()
  bridge: use spin_lock_bh() in br_multicast_set_hash_max
  netpoll: Fix missing TXQ unlock and and OOPS.
  net: llc: fix use after free in llc_ui_recvmsg
  virtio-net: fix refill races during restore
  virtio_net: don't leak memory or block when too many frags
  virtio-net: make all RX paths handle errors consistently
  virtio_net: fix error handling for mergeable buffers
  vlan: Fix header ops passthru when doing TX VLAN offload.
  net: rose: restore old recvmsg behavior
  rds: prevent dereference of a NULL device
  ipv6: always set the new created dst's from in ip6_rt_copy
  net: fec: fix potential use after free
  hamradio/yam: fix info leak in ioctl
  drivers/net/hamradio: Integer overflow in hdlcdrv_ioctl()
  net: inet_diag: zero out uninitialized idiag_{src,dst} fields
  ip_gre: fix msg_name parsing for recvfrom/recvmsg
  net: unix: allow bind to fail on mutex lock
  ipv6: fix illegal mac_header comparison on 32bit
  netvsc: don't flush peers notifying work during setting mtu
  tg3: Initialize REG_BASE_ADDR at PCI config offset 120 to 0
  net: unix: allow set_peek_off to fail
  net: drop_monitor: fix the value of maxattr
  ipv6: don't count addrconf generated routes against gc limit
  packet: fix send path when running with proto == 0
  virtio: delete napi structures from netdev before releasing memory
  macvtap: signal truncated packets
  tun: update file current position
  macvtap: update file current position
  macvtap: Do not double-count received packets
  rds: prevent BUG_ON triggered on congestion update to loopback
  net: do not pretend FRAGLIST support
  IPv6: Fixed support for blackhole and prohibit routes
  HID: Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
  gpio-rcar: R-Car GPIO IRQ share interrupt
  clocksource: em_sti: Set cpu_possible_mask to fix SMP broadcast
  irqchip: renesas-irqc: Fix irqc_probe error handling
  Linux 3.10.26
  sh: add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c
  ext4: fix bigalloc regression
  arm64: Use Normal NonCacheable memory for writecombine
  arm64: Do not flush the D-cache for anonymous pages
  arm64: Avoid cache flushing in flush_dcache_page()
  ARM: KVM: arch_timers: zero CNTVOFF upon return to host
  ARM: hyp: initialize CNTVOFF to zero
  clocksource: arch_timer: use virtual counters
  arm64: Remove unused cpu_name ascii in arch/arm64/mm/proc.S
  arm64: dts: Reserve the memory used for secondary CPU release address
  arm64: check for number of arguments in syscall_get/set_arguments()
  arm64: fix possible invalid FPSIMD initialization state
  ...

Change-Id: Ia0e5d71b536ab49ec3a1179d59238c05bdd03106
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-03-24 14:28:34 -07:00
Zhen Kong 3bbed21e10 crypto: msm: fix Off-by-one error in computation of length for strlcpy()
size + strlen("qcom-") is equal to the length of string not including the
null character. However, we are comparing it to the length of the buffer,
so we need to include the null character, and make a change to make sure
(size + strlen("qcom-")) is smaller than CRYPTO_MAX_ALG_NAME.

Change-Id: I882e2c3e761a4bd4344ce8820b26cf890f29bab3
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-03-20 13:43:36 -07:00
Linux Build Service Account 24e388b9fb Merge "crypto: msm: Add support for multiple qcrypto device" 2014-03-12 23:21:37 -07:00
Mona Hossain fe78c0cd72 crypto: msm: Add support for multiple qcrypto device
Expose APIs to enable qcrypto client to select any specific qcrypto
instance.

Change-Id: Ia96f7fa0f15216c0656aa6dc495db350b3c574a8
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2014-03-12 10:19:01 -07:00
Dan Sneddon b0da38f02c msm: msm_bus: Move bus scaling to platform drivers
Moves bus scaling code to architecture independant directory
for platform drivers.

Change-Id: Ie0d5b104882d1534fae262af85e99cc09a56ab04
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
2014-03-11 18:00:53 -06:00
Niranjana Vishwanathapura 3c58438ef9 crypto: msm: fix memory leak during algorithm registration
During driver algorithm registration, if there are errors, the
dynamically allocated memory needs to be free on the error return.
Otherwise, there will be memory leak. This patch fixes memory leak
accordingly.

Change-Id: Ic3c65ebd3d6c7b0e88815e6750ec14990e375587
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Niranjana Vishwanathapura <nvishwan@codeaurora.org>
2014-02-26 13:42:16 -07:00
Niranjana Vishwanathapura 6753e2aa25 crypto: msm: enable rfc4309(ccm(aes)) algorithm
This patch enables rfc4309(ccm(aes)) algorithm. Further more, it fixes
an issues with ccm.  According to RFC3610, associate
data is optional. The assocaite data length can be 0 as shown in
testmgr ccm rfc4309 test vectors. The driver did not take this zero
length of  associate data situation into account. And the corresponding
test vectors in testmgr may fail.

Change-Id: I2f269a54ad269a8ba72c0e570a7859da223e2d9b
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Niranjana Vishwanathapura <nvishwan@codeaurora.org>
2014-02-26 13:42:02 -07:00
Dipen Parmar 7f918cb5c7 msm: sps: remove sps header file
Remove the sps header file from older location as sps
driver and clients need to use new header file from
new location include/linux.

Resolve the warnings/errors from client drivers due to
new sps header changes.

Change-Id: I1cdb87756abf3425a9bb5d8bf89cd1aa03a01716
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
2014-02-05 15:31:11 -08:00
AnilKumar Chimata 53b076eef9 crypto: Kconfig: msm8916: Add Hardware crypto module
Add hardware crypto module for msm8916 target.

Change-Id: Ieca9c6aaa43ac662dbaa50dbbd45d6e5921afc02
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2014-02-05 09:33:57 -08:00
Xiaocheng Li 5f441c883e msm: socinfo: Support multiplatform
Upstream prefers existing drivers be converted to support multiplatform
kernels.  This requires drivers to be located in directories that
contain generic functionality instead of specific mach directories.
Move the socinfo driver into drivers/soc/qcom and update the initcall
levels to satisfy dependencies.

Change-Id: If195cd793d84867d371f25136a88f2a7ce239500
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2014-01-30 19:08:34 -08:00
Zhen Kong 00fa0d8c21 crypto: msm: Add basic suspend resume functionality
If ce clock is not disabled in suspend state, memory may be corrupted
and device can not wake up. We add an optional flag "clk_mgmt_sus_res"
for qcrypto driver. This flag indicates if the ce clocks need to be
disabled in suspend function and enabled in resume function of qcrypto
driver. When the flag is set, we disable the clocks that are not disabled
in suspend function and re-enable them again in resume function.

Change-Id: I23be38b2765c0cc5f3ed41d65f8e4ae8a9372d18
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-01-27 19:59:06 -08:00
Vikram Mulukutla 1e635c644a msm: scm: Move the scm driver to drivers/soc/qcom
Architectural changes in the ARM Linux kernel tree mandate
the eventual removal of the mach-* directories. Move the
scm driver to drivers/soc/qcom and the scm header to
include/soc/qcom to support that removal.

Change-Id: Ie660d0566de35045c1ba73fcddeda99efacf057e
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-01-24 11:49:11 -08:00
Zhen Kong fe560bd4dd crypto: msm: Rename and register crypto algorithms
Add optional crypto algorithm flags to indicates if to use SW crypto
algorithms instead of HW algorithms. Based on it, we then rename and
register crypto algorithms to be qualcomm specific to prevent clashing
with the default SW implementation of the algorithms used by dm_crypt
module. (used for disk encryption).

Change-Id: I39badf22581791c502a247f8f37123f513b8c77e
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-01-23 23:41:00 -08:00
Linux Build Service Account 35f90d26b1 Merge "crypto: msm: Add debug log" 2014-01-23 03:21:48 -08:00
Linux Build Service Account 787a183b61 Merge "crypto: msm: Fix key length setting" 2014-01-17 16:42:21 -08:00
Zhen Kong e849a34af4 crypto: msm: Fix a bug when writing xts du size
The break is missing in the switch-case branch of writing xts du size,
this leads to incorrect xts du size setting.

Change-Id: I288c3d30cc3d59eb28672be32aa57819971ca97f
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-01-16 10:43:25 -08:00
Zhen Kong 83c570e1b6 crypto: msm: Fix key length setting
Hardcoding key length to a constant value results in overwriting
command element information in the command descriptor beyond what
is allocate for the key information in the command element list.
This results in corruption of the command list in the case where
command descriptors are used for configuring crypto registers and
needlessly writing to key registers that are not relevant to the
operation (when writing to registers directly), and thus leads to
crypto operation failures. Fix is to use the key length based on
what is requested by the client.

Change-Id: Ibd625dc7a438fac84b13588700bf472004e246d5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2014-01-15 18:18:48 -08:00
Mona Hossain e2bd6519fc crypto: msm: Add debug log
Add MACRO for writel_relaxed that output register
settings.

Change-Id: Iffb76acbe2c0c389a6c79ac4b72a1aaa2a9af531
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2014-01-15 17:40:53 -08:00
Linux Build Service Account 8609c30843 Merge "Revert "crypto: Fix memory leak in bam_release call"" 2013-12-30 15:12:09 -08:00
Zhen Kong ea5ec1f1ab Revert "crypto: Fix memory leak in bam_release call"
This reverts commit 8d175c9d77, which
release pbam memory when an error occurs. However, on a device with
multiple ce, pbam memory is shared by multiple pce_dev, it can only
be freed when the reference count goes to zero, and can not be
released it if reference count is not zero when an error occurs.
The previous implementation on bam_release was correct, so we
revert commit 8d175c9d77.

Change-Id: Ibc3b83dd46ea087c7a0084d032d96a2848f6baf5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2013-12-30 11:11:47 -08:00
Linux Build Service Account aa2078492f Merge "crypto: msm: add pm wakeup support for qcrypto driver" 2013-12-23 15:42:26 -08:00
Zhen Kong 1ca995cee4 crypto: msm: add pm wakeup support for qcrypto driver
Add support for holding system from suspending while an operation
is in progress (when clks are enabled).  This is done by invoking
pm_stay_awake before enabling clks (when a crypto operation is
initiated) and invoking pm_relax when crypto operation is done.

Change-Id: I5c7ceb025f6cac1b7c985fc1c308e82f851fca72
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2013-12-23 12:35:23 -08:00
Vikram Mulukutla 6918831f31 msm: clk-provider: Move clock headers to include/linux/clk
Architecutural changes in the ARM Linux kernel tree mandate the
eventual removal of the mach-* directories. Move the
mach/clk-provider and mach/clk header to include/linux/clk.

Change-Id: I495f8332bf5d0d09ccfb236c819dea2bacb13542
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2013-12-12 11:29:09 -08:00
Kumar Gala c37b3a4042 msm: remove code, dts, and references to MSM9625
We no longer support MSM9625 so remove various files and code associated
with it.  This is not a complete removal of MSM9625, but just removing
dts files, any file with 9625 in name, and any code that was associated
with CONFIG_ARCH_MSM9625.

Change-Id: I3d5405bb71a529806797adc81dd628996000acdc
Signed-off-by: Kumar Gala <galak@codeaurora.org>
2013-12-09 16:31:05 -06:00
Ian Maund f06163e6d0 msm: reap unused kernel files
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.

A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.

Some files which support planned functionality or are
useful in debugging have been excluded from this reap.

Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2013-11-21 17:45:28 -08:00
Linux Build Service Account 77949f94d6 Merge "crypto: msm: ota: multiple variable size packet support" 2013-11-15 01:10:35 -08:00
Linux Build Service Account 437170c368 Merge "crypto: Fix memory leak in bam_release call" 2013-11-11 22:16:11 -08:00
Rohit Vaswani 2c7dc49733 crypto: msm: ota: multiple variable size packet support
This patch provides support of multiple variable size packet
API to the ota_crypto driver.

Furthermore, this patch replaces snprintf with scnprintf
to make pointer manipulation save when display stats.

Change-Id: I56aebd24557dccc547ff86cb8853ace0602b6e50
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2013-11-05 13:24:29 -08:00
Zhen Kong 4ddee896f7 crypto: Kconfig: select QCE50 for ARCH_APQ8084
select qce50 for APQ8084 architecture and then bring up crypto driver
on APO8084

Change-Id: I4235dbf88003203353c7d8b18093136bef1b62d1
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2013-10-29 16:25:33 -07:00
Zhen Kong 07642fbca1 crypto: msm: Add support for LPAE in crypto drivers for APQ8084
change physical address type to support LPAE for crypro drivers on
APQ8084

Change-Id: I2a85c5db9d131c3be469a5f6b322bc3c4a317400
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2013-10-29 16:25:20 -07:00
Linux Build Service Account 6ff9d7e0ab Merge "crypto: msm: Use scnprintf() instead of snprintf()" 2013-10-26 08:27:34 -07:00
Linux Build Service Account fd3a275e6d Merge " crypto: msm: fix hmac ahashing issues with simultaneous multiple requests." 2013-10-26 03:29:57 -07:00
Linux Build Service Account 9148e7eaa2 Merge "crypto: msm: fix hmac hashing issues with various key size" 2013-10-26 03:29:56 -07:00
Mona Hossain 8d175c9d77 crypto: Fix memory leak in bam_release call
Release pmab memory when an error occurs as well.

Change-Id: I7aa13d5a03edbdfa806345039459feaeac6e7a11
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
2013-10-25 14:31:39 -07:00
AnilKumar Chimata f10d718047 crypto: msm: Use scnprintf() instead of snprintf()
snprintf can return more than the size of buffer, which is not
expected here, obviously. Use scnprintf instead.

Change-Id: I3b97a016df910728dfef5a0914ab8ad67c68e39c
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2013-10-25 12:54:58 -07:00
Linux Build Service Account ff585cbf30 Merge "crypto: msm: check potential integer overflow on AEAD req length" 2013-10-25 05:30:50 -07:00
Linux Build Service Account 05ab31fd11 Merge "crypto: msm: Fix null pointer exception in qcrypto_count_sg()" 2013-10-24 18:08:47 -07:00
Zhen Kong 5afcf33702 crypto: msm: check potential integer overflow on AEAD req length
According to the specification of AEAD, AEAD request cryptlen is
not a Fixed maximum and assoclen is also same. This could lead to
potential integer overflow, thus allocating less memory. So we
need to check potential integer overflow on AEAD request length.

Change-Id: I58a0c5e1a6e890bad30f7865e96b7db46337158c
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2013-10-24 14:25:12 -07:00
Rohit Vaswani 9c23b09c59 crypto: msm: fix hmac ahashing issues with simultaneous multiple requests.
This patch fixes two issues. One issue is to do with simultaneous requests
 of a ahash tfm. The other issue is to do with ahash import, and export
 functions.

 Agent issues chain of requests in sequence of init, followed
 by multiple updates, and final to the crypto driver for the hashing of a
 buffer. Each request can be asynchrounous. After a request is complete,
 the next one in the sequence is issued.

 Multiple simultaneous async requests can be issued to the driver
 for the same tfm if they are for independent hashing.

 In the driver, the state variables such as trailing buffer, first
 block, last block are maintained in the driver. The
 state variables are maintained in the request context, instead of
 tfm context. Otherwise, simultaneous async requests can
 confuse each other. This patch moves those variables out of
 tfm context to request context to fix this issue.

 Agent above the driver can import/export ahash state of a request. This
 patch fixes a few issues in the driver to support import/export.
 First issue, the byte count returned from hw for hmac has 64 bytes of
 padding on the first request to the hardware. In the import/export this
 special case needs to be accomodated.

 The 2nd issue is the state buffer is only updated after hardware operation
 complete. For the first, data being accumulated in the trailing buffer,
 and if request has not ever issued to the hw, when import function comes,
 the trailing data needs to be exported. This patch uses trailing
 buffer directly as state buffer variable for import and export.
 The context update functions after hareware request complete are not
 necessary and they are removed. The last issue is to do with state
 variable count. It was not initialized. That may cause hashing generated
 wrong  digest after export and import.

Change-Id: I608c2322b120825b9ca12c3794e0b0a4628ef693
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2013-10-22 14:22:19 -07:00
Rohit Vaswani dc1af015b7 crypto: msm: fix hmac hashing issues with various key size
hmac-sha1 and hamc-sha256 have variable mac key up to a block size.
If user provides a key that is less than the block size, the
key should be padded with zero to the block size before it is
given to the hw.

This padding was not done properly in the driver.
When switch engine between ahash hmac(sha1), hmac(sha256),
and ipsec, problem may happen. ipsec takes 20 bytes of key.
The generated digested data is wrong, even though everything looks
fine from driver. ipsec may fail.

Furthermore, this patch cleanup the driver to do proper setup of
hardware to use hw key or pipe key.

Change-Id: I128eca5a1ac4df326ea1ca9aef2bf27323c1c82f
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2013-10-22 14:15:05 -07:00
AnilKumar Chimata 12ed3c0a21 crypto: msm: Fix null pointer exception in qcrypto_count_sg()
Fixes null pointer exception in count scatter gather function. Scatter
gather list pointer become NULL if the sg pointer reaches last but one
node, which results in NULL pointer exception.

Change-Id: I634baf30074e6e53ffa22635565da54e9ae43150
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2013-10-19 19:27:11 +05:30
Linux Build Service Account 8fbc221127 Merge "crypto: msm: Fix issues related to non-zero byteoffset input" 2013-10-19 01:51:54 -07:00
AnilKumar Chimata 3e88ed60f1 crypto: msm: Fix issues related to non-zero byteoffset input
Fix buffer overflow for a non-zero byteoffset value.

Also fixes memory leak issue by adding data_len check in check_params.
One of the scenarios data_len can be less than byteoffset which results
in memory leak with huge data length, which might cause the kernel panic.

Change-Id: I3f773673219f45dad4f17499b1ee0feda2aff1f7
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
2013-10-18 14:31:08 +05:30
Linux Build Service Account 778a075f67 Merge "crypto: msm: Remove invalid check in qcedev driver" 2013-10-18 00:46:53 -07:00