18 Apr, 2019

1 commit

  • Use subsys_initcall for registration of all templates and generic
    algorithm implementations, rather than module_init. Then change
    cryptomgr to use arch_initcall, to place it before the subsys_initcalls.

    This is needed so that when both a generic and optimized implementation
    of an algorithm are built into the kernel (not loadable modules), the
    generic implementation is registered before the optimized one.
    Otherwise, the self-tests for the optimized implementation are unable to
    allocate the generic implementation for the new comparison fuzz tests.

    Note that on arm, a side effect of this change is that self-tests for
    generic implementations may run before the unaligned access handler has
    been installed. So, unaligned accesses will crash the kernel. This is
    arguably a good thing as it makes it easier to detect that type of bug.

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

    Eric Biggers
     

08 Feb, 2019

1 commit

  • The generic MORUS implementations all fail the improved AEAD tests
    because they produce the wrong result with some data layouts. The issue
    is that they assume that if the skcipher_walk API gives 'nbytes' not
    aligned to the walksize (a.k.a. walk.stride), then it is the end of the
    data. In fact, this can happen before the end. Fix them.

    Fixes: 396be41f16fd ("crypto: morus - Add generic MORUS AEAD implementations")
    Cc: # v4.18+
    Cc: Ondrej Mosnacek
    Signed-off-by: Eric Biggers
    Reviewed-by: Ondrej Mosnacek
    Signed-off-by: Herbert Xu

    Eric Biggers
     

25 Jan, 2019

1 commit

  • The license boiler plate text is not ideal for machine parsing. The kernel
    uses SPDX license identifiers for that purpose, which replace the boiler
    plate text.

    Signed-off-by: Thomas Gleixner
    Cc: Ondrej Mosnacek
    Cc: Herbert Xu
    Cc: "David S. Miller"
    Cc: linux-crypto@vger.kernel.org
    Acked-by: Ondrej Mosnacek
    Signed-off-by: Herbert Xu

    Thomas Gleixner
     

08 Oct, 2018

1 commit

  • Omit the endian swabbing when folding the lengths of the assoc and
    crypt input buffers into the state to finalize the tag. This is not
    necessary given that the memory representation of the state is in
    machine native endianness already.

    This fixes an error reported by tcrypt running on a big endian system:

    alg: aead: Test 2 failed on encryption for morus640-generic
    00000000: a8 30 ef fb e6 26 eb 23 b0 87 dd 98 57 f3 e1 4b
    00000010: 21
    alg: aead: Test 2 failed on encryption for morus1280-generic
    00000000: 88 19 1b fb 1c 29 49 0e ee 82 2f cb 97 a6 a5 ee
    00000010: 5f

    Fixes: 396be41f16fd ("crypto: morus - Add generic MORUS AEAD implementations")
    Cc: # v4.18+
    Reviewed-by: Ondrej Mosnacek
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     

09 Jul, 2018

1 commit

  • Some aead algorithms set .cra_flags = CRYPTO_ALG_TYPE_AEAD. But this is
    redundant with the C structure type ('struct aead_alg'), and
    crypto_register_aead() already sets the type flag automatically,
    clearing any type flag that was already there. Apparently the useless
    assignment has just been copy+pasted around.

    So, remove the useless assignment from all the aead algorithms.

    This patch shouldn't change any actual behavior.

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

    Eric Biggers
     

19 May, 2018

1 commit

  • This patch adds the generic implementation of the MORUS family of AEAD
    algorithms (MORUS-640 and MORUS-1280). The original authors of MORUS
    are Hongjun Wu and Tao Huang.

    At the time of writing, MORUS is one of the finalists in CAESAR, an
    open competition intended to select a portfolio of alternatives to
    the problematic AES-GCM:

    https://competitions.cr.yp.to/caesar-submissions.html
    https://competitions.cr.yp.to/round3/morusv2.pdf

    Signed-off-by: Ondrej Mosnacek
    Signed-off-by: Herbert Xu

    Ondrej Mosnacek