30 Nov, 2016

1 commit

  • When using SGs, only heap memory (memory that is valid as per
    virt_addr_valid) is allowed to be referenced. The CTR DRBG used to
    reference the caller-provided memory directly in an SG. In case the
    caller provided stack memory pointers, the SG mapping is not considered
    to be valid. In some cases, this would even cause a paging fault.

    The change adds a new scratch buffer that is used unconditionally to
    catch the cases where the caller-provided buffer is not suitable for
    use in an SG. The crypto operation of the CTR DRBG produces its output
    with that scratch buffer and finally copies the content of the
    scratch buffer to the caller's buffer.

    The scratch buffer is allocated during allocation time of the CTR DRBG
    as its access is protected with the DRBG mutex.

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

    Stephan Mueller
     

10 Oct, 2016

1 commit


02 Oct, 2016

1 commit


07 Sep, 2016

2 commits


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
     

19 Jul, 2016

1 commit


18 Jul, 2016

10 commits


05 Jul, 2016

1 commit


03 Jul, 2016

1 commit


01 Jul, 2016

1 commit


23 Jun, 2016

5 commits

  • * Implement ECDH under kpp API
    * Provide ECC software support for curve P-192 and
    P-256.
    * Add kpp test for ECDH with data generated by OpenSSL

    Signed-off-by: Salvatore Benedetto
    Signed-off-by: Herbert Xu

    Salvatore Benedetto
     
  • * Implement MPI based Diffie-Hellman under kpp API
    * Test provided uses data generad by OpenSSL

    Signed-off-by: Salvatore Benedetto
    Signed-off-by: Herbert Xu

    Salvatore Benedetto
     
  • Add key-agreement protocol primitives (kpp) API which allows to
    implement primitives required by protocols such as DH and ECDH.
    The API is composed mainly by the following functions
    * set_secret() - It allows the user to set his secret, also
    referred to as his private key, along with the parameters
    known to both parties involved in the key-agreement session.
    * generate_public_key() - It generates the public key to be sent to
    the other counterpart involved in the key-agreement session. The
    function has to be called after set_params() and set_secret()
    * generate_secret() - It generates the shared secret for the session

    Other functions such as init() and exit() are provided for allowing
    cryptographic hardware to be inizialized properly before use

    Signed-off-by: Salvatore Benedetto
    Signed-off-by: Herbert Xu

    Salvatore Benedetto
     
  • Herbert wants the sha1-mb algorithm to have an async implementation:
    https://lkml.org/lkml/2016/4/5/286.
    Currently, sha1-mb uses an async interface for the outer algorithm
    and a sync interface for the inner algorithm. This patch introduces
    a async interface for even the inner algorithm.

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

    Megha Dey
     
  • This patch adds helpers to check whether a given tfm is currently
    queued. This is meant to be used by ablk_helper and similar
    entities to ensure that no reordering is introduced because of
    requests queued in cryptd with respect to requests being processed
    in softirq context.

    The per-cpu queue length limit is also increased to 1000 in line
    with network limits.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

20 Jun, 2016

1 commit

  • This patch adds the implementation of SHA3 algorithm
    in software and it's based on original implementation
    pushed in patch https://lwn.net/Articles/518415/ with
    additional changes to match the padding rules specified
    in SHA-3 specification.

    Signed-off-by: Jeff Garzik
    Signed-off-by: Raveendra Padasalagi
    Signed-off-by: Herbert Xu

    Jeff Garzik
     

15 Jun, 2016

3 commits

  • Return the raw key with no other processing so that the caller
    can copy it or MPI parse it, etc.

    The scope is to have only one ANS.1 parser for all RSA
    implementations.

    Update the RSA software implementation so that it does
    the MPI conversion on top.

    Signed-off-by: Tudor Ambarus
    Signed-off-by: Herbert Xu

    Tudor Ambarus
     
  • Hardware cipher implementation may require aligned buffers. All buffers
    that potentially are processed with a cipher are now aligned.

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

    Stephan Mueller
     
  • The CTR DRBG derives its random data from the CTR that is encrypted with
    AES.

    This patch now changes the CTR DRBG implementation such that the
    CTR AES mode is employed. This allows the use of steamlined CTR AES
    implementation such as ctr-aes-aesni.

    Unfortunately there are the following subtile changes we need to apply
    when using the CTR AES mode:

    - the CTR mode increments the counter after the cipher operation, but
    the CTR DRBG requires the increment before the cipher op. Hence, the
    crypto_inc is applied to the counter (drbg->V) once it is
    recalculated.

    - the CTR mode wants to encrypt data, but the CTR DRBG is interested in
    the encrypted counter only. The full CTR mode is the XOR of the
    encrypted counter with the plaintext data. To access the encrypted
    counter, the patch uses a NULL data vector as plaintext to be
    "encrypted".

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

    Stephan Mueller
     

20 May, 2016

1 commit

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

    - A new LSM, "LoadPin", from Kees Cook is added, which allows forcing
    of modules and firmware to be loaded from a specific device (this
    is from ChromeOS, where the device as a whole is verified
    cryptographically via dm-verity).

    This is disabled by default but can be configured to be enabled by
    default (don't do this if you don't know what you're doing).

    - Keys: allow authentication data to be stored in an asymmetric key.
    Lots of general fixes and updates.

    - SELinux: add restrictions for loading of kernel modules via
    finit_module(). Distinguish non-init user namespace capability
    checks. Apply execstack check on thread stacks"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (48 commits)
    LSM: LoadPin: provide enablement CONFIG
    Yama: use atomic allocations when reporting
    seccomp: Fix comment typo
    ima: add support for creating files using the mknodat syscall
    ima: fix ima_inode_post_setattr
    vfs: forbid write access when reading a file into memory
    fs: fix over-zealous use of "const"
    selinux: apply execstack check on thread stacks
    selinux: distinguish non-init user namespace capability checks
    LSM: LoadPin for kernel file loading restrictions
    fs: define a string representation of the kernel_read_file_id enumeration
    Yama: consolidate error reporting
    string_helpers: add kstrdup_quotable_file
    string_helpers: add kstrdup_quotable_cmdline
    string_helpers: add kstrdup_quotable
    selinux: check ss_initialized before revalidating an inode label
    selinux: delay inode label lookup as long as possible
    selinux: don't revalidate an inode's label when explicitly setting it
    selinux: Change bool variable name to index.
    KEYS: Add KEYCTL_DH_COMPUTE command
    ...

    Linus Torvalds
     

15 Apr, 2016

1 commit


12 Apr, 2016

2 commits

  • Move the point at which a key is determined to be trustworthy to
    __key_link() so that we use the contents of the keyring being linked in to
    to determine whether the key being linked in is trusted or not.

    What is 'trusted' then becomes a matter of what's in the keyring.

    Currently, the test is done when the key is parsed, but given that at that
    point we can only sensibly refer to the contents of the system trusted
    keyring, we can only use that as the basis for working out the
    trustworthiness of a new key.

    With this change, a trusted keyring is a set of keys that once the
    trusted-only flag is set cannot be added to except by verification through
    one of the contained keys.

    Further, adding a key into a trusted keyring, whilst it might grant
    trustworthiness in the context of that keyring, does not automatically
    grant trustworthiness in the context of a second keyring to which it could
    be secondarily linked.

    To accomplish this, the authentication data associated with the key source
    must now be retained. For an X.509 cert, this means the contents of the
    AuthorityKeyIdentifier and the signature data.

    If system keyrings are disabled then restrict_link_by_builtin_trusted()
    resolves to restrict_link_reject(). The integrity digital signature code
    still works correctly with this as it was previously using
    KEY_FLAG_TRUSTED_ONLY, which doesn't permit anything to be added if there
    is no system keyring against which trust can be determined.

    Signed-off-by: David Howells

    David Howells
     
  • Move x509_request_asymmetric_key() to asymmetric_type.c so that it can be
    generalised.

    Signed-off-by: David Howells

    David Howells
     

06 Apr, 2016

4 commits


18 Mar, 2016

1 commit

  • Pull security layer updates from James Morris:
    "There are a bunch of fixes to the TPM, IMA, and Keys code, with minor
    fixes scattered across the subsystem.

    IMA now requires signed policy, and that policy is also now measured
    and appraised"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (67 commits)
    X.509: Make algo identifiers text instead of enum
    akcipher: Move the RSA DER encoding check to the crypto layer
    crypto: Add hash param to pkcs1pad
    sign-file: fix build with CMS support disabled
    MAINTAINERS: update tpmdd urls
    MODSIGN: linux/string.h should be #included to get memcpy()
    certs: Fix misaligned data in extra certificate list
    X.509: Handle midnight alternative notation in GeneralizedTime
    X.509: Support leap seconds
    Handle ISO 8601 leap seconds and encodings of midnight in mktime64()
    X.509: Fix leap year handling again
    PKCS#7: fix unitialized boolean 'want'
    firmware: change kernel read fail to dev_dbg()
    KEYS: Use the symbol value for list size, updated by scripts/insert-sys-cert
    KEYS: Reserve an extra certificate symbol for inserting without recompiling
    modsign: hide openssl output in silent builds
    tpm_tis: fix build warning with tpm_tis_resume
    ima: require signed IMA policy
    ima: measure and appraise the IMA policy itself
    ima: load policy using path
    ...

    Linus Torvalds
     

04 Mar, 2016

2 commits

  • Make the identifier public key and digest algorithm fields text instead of
    enum.

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

    David Howells
     
  • Move the RSA EMSA-PKCS1-v1_5 encoding from the asymmetric-key public_key
    subtype to the rsa crypto module's pkcs1pad template. This means that the
    public_key subtype no longer has any dependencies on public key type.

    To make this work, the following changes have been made:

    (1) The rsa pkcs1pad template is now used for RSA keys. This strips off the
    padding and returns just the message hash.

    (2) In a previous patch, the pkcs1pad template gained an optional second
    parameter that, if given, specifies the hash used. We now give this,
    and pkcs1pad checks the encoded message E(M) for the EMSA-PKCS1-v1_5
    encoding and verifies that the correct digest OID is present.

    (3) The crypto driver in crypto/asymmetric_keys/rsa.c is now reduced to
    something that doesn't care about what the encryption actually does
    and and has been merged into public_key.c.

    (4) CONFIG_PUBLIC_KEY_ALGO_RSA is gone. Module signing must set
    CONFIG_CRYPTO_RSA=y instead.

    Thoughts:

    (*) Should the encoding style (eg. raw, EMSA-PKCS1-v1_5) also be passed to
    the padding template? Should there be multiple padding templates
    registered that share most of the code?

    Signed-off-by: David Howells
    Signed-off-by: Tadeusz Struk
    Acked-by: Herbert Xu

    David Howells