aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-12-02crypto: powerpc - replace memset by memzero_explicitJulia Lawall1-1/+1
Memset on a local variable may be removed when it is called just before the variable goes out of scope. Using memzero_explicit defeats this optimization. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier x; type T; @@ { ... when any T x[...]; ... when any when exists - memset + memzero_explicit (x, -0, ...) ... when != x when strict } // </smpl> This change was suggested by Daniel Borkmann <[email protected]> Signed-off-by: Julia Lawall <[email protected]> Acked-by: Michael Ellerman <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-12-02crypto: sha - replace memset by memzero_explicitJulia Lawall2-2/+2
Memset on a local variable may be removed when it is called just before the variable goes out of scope. Using memzero_explicit defeats this optimization. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier x; type T; @@ { ... when any T x[...]; ... when any when exists - memset + memzero_explicit (x, -0, ...) ... when != x when strict } // </smpl> This change was suggested by Daniel Borkmann <[email protected]> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-12-02crypto: sparc - replace memset by memzero_explicitJulia Lawall2-2/+2
Memset on a local variable may be removed when it is called just before the variable goes out of scope. Using memzero_explicit defeats this optimization. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier x; type T; @@ { ... when any T x[...]; ... when any when exists - memset + memzero_explicit (x, -0, ...) ... when != x when strict } // </smpl> This change was suggested by Daniel Borkmann <[email protected]> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-12-02crypto: algif_skcipher - initialize upon init requestStephan Mueller1-1/+3
When using the algif_skcipher, the following call sequence causess a re-initialization: 1. sendmsg with ALG_SET_OP and iov == NULL, iovlen == 0 (i.e initializing the cipher, but not sending data) 2. sendmsg with msg->msg-controllen == 0 and iov != NULL (using the initalized cipher handle by sending data) In step 2, the cipher operation type (encryption or decryption) is reset to always decryption, because the local variable of enc is put into ctx->enc as ctx->user is still zero. The same applies when all send data is processed and ctx->used falls to zero followed by user space to send new data. This patch changes the behavior to only reset the cipher operation type (and the IV) if such configuration request is received. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-12-01crypto: algif_skcipher - removed unneeded codeStruk, Tadeusz1-4/+0
Remover unneeded code. Signed-off-by: Tadeusz Struk <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-28crypto: algif_skcipher - Fixed blocking recvmsgHerbert Xu1-3/+2
As most (all?) users of algif_skcipher are single-threaded and therefore always write before reading from an algif_skcipher socket, they never block and exercise that code-path. It turns out that code path doesn't even work because we never reload ctx->used after waking up so we never even see the new data and immediately return an error (and a loud WARN_ON). This patch fixes this by always reloading ctx->used. Reported-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Acked-by: Stephan Mueller <[email protected]>
2014-11-27crypto: drbg - use memzero_explicit() for clearing sensitive dataNickolaus Woodruff1-11/+12
Compiler dead store optimization can sometimes remove final calls to memset() used to clear sensitive data at the end of a function. Replace trailing memset() calls with memzero_explicit() to preclude unwanted removal. Signed-off-by: Nickolaus Woodruff <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-26crypto: drbg - use MODULE_ALIAS_CRYPTOStephan Mueller1-22/+22
Use the crypto- prefix for the DRBG implementations. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-26crypto: include crypto- module prefix in templateKees Cook23-2/+26
This adds the module loading prefix "crypto-" to the template lookup as well. For example, attempting to load 'vfat(blowfish)' via AF_ALG now correctly includes the "crypto-" prefix at every level, correctly rejecting "vfat": net-pf-38 algif-hash crypto-vfat(blowfish) crypto-vfat(blowfish)-all crypto-vfat Reported-by: Mathias Krause <[email protected]> Signed-off-by: Kees Cook <[email protected]> Acked-by: Mathias Krause <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-26crypto: user - add MODULE_ALIASStephan Mueller1-0/+1
To allow automatic loading of the crypto_user kernel module, the netlink MODULE_ALIAS is added. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-25crypto: sha-mb - remove a bogus NULL checkDan Carpenter1-2/+1
This can't be NULL and we dereferenced it earlier. Smatch used to ignore these things where the pointer was obviously non-NULL but I've found that sometimes the intention was to check something else so we were maybe missing bugs. Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Tim Chen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-25crytpo: qat - Fix 64 bytes requestsStruk, Tadeusz1-3/+6
Fix invalid inflights calculation for 64 bytes requests. Signed-off-by: Tadeusz Struk <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-25crypto: algif - add and use sock_kzfree_s() instead of memzero_explicit()Daniel Borkmann4-10/+24
Commit e1bd95bf7c25 ("crypto: algif - zeroize IV buffer") and 2a6af25befd0 ("crypto: algif - zeroize message digest buffer") added memzero_explicit() calls on buffers that are later on passed back to sock_kfree_s(). This is a discussed follow-up that, instead, extends the sock API and adds sock_kzfree_s(), which internally uses kzfree() instead of kfree() for passing the buffers back to slab. Having sock_kzfree_s() allows to keep the changes more minimal by just having a drop-in replacement instead of adding memzero_explicit() calls everywhere before sock_kfree_s(). In kzfree(), the compiler is not allowed to optimize the memset() away and thus there's no need for memzero_explicit(). Both, sock_kfree_s() and sock_kzfree_s() are wrappers for __sock_kfree_s() and call into kfree() resp. kzfree(); here, __sock_kfree_s() needs to be explicitly inlined as we want the compiler to optimize the call and condition away and thus it produces e.g. on x86_64 the _same_ assembler output for sock_kfree_s() before and after, and thus also allows for avoiding code duplication. Cc: David S. Miller <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-24crypto: prefix module autoloading with "crypto-"Kees Cook95-123/+155
This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-24crypto: user - Allow get request with empty driver nameHerbert Xu1-4/+1
Currently all get requests with an empty driver name fail with EINVAL. Since most users actually want to supply an empty driver name this patch removes this check. Signed-off-by: Herbert Xu <[email protected]>
2014-11-20ARM: at91/dt: add trng node to at91sam9g45Boris Brezillon1-0/+7
Add a DT node for the TRNG (True Random Number Generator) block. Keep this block enabled as it does not depend on any external connection, and thus should be available on all boards. Signed-off-by: Boris Brezillon <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-20hwrng: atmel - Add TRNG DT binding docBoris Brezillon1-0/+16
Document DT bindings of Atmel's TRNG (True Random Number Generator) IP. Signed-off-by: Boris Brezillon <[email protected]> Acked-by: Peter Korsgaard <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-20hwrng: atmel - add DT supportBoris Brezillon2-1/+8
Add DT support. Make the driver depend on CONFIG_OF as at91sam9g45 was the only SoC making use of the TRNG block and this SoC is now fully migrated to DT. Signed-off-by: Boris Brezillon <[email protected]> Acked-by: Peter Korsgaard <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-20hwrng: atmel - use clk_prepapre_enable/_disable_unprepareBoris Brezillon1-4/+4
Use clk_prepare_enable/_disable_unprepare instead of clk_enable/disable to work properly with the CCF. Signed-off-by: Boris Brezillon <[email protected]> Acked-by: Peter Korsgaard <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-20crypto: bfin_crc - don't include linux/unaligned/access_ok.hJohannes Berg1-1/+1
This is a specific implementation, <asm/unaligned.h> is the multiplexer that has the arch-specific knowledge of which of the implementations needs to be used, so include that. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-20crypto: crc32 - Add ARM64 CRC32 hw accelerated moduleYazen Ghannam3-0/+282
This module registers a crc32 algorithm and a crc32c algorithm that use the optional CRC32 and CRC32C instructions in ARMv8. Tested on AMD Seattle. Improvement compared to crc32c-generic algorithm: TCRYPT CRC32C speed test shows ~450% speedup. Simple dd write tests to btrfs filesystem show ~30% speedup. Signed-off-by: Yazen Ghannam <[email protected]> Acked-by: Steve Capper <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-17crypto: qat - Use memzero_explicitStruk, Tadeusz1-14/+22
Use the new memzero_explicit function to cleanup sensitive data. Signed-off-by: Tadeusz Struk <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-17crypto: doc - document uncovered member variablesStephan Mueller1-1/+6
Fix documentation typo for shash_alg->descsize. Add documentation for initially uncovered member variables. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-17crypto: caam - Remove unnecessary smp_read_barrier_depends()Pranith Kumar1-3/+0
Recently lockless_dereference() was added which can be used in place of hard-coding smp_read_barrier_depends(). The following PATCH makes the change. Signed-off-by: Pranith Kumar <[email protected]> Reviewed-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - HASH API documentationStephan Mueller1-0/+119
The API function calls exported by the kernel crypto API for message digests to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - CIPHER API documentationStephan Mueller1-0/+89
The API function calls exported by the kernel crypto API for signle block ciphers to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - BLKCIPHER API documentationStephan Mueller1-0/+188
The API function calls exported by the kernel crypto API for synchronous block ciphers to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - AEAD API documentationStephan Mueller1-0/+251
The API function calls exported by the kernel crypto API for AEAD ciphers to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - ABLKCIPHER API documentationStephan Mueller1-0/+206
The API function calls exported by the kernel crypto API for asynchronous block ciphers to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - cipher data structuresStephan Mueller1-3/+243
The data structure of struct crypto_alg together with various other data structures needed by cipher developers is documented wit all parameters that can be set by a developer of a transformation. All parameters that are internal to the crypto API are marked as such. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - SHASH API documentationStephan Mueller1-0/+164
The API function calls exported by the kernel crypto API for SHASHes to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - AHASH API documentationStephan Mueller1-0/+228
The API function calls exported by the kernel crypto API for AHASHes to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - hash data structuresStephan Mueller1-0/+95
The hash data structures needed to be filled in by cipher developers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - RNG API documentationStephan Mueller1-0/+80
The API function calls exported by the kernel crypto API for RNGs to be used by consumers are documented. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - userspace interface specStephan Mueller1-0/+205
The userspace interface of the kernel crypto API is documented with * a general explanation * a discussion of the memory in-place operation * the description of the message digest API * the description of the symmetric cipher API The documentation refers to libkcapi as a working example on how to use the kernel crypto API from user space. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - compile crypto API specStephan Mueller1-1/+1
Add the crypto API documentation into the DocBook Makefile to allow it being compiled Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-13crypto: doc - crypto API high level specStephan Mueller1-0/+1253
The design of the kernel crypto API as well as hints to program with the kernel crypto API are given. The documentation contains: * design aspects of crypto API * develper specific hints * references to the API function description * source code examples CC: Marek Vasut <[email protected]> Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-12crypto: caam - add support for givencrypt cbc(des) and cbc(des3_ede)Catalin Vasile1-4/+6
Merge DES Cipher Block Chaining mode (CBC) and Triple DES Cipher Block Chaining mode (CBC) algorithms from ablkcipher to givencrypt. Signed-off-by: Catalin Vasile <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-12crypto: algif - zeroize IV bufferStephan Mueller1-0/+1
Zeroize the buffer holding the IV used for the completed cipher operation before the buffer is released by the skcipher AF_ALG interface handler. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-12crypto: algif - zeroize message digest bufferStephan Mueller1-0/+2
Zeroize the buffer holding the message digest calculated for the consumer before the buffer is released by the hash AF_ALG interface handler. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-12Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linuxHerbert Xu1139-10258/+21117
Merging 3.18-rc4 in order to pick up the memzero_explicit helper.
2014-11-10crypto: ux500/hash - Silence compiler warning for !CONFIG_PMUlf Hansson1-0/+2
The system PM functions were unused when CONFIG_PM is unset. Let's move them inside CONFIG_PM_SLEEP to silence the compiler warning. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-10crypto: ux500/cryp - Silence compiler warning for !CONFIG_PMUlf Hansson1-0/+2
The system PM functions were unused when CONFIG_PM is unset. Let's move them inside CONFIG_PM_SLEEP to silence the compiler warning. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-10crypto: drbg - add MODULE_ALIAS for all DRBG typesStephan Mueller1-0/+25
The kernel module drbg.ko is currently not loaded automatically when a DRBG is requested by a consumer. This is due to missing MODULE_ALIAS flags for each of the implemented DRBG types. This patch adds aliases for each of the 22 defined DRBGs. Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-11-09Linux 3.18-rc4Linus Torvalds1-1/+1
2014-11-09Merge tag 'arm64-fixes' of ↵Linus Torvalds3-3/+27
git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fixes from Catalin Marinas: - enable bpf syscall for compat - cpu_suspend fix when checking the idle state type - defconfig update * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: defconfig: update defconfig for 3.18 arm64: compat: Enable bpf syscall arm64: psci: fix cpu_suspend to check idle state type for index
2014-11-09Merge tag 'armsoc-for-rc4' of ↵Linus Torvalds9-90/+160
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC fixes from Olof Johansson: "Another quiet week: - a fix to silence edma probe error on non-supported platforms from Arnd - a fix to enable the PL clock for Parallella, to make mainline usable with the SDK. - a somewhat verbose fix for the PLL clock tree on VF610 - enabling of SD/MMC on one of the VF610-based boards (for testing) - a fix for i.MX where CONFIG_SPI used to be implicitly enabled and now needs to be added to the defconfig instead - another maintainer added for bcm2835: Lee Jones" * tag 'armsoc-for-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: dts: zynq: Enable PL clocks for Parallella dma: edma: move device registration to platform code ARM: dts: vf610: add SD node to cosmic dts MAINTAINERS: update bcm2835 entry ARM: imx: Fix the removal of CONFIG_SPI option ARM: imx: clk-vf610: define PLL's clock tree
2014-11-09Merge branch 'devicetree/merge' of ↵Linus Torvalds4-86/+154
git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux Pull devicetree bugfix from Grant Likely: "One buffer overflow bug that shouldn't be left around" * 'devicetree/merge' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux: of: Fix overflow bug in string property parsing functions
2014-11-09Merge branch 'for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs Pull btrfs fix from Chris Mason: "It's a one liner for an error cleanup path that leads to crashes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error cleanup
2014-11-09Merge tag 'driver-core-3.18-rc4' of ↵Linus Torvalds2-9/+14
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core fixes from Greg KH: "Here are 3 tiny fixes for 3.18-rc4. One fixes up a long-stading race condition in the driver core for removing directories in /sys/devices/virtual/ and the other 2 fix up the wording of a new Kconfig option that was added in 3.18-rc1" * tag 'driver-core-3.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: tiny: rename ENABLE_DEV_COREDUMP to ALLOW_DEV_COREDUMP tiny: reverse logic for DISABLE_DEV_COREDUMP sysfs: driver core: Fix glue dir race condition by gdp_mutex