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
     

18 Feb, 2016

1 commit


15 Dec, 2015

1 commit

  • This option creates IMA MOK and blacklist keyrings. IMA MOK is an
    intermediate keyring that sits between .system and .ima keyrings,
    effectively forming a simple CA hierarchy. To successfully import a key
    into .ima_mok it must be signed by a key which CA is in .system keyring.
    On turn any key that needs to go in .ima keyring must be signed by CA in
    either .system or .ima_mok keyrings. IMA MOK is empty at kernel boot.

    IMA blacklist keyring contains all revoked IMA keys. It is consulted
    before any other keyring. If the search is successful the requested
    operation is rejected and error is returned to the caller.

    Signed-off-by: Petko Manolov
    Signed-off-by: Mimi Zohar

    Petko Manolov
     

07 Oct, 2014

1 commit


09 Sep, 2014

1 commit

  • If file has IMA signature, IMA in enforce mode, but key is missing
    then file access is blocked and single error message is printed.

    If IMA appraisal is enabled in fix mode, then system runs as usual
    but might produce tons of 'Request for unknown key' messages.

    This patch switches 'pr_warn' to 'pr_err_ratelimited'.

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

    Dmitry Kasatkin
     

26 Oct, 2013

1 commit

  • All files on the filesystem, currently, are hashed using the same hash
    algorithm. In preparation for files from different packages being
    signed using different hash algorithms, this patch adds support for
    reading the signature hash algorithm from the 'security.ima' extended
    attribute and calculates the appropriate file data hash based on it.

    Changelog:
    - fix scripts Lindent and checkpatch msgs - Mimi
    - fix md5 support for older version, which occupied 20 bytes in the
    xattr, not the expected 16 bytes. Fix the comparison to compare
    only the first 16 bytes.

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

    Dmitry Kasatkin
     

07 Feb, 2013

1 commit

  • Asymmetric keys were introduced in linux-3.7 to verify the signature on
    signed kernel modules. The asymmetric keys infrastructure abstracts the
    signature verification from the crypto details. This patch adds IMA/EVM
    signature verification using asymmetric keys. Support for additional
    signature verification methods can now be delegated to the asymmetric
    key infrastructure.

    Although the module signature header and the IMA/EVM signature header
    could use the same format, to minimize the signature length and save
    space in the extended attribute, this patch defines a new IMA/EVM
    header format. The main difference is that the key identifier is a
    sha1[12 - 19] hash of the key modulus and exponent, similar to the
    current implementation. The only purpose of the key identifier is to
    identify the corresponding key in the kernel keyring. ima-evm-utils
    was updated to support the new signature format.

    While asymmetric signature verification functionality supports many
    different hash algorithms, the hash used in this patch is calculated
    during the IMA collection phase, based on the configured algorithm.
    The default algorithm is sha1, but for backwards compatibility md5
    is supported. Due to this current limitation, signatures should be
    generated using a sha1 hash algorithm.

    Changes in this patch:
    - Functionality has been moved to separate source file in order to get rid of
    in source #ifdefs.
    - keyid is derived according to the RFC 3280. It does not require to assign
    IMA/EVM specific "description" when loading X509 certificate. Kernel
    asymmetric key subsystem automatically generate the description. Also
    loading a certificate does not require using of ima-evm-utils and can be
    done using keyctl only.
    - keyid size is reduced to 32 bits to save xattr space. Key search is done
    using partial match functionality of asymmetric_key_match().
    - Kconfig option title was changed

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

    Dmitry Kasatkin