20 Nov, 2018

1 commit

  • 'shash' algorithms are always synchronous, so passing CRYPTO_ALG_ASYNC
    in the mask to crypto_alloc_shash() has no effect. Many users therefore
    already don't pass it, but some still do. This inconsistency can cause
    confusion, especially since the way the 'mask' argument works is
    somewhat counterintuitive.

    Thus, just remove the unneeded CRYPTO_ALG_ASYNC flags.

    This patch shouldn't change any actual behavior.

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

    Eric Biggers
     

07 Apr, 2017

1 commit

  • When building the kernel with clang, the compiler fails to build
    security/apparmor/crypto.c with the following error:

    security/apparmor/crypto.c:36:8: error: fields must have a constant
    size: 'variable length array in structure' extension will never be
    supported
    char ctx[crypto_shash_descsize(apparmor_tfm)];
    ^

    Since commit a0a77af14117 ("crypto: LLVMLinux: Add macro to remove use
    of VLAIS in crypto code"), include/crypto/hash.h defines
    SHASH_DESC_ON_STACK to work around this issue. Use it in aa_calc_hash()
    and aa_calc_profile_hash().

    Signed-off-by: Nicolas Iooss
    Signed-off-by: John Johansen
    Signed-off-by: James Morris

    Nicolas Iooss
     

16 Jan, 2017

1 commit


27 Jul, 2016

1 commit

  • The newly added Kconfig option could never work and just causes a build error
    when disabled:

    security/apparmor/lsm.c:675:25: error: 'CONFIG_SECURITY_APPARMOR_HASH_DEFAULT' undeclared here (not in a function)
    bool aa_g_hash_policy = CONFIG_SECURITY_APPARMOR_HASH_DEFAULT;

    The problem is that the macro undefined in this case, and we need to use the IS_ENABLED()
    helper to turn it into a boolean constant.

    Another minor problem with the original patch is that the option is even offered
    in sysfs when SECURITY_APPARMOR_HASH is not enabled, so this also hides the option
    in that case.

    Signed-off-by: Arnd Bergmann
    Fixes: 6059f71f1e94 ("apparmor: add parameter to control whether policy hashing is used")
    Signed-off-by: John Johansen
    Signed-off-by: James Morris

    Arnd Bergmann
     

30 Sep, 2013

1 commit

  • Use the shash interface, rather than the hash interface, when hashing
    AppArmor profiles. The shash interface does not use scatterlists and it
    is a better fit for what AppArmor needs.

    This fixes a kernel paging BUG when aa_calc_profile_hash() is passed a
    buffer from vmalloc(). The hash interface requires callers to handle
    vmalloc() buffers differently than what AppArmor was doing. Due to
    vmalloc() memory not being physically contiguous, each individual page
    behind the buffer must be assigned to a scatterlist with sg_set_page()
    and then the scatterlist passed to crypto_hash_update().

    The shash interface does not have that limitation and allows vmalloc()
    and kmalloc() buffers to be handled in the same manner.

    BugLink: https://launchpad.net/bugs/1216294/
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=62261

    Signed-off-by: Tyler Hicks
    Acked-by: Seth Arnold
    Signed-off-by: John Johansen
    Signed-off-by: James Morris

    Tyler Hicks
     

15 Aug, 2013

1 commit