10 Nov, 2015

1 commit

  • commit 3fc89adb9fa4beff31374a4bf50b3d099d88ae83 upstream.

    Currently a number of Crypto API operations may fail when a signal
    occurs. This causes nasty problems as the caller of those operations
    are often not in a good position to restart the operation.

    In fact there is currently no need for those operations to be
    interrupted by user signals at all. All we need is for them to
    be killable.

    This patch replaces the relevant calls of signal_pending with
    fatal_signal_pending, and wait_for_completion_interruptible with
    wait_for_completion_killable, respectively.

    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     

08 Apr, 2015

1 commit

  • The function crypto_alg_match returns an algorithm without taking
    any references on it. This means that the algorithm can be freed
    at any time, therefore all users of crypto_alg_match are buggy.

    This patch fixes this by taking a reference count on the algorithm
    to prevent such races.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

03 Apr, 2015

1 commit


26 Nov, 2014

1 commit


24 Nov, 2014

1 commit


08 Jun, 2014

1 commit

  • 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
     

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
     

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
     

10 Mar, 2013

1 commit


19 Feb, 2013

3 commits

  • To avoid misuse, ensure cru_name and cru_driver_name are always
    nul-terminated strings.

    Signed-off-by: Mathias Krause
    Signed-off-by: Herbert Xu

    Mathias Krause
     
  • The current test for empty strings fails because it is testing the
    address of a field, not a pointer. So the test will always be true.
    Test the first character in the string to not be null instead.

    Signed-off-by: Mathias Krause
    Cc: Steffen Klassert
    Signed-off-by: Herbert Xu

    Mathias Krause
     
  • Three errors resulting in kernel memory disclosure:

    1/ The structures used for the netlink based crypto algorithm report API
    are located on the stack. As snprintf() does not fill the remainder of
    the buffer with null bytes, those stack bytes will be disclosed to users
    of the API. Switch to strncpy() to fix this.

    2/ crypto_report_one() does not initialize all field of struct
    crypto_user_alg. Fix this to fix the heap info leak.

    3/ For the module name we should copy only as many bytes as
    module_name() returns -- not as much as the destination buffer could
    hold. But the current code does not and therefore copies random data
    from behind the end of the module name, as the module name is always
    shorter than CRYPTO_MAX_ALG_NAME.

    Also switch to use strncpy() to copy the algorithm's name and
    driver_name. They are strings, after all.

    Signed-off-by: Mathias Krause
    Cc: Steffen Klassert
    Signed-off-by: Herbert Xu

    Mathias Krause
     

05 Oct, 2012

1 commit

  • Pull crypto update from Herbert Xu:
    - Optimised AES/SHA1 for ARM.
    - IPsec ESN support in talitos and caam.
    - x86_64/avx implementation of cast5/cast6.
    - Add/use multi-algorithm registration helpers where possible.
    - Added IBM Power7+ in-Nest support.
    - Misc fixes.

    Fix up trivial conflicts in crypto/Kconfig due to the sparc64 crypto
    config options being added next to the new ARM ones.

    [ Side note: cut-and-paste duplicate help texts make those conflicts
    harder to read than necessary, thanks to git being smart about
    minimizing conflicts and maximizing the common parts... ]

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (71 commits)
    crypto: x86/glue_helper - fix storing of new IV in CBC encryption
    crypto: cast5/avx - fix storing of new IV in CBC encryption
    crypto: tcrypt - add missing tests for camellia and ghash
    crypto: testmgr - make test_aead also test 'dst != src' code paths
    crypto: testmgr - make test_skcipher also test 'dst != src' code paths
    crypto: testmgr - add test vectors for CTR mode IV increasement
    crypto: testmgr - add test vectors for partial ctr(cast5) and ctr(cast6)
    crypto: testmgr - allow non-multi page and multi page skcipher tests from same test template
    crypto: caam - increase TRNG clocks per sample
    crypto, tcrypt: remove local_bh_disable/enable() around local_irq_disable/enable()
    crypto: tegra-aes - fix error return code
    crypto: crypto4xx - fix error return code
    crypto: hifn_795x - fix error return code
    crypto: ux500 - fix error return code
    crypto: caam - fix error IDs for SEC v5.x RNG4
    hwrng: mxc-rnga - Access data via structure
    hwrng: mxc-rnga - Adapt clocks to new i.mx clock framework
    crypto: caam - add IPsec ESN support
    crypto: 842 - remove .cra_list initialization
    Revert "[CRYPTO] cast6: inline bloat--"
    ...

    Linus Torvalds
     

11 Sep, 2012

1 commit

  • It is a frequent mistake to confuse the netlink port identifier with a
    process identifier. Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

    Signed-off-by: "Eric W. Biederman"
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

09 Sep, 2012

1 commit


07 Sep, 2012

1 commit


30 Jun, 2012

1 commit

  • This patch adds the following structure:

    struct netlink_kernel_cfg {
    unsigned int groups;
    void (*input)(struct sk_buff *skb);
    struct mutex *cb_mutex;
    };

    That can be passed to netlink_kernel_create to set optional configurations
    for netlink kernel sockets.

    I've populated this structure by looking for NULL and zero parameters at the
    existing code. The remaining parameters that always need to be set are still
    left in the original interface.

    That includes optional parameters for the netlink socket creation. This allows
    easy extensibility of this interface in the future.

    This patch also adapts all callers to use this new interface.

    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: David S. Miller

    Pablo Neira Ayuso
     

11 Apr, 2012

1 commit


02 Apr, 2012

1 commit


29 Mar, 2012

2 commits

  • The default netlink message size limit might be exceeded when dumping a
    lot of algorithms to userspace. As a result, not all of the instantiated
    algorithms dumped to userspace. So calculate an upper bound on the message
    size and call netlink_dump_start() with that value.

    Signed-off-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Steffen Klassert
     
  • We lookup algorithms with crypto_alg_mod_lookup() when instantiating via
    crypto_add_alg(). However, algorithms that are wrapped by an IV genearator
    (e.g. aead or genicv type algorithms) need special care. The userspace
    process hangs until it gets a timeout when we use crypto_alg_mod_lookup()
    to lookup these algorithms. So export the lookup functions for these
    algorithms and use them in crypto_add_alg().

    Signed-off-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Steffen Klassert
     

22 Mar, 2012

1 commit

  • Pull crypto update from Herbert Xu:
    "* sha512 bug fixes (already in your tree).
    * SHA224/SHA384 AEAD support in caam.
    * X86-64 optimised version of Camellia.
    * Tegra AES support.
    * Bulk algorithm registration interface to make driver registration easier.
    * padata race fixes.
    * Misc fixes."

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (31 commits)
    padata: Fix race on sequence number wrap
    padata: Fix race in the serialization path
    crypto: camellia - add assembler implementation for x86_64
    crypto: camellia - rename camellia.c to camellia_generic.c
    crypto: camellia - fix checkpatch warnings
    crypto: camellia - rename camellia module to camellia_generic
    crypto: tcrypt - add more camellia tests
    crypto: testmgr - add more camellia test vectors
    crypto: camellia - simplify key setup and CAMELLIA_ROUNDSM macro
    crypto: twofish-x86_64/i586 - set alignmask to zero
    crypto: blowfish-x86_64 - set alignmask to zero
    crypto: serpent-sse2 - combine ablk_*_init functions
    crypto: blowfish-x86_64 - use crypto_[un]register_algs
    crypto: twofish-x86_64-3way - use crypto_[un]register_algs
    crypto: serpent-sse2 - use crypto_[un]register_algs
    crypto: serpent-sse2 - remove dead code from serpent_sse2_glue.c::serpent_sse2_init()
    crypto: twofish-x86 - Remove dead code from twofish_glue_3way.c::init()
    crypto: In crypto_add_alg(), 'exact' wants to be initialized to 0
    crypto: caam - fix gcc 4.6 warning
    crypto: Add bulk algorithm registration interface
    ...

    Linus Torvalds
     

27 Feb, 2012

1 commit


05 Feb, 2012

1 commit

  • We declare 'exact' without initializing it and then do:

    [...]
    if (strlen(p->cru_driver_name))
    exact = 1;

    if (priority && !exact)
    return -EINVAL;

    [...]

    If the first 'if' is not true, then the second will test an
    uninitialized 'exact'.
    As far as I can tell, what we want is for 'exact' to be initialized to
    0 (zero/false).

    Signed-off-by: Jesper Juhl
    Acked-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Jesper Juhl
     

15 Jan, 2012

1 commit

  • * 'for-linus' of git://selinuxproject.org/~jmorris/linux-security:
    capabilities: remove __cap_full_set definition
    security: remove the security_netlink_recv hook as it is equivalent to capable()
    ptrace: do not audit capability check when outputing /proc/pid/stat
    capabilities: remove task_ns_* functions
    capabitlies: ns_capable can use the cap helpers rather than lsm call
    capabilities: style only - move capable below ns_capable
    capabilites: introduce new has_ns_capabilities_noaudit
    capabilities: call has_ns_capability from has_capability
    capabilities: remove all _real_ interfaces
    capabilities: introduce security_capable_noaudit
    capabilities: reverse arguments to security_capable
    capabilities: remove the task from capable LSM hook entirely
    selinux: sparse fix: fix several warnings in the security server cod
    selinux: sparse fix: fix warnings in netlink code
    selinux: sparse fix: eliminate warnings for selinuxfs
    selinux: sparse fix: declare selinux_disable() in security.h
    selinux: sparse fix: move selinux_complete_init
    selinux: sparse fix: make selinux_secmark_refcount static
    SELinux: Fix RCU deref check warning in sel_netport_insert()

    Manually fix up a semantic mis-merge wrt security_netlink_recv():

    - the interface was removed in commit fd7784615248 ("security: remove
    the security_netlink_recv hook as it is equivalent to capable()")

    - a new user of it appeared in commit a38f7907b926 ("crypto: Add
    userspace configuration API")

    causing no automatic merge conflict, but Eric Paris pointed out the
    issue.

    Linus Torvalds
     

11 Jan, 2012

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (54 commits)
    crypto: gf128mul - remove leftover "(EXPERIMENTAL)" in Kconfig
    crypto: serpent-sse2 - remove unneeded LRW/XTS #ifdefs
    crypto: serpent-sse2 - select LRW and XTS
    crypto: twofish-x86_64-3way - remove unneeded LRW/XTS #ifdefs
    crypto: twofish-x86_64-3way - select LRW and XTS
    crypto: xts - remove dependency on EXPERIMENTAL
    crypto: lrw - remove dependency on EXPERIMENTAL
    crypto: picoxcell - fix boolean and / or confusion
    crypto: caam - remove DECO access initialization code
    crypto: caam - fix polarity of "propagate error" logic
    crypto: caam - more desc.h cleanups
    crypto: caam - desc.h - convert spaces to tabs
    crypto: talitos - convert talitos_error to struct device
    crypto: talitos - remove NO_IRQ references
    crypto: talitos - fix bad kfree
    crypto: convert drivers/crypto/* to use module_platform_driver()
    char: hw_random: convert drivers/char/hw_random/* to use module_platform_driver()
    crypto: serpent-sse2 - should select CRYPTO_CRYPTD
    crypto: serpent - rename serpent.c to serpent_generic.c
    crypto: serpent - cleanup checkpatch errors and warnings
    ...

    Linus Torvalds
     

09 Nov, 2011

1 commit

  • We leak the crypto instance when we unregister an instance with
    crypto_del_alg(). Therefore we introduce crypto_unregister_instance()
    to unlink the crypto instance from the template's instances list and
    to free the recources of the instance properly.

    Signed-off-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Steffen Klassert
     

02 Nov, 2011

1 commit

  • The list_empty case in crypto_alg_match() will return without calling
    up_read() on crypto_alg_sem. We could do the "goto out" routine, but the
    function will clearly do the right thing with that test simply removed.

    Signed-off-by: Jonathan Corbet
    Signed-off-by: Herbert Xu

    Jonathan Corbet
     

21 Oct, 2011

6 commits