09 Jun, 2014

1 commit

  • Pull LLVM patches from Behan Webster:
    "Next set of patches to support compiling the kernel with clang.
    They've been soaking in linux-next since the last merge window.

    More still in the works for the next merge window..."

    * tag 'llvmlinux-for-v3.16' of git://git.linuxfoundation.org/llvmlinux/kernel:
    arm, unwind, LLVMLinux: Enable clang to be used for unwinding the stack
    ARM: LLVMLinux: Change "extern inline" to "static inline" in glue-cache.h
    all: LLVMLinux: Change DWARF flag to support gcc and clang
    net: netfilter: LLVMLinux: vlais-netfilter
    crypto: LLVMLinux: aligned-attribute.patch

    Linus Torvalds
     

08 Jun, 2014

2 commits

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

    - Added test vectors for SHA/AES-CCM/DES-CBC/3DES-CBC.
    - Fixed a number of error-path memory leaks in tcrypt.
    - Fixed error-path memory leak in caam.
    - Removed unnecessary global mutex from mxs-dcp.
    - Added ahash walk interface that can actually be asynchronous.
    - Cleaned up caam error reporting.
    - Allow crypto_user get operation to be used by non-root users.
    - Add support for SSS module on Exynos.
    - Misc fixes"

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6: (60 commits)
    crypto: testmgr - add aead cbc des, des3_ede tests
    crypto: testmgr - Fix DMA-API warning
    crypto: cesa - tfm->__crt_alg->cra_type directly
    crypto: sahara - tfm->__crt_alg->cra_name directly
    crypto: padlock - tfm->__crt_alg->cra_name directly
    crypto: n2 - tfm->__crt_alg->cra_name directly
    crypto: dcp - tfm->__crt_alg->cra_name directly
    crypto: cesa - tfm->__crt_alg->cra_name directly
    crypto: ccp - tfm->__crt_alg->cra_name directly
    crypto: geode - Don't use tfm->__crt_alg->cra_name directly
    crypto: geode - Weed out printk() from probe()
    crypto: geode - Consistently use AES_KEYSIZE_128
    crypto: geode - Kill AES_IV_LENGTH
    crypto: geode - Kill AES_MIN_BLOCK_SIZE
    crypto: mxs-dcp - Remove global mutex
    crypto: hash - Add real ahash walk interface
    hwrng: n2-drv - Introduce the use of the managed version of kzalloc
    crypto: caam - reinitialize keys_fit_inline for decrypt and givencrypt
    crypto: s5p-sss - fix multiplatform build
    hwrng: timeriomem - remove unnecessary OOM messages
    ...

    Linus Torvalds
     
  • __attribute__((aligned)) applies the default alignment for the largest scalar
    type for the target ABI. gcc allows it to be applied inline to a defined type.
    Clang only allows it to be applied to a type definition (PR11071).

    Making it into 2 lines makes it more readable and works with both compilers.

    Author: Mark Charlebois
    Signed-off-by: Mark Charlebois
    Signed-off-by: Behan Webster

    Mark Charlebois
     

04 Jun, 2014

1 commit

  • …el/git/tip/tip into next

    Pull core locking updates from Ingo Molnar:
    "The main changes in this cycle were:

    - reduced/streamlined smp_mb__*() interface that allows more usecases
    and makes the existing ones less buggy, especially in rarer
    architectures

    - add rwsem implementation comments

    - bump up lockdep limits"

    * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
    rwsem: Add comments to explain the meaning of the rwsem's count field
    lockdep: Increase static allocations
    arch: Mass conversion of smp_mb__*()
    arch,doc: Convert smp_mb__*()
    arch,xtensa: Convert smp_mb__*()
    arch,x86: Convert smp_mb__*()
    arch,tile: Convert smp_mb__*()
    arch,sparc: Convert smp_mb__*()
    arch,sh: Convert smp_mb__*()
    arch,score: Convert smp_mb__*()
    arch,s390: Convert smp_mb__*()
    arch,powerpc: Convert smp_mb__*()
    arch,parisc: Convert smp_mb__*()
    arch,openrisc: Convert smp_mb__*()
    arch,mn10300: Convert smp_mb__*()
    arch,mips: Convert smp_mb__*()
    arch,metag: Convert smp_mb__*()
    arch,m68k: Convert smp_mb__*()
    arch,m32r: Convert smp_mb__*()
    arch,ia64: Convert smp_mb__*()
    ...

    Linus Torvalds
     

22 May, 2014

2 commits

  • Test vectors were taken from existing test for
    CBC(DES3_EDE). Associated data has been added to test vectors.
    HMAC computed with Crypto++ has been used. Following algos have
    been covered.

    (a) "authenc(hmac(sha1),cbc(des))"
    (b) "authenc(hmac(sha1),cbc(des3_ede))"
    (c) "authenc(hmac(sha224),cbc(des))"
    (d) "authenc(hmac(sha224),cbc(des3_ede))"
    (e) "authenc(hmac(sha256),cbc(des))"
    (f) "authenc(hmac(sha256),cbc(des3_ede))"
    (g) "authenc(hmac(sha384),cbc(des))"
    (h) "authenc(hmac(sha384),cbc(des3_ede))"
    (i) "authenc(hmac(sha512),cbc(des))"
    (j) "authenc(hmac(sha512),cbc(des3_ede))"

    Signed-off-by: Vakul Garg
    [NiteshNarayanLal@freescale.com: added hooks for the missing algorithms test and tested the patch]
    Signed-off-by: Nitesh Lal
    Signed-off-by: Herbert Xu

    Nitesh Lal
     
  • With DMA-API debug enabled testmgr triggers a "DMA-API: device driver maps memory from stack" warning, when tested on a crypto HW accelerator.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     

21 May, 2014

1 commit

  • Although the existing hash walk interface has already been used
    by a number of ahash crypto drivers, it turns out that none of
    them were really asynchronous. They were all essentially polling
    for completion.

    That's why nobody has noticed until now that the walk interface
    couldn't work with a real asynchronous driver since the memory
    is mapped using kmap_atomic.

    As we now have a use-case for a real ahash implementation on x86,
    this patch creates a minimal ahash walk interface. Basically it
    just calls kmap instead of kmap_atomic and does away with the
    crypto_yield call. Real ahash crypto drivers don't need to yield
    since by definition they won't be hogging the CPU.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

08 May, 2014

1 commit

  • CRYPTO_USER requires CAP_NET_ADMIN for all operations. Most information
    provided by CRYPTO_MSG_GETALG is also accessible through /proc/modules
    and AF_ALG. CRYPTO_MSG_GETALG should not require CAP_NET_ADMIN so that
    processes without CAP_NET_ADMIN can use CRYPTO_MSG_GETALG to get cipher
    details, such as cipher priorities, for AF_ALG.

    Signed-off-by: Matthias-Christian Ott
    Signed-off-by: Herbert Xu

    Matthias-Christian Ott
     

28 Apr, 2014

3 commits


25 Apr, 2014

1 commit

  • It is possible by passing a netlink socket to a more privileged
    executable and then to fool that executable into writing to the socket
    data that happens to be valid netlink message to do something that
    privileged executable did not intend to do.

    To keep this from happening replace bare capable and ns_capable calls
    with netlink_capable, netlink_net_calls and netlink_ns_capable calls.
    Which act the same as the previous calls except they verify that the
    opener of the socket had the desired permissions as well.

    Reported-by: Andy Lutomirski
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

18 Apr, 2014

1 commit

  • Mostly scripted conversion of the smp_mb__* barriers.

    Signed-off-by: Peter Zijlstra
    Acked-by: Paul E. McKenney
    Link: http://lkml.kernel.org/n/tip-55dhyhocezdw1dg7u19hmh1u@git.kernel.org
    Cc: Linus Torvalds
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

16 Apr, 2014

2 commits


21 Mar, 2014

7 commits

  • This git patch adds x86_64 AVX2 optimization of SHA1
    transform to crypto support. The patch has been tested with 3.14.0-rc1
    kernel.

    On a Haswell desktop, with turbo disabled and all cpus running
    at maximum frequency, tcrypt shows AVX2 performance improvement
    from 3% for 256 bytes update to 16% for 1024 bytes update over
    AVX implementation.

    This patch adds sha1_avx2_transform(), the glue, build and
    configuration changes needed for AVX2 optimization of
    SHA1 transform to crypto support.

    sha1-ssse3 is one module which adds the necessary optimization
    support (SSSE3/AVX/AVX2) for the low-level SHA1 transform function.
    With better optimization support, transform function is overridden
    as the case may be. In the case of AVX2, due to performance reasons
    across datablock sizes, the AVX or AVX2 transform function is used
    at run-time as it suits best. The Makefile change therefore appends
    the necessary objects to the linkage. Due to this, the patch merely
    appends AVX2 transform to the existing build mix and Kconfig support
    and leaves the configuration build support as is.

    Signed-off-by: Chandramouli Narayanan
    Reviewed-by: Marek Vasut
    Acked-by: H. Peter Anvin
    Signed-off-by: Herbert Xu

    chandramouli narayanan
     
  • The crypto algorithm modules utilizing the crypto daemon could
    be used early when the system start up. Using module_init
    does not guarantee that the daemon's work queue is initialized
    when the cypto alorithm depending on crypto_wq starts. It is necessary
    to initialize the crypto work queue earlier at the subsystem
    init time to make sure that it is initialized
    when used.

    Signed-off-by: Tim Chen
    Signed-off-by: Herbert Xu

    Tim Chen
     
  • Add test vectors for aead with null encryption and md5,
    respectively sha1 authentication.
    Input data is taken from test vectors listed in RFC2410.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • These defines might be needed by crypto drivers.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • The ahash_def_finup() can make use of the request save/restore functions,
    thus make it so. This simplifies the code a little and unifies the code
    paths.

    Note that the same remark about free()ing the req->priv applies here, the
    req->priv can only be free()'d after the original request was restored.

    Finally, squash a bug in the invocation of completion in the ASYNC path.
    In both ahash_def_finup_done{1,2}, the function areq->base.complete(X, err);
    was called with X=areq->base.data . This is incorrect , as X=&areq->base
    is the correct value. By analysis of the data structures, we see the areq is
    of type 'struct ahash_request' , areq->base is of type 'struct crypto_async_request'
    and areq->base.completion is of type crypto_completion_t, which is defined in
    include/linux/crypto.h as:

    typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);

    This is one lead that the X should be &areq->base . Next up, we can inspect
    other code which calls the completion callback to give us kind-of statistical
    idea of how this callback is used. We can try:

    $ git grep base\.complete\( drivers/crypto/

    Finally, by inspecting ahash_request_set_callback() implementation defined
    in include/crypto/hash.h , we observe that the .data entry of 'struct
    crypto_async_request' is intended for arbitrary data, not for completion
    argument.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     
  • The functions to save original request within a newly adjusted request
    and it's counterpart to restore the original request can be re-used by
    more code in the crypto/ahash.c file. Pull these functions out from the
    code so they're available.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     
  • Add documentation for the pointer voodoo that is happening in crypto/ahash.c
    in ahash_op_unaligned(). This code is quite confusing, so add a beefy chunk
    of documentation.

    Moreover, make sure the mangled request is completely restored after finishing
    this unaligned operation. This means restoring all of .result, .base.data
    and .base.complete .

    Also, remove the crypto_completion_t complete = ... line present in the
    ahash_op_unaligned_done() function. This type actually declares a function
    pointer, which is very confusing.

    Finally, yet very important nonetheless, make sure the req->priv is free()'d
    only after the original request is restored in ahash_op_unaligned_done().
    The req->priv data must not be free()'d before that in ahash_op_unaligned_finish(),
    since we would be accessing previously free()'d data in ahash_op_unaligned_done()
    and cause corruption.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     

10 Mar, 2014

2 commits


25 Feb, 2014

1 commit

  • We added the soft module dependency of crc32c module alias
    to generic crc32c module so other hardware accelerated crc32c
    modules could get loaded and used before the generic version.
    We also renamed the crypto/crc32c.c containing the generic
    crc32c crypto computation to crypto/crc32c_generic.c according
    to convention.

    Signed-off-by: Tim Chen
    Signed-off-by: Herbert Xu

    Tim Chen
     

24 Jan, 2014

1 commit

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

    - Improved crypto_memneq helper
    - Use cyprto_memneq in arch-specific crypto code
    - Replaced orphaned DCP driver with Freescale MXS DCP driver
    - Added AVX/AVX2 version of AESNI-GCM encode and decode
    - Added AMD Cryptographic Coprocessor (CCP) driver
    - Misc fixes"

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (41 commits)
    crypto: aesni - fix build on x86 (32bit)
    crypto: mxs - Fix sparse non static symbol warning
    crypto: ccp - CCP device enabled/disabled changes
    crypto: ccp - Cleanup hash invocation calls
    crypto: ccp - Change data length declarations to u64
    crypto: ccp - Check for caller result area before using it
    crypto: ccp - Cleanup scatterlist usage
    crypto: ccp - Apply appropriate gfp_t type to memory allocations
    crypto: drivers - Sort drivers/crypto/Makefile
    ARM: mxs: dts: Enable DCP for MXS
    crypto: mxs - Add Freescale MXS DCP driver
    crypto: mxs - Remove the old DCP driver
    crypto: ahash - Fully restore ahash request before completing
    crypto: aesni - fix build on x86 (32bit)
    crypto: talitos - Remove redundant dev_set_drvdata
    crypto: ccp - Remove redundant dev_set_drvdata
    crypto: crypto4xx - Remove redundant dev_set_drvdata
    crypto: caam - simplify and harden key parsing
    crypto: omap-sham - Fix Polling mode for larger blocks
    crypto: tcrypt - Added speed tests for AEAD crypto alogrithms in tcrypt test suite
    ...

    Linus Torvalds
     

05 Jan, 2014

1 commit

  • When finishing the ahash request, the ahash_op_unaligned_done() will
    call complete() on the request. Yet, this will not call the correct
    complete callback. The correct complete callback was previously stored
    in the requests' private data, as seen in ahash_op_unaligned(). This
    patch restores the correct complete callback and .data field of the
    request before calling complete() on it.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Shawn Guo
    Signed-off-by: Herbert Xu

    Marek Vasut
     

20 Dec, 2013

1 commit


09 Dec, 2013

1 commit

  • Commit fe8c8a126806 introduced a possible build error for archs
    that do not have CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS set. :/
    Fix this up by bringing else braces outside of the ifdef.

    Reported-by: Fengguang Wu
    Fixes: fe8c8a126806 ("crypto: more robust crypto_memneq")
    Signed-off-by: Daniel Borkmann
    Acked-By: Cesar Eduardo Barros
    Signed-off-by: Herbert Xu

    Daniel Borkmann
     

05 Dec, 2013

3 commits

  • A kernel with enabled lockdep complains about the wrong usage of
    rcu_dereference() under a rcu_read_lock_bh() protected region.

    ===============================
    [ INFO: suspicious RCU usage. ]
    3.13.0-rc1+ #126 Not tainted
    -------------------------------
    linux/crypto/pcrypt.c:81 suspicious rcu_dereference_check() usage!

    other info that might help us debug this:

    rcu_scheduler_active = 1, debug_locks = 1
    1 lock held by cryptomgr_test/153:
    #0: (rcu_read_lock_bh){.+....}, at: [] pcrypt_do_parallel.isra.2+0x5/0x200

    Fix that by using rcu_dereference_bh() instead.

    Signed-off-by: Mathias Krause
    Cc: "David S. Miller"
    Acked-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Mathias Krause
     
  • Disabling compiler optimizations can be fragile, since a new
    optimization could be added to -O0 or -Os that breaks the assumptions
    the code is making.

    Instead of disabling compiler optimizations, use a dummy inline assembly
    (based on RELOC_HIDE) to block the problematic kinds of optimization,
    while still allowing other optimizations to be applied to the code.

    The dummy inline assembly is added after every OR, and has the
    accumulator variable as its input and output. The compiler is forced to
    assume that the dummy inline assembly could both depend on the
    accumulator variable and change the accumulator variable, so it is
    forced to compute the value correctly before the inline assembly, and
    cannot assume anything about its value after the inline assembly.

    This change should be enough to make crypto_memneq work correctly (with
    data-independent timing) even if it is inlined at its call sites. That
    can be done later in a followup patch.

    Compile-tested on x86_64.

    Signed-off-by: Cesar Eduardo Barros
    Acked-by: Daniel Borkmann
    Signed-off-by: Herbert Xu

    Cesar Eduardo Barros
     
  • Pull crypto fixes from Herbert Xu:
    "This push fixes a number of crashes triggered by a previous crypto
    self-test update. It also fixes a build problem in the caam driver,
    as well as a concurrency issue in s390.

    Finally there is a pair of fixes to bugs in the crypto scatterwalk
    code and authenc that may lead to crashes"

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: testmgr - fix sglen in test_aead for case 'dst != src'
    crypto: talitos - fix aead sglen for case 'dst != src'
    crypto: caam - fix aead sglen for case 'dst != src'
    crypto: ccm - Fix handling of zero plaintext when computing mac
    crypto: s390 - Fix aes-xts parameter corruption
    crypto: talitos - corrrectly handle zero-length assoc data
    crypto: scatterwalk - Set the chain pointer indication bit
    crypto: authenc - Find proper IV address in ablkcipher callback
    crypto: caam - Add missing Job Ring include

    Linus Torvalds
     

03 Dec, 2013

1 commit

  • Pull networking updates from David Miller:
    "Here is a pile of bug fixes that accumulated while I was in Europe"

    1) In fixing kernel leaks to userspace during copying of socket
    addresses, we broke a case that used to work, namely the user
    providing a buffer larger than the in-kernel generic socket address
    structure. This broke Ruby amongst other things. Fix from Dan
    Carpenter.

    2) Fix regression added by byte queue limit support in 8139cp driver,
    from Yang Yingliang.

    3) The addition of MSG_SENDPAGE_NOTLAST buggered up a few sendpage
    implementations, they should just treat it the same as MSG_MORE.
    Fix from Richard Weinberger and Shawn Landden.

    4) Handle icmpv4 errors received on ipv6 SIT tunnels correctly, from
    Oussama Ghorbel. In particular we should send an ICMPv6 unreachable
    in such situations.

    5) Fix some regressions in the recent genetlink fixes, in particular
    get the pmcraid driver to use the new safer interfaces correctly.
    From Johannes Berg.

    6) macvtap was converted to use a per-cpu set of statistics, but some
    code was still bumping tx_dropped elsewhere. From Jason Wang.

    7) Fix build failure of xen-netback due to missing include on some
    architectures, from Andy Whitecroft.

    8) macvtap double counts received packets in statistics, fix from Vlad
    Yasevich.

    9) Fix various cases of using *_STATS_BH() when *_STATS() is more
    appropriate. From Eric Dumazet and Hannes Frederic Sowa.

    10) Pktgen ipsec mode doesn't update the ipv4 header length and checksum
    properly after encapsulation. Fix from Fan Du.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (61 commits)
    net/mlx4_en: Remove selftest TX queues empty condition
    {pktgen, xfrm} Update IPv4 header total len and checksum after tranformation
    virtio_net: make all RX paths handle erors consistently
    virtio_net: fix error handling for mergeable buffers
    virtio_net: Fixed a trivial typo (fitler --> filter)
    netem: fix gemodel loss generator
    netem: fix loss 4 state model
    netem: missing break in ge loss generator
    net/hsr: Support iproute print_opt ('ip -details ...')
    net/hsr: Very small fix of comment style.
    MAINTAINERS: Added net/hsr/ maintainer
    ipv6: fix possible seqlock deadlock in ip6_finish_output2
    ixgbe: Make ixgbe_identify_qsfp_module_generic static
    ixgbe: turn NETIF_F_HW_L2FW_DOFFLOAD off by default
    ixgbe: ixgbe_fwd_ring_down needs to be static
    e1000: fix possible reset_task running after adapter down
    e1000: fix lockdep warning in e1000_reset_task
    e1000: prevent oops when adapter is being closed and reset simultaneously
    igb: Fixed Wake On LAN support
    inet: fix possible seqlock deadlocks
    ...

    Linus Torvalds
     

30 Nov, 2013

1 commit

  • Commit 35f9c09fe (tcp: tcp_sendpages() should call tcp_push() once)
    added an internal flag MSG_SENDPAGE_NOTLAST, similar to
    MSG_MORE.

    algif_hash, algif_skcipher, and udp used MSG_MORE from tcp_sendpages()
    and need to see the new flag as identical to MSG_MORE.

    This fixes sendfile() on AF_ALG.

    v3: also fix udp

    Cc: Tom Herbert
    Cc: Eric Dumazet
    Cc: David S. Miller
    Cc: # 3.4.x + 3.2.x
    Reported-and-tested-by: Shawn Landden
    Original-patch: Richard Weinberger
    Signed-off-by: Shawn Landden
    Signed-off-by: David S. Miller

    Shawn Landden
     

28 Nov, 2013

4 commits

  • Commit d8a32ac25698cd60b02bed2100379803c7f964e3 (crypto: testmgr - make
    test_aead also test 'dst != src' code paths) added support for different
    source and destination buffers in test_aead.

    This patch modifies the source and destination buffer lengths accordingly:
    the lengths are not equal since encryption / decryption adds / removes
    the ICV.

    Cc: Jussi Kivilinna
    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • For aead case when source and destination buffers are different,
    there is an incorrect assumption that the source length includes the ICV
    length. Fix this, since it leads to an oops when using sg_count() to
    find the number of nents in the scatterlist:

    Unable to handle kernel paging request for data at address 0x00000004
    Faulting instruction address: 0xf91f7634
    Oops: Kernel access of bad area, sig: 11 [#1]
    SMP NR_CPUS=8 P4080 DS
    Modules linked in: caamalg(+) caam_jr caam
    CPU: 1 PID: 1053 Comm: cryptomgr_test Not tainted 3.11.0 #16
    task: eeb24ab0 ti: eeafa000 task.ti: eeafa000
    NIP: f91f7634 LR: f91f7f24 CTR: f91f7ef0
    REGS: eeafbbc0 TRAP: 0300 Not tainted (3.11.0)
    MSR: 00029002 CR: 44044044 XER: 00000000
    DEAR: 00000004, ESR: 00000000

    GPR00: f91f7f24 eeafbc70 eeb24ab0 00000002 ee8e0900 ee8e0800 00000024 c45c4462
    GPR08: 00000010 00000000 00000014 0c0e4000 24044044 00000000 00000000 c0691590
    GPR16: eeab0000 eeb23000 00000000 00000000 00000000 00000001 00000001 eeafbcc8
    GPR24: 000000d1 00000010 ee2d5000 ee49ea10 ee49ea10 ee46f640 ee46f640 c0691590
    NIP [f91f7634] aead_edesc_alloc.constprop.14+0x144/0x780 [caamalg]
    LR [f91f7f24] aead_encrypt+0x34/0x288 [caamalg]
    Call Trace:
    [eeafbc70] [a1004000] 0xa1004000 (unreliable)
    [eeafbcc0] [f91f7f24] aead_encrypt+0x34/0x288 [caamalg]
    [eeafbcf0] [c020d77c] __test_aead+0x3ec/0xe20
    [eeafbe20] [c020f35c] test_aead+0x6c/0xe0
    [eeafbe40] [c020f420] alg_test_aead+0x50/0xd0
    [eeafbe60] [c020e5e4] alg_test+0x114/0x2e0
    [eeafbee0] [c020bd1c] cryptomgr_test+0x4c/0x60
    [eeafbef0] [c0047058] kthread+0xa8/0xb0
    [eeafbf40] [c000eb0c] ret_from_kernel_thread+0x5c/0x64
    Instruction dump:
    69084321 7d080034 5508d97e 69080001 0f080000 81290024 552807fe 0f080000
    3a600001 5529003a 2f8a0000 40dd0028 3ab50001 8109000c 70e30002
    ---[ end trace b3c3e23925c7484e ]---

    While here, add a tcrypt mode for making it easy to test authenc
    (needed for triggering case above).

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • There are cases when cryptlen can be zero in crypto_ccm_auth():
    -encryptiom: input scatterlist length is zero (no plaintext)
    -decryption: input scatterlist contains only the mac
    plus the condition of having different source and destination buffers
    (or else scatterlist length = max(plaintext_len, ciphertext_len)).

    These are not handled correctly, leading to crashes like:

    root@p4080ds:~/crypto# insmod tcrypt.ko mode=45
    ------------[ cut here ]------------
    kernel BUG at crypto/scatterwalk.c:37!
    Oops: Exception in kernel mode, sig: 5 [#1]
    SMP NR_CPUS=8 P4080 DS
    Modules linked in: tcrypt(+) crc32c xts xcbc vmac pcbc ecb gcm ghash_generic gf128mul ccm ctr seqiv
    CPU: 3 PID: 1082 Comm: cryptomgr_test Not tainted 3.11.0 #14
    task: ee12c5b0 ti: eecd0000 task.ti: eecd0000
    NIP: c0204d98 LR: f9225848 CTR: c0204d80
    REGS: eecd1b70 TRAP: 0700 Not tainted (3.11.0)
    MSR: 00029002 CR: 22044022 XER: 20000000

    GPR00: f9225c94 eecd1c20 ee12c5b0 eecd1c28 ee879400 ee879400 00000000 ee607464
    GPR08: 00000001 00000001 00000000 006b0000 c0204d80 00000000 00000002 c0698e20
    GPR16: ee987000 ee895000 fffffff4 ee879500 00000100 eecd1d58 00000001 00000000
    GPR24: ee879400 00000020 00000000 00000000 ee5b2800 ee607430 00000004 ee607460
    NIP [c0204d98] scatterwalk_start+0x18/0x30
    LR [f9225848] get_data_to_compute+0x28/0x2f0 [ccm]
    Call Trace:
    [eecd1c20] [f9225974] get_data_to_compute+0x154/0x2f0 [ccm] (unreliable)
    [eecd1c70] [f9225c94] crypto_ccm_auth+0x184/0x1d0 [ccm]
    [eecd1cb0] [f9225d40] crypto_ccm_encrypt+0x60/0x2d0 [ccm]
    [eecd1cf0] [c020d77c] __test_aead+0x3ec/0xe20
    [eecd1e20] [c020f35c] test_aead+0x6c/0xe0
    [eecd1e40] [c020f420] alg_test_aead+0x50/0xd0
    [eecd1e60] [c020e5e4] alg_test+0x114/0x2e0
    [eecd1ee0] [c020bd1c] cryptomgr_test+0x4c/0x60
    [eecd1ef0] [c0047058] kthread+0xa8/0xb0
    [eecd1f40] [c000eb0c] ret_from_kernel_thread+0x5c/0x64
    Instruction dump:
    0f080000 81290024 552807fe 0f080000 5529003a 4bffffb4 90830000 39400000
    39000001 8124000c 2f890000 7d28579e 81240008 91230004 4e800020
    ---[ end trace 6d652dfcd1be37bd ]---

    Cc:
    Cc: Jussi Kivilinna
    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • When performing an asynchronous ablkcipher operation the authenc
    completion callback routine is invoked, but it does not locate and use
    the proper IV.

    The callback routine, crypto_authenc_encrypt_done, is updated to use
    the same method of calculating the address of the IV as is done in
    crypto_authenc_encrypt function which sets up the callback.

    Cc: stable@vger.kernel.org
    Signed-off-by: Tom Lendacky
    Signed-off-by: Herbert Xu

    Tom Lendacky
     

24 Nov, 2013

2 commits

  • This reverts commit 09fbc47373826d67531380662b516de2da120545, which
    caused the following build errors:

    crypto/asymmetric_keys/x509_public_key.c: In function ‘x509_key_preparse’:
    crypto/asymmetric_keys/x509_public_key.c:237:35: error: ‘system_trusted_keyring’ undeclared (first use in this function)
    ret = x509_validate_trust(cert, system_trusted_keyring);
    ^
    crypto/asymmetric_keys/x509_public_key.c:237:35: note: each undeclared identifier is reported only once for each function it appears in

    reported by Jim Davis. Mimi says:

    "I made the classic mistake of requesting this patch to be upstreamed
    at the last second, rather than waiting until the next open window.

    At this point, the best course would probably be to revert the two
    commits and fix them for the next open window"

    Reported-by: Jim Davis
    Acked-by: Mimi Zohar
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Pull crypto update from Herbert Xu:
    - Made x86 ablk_helper generic for ARM
    - Phase out chainiv in favour of eseqiv (affects IPsec)
    - Fixed aes-cbc IV corruption on s390
    - Added constant-time crypto_memneq which replaces memcmp
    - Fixed aes-ctr in omap-aes
    - Added OMAP3 ROM RNG support
    - Add PRNG support for MSM SoC's
    - Add and use Job Ring API in caam
    - Misc fixes

    [ NOTE! This pull request was sent within the merge window, but Herbert
    has some questionable email sending setup that makes him public enemy
    #1 as far as gmail is concerned. So most of his emails seem to be
    trapped by gmail as spam, resulting in me not seeing them. - Linus ]

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (49 commits)
    crypto: s390 - Fix aes-cbc IV corruption
    crypto: omap-aes - Fix CTR mode counter length
    crypto: omap-sham - Add missing modalias
    padata: make the sequence counter an atomic_t
    crypto: caam - Modify the interface layers to use JR API's
    crypto: caam - Add API's to allocate/free Job Rings
    crypto: caam - Add Platform driver for Job Ring
    hwrng: msm - Add PRNG support for MSM SoC's
    ARM: DT: msm: Add Qualcomm's PRNG driver binding document
    crypto: skcipher - Use eseqiv even on UP machines
    crypto: talitos - Simplify key parsing
    crypto: picoxcell - Simplify and harden key parsing
    crypto: ixp4xx - Simplify and harden key parsing
    crypto: authencesn - Simplify key parsing
    crypto: authenc - Export key parsing helper function
    crypto: mv_cesa: remove deprecated IRQF_DISABLED
    hwrng: OMAP3 ROM Random Number Generator support
    crypto: sha256_ssse3 - also test for BMI2
    crypto: mv_cesa - Remove redundant of_match_ptr
    crypto: sahara - Remove redundant of_match_ptr
    ...

    Linus Torvalds