12 Oct, 2016

1 commit

  • A good practice is to prefix the names of functions by the name
    of the subsystem.

    The kthread worker API is a mix of classic kthreads and workqueues. Each
    worker has a dedicated kthread. It runs a generic function that process
    queued works. It is implemented as part of the kthread subsystem.

    This patch renames the existing kthread worker API to use
    the corresponding name from the workqueues API prefixed by
    kthread_:

    __init_kthread_worker() -> __kthread_init_worker()
    init_kthread_worker() -> kthread_init_worker()
    init_kthread_work() -> kthread_init_work()
    insert_kthread_work() -> kthread_insert_work()
    queue_kthread_work() -> kthread_queue_work()
    flush_kthread_work() -> kthread_flush_work()
    flush_kthread_worker() -> kthread_flush_worker()

    Note that the names of DEFINE_KTHREAD_WORK*() macros stay
    as they are. It is common that the "DEFINE_" prefix has
    precedence over the subsystem names.

    Note that INIT() macros and init() functions use different
    naming scheme. There is no good solution. There are several
    reasons for this solution:

    + "init" in the function names stands for the verb "initialize"
    aka "initialize worker". While "INIT" in the macro names
    stands for the noun "INITIALIZER" aka "worker initializer".

    + INIT() macros are used only in DEFINE() macros

    + init() functions are used close to the other kthread()
    functions. It looks much better if all the functions
    use the same scheme.

    + There will be also kthread_destroy_worker() that will
    be used close to kthread_cancel_work(). It is related
    to the init() function. Again it looks better if all
    functions use the same naming scheme.

    + there are several precedents for such init() function
    names, e.g. amd_iommu_init_device(), free_area_init_node(),
    jump_label_init_type(), regmap_init_mmio_clk(),

    + It is not an argument but it was inconsistent even before.

    [arnd@arndb.de: fix linux-next merge conflict]
    Link: http://lkml.kernel.org/r/20160908135724.1311726-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/1470754545-17632-3-git-send-email-pmladek@suse.com
    Suggested-by: Andrew Morton
    Signed-off-by: Petr Mladek
    Cc: Oleg Nesterov
    Cc: Tejun Heo
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: "Paul E. McKenney"
    Cc: Josh Triplett
    Cc: Thomas Gleixner
    Cc: Jiri Kosina
    Cc: Borislav Petkov
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Petr Mladek
     

11 Oct, 2016

1 commit

  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 4.9:

    API:
    - The crypto engine code now supports hashes.

    Algorithms:
    - Allow keys >= 2048 bits in FIPS mode for RSA.

    Drivers:
    - Memory overwrite fix for vmx ghash.
    - Add support for building ARM sha1-neon in Thumb2 mode.
    - Reenable ARM ghash-ce code by adding import/export.
    - Reenable img-hash by adding import/export.
    - Add support for multiple cores in omap-aes.
    - Add little-endian support for sha1-powerpc.
    - Add Cavium HWRNG driver for ThunderX SoC"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (137 commits)
    crypto: caam - treat SGT address pointer as u64
    crypto: ccp - Make syslog errors human-readable
    crypto: ccp - clean up data structure
    crypto: vmx - Ensure ghash-generic is enabled
    crypto: testmgr - add guard to dst buffer for ahash_export
    crypto: caam - Unmap region obtained by of_iomap
    crypto: sha1-powerpc - little-endian support
    crypto: gcm - Fix IV buffer size in crypto_gcm_setkey
    crypto: vmx - Fix memory corruption caused by p8_ghash
    crypto: ghash-generic - move common definitions to a new header file
    crypto: caam - fix sg dump
    hwrng: omap - Only fail if pm_runtime_get_sync returns < 0
    crypto: omap-sham - shrink the internal buffer size
    crypto: omap-sham - add support for export/import
    crypto: omap-sham - convert driver logic to use sgs for data xmit
    crypto: omap-sham - change the DMA threshold value to a define
    crypto: omap-sham - add support functions for sg based data handling
    crypto: omap-sham - rename sgl to sgl_tmp for deprecation
    crypto: omap-sham - align algorithms on word offset
    crypto: omap-sham - add context export/import stubs
    ...

    Linus Torvalds
     

10 Oct, 2016

1 commit


07 Oct, 2016

1 commit

  • Pull dmaengine updates from Vinod Koul:
    "This is bit large pile of code which bring in some nice additions:

    - Error reporting: we have added a new mechanism for users of
    dmaenegine to register a callback_result which tells them the
    result of the dma transaction. Right now only one user (ntb) is
    using it.

    - As we discussed on KS mailing list and pointed out NO_IRQ has no
    place in kernel, this also remove NO_IRQ from dmaengine subsystem
    (both arm and ppc users)

    - Support for IOMMU slave transfers and its implementation for arm.

    - To get better build coverage, enable COMPILE_TEST for bunch of
    driver, and fix the warning and sparse complaints on these.

    - Apart from above, usual updates spread across drivers"

    * tag 'dmaengine-4.9-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (169 commits)
    async_pq_val: fix DMA memory leak
    dmaengine: virt-dma: move function declarations
    dmaengine: omap-dma: Enable burst and data pack for SG
    DT: dmaengine: rcar-dmac: document R8A7743/5 support
    dmaengine: fsldma: Unmap region obtained by of_iomap
    dmaengine: jz4780: fix resource leaks on error exit return
    dma-debug: fix ia64 build, use PHYS_PFN
    dmaengine: coh901318: fix integer overflow when shifting more than 32 places
    dmaengine: edma: avoid uninitialized variable use
    dma-mapping: fix m32r build warning
    dma-mapping: fix ia64 build, use PHYS_PFN
    dmaengine: ti-dma-crossbar: enable COMPILE_TEST
    dmaengine: omap-dma: enable COMPILE_TEST
    dmaengine: edma: enable COMPILE_TEST
    dmaengine: ti-dma-crossbar: Fix of_device_id data parameter usage
    dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter
    dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs
    dmaengine: edma: Rename set_bits and remove unused clear_bits helper
    dmaengine: edma: Use correct type for of_find_property() third parameter
    dmaengine: edma: Fix of_device_id data parameter usage (legacy vs TPCC)
    ...

    Linus Torvalds
     

05 Oct, 2016

1 commit

  • Add missing dmaengine_unmap_put(), so we don't OOM during RAID6 sync.

    Fixes: 1786b943dad0 ("async_pq_val: convert to dmaengine_unmap_data")
    Signed-off-by: Justin Maggard
    Reviewed-by: Dan Williams
    Cc:
    Signed-off-by: Vinod Koul

    Justin Maggard
     

02 Oct, 2016

3 commits

  • Add a guard to 'state' buffer and warn if its consistency after
    call to crypto_ahash_export() changes, so that any write that
    goes beyond advertised statesize (and thus causing potential
    memory corruption [1]) is more visible.

    [1] https://marc.info/?l=linux-crypto-vger&m=147467656516085

    Signed-off-by: Jan Stancek
    Cc: Herbert Xu
    Cc: Marcelo Cerri
    Signed-off-by: Herbert Xu

    Jan Stancek
     
  • The cipher block size for GCM is 16 bytes, and thus the CTR transform
    used in crypto_gcm_setkey() will also expect a 16-byte IV. However,
    the code currently reserves only 8 bytes for the IV, causing
    an out-of-bounds access in the CTR transform. This patch fixes
    the issue by setting the size of the IV buffer to 16 bytes.

    Fixes: 84c911523020 ("[CRYPTO] gcm: Add support for async ciphers")
    Signed-off-by: Ondrej Mosnacek
    Signed-off-by: Herbert Xu

    Ondrej Mosnáček
     
  • Move common values and types used by ghash-generic to a new header file
    so drivers can directly use ghash-generic as a fallback implementation.

    Fixes: cc333cd68dfa ("crypto: vmx - Adding GHASH routines for VMX module")
    Cc: stable@vger.kernel.org
    Signed-off-by: Marcelo Cerri
    Signed-off-by: Herbert Xu

    Marcelo Cerri
     

22 Sep, 2016

1 commit

  • As the software RSA implementation now produces fixed-length
    output, we need to eliminate leading zeros in the calling code
    instead.

    This patch does just that for pkcs1pad decryption while signature
    verification was fixed in an earlier patch.

    Fixes: 9b45b7bba3d2 ("crypto: rsa - Generate fixed-length output")
    Reported-by: Mat Martineau
    Signed-off-by: Herbert Xu

    Herbert Xu
     

13 Sep, 2016

3 commits

  • Remove unneeded variables and assignments.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Herbert Xu

    Masahiro Yamada
     
  • When we need to allocate a temporary blkcipher_walk_next and it
    fails, the code is supposed to take the slow path of processing
    the data block by block. However, due to an unrelated change
    we instead end up dereferencing the NULL pointer.

    This patch fixes it by moving the unrelated bsize setting out
    of the way so that we enter the slow path as inteded.

    Fixes: 7607bd8ff03b ("[CRYPTO] blkcipher: Added blkcipher_walk_virt_block")
    Cc: stable@vger.kernel.org
    Reported-by: xiakaixu
    Reported-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu
    Tested-by: Ard Biesheuvel

    Herbert Xu
     
  • The current implementation uses a global per-cpu array to store
    data which are used to derive the next IV. This is insecure as
    the attacker may change the stored data.

    This patch removes all traces of chaining and replaces it with
    multiplication of the salt and the sequence number.

    Fixes: a10f554fa7e0 ("crypto: echainiv - Add encrypted chain IV...")
    Cc: stable@vger.kernel.org
    Reported-by: Mathias Krause
    Signed-off-by: Herbert Xu

    Herbert Xu
     

07 Sep, 2016

4 commits


31 Aug, 2016

3 commits

  • In FIPS mode, additional restrictions may apply. If these restrictions
    are violated, the kernel will panic(). This patch allows test vectors
    for symmetric ciphers to be marked as to be skipped in FIPS mode.

    Together with the patch, the XTS test vectors where the AES key is
    identical to the tweak key is disabled in FIPS mode. This test vector
    violates the FIPS requirement that both keys must be different.

    Reported-by: Tapas Sarangi
    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • This patch fixes an unused label warning triggered when the macro
    XOR_SELECT_TEMPLATE is not set.

    Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...")
    Reported-by: Stephen Rothwell
    Suggested-by: Stephen Rothwell
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The AEAD code path incorrectly uses the child tfm to track the
    cryptd refcnt, and then potentially frees the child tfm.

    Fixes: 81760ea6a95a ("crypto: cryptd - Add helpers to check...")
    Reported-by: Sowmini Varadhan
    Signed-off-by: Herbert Xu

    Herbert Xu
     

24 Aug, 2016

3 commits

  • With a public notification, NIST now allows the use of RSA keys with a
    modulus >= 2048 bits. The new rule allows any modulus size >= 2048 bits
    provided that either 2048 or 3072 bits are supported at least so that
    the entire RSA implementation can be CAVS tested.

    This patch fixes the inability to boot the kernel in FIPS mode, because
    certs/x509.genkey defines a 4096 bit RSA key per default. This key causes
    the RSA signature verification to fail in FIPS mode without the patch
    below.

    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • Fix to return a negative error code from the error handling
    case instead of 0.

    Signed-off-by: Wei Yongjun
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Wei Yongjun
     
  • If the architecture selected the xor function with XOR_SELECT_TEMPLATE
    the speed result of the do_xor_speed benchmark is of limited value.
    The speed measurement increases the bootup time a little, which can
    makes a difference for kernels used in container like virtual machines.

    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Herbert Xu

    Martin Schwidefsky
     

16 Aug, 2016

2 commits

  • When calling the DRBG health test in FIPS mode, the Jitter RNG is not
    yet present in the kernel crypto API which will cause the instantiation
    to fail and thus the health test to fail.

    As the health tests cover the enforcement of various thresholds, invoke
    the functions that are supposed to enforce the thresholds directly.

    This patch also saves precious seed.

    Reported-by: Tapas Sarangi
    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • The sentence 'Based on' is misspelled, respell it.

    Signed-off-by: LABBE Corentin
    Signed-off-by: Herbert Xu

    Corentin LABBE
     

09 Aug, 2016

2 commits

  • "if (!ret == template[i].fail)" is confusing to compilers (gcc5):

    crypto/testmgr.c: In function '__test_aead':
    crypto/testmgr.c:531:12: warning: logical not is only applied to the
    left hand side of comparison [-Wlogical-not-parentheses]
    if (!ret == template[i].fail) {
    ^

    Let there be 'if (template[i].fail == !ret) '.

    Signed-off-by: Yanjiang Jin
    Signed-off-by: Herbert Xu

    Yanjiang Jin
     
  • The optimised crc32c implementation depends on VMX (aka. Altivec)
    instructions, so the kernel must be built with Altivec support in order
    for the crc32c code to build.

    Fixes: 6dd7a82cc54e ("crypto: powerpc - Add POWER8 optimised crc32c")
    Acked-by: Anton Blanchard
    Signed-off-by: Michael Ellerman
    Signed-off-by: Herbert Xu

    Michael Ellerman
     

08 Aug, 2016

1 commit

  • On 32-bit (e.g. with m68k-linux-gnu-gcc-4.1):

    crypto/sha3_generic.c:27: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:28: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:29: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:29: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:31: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:31: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:33: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:33: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:34: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:34: warning: integer constant is too large for ‘long’ type

    Fixes: 53964b9ee63b7075 ("crypto: sha3 - Add SHA-3 hash algorithm")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Herbert Xu

    Geert Uytterhoeven
     

28 Jul, 2016

1 commit

  • Pull random driver updates from Ted Ts'o:
    "A number of improvements for the /dev/random driver; the most
    important is the use of a ChaCha20-based CRNG for /dev/urandom, which
    is faster, more efficient, and easier to make scalable for
    silly/abusive userspace programs that want to read from /dev/urandom
    in a tight loop on NUMA systems.

    This set of patches also improves entropy gathering on VM's running on
    Microsoft Azure, and will take advantage of a hw random number
    generator (if present) to initialize the /dev/urandom pool"

    (It turns out that the random tree hadn't been in linux-next this time
    around, because it had been dropped earlier as being too quiet. Oh
    well).

    * tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
    random: strengthen input validation for RNDADDTOENTCNT
    random: add backtracking protection to the CRNG
    random: make /dev/urandom scalable for silly userspace programs
    random: replace non-blocking pool with a Chacha20-based CRNG
    random: properly align get_random_int_hash
    random: add interrupt callback to VMBus IRQ handler
    random: print a warning for the first ten uninitialized random users
    random: initialize the non-blocking pool via add_hwgenerator_randomness()

    Linus Torvalds
     

27 Jul, 2016

1 commit

  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 4.8:

    API:
    - first part of skcipher low-level conversions
    - add KPP (Key-agreement Protocol Primitives) interface.

    Algorithms:
    - fix IPsec/cryptd reordering issues that affects aesni
    - RSA no longer does explicit leading zero removal
    - add SHA3
    - add DH
    - add ECDH
    - improve DRBG performance by not doing CTR by hand

    Drivers:
    - add x86 AVX2 multibuffer SHA256/512
    - add POWER8 optimised crc32c
    - add xts support to vmx
    - add DH support to qat
    - add RSA support to caam
    - add Layerscape support to caam
    - add SEC1 AEAD support to talitos
    - improve performance by chaining requests in marvell/cesa
    - add support for Araneus Alea I USB RNG
    - add support for Broadcom BCM5301 RNG
    - add support for Amlogic Meson RNG
    - add support Broadcom NSP SoC RNG"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (180 commits)
    crypto: vmx - Fix aes_p8_xts_decrypt build failure
    crypto: vmx - Ignore generated files
    crypto: vmx - Adding support for XTS
    crypto: vmx - Adding asm subroutines for XTS
    crypto: skcipher - add comment for skcipher_alg->base
    crypto: testmgr - Print akcipher algorithm name
    crypto: marvell - Fix wrong flag used for GFP in mv_cesa_dma_add_iv_op
    crypto: nx - off by one bug in nx_of_update_msc()
    crypto: rsa-pkcs1pad - fix rsa-pkcs1pad request struct
    crypto: scatterwalk - Inline start/map/done
    crypto: scatterwalk - Remove unnecessary BUG in scatterwalk_start
    crypto: scatterwalk - Remove unnecessary advance in scatterwalk_pagedone
    crypto: scatterwalk - Fix test in scatterwalk_done
    crypto: api - Optimise away crypto_yield when hard preemption is on
    crypto: scatterwalk - add no-copy support to copychunks
    crypto: scatterwalk - Remove scatterwalk_bytes_sglen
    crypto: omap - Stop using crypto scatterwalk_bytes_sglen
    crypto: skcipher - Remove top-level givcipher interface
    crypto: user - Remove crypto_lookup_skcipher call
    crypto: cts - Convert to skcipher
    ...

    Linus Torvalds
     

23 Jul, 2016

1 commit


22 Jul, 2016

1 commit


21 Jul, 2016

1 commit


19 Jul, 2016

2 commits


18 Jul, 2016

6 commits