06 Nov, 2015

1 commit

  • Pull security subsystem update from James Morris:
    "This is mostly maintenance updates across the subsystem, with a
    notable update for TPM 2.0, and addition of Jarkko Sakkinen as a
    maintainer of that"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (40 commits)
    apparmor: clarify CRYPTO dependency
    selinux: Use a kmem_cache for allocation struct file_security_struct
    selinux: ioctl_has_perm should be static
    selinux: use sprintf return value
    selinux: use kstrdup() in security_get_bools()
    selinux: use kmemdup in security_sid_to_context_core()
    selinux: remove pointless cast in selinux_inode_setsecurity()
    selinux: introduce security_context_str_to_sid
    selinux: do not check open perm on ftruncate call
    selinux: change CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE default
    KEYS: Merge the type-specific data with the payload data
    KEYS: Provide a script to extract a module signature
    KEYS: Provide a script to extract the sys cert list from a vmlinux file
    keys: Be more consistent in selection of union members used
    certs: add .gitignore to stop git nagging about x509_certificate_list
    KEYS: use kvfree() in add_key
    Smack: limited capability for changing process label
    TPM: remove unnecessary little endian conversion
    vTPM: support little endian guests
    char: Drop owner assignment from i2c_driver
    ...

    Linus Torvalds
     

05 Nov, 2015

1 commit

  • Pull crypto update from Herbert Xu:
    "API:

    - Add support for cipher output IVs in testmgr
    - Add missing crypto_ahash_blocksize helper
    - Mark authenc and des ciphers as not allowed under FIPS.

    Algorithms:

    - Add CRC support to 842 compression
    - Add keywrap algorithm
    - A number of changes to the akcipher interface:
    + Separate functions for setting public/private keys.
    + Use SG lists.

    Drivers:

    - Add Intel SHA Extension optimised SHA1 and SHA256
    - Use dma_map_sg instead of custom functions in crypto drivers
    - Add support for STM32 RNG
    - Add support for ST RNG
    - Add Device Tree support to exynos RNG driver
    - Add support for mxs-dcp crypto device on MX6SL
    - Add xts(aes) support to caam
    - Add ctr(aes) and xts(aes) support to qat
    - A large set of fixes from Russell King for the marvell/cesa driver"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (115 commits)
    crypto: asymmetric_keys - Fix unaligned access in x509_get_sig_params()
    crypto: akcipher - Don't #include crypto/public_key.h as the contents aren't used
    hwrng: exynos - Add Device Tree support
    hwrng: exynos - Fix missing configuration after suspend to RAM
    hwrng: exynos - Add timeout for waiting on init done
    dt-bindings: rng: Describe Exynos4 PRNG bindings
    crypto: marvell/cesa - use __le32 for hardware descriptors
    crypto: marvell/cesa - fix missing cpu_to_le32() in mv_cesa_dma_add_op()
    crypto: marvell/cesa - use memcpy_fromio()/memcpy_toio()
    crypto: marvell/cesa - use gfp_t for gfp flags
    crypto: marvell/cesa - use dma_addr_t for cur_dma
    crypto: marvell/cesa - use readl_relaxed()/writel_relaxed()
    crypto: caam - fix indentation of close braces
    crypto: caam - only export the state we really need to export
    crypto: caam - fix non-block aligned hash calculation
    crypto: caam - avoid needlessly saving and restoring caam_hash_ctx
    crypto: caam - print errno code when hash registration fails
    crypto: marvell/cesa - fix memory leak
    crypto: marvell/cesa - fix first-fragment handling in mv_cesa_ahash_dma_last_req()
    crypto: marvell/cesa - rearrange handling for sw padded hashes
    ...

    Linus Torvalds
     

28 Oct, 2015

1 commit


21 Oct, 2015

1 commit

  • Merge the type-specific data with the payload data into one four-word chunk
    as it seems pointless to keep them separate.

    Use user_key_payload() for accessing the payloads of overloaded
    user-defined keys.

    Signed-off-by: David Howells
    cc: linux-cifs@vger.kernel.org
    cc: ecryptfs@vger.kernel.org
    cc: linux-ext4@vger.kernel.org
    cc: linux-f2fs-devel@lists.sourceforge.net
    cc: linux-nfs@vger.kernel.org
    cc: ceph-devel@vger.kernel.org
    cc: linux-ima-devel@lists.sourceforge.net

    David Howells
     

20 Oct, 2015

3 commits

  • x509_get_sig_params() has the same code pattern as the one in
    pkcs7_verify() that is fixed by commit 62f57d05e287 ("crypto: pkcs7 - Fix
    unaligned access in pkcs7_verify()") so apply a similar fix here: make
    sure that desc is pointing at an algined value past the digest_size,
    and take alignment values into consideration when doing kzalloc()

    Signed-off-by: Sowmini Varadhan
    Acked-by: David Howells
    Signed-off-by: Herbert Xu

    Sowmini Varadhan
     
  • Don't #include crypto/public_key.h in akcipher as the contents of the
    header aren't used and changes in a future patch cause it to fail to
    compile if CONFIG_KEYS=n.

    Signed-off-by: David Howells
    Signed-off-by: Herbert Xu

    David Howells
     
  • 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.

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

    Herbert Xu
     

15 Oct, 2015

4 commits

  • The testmanager code for symmetric ciphers is extended to allow
    verification of the IV after a cipher operation.

    In addition, test vectors for kw(aes) for encryption and decryption are
    added.

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

    Stephan Mueller
     
  • Hook keywrap source code into Kconfig and Makefile

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

    Stephan Mueller
     
  • This patch implements the AES key wrapping as specified in
    NIST SP800-38F and RFC3394.

    The implementation covers key wrapping without padding.

    IV handling: The caller does not provide an IV for encryption,
    but must obtain the IV after encryption which would serve as the first
    semblock in the ciphertext structure defined by SP800-38F. Conversely,
    for decryption, the caller must provide the first semiblock of the data
    as the IV and the following blocks as ciphertext.

    The key wrapping is an authenticated decryption operation. The caller
    will receive EBADMSG during decryption if the authentication failed.

    Albeit the standards define the key wrapping for AES only, the template
    can be used with any other block cipher that has a block size of 16
    bytes. During initialization of the template, that condition is checked.
    Any cipher not having a block size of 16 bytes will cause the
    initialization to fail.

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

    Stephan Mueller
     
  • The crypto drivers are supposed to update the IV passed to the crypto
    request before calling the completion callback.
    Test for the IV value before considering the test as successful.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Herbert Xu

    Boris BREZILLON
     

14 Oct, 2015

4 commits

  • On sparc, we see unaligned access messages on each modprobe[-r]:

    Kernel unaligned access at TPC[6ad9b4] pkcs7_verify [..]
    Kernel unaligned access at TPC[6a5484] crypto_shash_finup [..]
    Kernel unaligned access at TPC[6a5390] crypto_shash_update [..]
    Kernel unaligned access at TPC[10150308] sha1_sparc64_update [..]
    Kernel unaligned access at TPC[101501ac] __sha1_sparc64_update [..]

    These ware triggered by mod_verify_sig() invocations of pkcs_verify(), and
    are are being caused by an unaligned desc at (sha1, digest_size is 0x14)
    desc = digest + digest_size;

    To fix this, pkcs7_verify needs to make sure that desc is pointing
    at an aligned value past the digest_size, and kzalloc appropriately,
    taking alignment values into consideration.

    Signed-off-by: Sowmini Varadhan
    Signed-off-by: Herbert Xu

    Sowmini Varadhan
     
  • The clocksource does not provide clocksource_register() function since
    f893598 commit (clocksource: Mostly kill clocksource_register()), so
    let's remove unnecessary information about this function from a comment.

    Signed-off-by: Alexander Kuleshov
    Suggested-by: Herbert Xu
    Signed-off-by: Herbert Xu

    Alexander Kuleshov
     
  • Setkey function has been split into set_priv_key and set_pub_key.
    Akcipher requests takes sgl for src and dst instead of void *.
    Users of the API i.e. two existing RSA implementation and
    test mgr code have been updated accordingly.

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

    Tadeusz Struk
     
  • Pull crypto fixes from Herbert Xu:
    "This fixes the following issues:

    - Fix AVX detection to prevent use of non-existent AESNI.

    - Some SPARC ciphers did not set their IV size which may lead to
    memory corruption"

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: ahash - ensure statesize is non-zero
    crypto: camellia_aesni_avx - Fix CPU feature checks
    crypto: sparc - initialize blkcipher.ivsize

    Linus Torvalds
     

13 Oct, 2015

1 commit

  • Unlike shash algorithms, ahash drivers must implement export
    and import as their descriptors may contain hardware state and
    cannot be exported as is. Unfortunately some ahash drivers did
    not provide them and end up causing crashes with algif_hash.

    This patch adds a check to prevent these drivers from registering
    ahash algorithms until they are fixed.

    Cc: stable@vger.kernel.org
    Signed-off-by: Russell King
    Signed-off-by: Herbert Xu

    Russell King
     

01 Oct, 2015

2 commits


25 Sep, 2015

1 commit

  • Don't strip leading zeros from the crypto key ID when using it to construct
    the struct key description as the signature in kernels up to and including
    4.2 matched this aspect of the key. This means that 1 in 256 keys won't
    actually match if their key ID begins with 00.

    The key ID is stored in the module signature as binary and so must be
    converted to text in order to invoke request_key() - but it isn't stripped
    at this point.

    Something like this is likely to be observed in dmesg when the key is loaded:

    [ 1.572423] Loaded X.509 cert 'Build time autogenerated kernel
    key: 62a7c3d2da278be024da4af8652c071f3fea33'

    followed by this when we try and use it:

    [ 1.646153] Request for unknown module key 'Build time autogenerated
    kernel key: 0062a7c3d2da278be024da4af8652c071f3fea33' err -11

    The 'Loaded' line should show an extra '00' on the front of the hex string.

    This problem should not affect 4.3-rc1 and onwards because there the key
    should be matched on one of its auxiliary identities rather than the key
    struct's description string.

    Reported-by: Arjan van de Ven
    Reported-by: Andy Whitcroft
    Signed-off-by: David Howells

    David Howells
     

21 Sep, 2015

3 commits

  • This patch provides the configuration and build support to
    include and build the optimized SHA1 and SHA256 update transforms
    for the kernel's crypto library.

    Originally-by: Chandramouli Narayanan
    Signed-off-by: Tim Chen
    Acked-by: David S. Miller
    Signed-off-by: Herbert Xu

    Tim
     
  • hour, min and sec are unsigned int and they can never be less than zero.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Herbert Xu

    sudip
     
  • The output buffer in test_ahash_speed will point to an address located
    within the tcrypt module image.
    This causes problems when trying to DMA map the buffer.
    For e.g. on ARM-based LS1021A, a page fault occurs within the
    DMA API when trying to access the struct page returned by
    virt_to_page(output):

    insmod tcrypt.ko mode=403

    testing speed of async sha1 (sha1-caam)
    test 0 ( 16 byte blocks, 16 bytes per update, 1 updates):
    Unable to handle kernel paging request at virtual address f07e9080
    pgd = e58d0e00
    [f07e9080] *pgd=80000080007003, *pmd=00000000
    Internal error: Oops: 206 [#1] SMP THUMB2
    Modules linked in: tcrypt(+)
    CPU: 1 PID: 1119 Comm: insmod Not tainted 4.2.0-rc1-256134-gbf433416e675 #1
    Hardware name: Freescale LS1021A
    task: ea063900 ti: e5a34000 task.ti: e5a34000
    PC is at dma_cache_maint_page+0x38/0xd0
    LR is at __dma_page_cpu_to_dev+0x15/0x64
    pc : [] lr : [] psr: 000f0033
    sp : e5a35ca0 ip : 8063df00 fp : f07e9080
    r10: 00000cd0 r9 : 8063df00 r8 : 805a2f04
    r7 : 0017f804 r6 : 00000002 r5 : ee7f9000 r4 : 00000014
    r3 : 80612d40 r2 : 01ff0080 r1 : 00000380 r0 : ee7f9000
    Flags: nzcv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
    Control: 70c5387d Table: e58d0e00 DAC: 9b7ede70
    Process insmod (pid: 1119, stack limit = 0xe5a34210)
    Stack: (0xe5a35ca0 to 0xe5a36000)
    [...]
    [] (dma_cache_maint_page) from [] (__dma_page_cpu_to_dev+0x15/0x64)
    [] (__dma_page_cpu_to_dev) from [] (arm_dma_map_page+0x1f/0x44)
    [] (arm_dma_map_page) from [] (ahash_digest+0x35f/0x510)
    [] (ahash_digest) from [] (test_ahash_speed.constprop.6+0x24a/0x4e4 [tcrypt])
    [] (test_ahash_speed.constprop.6 [tcrypt]) from [] (do_test+0x1898/0x2058 [tcrypt])
    [] (do_test [tcrypt]) from [] (tcrypt_mod_init+0x2e/0x63 [tcrypt])
    [] (tcrypt_mod_init [tcrypt]) from [] (do_one_initcall+0xb3/0x134)
    [] (do_one_initcall) from [] (do_init_module+0x3b/0x13c)
    [] (do_init_module) from [] (load_module+0x97b/0x9dc)
    [] (load_module) from [] (SyS_finit_module+0x35/0x3e)
    [] (SyS_finit_module) from [] (ret_fast_syscall+0x1/0x4c)
    Code: 1aba 0152 eb00 0b02 (5882) 0f92

    addr2line -f -i -e vmlinux 800155a0
    page_zonenum
    include/linux/mm.h:728
    page_zone
    include/linux/mm.h:881
    dma_cache_maint_page
    arch/arm/mm/dma-mapping.c:822

    Signed-off-by: Horia Geant?
    Signed-off-by: Herbert Xu

    Horia Geant?
     

16 Sep, 2015

1 commit

  • Pull crypto fixes from Herbert Xu:
    "This fixes the following issues:

    - The selftest overreads the IV test vector.

    - Fix potential infinite loop in sunxi-ss driver.

    - Fix powerpc build failure when VMX is set without VSX"

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: testmgr - don't copy from source IV too much
    crypto: sunxi-ss - Fix a possible driver hang with ciphers
    crypto: vmx - VMX crypto should depend on CONFIG_VSX

    Linus Torvalds
     

11 Sep, 2015

1 commit


09 Sep, 2015

1 commit

  • Pull security subsystem updates from James Morris:
    "Highlights:

    - PKCS#7 support added to support signed kexec, also utilized for
    module signing. See comments in 3f1e1bea.

    ** NOTE: this requires linking against the OpenSSL library, which
    must be installed, e.g. the openssl-devel on Fedora **

    - Smack
    - add IPv6 host labeling; ignore labels on kernel threads
    - support smack labeling mounts which use binary mount data

    - SELinux:
    - add ioctl whitelisting (see
    http://kernsec.org/files/lss2015/vanderstoep.pdf)
    - fix mprotect PROT_EXEC regression caused by mm change

    - Seccomp:
    - add ptrace options for suspend/resume"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (57 commits)
    PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos and use them
    Documentation/Changes: Now need OpenSSL devel packages for module signing
    scripts: add extract-cert and sign-file to .gitignore
    modsign: Handle signing key in source tree
    modsign: Use if_changed rule for extracting cert from module signing key
    Move certificate handling to its own directory
    sign-file: Fix warning about BIO_reset() return value
    PKCS#7: Add MODULE_LICENSE() to test module
    Smack - Fix build error with bringup unconfigured
    sign-file: Document dependency on OpenSSL devel libraries
    PKCS#7: Appropriately restrict authenticated attributes and content type
    KEYS: Add a name for PKEY_ID_PKCS7
    PKCS#7: Improve and export the X.509 ASN.1 time object decoder
    modsign: Use extract-cert to process CONFIG_SYSTEM_TRUSTED_KEYS
    extract-cert: Cope with multiple X.509 certificates in a single file
    sign-file: Generate CMS message as signature instead of PKCS#7
    PKCS#7: Support CMS messages also [RFC5652]
    X.509: Change recorded SKID & AKID to not include Subject or Issuer
    PKCS#7: Check content type and versions
    MAINTAINERS: The keyrings mailing list has moved
    ...

    Linus Torvalds
     

03 Sep, 2015

1 commit

  • Pull SG updates from Jens Axboe:
    "This contains a set of scatter-gather related changes/fixes for 4.3:

    - Add support for limited chaining of sg tables even for
    architectures that do not set ARCH_HAS_SG_CHAIN. From Christoph.

    - Add sg chain support to target_rd. From Christoph.

    - Fixup open coded sg->page_link in crypto/omap-sham. From
    Christoph.

    - Fixup open coded crypto ->page_link manipulation. From Dan.

    - Also from Dan, automated fixup of manual sg_unmark_end()
    manipulations.

    - Also from Dan, automated fixup of open coded sg_phys()
    implementations.

    - From Robert Jarzmik, addition of an sg table splitting helper that
    drivers can use"

    * 'for-4.3/sg' of git://git.kernel.dk/linux-block:
    lib: scatterlist: add sg splitting function
    scatterlist: use sg_phys()
    crypto/omap-sham: remove an open coded access to ->page_link
    scatterlist: remove open coded sg_unmark_end instances
    crypto: replace scatterwalk_sg_chain with sg_chain
    target/rd: always chain S/G list
    scatterlist: allow limited chaining without ARCH_HAS_SG_CHAIN

    Linus Torvalds
     

01 Sep, 2015

1 commit

  • Add OIDs for sha224, sha284 and sha512 hash algos and use them to select
    the hashing algorithm. Without this, something like the following error
    might get written to dmesg:

    [ 31.829322] PKCS7: Unknown OID: [32] 2.16.840.1.101.3.4.2.3
    [ 31.829328] PKCS7: Unknown OID: [180] 2.16.840.1.101.3.4.2.3
    [ 31.829330] Unsupported digest algo: 55

    Where the 55 on the third line is OID__NR indicating an unknown OID.

    Reported-by: Valdis Kletnieks
    Signed-off-by: David Howells
    Tested-By: Valdis Kletnieks
    Signed-off-by: James Morris

    David Howells
     

25 Aug, 2015

1 commit


21 Aug, 2015

2 commits

  • This patch replaces uses of blkcipher and ablkcipher with the
    new skcipher interface.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch introduces the crypto skcipher interface which aims
    to replace both blkcipher and ablkcipher.

    It's very similar to the existing ablkcipher interface. The
    main difference is the removal of the givcrypt interface. In
    order to make the transition easier for blkcipher users, there
    is a helper SKCIPHER_REQUEST_ON_STACK which can be used to place
    a request on the stack for synchronous transforms.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

19 Aug, 2015

1 commit


17 Aug, 2015

9 commits