Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Oct 27, 2023
  2. Feb 13, 2023
  3. Feb 02, 2023
  4. Dec 02, 2022
  5. Nov 17, 2022
  6. Jan 30, 2022
  7. Aug 20, 2020
    • Herbert Xu's avatar
      crypto: algapi - Remove skbuff.h inclusion · 0c3dc787
      Herbert Xu authored
      
      The header file algapi.h includes skbuff.h unnecessarily since
      all we need is a forward declaration for struct sk_buff.  This
      patch removes that inclusion.
      
      Unfortunately skbuff.h pulls in a lot of things and drivers over
      the years have come to rely on it so this patch adds a lot of
      missing inclusions that result from this.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0c3dc787
  8. Aug 07, 2020
    • Waiman Long's avatar
      mm, treewide: rename kzfree() to kfree_sensitive() · 453431a5
      Waiman Long authored
      As said by Linus:
      
        A symmetric naming is only helpful if it implies symmetries in use.
        Otherwise it's actively misleading.
      
        In "kzalloc()", the z is meaningful and an important part of what the
        caller wants.
      
        In "kzfree()", the z is actively detrimental, because maybe in the
        future we really _might_ want to use that "memfill(0xdeadbeef)" or
        something. The "zero" part of the interface isn't even _relevant_.
      
      The main reason that kzfree() exists is to clear sensitive information
      that should not be leaked to other future users of the same memory
      objects.
      
      Rename kzfree() to kfree_sensitive() to follow the example of the recently
      added kvfree_sensitive() and make the intention of the API more explicit.
      In addition, memzero_explicit() is used to clear the memory to make sure
      that it won't get optimized away by the compiler.
      
      The renaming is done by using the command sequence:
      
        git grep -w --name-only kzfree |\
        xargs sed -i 's/kzfree/kfree_sen...
      453431a5
  9. Jul 16, 2020
    • Eric Biggers's avatar
      crypto: algapi - use common mechanism for inheriting flags · 7bcb2c99
      Eric Biggers authored
      The flag CRYPTO_ALG_ASYNC is "inherited" in the sense that when a
      template is instantiated, the template will have CRYPTO_ALG_ASYNC set if
      any of the algorithms it uses has CRYPTO_ALG_ASYNC set.
      
      We'd like to add a second flag (CRYPTO_ALG_ALLOCATES_MEMORY) that gets
      "inherited" in the same way.  This is difficult because the handling of
      CRYPTO_ALG_ASYNC is hardcoded everywhere.  Address this by:
      
        - Add CRYPTO_ALG_INHERITED_FLAGS, which contains the set of flags that
          have these inheritance semantics.
      
        - Add crypto_algt_inherited_mask(), for use by template ->create()
          methods.  It returns any of these flags that the user asked to be
          unset and thus must be passed in the 'mask' to crypto_grab_*().
      
        - Also modify crypto_check_attr_type() to handle computing the 'mask'
          so that most templates can just use this.
      
        - Make crypto_grab_*() propagate these flags to the template instance
          being created so that templates don't have to do this themselves.
      
      Make crypto/simd.c propagate these flags too, since it "wraps" another
      algorithm, similar to a template.
      
      Based on a patch by Mikulas Patocka <mpatocka@redhat.com>
      (https://lore.kernel.org/r/alpine.LRH.2.02.2006301414580.30526@file01.intranet.prod.int.rdu2.redhat.com
      
      ).
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      7bcb2c99
  10. Mar 05, 2020
  11. Jan 08, 2020
    • Eric Biggers's avatar
      crypto: akcipher - pass instance to crypto_grab_akcipher() · 73bed26f
      Eric Biggers authored
      Initializing a crypto_akcipher_spawn currently requires:
      
      1. Set spawn->base.inst to point to the instance.
      2. Call crypto_grab_akcipher().
      
      But there's no reason for these steps to be separate, and in fact this
      unneeded complication has caused at least one bug, the one fixed by
      commit 6db43410
      
       ("crypto: adiantum - initialize crypto_spawn::inst")
      
      So just make crypto_grab_akcipher() take the instance as an argument.
      
      To keep the function call from getting too unwieldy due to this extra
      argument, also introduce a 'mask' variable into pkcs1pad_create().
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      73bed26f
  12. May 30, 2019
  13. Apr 18, 2019
    • Vitaly Chikunov's avatar
      crypto: akcipher - new verify API for public key algorithms · c7381b01
      Vitaly Chikunov authored
      
      Previous akcipher .verify() just `decrypts' (using RSA encrypt which is
      using public key) signature to uncover message hash, which was then
      compared in upper level public_key_verify_signature() with the expected
      hash value, which itself was never passed into verify().
      
      This approach was incompatible with EC-DSA family of algorithms,
      because, to verify a signature EC-DSA algorithm also needs a hash value
      as input; then it's used (together with a signature divided into halves
      `r||s') to produce a witness value, which is then compared with `r' to
      determine if the signature is correct. Thus, for EC-DSA, nor
      requirements of .verify() itself, nor its output expectations in
      public_key_verify_signature() wasn't sufficient.
      
      Make improved .verify() call which gets hash value as input and produce
      complete signature check without any output besides status.
      
      Now for the top level verification only crypto_akcipher_verify() needs
      to be called and its return value inspected.
      
      Make sure that `digest' is in kmalloc'd memory (in place of `output`) in
      {public,tpm}_key_verify_signature() as insisted by Herbert Xu, and will
      be changed in the following commit.
      
      Cc: David Howells <dhowells@redhat.com>
      Cc: keyrings@vger.kernel.org
      Signed-off-by: default avatarVitaly Chikunov <vt@altlinux.org>
      Reviewed-by: default avatarDenis Kenzior <denkenz@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c7381b01
    • Vitaly Chikunov's avatar
      crypto: rsa - unimplement sign/verify for raw RSA backends · 3ecc9725
      Vitaly Chikunov authored
      
      In preparation for new akcipher verify call remove sign/verify callbacks
      from RSA backends and make PKCS1 driver call encrypt/decrypt instead.
      
      This also complies with the well-known idea that raw RSA should never be
      used for sign/verify. It only should be used with proper padding scheme
      such as PKCS1 driver provides.
      
      Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
      Cc: qat-linux@intel.com
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Gary Hook <gary.hook@amd.com>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Signed-off-by: default avatarVitaly Chikunov <vt@altlinux.org>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3ecc9725
  14. Jan 18, 2019
  15. Oct 26, 2018
  16. Sep 28, 2018
  17. Feb 15, 2018
  18. Nov 03, 2017
  19. Jun 19, 2017
  20. Jun 10, 2017
  21. Sep 22, 2016
  22. Jul 22, 2016
  23. Jul 19, 2016
  24. Jul 03, 2016
  25. Jul 01, 2016
  26. Apr 15, 2016
  27. Mar 03, 2016
  28. Dec 22, 2015