1. 05 4月, 2017 1 次提交
    • S
      KEYS: add SP800-56A KDF support for DH · f1c316a3
      Stephan Mueller 提交于
      SP800-56A defines the use of DH with key derivation function based on a
      counter. The input to the KDF is defined as (DH shared secret || other
      information). The value for the "other information" is to be provided by
      the caller.
      
      The KDF is implemented using the hash support from the kernel crypto API.
      The implementation uses the symmetric hash support as the input to the
      hash operation is usually very small. The caller is allowed to specify
      the hash name that he wants to use to derive the key material allowing
      the use of all supported hashes provided with the kernel crypto API.
      
      As the KDF implements the proper truncation of the DH shared secret to
      the requested size, this patch fills the caller buffer up to its size.
      
      The patch is tested with a new test added to the keyutils user space
      code which uses a CAVS test vector testing the compliance with
      SP800-56A.
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      f1c316a3
  2. 27 10月, 2016 1 次提交
  3. 13 4月, 2016 2 次提交
    • M
      KEYS: Add KEYCTL_DH_COMPUTE command · ddbb4114
      Mat Martineau 提交于
      This adds userspace access to Diffie-Hellman computations through a
      new keyctl() syscall command to calculate shared secrets or public
      keys using input parameters stored in the keyring.
      
      Input key ids are provided in a struct due to the current 5-arg limit
      for the keyctl syscall. Only user keys are supported in order to avoid
      exposing the content of logon or encrypted keys.
      
      The output is written to the provided buffer, based on the assumption
      that the values are only needed in userspace.
      
      Future support for other types of key derivation would involve a new
      command, like KEYCTL_ECDH_COMPUTE.
      
      Once Diffie-Hellman support is included in the crypto API, this code
      can be converted to use the crypto API to take advantage of possible
      hardware acceleration and reduce redundant code.
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      ddbb4114
    • K
      Security: Keys: Big keys stored encrypted · 13100a72
      Kirill Marinushkin 提交于
      Solved TODO task: big keys saved to shmem file are now stored encrypted.
      The encryption key is randomly generated and saved to payload[big_key_data].
      Signed-off-by: NKirill Marinushkin <k.marinushkin@gmail.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      13100a72
  4. 20 12月, 2015 1 次提交
  5. 23 1月, 2015 1 次提交
  6. 30 10月, 2013 1 次提交
  7. 24 9月, 2013 3 次提交
    • D
      KEYS: Add per-user_namespace registers for persistent per-UID kerberos caches · f36f8c75
      David Howells 提交于
      Add support for per-user_namespace registers of persistent per-UID kerberos
      caches held within the kernel.
      
      This allows the kerberos cache to be retained beyond the life of all a user's
      processes so that the user's cron jobs can work.
      
      The kerberos cache is envisioned as a keyring/key tree looking something like:
      
      	struct user_namespace
      	  \___ .krb_cache keyring		- The register
      		\___ _krb.0 keyring		- Root's Kerberos cache
      		\___ _krb.5000 keyring		- User 5000's Kerberos cache
      		\___ _krb.5001 keyring		- User 5001's Kerberos cache
      			\___ tkt785 big_key	- A ccache blob
      			\___ tkt12345 big_key	- Another ccache blob
      
      Or possibly:
      
      	struct user_namespace
      	  \___ .krb_cache keyring		- The register
      		\___ _krb.0 keyring		- Root's Kerberos cache
      		\___ _krb.5000 keyring		- User 5000's Kerberos cache
      		\___ _krb.5001 keyring		- User 5001's Kerberos cache
      			\___ tkt785 keyring	- A ccache
      				\___ krbtgt/REDHAT.COM@REDHAT.COM big_key
      				\___ http/REDHAT.COM@REDHAT.COM user
      				\___ afs/REDHAT.COM@REDHAT.COM user
      				\___ nfs/REDHAT.COM@REDHAT.COM user
      				\___ krbtgt/KERNEL.ORG@KERNEL.ORG big_key
      				\___ http/KERNEL.ORG@KERNEL.ORG big_key
      
      What goes into a particular Kerberos cache is entirely up to userspace.  Kernel
      support is limited to giving you the Kerberos cache keyring that you want.
      
      The user asks for their Kerberos cache by:
      
      	krb_cache = keyctl_get_krbcache(uid, dest_keyring);
      
      The uid is -1 or the user's own UID for the user's own cache or the uid of some
      other user's cache (requires CAP_SETUID).  This permits rpc.gssd or whatever to
      mess with the cache.
      
      The cache returned is a keyring named "_krb.<uid>" that the possessor can read,
      search, clear, invalidate, unlink from and add links to.  Active LSMs get a
      chance to rule on whether the caller is permitted to make a link.
      
      Each uid's cache keyring is created when it first accessed and is given a
      timeout that is extended each time this function is called so that the keyring
      goes away after a while.  The timeout is configurable by sysctl but defaults to
      three days.
      
      Each user_namespace struct gets a lazily-created keyring that serves as the
      register.  The cache keyrings are added to it.  This means that standard key
      search and garbage collection facilities are available.
      
      The user_namespace struct's register goes away when it does and anything left
      in it is then automatically gc'd.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NSimo Sorce <simo@redhat.com>
      cc: Serge E. Hallyn <serge.hallyn@ubuntu.com>
      cc: Eric W. Biederman <ebiederm@xmission.com>
      f36f8c75
    • D
      KEYS: Implement a big key type that can save to tmpfs · ab3c3587
      David Howells 提交于
      Implement a big key type that can save its contents to tmpfs and thus
      swapspace when memory is tight.  This is useful for Kerberos ticket caches.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NSimo Sorce <simo@redhat.com>
      ab3c3587
    • D
      KEYS: Expand the capacity of a keyring · b2a4df20
      David Howells 提交于
      Expand the capacity of a keyring to be able to hold a lot more keys by using
      the previously added associative array implementation.  Currently the maximum
      capacity is:
      
      	(PAGE_SIZE - sizeof(header)) / sizeof(struct key *)
      
      which, on a 64-bit system, is a little more 500.  However, since this is being
      used for the NFS uid mapper, we need more than that.  The new implementation
      gives us effectively unlimited capacity.
      
      With some alterations, the keyutils testsuite runs successfully to completion
      after this patch is applied.  The alterations are because (a) keyrings that
      are simply added to no longer appear ordered and (b) some of the errors have
      changed a bit.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b2a4df20
  8. 11 5月, 2012 1 次提交