08 Aug, 2020

1 commit

  • 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_sensitive/'

    followed by some editing of the kfree_sensitive() kerneldoc and adding
    a kzfree backward compatibility macro in slab.h.

    [akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
    [akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]

    Suggested-by: Joe Perches
    Signed-off-by: Waiman Long
    Signed-off-by: Andrew Morton
    Acked-by: David Howells
    Acked-by: Michal Hocko
    Acked-by: Johannes Weiner
    Cc: Jarkko Sakkinen
    Cc: James Morris
    Cc: "Serge E. Hallyn"
    Cc: Joe Perches
    Cc: Matthew Wilcox
    Cc: David Rientjes
    Cc: Dan Carpenter
    Cc: "Jason A . Donenfeld"
    Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.com
    Signed-off-by: Linus Torvalds

    Waiman Long
     

12 Mar, 2020

1 commit


11 Dec, 2019

1 commit


17 Nov, 2019

1 commit


09 Jul, 2019

1 commit

  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 5.3:

    API:
    - Test shash interface directly in testmgr
    - cra_driver_name is now mandatory

    Algorithms:
    - Replace arc4 crypto_cipher with library helper
    - Implement 5 way interleave for ECB, CBC and CTR on arm64
    - Add xxhash
    - Add continuous self-test on noise source to drbg
    - Update jitter RNG

    Drivers:
    - Add support for SHA204A random number generator
    - Add support for 7211 in iproc-rng200
    - Fix fuzz test failures in inside-secure
    - Fix fuzz test failures in talitos
    - Fix fuzz test failures in qat"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (143 commits)
    crypto: stm32/hash - remove interruptible condition for dma
    crypto: stm32/hash - Fix hmac issue more than 256 bytes
    crypto: stm32/crc32 - rename driver file
    crypto: amcc - remove memset after dma_alloc_coherent
    crypto: ccp - Switch to SPDX license identifiers
    crypto: ccp - Validate the the error value used to index error messages
    crypto: doc - Fix formatting of new crypto engine content
    crypto: doc - Add parameter documentation
    crypto: arm64/aes-ce - implement 5 way interleave for ECB, CBC and CTR
    crypto: arm64/aes-ce - add 5 way interleave routines
    crypto: talitos - drop icv_ool
    crypto: talitos - fix hash on SEC1.
    crypto: talitos - move struct talitos_edesc into talitos.h
    lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE
    crypto/NX: Set receive window credits to max number of CRBs in RxFIFO
    crypto: asymmetric_keys - select CRYPTO_HASH where needed
    crypto: serpent - mark __serpent_setkey_sbox noinline
    crypto: testmgr - dynamically allocate crypto_shash
    crypto: testmgr - dynamically allocate testvec_config
    crypto: talitos - eliminate unneeded 'done' functions at build time
    ...

    Linus Torvalds
     

13 Jun, 2019

1 commit

  • crypto_aead_encrypt() and crypto_aead_decrypt() have grown to be more
    than a single indirect function call. They now also check whether a key
    has been set, the decryption side checks whether the input is at least
    as long as the authentication tag length, and with CONFIG_CRYPTO_STATS=y
    they also update the crypto statistics. That can add up to a lot of
    bloat at every call site. Moreover, these always involve a function
    call anyway, which greatly limits the benefits of inlining.

    So change them to be non-inline.

    Signed-off-by: Eric Biggers
    Acked-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Eric Biggers
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

23 Dec, 2018

1 commit

  • Remove dead code related to internal IV generators, which are no longer
    used since they've been replaced with the "seqiv" and "echainiv"
    templates. The removed code includes:

    - The "givcipher" (GIVCIPHER) algorithm type. No algorithms are
    registered with this type anymore, so it's unneeded.

    - The "const char *geniv" member of aead_alg, ablkcipher_alg, and
    blkcipher_alg. A few algorithms still set this, but it isn't used
    anymore except to show via /proc/crypto and CRYPTO_MSG_GETALG.
    Just hardcode "" or "" in those cases.

    - The 'skcipher_givcrypt_request' structure, which is never used.

    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Eric Biggers
     

07 Dec, 2018

2 commits


28 Sep, 2018

1 commit


12 Jan, 2018

1 commit

  • Similar to what was done for the hash API, update the AEAD API to track
    whether each transform has been keyed, and reject encryption/decryption
    if a key is needed but one hasn't been set.

    This isn't quite as important as the equivalent fix for the hash API
    because AEADs always require a key, so are unlikely to be used without
    one. Still, tracking the key will prevent accidental unkeyed use.
    algif_aead also had to track the key anyway, so the new flag replaces
    that and slightly simplifies the algif_aead implementation.

    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Eric Biggers
     

14 Dec, 2016

2 commits


18 Jul, 2016

1 commit

  • This patch adds a chunk size parameter to aead algorithms, just
    like the chunk size for skcipher algorithms.

    However, unlike skcipher we do not currently export this to AEAD
    users. It is only meant to be used by AEAD implementors for now.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

15 Apr, 2016

1 commit


17 Feb, 2016

1 commit


09 Dec, 2015

1 commit


17 Aug, 2015

1 commit


04 Aug, 2015

1 commit


04 Jun, 2015

1 commit


03 Jun, 2015

2 commits

  • As it stands the only non-type safe functions left in the new
    AEAD interface are the cra_init/cra_exit functions. It means
    exposing the ugly __crypto_aead_cast to every AEAD implementor.

    This patch adds type-safe init/exit functions to AEAD. Existing
    algorithms are unaffected while new implementations can simply
    fill in these two instead of cra_init/cra_exit.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The patch updates the DocBook to cover the new AEAD interface
    implementation.

    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     

28 May, 2015

1 commit

  • This patch defines the behaviour of AD in the new interface more
    clearly. In particular, it specifies that if the user must copy
    the AD to the destination manually when src != dst if they wish
    to guarantee that the destination buffer contains a copy of the
    AD.

    The reason for this is that otherwise every AEAD implementation
    would have to perform such a copy when src != dst. In reality
    most users do in-place processing where src == dst so this is
    not an issue.

    This patch also kills some remaining references to cryptoff.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

25 May, 2015

2 commits


22 May, 2015

3 commits

  • This patch adds the basic structure of the new AEAD type. Unlike
    the current version, there is no longer any concept of geniv. IV
    generation will still be carried out by wrappers but they will be
    normal AEAD algorithms that simply take the IPsec sequence number
    as the IV.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch is the first step in the introduction of a new AEAD
    alg type. Unlike normal conversions this patch only renames the
    existing aead_alg structure because there are external references
    to it.

    Those references will be removed after this patch.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The primary user of AEAD, IPsec includes the IV in the AD in
    most cases, except where it is implicitly authenticated by the
    underlying algorithm.

    The way it is currently implemented is a hack because we pass
    the data in piecemeal and the underlying algorithms try to stitch
    them back up into one piece.

    This is why this patch is adding a new interface that allows a
    single SG list to be passed in that contains everything so the
    algorithm implementors do not have to stitch.

    The new interface accepts a single source SG list and a single
    destination SG list. Both must be laid out as follows:

    AD, skipped data, plain/cipher text, ICV

    The ICV is not present from the source during encryption and from
    the destination during decryption.

    For the top-level IPsec AEAD algorithm the plain/cipher text will
    contain the generated (or received) IV.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

13 May, 2015

1 commit

  • This patch converts the top-level aead interface to the new style.
    All user-level AEAD interface code have been moved into crypto/aead.h.

    The allocation/free functions have switched over to the new way of
    allocating tfms.

    This patch also removes the double indrection on setkey so the
    indirection now exists only at the alg level.

    Apart from these there are no user-visible changes.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

01 Aug, 2014

1 commit


11 Jan, 2008

2 commits

  • This patch finally makes the givencrypt/givdecrypt operations available
    to users by adding crypto_aead_givencrypt and crypto_aead_givdecrypt.
    A suite of helpers to allocate and fill in the request is also available.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the underlying givcrypt operations for aead and associated
    support elements. The rationale is identical to that of the skcipher
    givcrypt operations, i.e., sometimes only the algorithm knows how the
    IV should be generated.

    A new request type aead_givcrypt_request is added which contains an
    embedded aead_request structure with two new elements to support this
    operation. The new elements are seq and giv. The seq field should
    contain a strictly increasing 64-bit integer which may be used by
    certain IV generators as an input value. The giv field will be used
    to store the generated IV. It does not need to obey the alignment
    requirements of the algorithm because it's not used during the operation.

    The existing iv field must still be available as it will be used to store
    intermediate IVs and the output IV if chaining is desired.

    Signed-off-by: Herbert Xu

    Herbert Xu