1. Aug 17, 2023
    • Holger Dengler's avatar
      s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs · cba33db3
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced PKEY_TYPE_EP11_AES securekey blobs as a
      supplement to the PKEY_TYPE_EP11 (which won't work in environments
      with session-bound keys). This new keyblobs has a different maximum
      size, so fix paes crypto module to accept also these larger keyblobs.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      cba33db3
    • Holger Dengler's avatar
      s390/pkey: fix PKEY_TYPE_EP11_AES handling for sysfs attributes · b9352e4b
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced a new PKEY_TYPE_EP11_AES securekey type as
      a supplement to the existing PKEY_TYPE_EP11 (which won't work in
      environments with session-bound keys). The pkey EP11 securekey
      attributes use PKEY_TYPE_EP11_AES (instead of PKEY_TYPE_EP11)
      keyblobs, to make the generated keyblobs usable also in environments,
      where session-bound keys are required.
      
      There should be no negative impacts to userspace because the internal
      structure of the keyblobs is opaque. The increased size of the
      generated keyblobs is reflected by the changed size of the attributes.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      b9352e4b
    • Holger Dengler's avatar
      s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_VERIFYKEY2 IOCTL · 745742db
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced a new PKEY_TYPE_EP11_AES type for the
      PKEY_VERIFYKEY2 IOCTL to verify keyblobs of this type. Unfortunately,
      all PKEY_VERIFYKEY2 IOCTL requests with keyblobs of this type return
      with an error (-EINVAL). Fix PKEY_TYPE_EP11_AES handling in
      PKEY_VERIFYKEY2 IOCTL, so that userspace can verify keyblobs of this
      type.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      745742db
    • Holger Dengler's avatar
      s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_KBLOB2PROTK[23] · d1fdfb0b
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced a new PKEY_TYPE_EP11_AES type for the
      PKEY_KBLOB2PROTK2 and a new IOCTL, PKEY_KBLOB2PROTK3, which both
      allows userspace to convert opaque securekey blobs of this type into
      protectedkey blobs. Unfortunately, all PKEY_KBLOB2PROTK2 and
      PKEY_KBLOB2PROTK3 IOCTL requests with this keyblobs of this type
      return with an error (-EINVAL). Fix PKEY_TYPE_EP11_AES handling in
      PKEY_KBLOB2PROTK2 and PKEY_KBLOB2PROTK3 IOCTLs, so that userspace can
      convert PKEY_TYPE_EP11_AES keyblobs into protectedkey blobs.
      
      Add a helper function to decode the start and size of the internal
      header as well as start and size of the keyblob payload of an existing
      keyblob. Also validate the length of header and keyblob, as well as
      the keyblob magic.
      
      Introduce another helper function, which handles a raw key wrapping
      request and do the keyblob decoding in the calling function. Remove
      all other header-related calculations.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      d1fdfb0b
    • Holger Dengler's avatar
      s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_CLR2SECK2 IOCTL · da2863f1
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced PKEY_TYPE_EP11_AES for the PKEY_CLR2SECK2
      IOCTL to convert an AES clearkey into a securekey of this type.
      Unfortunately, all PKEY_CLR2SECK2 IOCTL requests with type
      PKEY_TYPE_EP11_AES return with an error (-EINVAL). Fix the handling
      for PKEY_TYPE_EP11_AES in PKEY_CLR2SECK2 IOCTL, so that userspace can
      convert clearkey blobs into PKEY_TYPE_EP11_AES securekey blobs.
      
      Cc: stable@vger.kernel.org # v5.10+
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      da2863f1
    • Holger Dengler's avatar
      s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_GENSECK2 IOCTL · fb249ce7
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced PKEY_TYPE_EP11_AES for the PKEY_GENSECK2
      IOCTL, to enable userspace to generate securekey blobs of this
      type. Unfortunately, all PKEY_GENSECK2 IOCTL requests for
      PKEY_TYPE_EP11_AES return with an error (-EINVAL). Fix the handling
      for PKEY_TYPE_EP11_AES in PKEY_GENSECK2 IOCTL, so that userspace can
      generate securekey blobs of this type.
      
      The start of the header and the keyblob, as well as the length need
      special handling, depending on the internal keyversion. Add a helper
      function that splits an uninitialized buffer into start and size of
      the header as well as start and size of the payload, depending on the
      requested keyversion.
      
      Do the header-related calculations and the raw genkey request handling
      in separate functions. Use the raw genkey request function for
      internal purposes.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      fb249ce7
    • Holger Dengler's avatar
      s390/pkey: fix/harmonize internal keyblob headers · 37a08f01
      Holger Dengler authored
      Commit 'fa6999e3 ("s390/pkey: support CCA and EP11 secure ECC
      private keys")' introduced PKEY_TYPE_EP11_AES as a supplement to
      PKEY_TYPE_EP11. All pkeys have an internal header/payload structure,
      which is opaque to the userspace. The header structures for
      PKEY_TYPE_EP11 and PKEY_TYPE_EP11_AES are nearly identical and there
      is no reason, why different structures are used. In preparation to fix
      the keyversion handling in the broken PKEY IOCTLs, the same header
      structure is used for PKEY_TYPE_EP11 and PKEY_TYPE_EP11_AES. This
      reduces the number of different code paths and increases the
      readability.
      
      Fixes: fa6999e3
      
       ("s390/pkey: support CCA and EP11 secure ECC private keys")
      Signed-off-by: default avatarHolger Dengler <dengler@linux.ibm.com>
      Reviewed-by: default avatarIngo Franzki <ifranzki@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      37a08f01
  2. Aug 16, 2023
  3. Aug 09, 2023
  4. Aug 01, 2023
  5. Jul 29, 2023
  6. Jul 27, 2023
  7. Jul 24, 2023