06 Oct, 2014

1 commit

  • Earlier KEYS code used pure subject key identifiers (fingerprint)
    for searching keys. Latest merged code removed that and broke
    compatibility with integrity subsytem signatures and original
    format of module signatures.

    This patch returns back partial matching on SKID.

    Reported-by: Dmitry Kasatkin
    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: David Howells

    Dmitry Kasatkin
     

03 Oct, 2014

1 commit

  • Module signing matches keys by comparing against the key description exactly.
    However, the way the key description gets constructed got changed to be
    composed of the subject name plus the certificate serial number instead of the
    subject name and the subjectKeyId. I changed this to avoid problems with
    certificates that don't *have* a subjectKeyId.

    Instead, if available, use the raw subjectKeyId to form the key description
    and only use the serial number if the subjectKeyId doesn't exist.

    Reported-by: Dmitry Kasatkin
    Signed-off-by: David Howells

    David Howells
     

17 Sep, 2014

2 commits

  • Provide better handling of unsupported crypto when verifying a PKCS#7 message.
    If we can't bridge the gap between a pair of X.509 certs or between a signed
    info block and an X.509 cert because it involves some crypto we don't support,
    that's not necessarily the end of the world as there may be other ways points
    at which we can intersect with a ring of trusted keys.

    Instead, only produce ENOPKG immediately if all the signed info blocks in a
    PKCS#7 message require unsupported crypto to bridge to the first X.509 cert.
    Otherwise, we defer the generation of ENOPKG until we get ENOKEY during trust
    validation.

    Signed-off-by: David Howells
    Acked-by: Vivek Goyal

    David Howells
     
  • Make use of the new match string preparsing to overhaul key identification
    when searching for asymmetric keys. The following changes are made:

    (1) Use the previously created asymmetric_key_id struct to hold the following
    key IDs derived from the X.509 certificate or PKCS#7 message:

    id: serial number + issuer
    skid: subjKeyId + subject
    authority: authKeyId + issuer

    (2) Replace the hex fingerprint attached to key->type_data[1] with an
    asymmetric_key_ids struct containing the id and the skid (if present).

    (3) Make the asymmetric_type match data preparse select one of two searches:

    (a) An iterative search for the key ID given if prefixed with "id:". The
    prefix is expected to be followed by a hex string giving the ID to
    search for. The criterion key ID is checked against all key IDs
    recorded on the key.

    (b) A direct search if the key ID is not prefixed with "id:". This will
    look for an exact match on the key description.

    (4) Make x509_request_asymmetric_key() take a key ID. This is then converted
    into "id:" and passed into keyring_search() where match preparsing
    will turn it back into a binary ID.

    (5) X.509 certificate verification then takes the authority key ID and looks
    up a key that matches it to find the public key for the certificate
    signature.

    (6) PKCS#7 certificate verification then takes the id key ID and looks up a
    key that matches it to find the public key for the signed information
    block signature.

    Additional changes:

    (1) Multiple subjKeyId and authKeyId values on an X.509 certificate cause the
    cert to be rejected with -EBADMSG.

    (2) The 'fingerprint' ID is gone. This was primarily intended to convey PGP
    public key fingerprints. If PGP is supported in future, this should
    generate a key ID that carries the fingerprint.

    (3) Th ca_keyid= kernel command line option is now converted to a key ID and
    used to match the authority key ID. Possibly this should only match the
    actual authKeyId part and not the issuer as well.

    Signed-off-by: David Howells
    Acked-by: Vivek Goyal

    David Howells
     

01 Jul, 2014

1 commit


26 Oct, 2013

2 commits

  • In preparation of supporting more hash algorithms with larger hash sizes
    needed for signature verification, this patch replaces the 20 byte sized
    digest, with a more flexible structure. The new structure includes the
    hash algorithm, digest size, and digest.

    Changelog:
    - recalculate filedata hash for the measurement list, if the signature
    hash digest size is greater than 20 bytes.
    - use generic HASH_ALGO_
    - make ima_calc_file_hash static
    - scripts lindent and checkpatch fixes

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

    Dmitry Kasatkin
     
  • This patch makes use of the newly defined common hash algorithm info,
    replacing, for example, PKEY_HASH with HASH_ALGO.

    Changelog:
    - Lindent fixes - Mimi

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

    Dmitry Kasatkin
     

26 Sep, 2013

3 commits


10 Oct, 2012

1 commit

  • The current choice of lifetime for the autogenerated X.509 of 100 years,
    putting the validTo date in 2112, causes problems on 32-bit systems where a
    32-bit time_t wraps in 2106. 64-bit x86_64 systems seem to be unaffected.

    This can result in something like:

    Loading module verification certificates
    X.509: Cert 6e03943da0f3b015ba6ed7f5e0cac4fe48680994 has expired
    MODSIGN: Problem loading in-kernel X.509 certificate (-127)

    Or:

    X.509: Cert 6e03943da0f3b015ba6ed7f5e0cac4fe48680994 is not yet valid
    MODSIGN: Problem loading in-kernel X.509 certificate (-129)

    Instead of turning the dates into time_t values and comparing, turn the system
    clock and the ASN.1 dates into tm structs and compare those piecemeal instead.

    Reported-by: Rusty Russell
    Signed-off-by: David Howells
    Acked-by: Josh Boyer
    Signed-off-by: Rusty Russell

    David Howells
     

08 Oct, 2012

1 commit