06 Aug, 2014

2 commits

  • Pull security subsystem updates from James Morris:
    "In this release:

    - PKCS#7 parser for the key management subsystem from David Howells
    - appoint Kees Cook as seccomp maintainer
    - bugfixes and general maintenance across the subsystem"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (94 commits)
    X.509: Need to export x509_request_asymmetric_key()
    netlabel: shorter names for the NetLabel catmap funcs/structs
    netlabel: fix the catmap walking functions
    netlabel: fix the horribly broken catmap functions
    netlabel: fix a problem when setting bits below the previously lowest bit
    PKCS#7: X.509 certificate issuer and subject are mandatory fields in the ASN.1
    tpm: simplify code by using %*phN specifier
    tpm: Provide a generic means to override the chip returned timeouts
    tpm: missing tpm_chip_put in tpm_get_random()
    tpm: Properly clean sysfs entries in error path
    tpm: Add missing tpm_do_selftest to ST33 I2C driver
    PKCS#7: Use x509_request_asymmetric_key()
    Revert "selinux: fix the default socket labeling in sock_graft()"
    X.509: x509_request_asymmetric_keys() doesn't need string length arguments
    PKCS#7: fix sparse non static symbol warning
    KEYS: revert encrypted key change
    ima: add support for measuring and appraising firmware
    firmware_class: perform new LSM checks
    security: introduce kernel_fw_from_file hook
    PKCS#7: Missing inclusion of linux/err.h
    ...

    Linus Torvalds
     
  • Pull ARM updates from Russell King:
    "Included in this update:

    - perf updates from Will Deacon:

    The main changes are callchain stability fixes from Jean Pihet and
    event mapping and PMU name rework from Mark Rutland

    The latter is preparatory work for enabling some code re-use with
    arm64 in the future.

    - updates for nommu from Uwe Kleine-König:

    Two different fixes for the same problem making some ARM nommu
    configurations not boot since 3.6-rc1. The problem is that
    user_addr_max returned the biggest available RAM address which
    makes some copy_from_user variants fail to read from XIP memory.

    - deprecate legacy OMAP DMA API, in preparation for it's removal.

    The popular drivers have been converted over, leaving a very small
    number of rarely used drivers, which hopefully can be converted
    during the next cycle with a bit more visibility (and hopefully
    people popping out of the woodwork to help test)

    - more tweaks for BE systems, particularly with the kernel image
    format. In connection with this, I've cleaned up the way we
    generate the linker script for the decompressor.

    - removal of hard-coded assumptions of the kernel stack size, making
    everywhere depend on the value of THREAD_SIZE_ORDER.

    - MCPM updates from Nicolas Pitre.

    - Make it easier for proper CPU part number checks (which should
    always include the vendor field).

    - Assembly code optimisation - use the "bx" instruction when
    returning from a function on ARMv6+ rather than "mov pc, reg".

    - Save the last kernel misaligned fault location and report it via
    the procfs alignment file.

    - Clean up the way we create the initial stack frame, which is a
    repeated pattern in several different locations.

    - Support for 8-byte get_user(), needed for some DRM implementations.

    - mcs locking from Will Deacon.

    - Save and restore a few more Cortex-A9 registers (for errata
    workarounds)

    - Fix various aspects of the SWP emulation, and the ELF hwcap for the
    SWP instruction.

    - Update LPAE logic for pte_write and pmd_write to make it more
    correct.

    - Support for Broadcom Brahma15 CPU cores.

    - ARM assembly crypto updates from Ard Biesheuvel"

    * 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: (53 commits)
    ARM: add comments to the early page table remap code
    ARM: 8122/1: smp_scu: enable SCU standby support
    ARM: 8121/1: smp_scu: use macro for SCU enable bit
    ARM: 8120/1: crypto: sha512: add ARM NEON implementation
    ARM: 8119/1: crypto: sha1: add ARM NEON implementation
    ARM: 8118/1: crypto: sha1/make use of common SHA-1 structures
    ARM: 8113/1: remove remaining definitions of PLAT_PHYS_OFFSET from
    ARM: 8111/1: Enable erratum 798181 for Broadcom Brahma-B15
    ARM: 8110/1: do CPU-specific init for Broadcom Brahma15 cores
    ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE
    ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear
    ARM: hwcap: disable HWCAP_SWP if the CPU advertises it has exclusives
    ARM: SWP emulation: only initialise on ARMv7 CPUs
    ARM: SWP emulation: always enable when SMP is enabled
    ARM: 8103/1: save/restore Cortex-A9 CP15 registers on suspend/resume
    ARM: 8098/1: mcs lock: implement wfe-based polling for MCS locking
    ARM: 8091/2: add get_user() support for 8 byte types
    ARM: 8097/1: unistd.h: relocate comments back to place
    ARM: 8096/1: Describe required sort order for textofs-y (TEXT_OFFSET)
    ARM: 8090/1: add revision info for PL310 errata 588369 and 727915
    ...

    Linus Torvalds
     

05 Aug, 2014

1 commit

  • Pull crypto update from Herbert Xu:
    - CTR(AES) optimisation on x86_64 using "by8" AVX.
    - arm64 support to ccp
    - Intel QAT crypto driver
    - Qualcomm crypto engine driver
    - x86-64 assembly optimisation for 3DES
    - CTR(3DES) speed test
    - move FIPS panic from module.c so that it only triggers on crypto
    modules
    - SP800-90A Deterministic Random Bit Generator (drbg).
    - more test vectors for ghash.
    - tweak self tests to catch partial block bugs.
    - misc fixes.

    * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (94 commits)
    crypto: drbg - fix failure of generating multiple of 2**16 bytes
    crypto: ccp - Do not sign extend input data to CCP
    crypto: testmgr - add missing spaces to drbg error strings
    crypto: atmel-tdes - Switch to managed version of kzalloc
    crypto: atmel-sha - Switch to managed version of kzalloc
    crypto: testmgr - use chunks smaller than algo block size in chunk tests
    crypto: qat - Fixed SKU1 dev issue
    crypto: qat - Use hweight for bit counting
    crypto: qat - Updated print outputs
    crypto: qat - change ae_num to ae_id
    crypto: qat - change slice->regions to slice->region
    crypto: qat - use min_t macro
    crypto: qat - remove unnecessary parentheses
    crypto: qat - remove unneeded header
    crypto: qat - checkpatch blank lines
    crypto: qat - remove unnecessary return codes
    crypto: Resolve shadow warnings
    crypto: ccp - Remove "select OF" from Kconfig
    crypto: caam - fix DECO RSR polling
    crypto: qce - Let 'DEV_QCE' depend on both HAS_DMA and HAS_IOMEM
    ...

    Linus Torvalds
     

03 Aug, 2014

1 commit


02 Aug, 2014

2 commits

  • This patch adds ARM NEON assembly implementation of SHA-512 and SHA-384
    algorithms.

    tcrypt benchmark results on Cortex-A8, sha512-generic vs sha512-neon-asm:

    block-size bytes/update old-vs-new
    16 16 2.99x
    64 16 2.67x
    64 64 3.00x
    256 16 2.64x
    256 64 3.06x
    256 256 3.33x
    1024 16 2.53x
    1024 256 3.39x
    1024 1024 3.52x
    2048 16 2.50x
    2048 256 3.41x
    2048 1024 3.54x
    2048 2048 3.57x
    4096 16 2.49x
    4096 256 3.42x
    4096 1024 3.56x
    4096 4096 3.59x
    8192 16 2.48x
    8192 256 3.42x
    8192 1024 3.56x
    8192 4096 3.60x
    8192 8192 3.60x

    Acked-by: Ard Biesheuvel
    Tested-by: Ard Biesheuvel
    Signed-off-by: Jussi Kivilinna
    Signed-off-by: Russell King

    Jussi Kivilinna
     
  • This patch adds ARM NEON assembly implementation of SHA-1 algorithm.

    tcrypt benchmark results on Cortex-A8, sha1-arm-asm vs sha1-neon-asm:

    block-size bytes/update old-vs-new
    16 16 1.04x
    64 16 1.02x
    64 64 1.05x
    256 16 1.03x
    256 64 1.04x
    256 256 1.30x
    1024 16 1.03x
    1024 256 1.36x
    1024 1024 1.52x
    2048 16 1.03x
    2048 256 1.39x
    2048 1024 1.55x
    2048 2048 1.59x
    4096 16 1.03x
    4096 256 1.40x
    4096 1024 1.57x
    4096 4096 1.62x
    8192 16 1.03x
    8192 256 1.40x
    8192 1024 1.58x
    8192 4096 1.63x
    8192 8192 1.63x

    Acked-by: Ard Biesheuvel
    Tested-by: Ard Biesheuvel
    Signed-off-by: Jussi Kivilinna
    Signed-off-by: Russell King

    Jussi Kivilinna
     

01 Aug, 2014

4 commits


31 Jul, 2014

2 commits

  • Th AF_ALG socket was missing a security label (e.g. SELinux)
    which means that socket was in "unlabeled" state.

    This was recently demonstrated in the cryptsetup package
    (cryptsetup v1.6.5 and later.)
    See https://bugzilla.redhat.com/show_bug.cgi?id=1115120

    This patch clones the sock's label from the parent sock
    and resolves the issue (similar to AF_BLUETOOTH protocol family).

    Cc: stable@vger.kernel.org
    Signed-off-by: Milan Broz
    Acked-by: Paul Moore
    Signed-off-by: Herbert Xu

    Milan Broz
     
  • X.509 certificate issuer and subject fields are mandatory fields in the ASN.1
    and so their existence needn't be tested for. They are guaranteed to end up
    with an empty string if the name material has nothing we can use (see
    x509_fabricate_name()).

    Reported-by: Dan Carpenter
    Signed-off-by: David Howells
    Acked-by: Vivek Goyal

    David Howells
     

29 Jul, 2014

1 commit

  • pkcs7_request_asymmetric_key() and x509_request_asymmetric_key() do the same
    thing, the latter being a copy of the former created by the IMA folks, so drop
    the PKCS#7 version as the X.509 location is more general.

    Whilst we're at it, rename the arguments of x509_request_asymmetric_key() to
    better reflect what the values being passed in are intended to match on an
    X.509 cert.

    Signed-off-by: David Howells
    Acked-by: Mimi Zohar

    David Howells
     

28 Jul, 2014

2 commits


25 Jul, 2014

1 commit


23 Jul, 2014

6 commits

  • With DMA_API_DEBUG set, following warnings are emitted
    (tested on CAAM accelerator):
    DMA-API: device driver maps memory from kernel text or rodata
    DMA-API: device driver maps memory from stack
    and the culprits are:
    -key in __test_aead and __test_hash
    -result in __test_hash

    MAX_KEYLEN is changed to accommodate maximum key length from
    existing test vectors in crypto/testmgr.h (131 bytes) and rounded.

    Signed-off-by: Horia Geanta
    Acked-by: Kim Phillips
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • Signed-off-by: David Howells

    David Howells
     
  • Signed-off-by: David Howells

    David Howells
     
  • Here's a set of changes that implement a PE file signature checker.

    This provides the following facility:

    (1) Extract the signature from the PE file. This is a PKCS#7 message
    containing, as its data, a hash of the signed parts of the file.

    (2) Digest the signed parts of the file.

    (3) Compare the digest with the one from the PKCS#7 message.

    (4) Validate the signatures on the PKCS#7 message and indicate
    whether it was matched by a trusted key.

    Signed-off-by: David Howells

    David Howells
     
  • Here's a set of changes that implement a PKCS#7 message parser in the kernel.

    The PKCS#7 message parsing will then be used to limit kexec to authenticated
    kernels only if so configured.

    The changes provide the following facilities:

    (1) Parse an ASN.1 PKCS#7 message and pick out useful bits such as the data
    content and the X.509 certificates used to sign it and all the data
    signatures.

    (2) Verify all the data signatures against the set of X.509 certificates
    available in the message.

    (3) Follow the certificate chains and verify that:

    (a) for every self-signed X.509 certificate, check that it validly signed
    itself, and:

    (b) for every non-self-signed certificate, if we have a 'parent'
    certificate, the former is validly signed by the latter.

    (4) Look for intersections between the certificate chains and the trusted
    keyring, if any intersections are found, verify that the trusted
    certificates signed the intersection point in the chain.

    (5) For testing purposes, a key type can be made available that will take a
    PKCS#7 message, check that the message is trustworthy, and if so, add its
    data content into the key.

    Note that (5) has to be altered to take account of the preparsing patches
    already committed to this branch.

    Signed-off-by: David Howells

    David Howells
     
  • struct key_preparsed_payload should have two payload pointers to correspond
    with those in struct key.

    Signed-off-by: David Howells
    Acked-by: Steve Dickson
    Acked-by: Jeff Layton
    Reviewed-by: Sage Weil

    David Howells
     

19 Jul, 2014

1 commit

  • Provide a generic instantiation function for key types that use the preparse
    hook. This makes it easier to prereserve key quota before keyrings get locked
    to retain the new key.

    Signed-off-by: David Howells
    Acked-by: Steve Dickson
    Acked-by: Jeff Layton
    Reviewed-by: Sage Weil

    David Howells
     

18 Jul, 2014

1 commit


17 Jul, 2014

4 commits

  • Instead of allowing public keys, with certificates signed by any
    key on the system trusted keyring, to be added to a trusted keyring,
    this patch further restricts the certificates to those signed only by
    builtin keys on the system keyring.

    This patch defines a new option 'builtin' for the kernel parameter
    'keys_ownerid' to allow trust validation using builtin keys.

    Simplified Mimi's "KEYS: define an owner trusted keyring" patch

    Changelog v7:
    - rename builtin_keys to use_builtin_keys

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • Instead of allowing public keys, with certificates signed by any
    key on the system trusted keyring, to be added to a trusted keyring,
    this patch further restricts the certificates to those signed by a
    particular key on the system keyring.

    This patch defines a new kernel parameter 'ca_keys' to identify the
    specific key which must be used for trust validation of certificates.

    Simplified Mimi's "KEYS: define an owner trusted keyring" patch.

    Changelog:
    - support for builtin x509 public keys only
    - export "asymmetric_keyid_match"
    - remove ifndefs MODULE
    - rename kernel boot parameter from keys_ownerid to ca_keys

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • To avoid code duplication this patch refactors asymmetric_key_match(),
    making partial ID string match a separate function.

    This patch also implicitly fixes a bug in the code. asymmetric_key_match()
    allows to match the key by its subtype. But subtype matching could be
    undone if asymmetric_key_id(key) would return NULL. This patch first
    checks for matching spec and then for its value.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • Only public keys, with certificates signed by an existing
    'trusted' key on the system trusted keyring, should be added
    to a trusted keyring. This patch adds support for verifying
    a certificate's signature.

    This is derived from David Howells pkcs7_request_asymmetric_key() patch.

    Changelog v6:
    - on error free key - Dmitry
    - validate trust only for not already trusted keys - Dmitry
    - formatting cleanup

    Changelog:
    - define get_system_trusted_keyring() to fix kbuild issues

    Signed-off-by: Mimi Zohar
    Signed-off-by: David Howells
    Acked-by: Dmitry Kasatkin

    Mimi Zohar
     

10 Jul, 2014

1 commit


09 Jul, 2014

8 commits


08 Jul, 2014

3 commits

  • The patch corrects the security strength of the HMAC-SHA1 DRBG to 128
    bits. This strength defines the size of the seed required for the DRBG.
    Thus, the patch lowers the seeding requirement from 256 bits to 128 bits
    for HMAC-SHA1.

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

    Stephan Mueller
     
  • The current locking approach of the DRBG tries to keep the protected
    code paths very minimal. It is therefore possible that two threads query
    one DRBG instance at the same time. When thread A requests random
    numbers, a shadow copy of the DRBG state is created upon which the
    request for A is processed. After finishing the state for A's request is
    merged back into the DRBG state. If now thread B requests random numbers
    from the same DRBG after the request for thread A is received, but
    before A's shadow state is merged back, the random numbers for B will be
    identical to the ones for A. Please note that the time window is very
    small for this scenario.

    To prevent that there is even a theoretical chance for thread A and B
    having the same DRBG state, the current time stamp is provided as
    additional information string for each new request.

    The addition of the time stamp as additional information string implies
    that now all generate functions must be capable to process a linked
    list with additional information strings instead of a scalar.

    CC: Rafael Aquini
    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • When the DRBG is initialized, the core is looked up using the DRBG name.
    The name that can be used for the lookup is registered in
    cra_driver_name. The cra_name value contains stdrng.

    Thus, the lookup code must use crypto_tfm_alg_driver_name to obtain the
    precise DRBG name and select the correct DRBG.

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

    Stephan Mueller