13 Oct, 2020

1 commit

  • Pull crypto updates from Herbert Xu:
    "API:
    - Allow DRBG testing through user-space af_alg
    - Add tcrypt speed testing support for keyed hashes
    - Add type-safe init/exit hooks for ahash

    Algorithms:
    - Mark arc4 as obsolete and pending for future removal
    - Mark anubis, khazad, sead and tea as obsolete
    - Improve boot-time xor benchmark
    - Add OSCCA SM2 asymmetric cipher algorithm and use it for integrity

    Drivers:
    - Fixes and enhancement for XTS in caam
    - Add support for XIP8001B hwrng in xiphera-trng
    - Add RNG and hash support in sun8i-ce/sun8i-ss
    - Allow imx-rngc to be used by kernel entropy pool
    - Use crypto engine in omap-sham
    - Add support for Ingenic X1830 with ingenic"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (205 commits)
    X.509: Fix modular build of public_key_sm2
    crypto: xor - Remove unused variable count in do_xor_speed
    X.509: fix error return value on the failed path
    crypto: bcm - Verify GCM/CCM key length in setkey
    crypto: qat - drop input parameter from adf_enable_aer()
    crypto: qat - fix function parameters descriptions
    crypto: atmel-tdes - use semicolons rather than commas to separate statements
    crypto: drivers - use semicolons rather than commas to separate statements
    hwrng: mxc-rnga - use semicolons rather than commas to separate statements
    hwrng: iproc-rng200 - use semicolons rather than commas to separate statements
    hwrng: stm32 - use semicolons rather than commas to separate statements
    crypto: xor - use ktime for template benchmarking
    crypto: xor - defer load time benchmark to a later time
    crypto: hisilicon/zip - fix the uninitalized 'curr_qm_qp_num'
    crypto: hisilicon/zip - fix the return value when device is busy
    crypto: hisilicon/zip - fix zero length input in GZIP decompress
    crypto: hisilicon/zip - fix the uncleared debug registers
    lib/mpi: Fix unused variable warnings
    crypto: x86/poly1305 - Remove assignments with no effect
    hwrng: npcm - modify readl to readb
    ...

    Linus Torvalds
     

11 Sep, 2020

1 commit


24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

21 Aug, 2020

1 commit

  • Once the crypto hash walk is started by crypto_hash_walk_first()
    returning non-zero, crypto_hash_walk_done() must be called to unmap any
    memory which was mapped by *_walk_first().

    Ensure crypto_hash_walk_done() is called properly by:

    1) Re-arranging the check for device data to be prior to calling
    *_walk_first()
    2) on error call crypto_hash_walk_done() with an error code to
    allow the hash walk code to clean up.

    While we are at it clean up the 'out' label to be more meaningful.

    Signed-off-by: Ira Weiny
    Signed-off-by: Herbert Xu

    Ira Weiny
     

20 Aug, 2020

1 commit

  • 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: Herbert Xu

    Herbert Xu
     

09 Jul, 2020

1 commit

  • A recent change to the Regulator consumer API (which this driver
    utilises) add prototypes for the some suspend functions. These
    functions require including header file include/linux/suspend.h.

    The following tree of includes affecting this driver will be
    present:

    In file included from include/linux/elevator.h:6,
    from include/linux/blkdev.h:288,
    from include/linux/blk-cgroup.h:23,
    from include/linux/writeback.h:14,
    from include/linux/memcontrol.h:22,
    from include/linux/swap.h:9,
    from include/linux/suspend.h:5,
    from include/linux/regulator/consumer.h:35,
    from drivers/crypto/ux500/hash/hash_core.c:28:

    include/linux/elevator.h pulls in include/linux/hashtable.h which
    contains its own version of hash_init(). This confuses the build
    system and results in the following error (amongst others):

    drivers/crypto/ux500/hash/hash_core.c:1362:19: error: passing argument 1 of '__hash_init' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1362 | return hash_init(req);

    Fix this by namespacing the local hash_init() such that the
    source of confusion is removed.

    Cc: Linus Walleij
    Cc: David S. Miller
    Cc: linux-crypto@vger.kernel.org
    Signed-off-by: Lee Jones
    Signed-off-by: Herbert Xu

    Lee Jones
     

09 Jan, 2020

1 commit

  • The CRYPTO_TFM_RES_BAD_KEY_LEN flag was apparently meant as a way to
    make the ->setkey() functions provide more information about errors.

    However, no one actually checks for this flag, which makes it pointless.

    Also, many algorithms fail to set this flag when given a bad length key.
    Reviewing just the generic implementations, this is the case for
    aes-fixed-time, cbcmac, echainiv, nhpoly1305, pcrypt, rfc3686, rfc4309,
    rfc7539, rfc7539esp, salsa20, seqiv, and xcbc. But there are probably
    many more in arch/*/crypto/ and drivers/crypto/.

    Some algorithms can even set this flag when the key is the correct
    length. For example, authenc and authencesn set it when the key payload
    is malformed in any way (not just a bad length), the atmel-sha and ccree
    drivers can set it if a memory allocation fails, and the chelsio driver
    sets it for bad auth tag lengths, not just bad key lengths.

    So even if someone actually wanted to start checking this flag (which
    seems unlikely, since it's been unused for a long time), there would be
    a lot of work needed to get it working correctly. But it would probably
    be much better to go back to the drawing board and just define different
    return values, like -EINVAL if the key is invalid for the algorithm vs.
    -EKEYREJECTED if the key was rejected by a policy like "no weak keys".
    That would be much simpler, less error-prone, and easier to test.

    So just remove this flag.

    Signed-off-by: Eric Biggers
    Reviewed-by: Horia Geantă
    Signed-off-by: Herbert Xu

    Eric Biggers
     

11 Dec, 2019

1 commit


17 Nov, 2019

1 commit

  • Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface")
    dated 20 august 2015 introduced the new skcipher API which is supposed to
    replace both blkcipher and ablkcipher. While all consumers of the API have
    been converted long ago, some producers of the ablkcipher remain, forcing
    us to keep the ablkcipher support routines alive, along with the matching
    code to expose [a]blkciphers via the skcipher API.

    So switch this driver to the skcipher API, allowing us to finally drop the
    ablkcipher code in the near future.

    Reviewed-by: Linus Walleij
    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Herbert Xu

    Ard Biesheuvel
     

01 Nov, 2019

1 commit


23 Oct, 2019

1 commit

  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/crypto/ux500/hash/hash_core.c: In function hash_set_dma_transfer:
    drivers/crypto/ux500/hash/hash_core.c:143:15: warning: variable cookie set but not used [-Wunused-but-set-variable]

    It is not used since commit 8a63b1994c50 ("crypto:
    ux500 - Add driver for HASH hardware")

    Reported-by: Hulk Robot
    Signed-off-by: zhengbin
    Signed-off-by: Herbert Xu

    zhengbin
     

09 Sep, 2019

1 commit


22 Aug, 2019

2 commits


09 Aug, 2019

1 commit

  • Mark switch cases where we are expecting to fall through.

    This patch fixes the following warning (Building: arm):

    drivers/crypto/ux500/cryp/cryp.c: In function ‘cryp_save_device_context’:
    drivers/crypto/ux500/cryp/cryp.c:316:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ctx->key_4_r = readl_relaxed(&src_reg->key_4_r);
    drivers/crypto/ux500/cryp/cryp.c:318:2: note: here
    case CRYP_KEY_SIZE_192:
    ^~~~
    drivers/crypto/ux500/cryp/cryp.c:320:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ctx->key_3_r = readl_relaxed(&src_reg->key_3_r);
    drivers/crypto/ux500/cryp/cryp.c:322:2: note: here
    case CRYP_KEY_SIZE_128:
    ^~~~
    drivers/crypto/ux500/cryp/cryp.c:324:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ctx->key_2_r = readl_relaxed(&src_reg->key_2_r);
    drivers/crypto/ux500/cryp/cryp.c:326:2: note: here
    default:
    ^~~~~~~
    In file included from ./include/linux/io.h:13:0,
    from drivers/crypto/ux500/cryp/cryp_p.h:14,
    from drivers/crypto/ux500/cryp/cryp.c:15:
    drivers/crypto/ux500/cryp/cryp.c: In function ‘cryp_restore_device_context’:
    ./arch/arm/include/asm/io.h:92:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
    #define __raw_writel __raw_writel
    ^
    ./arch/arm/include/asm/io.h:299:29: note: in expansion of macro ‘__raw_writel’
    #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
    ^~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:363:3: note: in expansion of macro ‘writel_relaxed’
    writel_relaxed(ctx->key_4_r, ®->key_4_r);
    ^~~~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:365:2: note: here
    case CRYP_KEY_SIZE_192:
    ^~~~
    In file included from ./include/linux/io.h:13:0,
    from drivers/crypto/ux500/cryp/cryp_p.h:14,
    from drivers/crypto/ux500/cryp/cryp.c:15:
    ./arch/arm/include/asm/io.h:92:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
    #define __raw_writel __raw_writel
    ^
    ./arch/arm/include/asm/io.h:299:29: note: in expansion of macro ‘__raw_writel’
    #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
    ^~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:367:3: note: in expansion of macro ‘writel_relaxed’
    writel_relaxed(ctx->key_3_r, ®->key_3_r);
    ^~~~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:369:2: note: here
    case CRYP_KEY_SIZE_128:
    ^~~~
    In file included from ./include/linux/io.h:13:0,
    from drivers/crypto/ux500/cryp/cryp_p.h:14,
    from drivers/crypto/ux500/cryp/cryp.c:15:
    ./arch/arm/include/asm/io.h:92:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
    #define __raw_writel __raw_writel
    ^
    ./arch/arm/include/asm/io.h:299:29: note: in expansion of macro ‘__raw_writel’
    #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
    ^~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:371:3: note: in expansion of macro ‘writel_relaxed’
    writel_relaxed(ctx->key_2_r, ®->key_2_r);
    ^~~~~~~~~~~~~~
    drivers/crypto/ux500/cryp/cryp.c:373:2: note: here
    default:
    ^~~~~~~

    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Kees Cook
    Signed-off-by: Herbert Xu

    Gustavo A. R. Silva
     

26 Jul, 2019

1 commit


02 Jun, 2019

1 commit


31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    license terms gnu general public license gpl version 2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Reviewed-by: Steve Winslow
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528170027.447718015@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

25 Apr, 2019

1 commit


18 Apr, 2019

1 commit


25 Jan, 2019

1 commit

  • CRYPTO_TFM_REQ_WEAK_KEY confuses newcomers to the crypto API because it
    sounds like it is requesting a weak key. Actually, it is requesting
    that weak keys be forbidden (for algorithms that have the notion of
    "weak keys"; currently only DES and XTS do).

    Also it is only one letter away from CRYPTO_TFM_RES_WEAK_KEY, with which
    it can be easily confused. (This in fact happened in the UX500 driver,
    though just in some debugging messages.)

    Therefore, make the intent clear by renaming it to
    CRYPTO_TFM_REQ_FORBID_WEAK_KEYS.

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

    Eric Biggers
     

11 Jan, 2019

1 commit


23 Dec, 2018

2 commits

  • Clang warns when one enumerated type is implicitly converted to another:

    drivers/crypto/ux500/hash/hash_core.c:169:4: warning: implicit
    conversion from enumeration type 'enum dma_data_direction' to different
    enumeration type 'enum dma_transfer_direction' [-Wenum-conversion]
    direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
    ^~~~~~~~~
    1 warning generated.

    dmaengine_prep_slave_sg expects an enum from dma_transfer_direction.
    We know that the only direction supported by this function is
    DMA_TO_DEVICE because of the check at the top of this function so we can
    just use the equivalent value from dma_transfer_direction.

    DMA_TO_DEVICE = DMA_MEM_TO_DEV = 1

    Signed-off-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Herbert Xu

    Nathan Chancellor
     
  • Clang warns when one enumerated type is implicitly converted to another:

    drivers/crypto/ux500/cryp/cryp_core.c:559:5: warning: implicit
    conversion from enumeration type 'enum dma_data_direction' to different
    enumeration type 'enum dma_transfer_direction' [-Wenum-conversion]
    direction, DMA_CTRL_ACK);
    ^~~~~~~~~
    drivers/crypto/ux500/cryp/cryp_core.c:583:5: warning: implicit
    conversion from enumeration type 'enum dma_data_direction' to different
    enumeration type 'enum dma_transfer_direction' [-Wenum-conversion]
    direction,
    ^~~~~~~~~
    2 warnings generated.

    dmaengine_prep_slave_sg expects an enum from dma_transfer_direction.
    Because we know the value of the dma_data_direction enum from the
    switch statement, we can just use the proper value from
    dma_transfer_direction so there is no more conversion.

    DMA_TO_DEVICE = DMA_MEM_TO_DEV = 1
    DMA_FROM_DEVICE = DMA_DEV_TO_MEM = 2

    Signed-off-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Herbert Xu

    Nathan Chancellor
     

19 Aug, 2018

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the bit set of char/misc drivers for 4.19-rc1

    There is a lot here, much more than normal, seems like everyone is
    writing new driver subsystems these days... Anyway, major things here
    are:

    - new FSI driver subsystem, yet-another-powerpc low-level hardware
    bus

    - gnss, finally an in-kernel GPS subsystem to try to tame all of the
    crazy out-of-tree drivers that have been floating around for years,
    combined with some really hacky userspace implementations. This is
    only for GNSS receivers, but you have to start somewhere, and this
    is great to see.

    Other than that, there are new slimbus drivers, new coresight drivers,
    new fpga drivers, and loads of DT bindings for all of these and
    existing drivers.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (255 commits)
    android: binder: Rate-limit debug and userspace triggered err msgs
    fsi: sbefifo: Bump max command length
    fsi: scom: Fix NULL dereference
    misc: mic: SCIF Fix scif_get_new_port() error handling
    misc: cxl: changed asterisk position
    genwqe: card_base: Use true and false for boolean values
    misc: eeprom: assignment outside the if statement
    uio: potential double frees if __uio_register_device() fails
    eeprom: idt_89hpesx: clean up an error pointer vs NULL inconsistency
    misc: ti-st: Fix memory leak in the error path of probe()
    android: binder: Show extra_buffers_size in trace
    firmware: vpd: Fix section enabled flag on vpd_section_destroy
    platform: goldfish: Retire pdev_bus
    goldfish: Use dedicated macros instead of manual bit shifting
    goldfish: Add missing includes to goldfish.h
    mux: adgs1408: new driver for Analog Devices ADGS1408/1409 mux
    dt-bindings: mux: add adi,adgs1408
    Drivers: hv: vmbus: Cleanup synic memory free path
    Drivers: hv: vmbus: Remove use of slow_virt_to_phys()
    Drivers: hv: vmbus: Reset the channel callback in vmbus_onoffer_rescind()
    ...

    Linus Torvalds
     

09 Jul, 2018

2 commits

  • Some ahash algorithms set .cra_type = &crypto_ahash_type. But this is
    redundant with the C structure type ('struct ahash_alg'), and
    crypto_register_ahash() already sets the .cra_type automatically.
    Apparently the useless assignment has just been copy+pasted around.

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

    This patch shouldn't change any actual behavior.

    Signed-off-by: Eric Biggers
    Acked-by: Gilad Ben-Yossef
    Signed-off-by: Herbert Xu

    Eric Biggers
     
  • Many ahash algorithms set .cra_flags = CRYPTO_ALG_TYPE_AHASH. But this
    is redundant with the C structure type ('struct ahash_alg'), and
    crypto_register_ahash() 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 ahash algorithms.

    This patch shouldn't change any actual behavior.

    Signed-off-by: Eric Biggers
    Acked-by: Gilad Ben-Yossef
    Signed-off-by: Herbert Xu

    Eric Biggers
     

07 Jul, 2018

1 commit

  • At over 4000 #includes, is the 9th most
    #included header file in the Linux kernel. It does not need
    , so drop that header and explicitly add
    to source files that need it.

    4146 #include

    After this patch, there are 225 files that use ,
    for a reduction of around 3900 times that
    does not have to be read & parsed.

    225 #include

    This patch was build-tested on 20 different arch-es.

    It also makes these drivers SubmitChecklist#1 compliant.

    Signed-off-by: Randy Dunlap
    Reported-by: kbuild test robot # drivers/media/platform/vimc/
    Reported-by: kbuild test robot # drivers/pinctrl/pinctrl-u300.c
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

22 Feb, 2018

4 commits


15 Feb, 2018

1 commit

  • Crypto framework requires export/import in async hash. If driver do not
    implement them, wrapper functions in framework will be used, and it will
    cause error during ahash alg registration (unless one disables crypto
    internal tests). To make change in framework and expose this requirement,
    I will remove wrappers from crypto/ahash.c , but this can broke code which
    depends on them. Add empty hash export and import, with the same behaviour
    as in framework and expose this directly in driver. This can also prevent
    OOPS when config option in Cryptographic API 'Disable run-time self tests'
    will be enabled.

    Signed-off-by: Kamil Konieczny
    Acked-by: Linus Walleij
    Signed-off-by: Herbert Xu

    Kamil Konieczny
     

22 Sep, 2017

1 commit

  • Fix checkpatch.pl warnings:

    WARNING: void function return statements are not generally useful
    FILE: crypto/rmd128.c:218:
    FILE: crypto/rmd160.c:261:
    FILE: crypto/rmd256.c:233:
    FILE: crypto/rmd320.c:280:
    FILE: crypto/tcrypt.c:385:
    FILE: drivers/crypto/ixp4xx_crypto.c:538:
    FILE: drivers/crypto/marvell/cesa.c:81:
    FILE: drivers/crypto/ux500/cryp/cryp_core.c:1755:

    Signed-off-by: Geliang Tang
    Signed-off-by: Herbert Xu

    Geliang Tang
     

10 Mar, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    disble||disable
    disbled||disabled

    I kept the TSL2563_INT_DISBLED in /drivers/iio/light/tsl2563.c
    untouched. The macro is not referenced at all, but this commit is
    touching only comment blocks just in case.

    Link: http://lkml.kernel.org/r/1481573103-11329-20-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

21 Jul, 2016

1 commit


28 Jun, 2016

1 commit

  • The ARM allmodconfig build currently warngs because of the
    ux500 crypto driver not working well with the jump label
    implementation that we started using for dynamic debug, which
    breaks building with 'gcc -O0':

    In file included from /git/arm-soc/include/linux/jump_label.h:105:0,
    from /git/arm-soc/include/linux/dynamic_debug.h:5,
    from /git/arm-soc/include/linux/printk.h:289,
    from /git/arm-soc/include/linux/kernel.h:13,
    from /git/arm-soc/include/linux/clk.h:16,
    from /git/arm-soc/drivers/crypto/ux500/hash/hash_core.c:16:
    /git/arm-soc/arch/arm/include/asm/jump_label.h: In function 'hash_set_dma_transfer':
    /git/arm-soc/arch/arm/include/asm/jump_label.h:13:7: error: asm operand 0 probably doesn't match constraints [-Werror]
    asm_volatile_goto("1:\n\t"

    Turning off compiler optimizations has never really been supported
    here, and it's only used when debugging the driver. I have not found
    a good reason for doing this here, other than a misguided attempt
    to produce more readable assembly output. Also, the driver is only
    used in obsolete hardware that almost certainly nobody will spend
    time debugging any more.

    This just removes the -O0 flag from the compiler options.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Arnd Bergmann
     

13 Jun, 2016

1 commit

  • The hash buffer is really HASH_BLOCK_SIZE bytes, someone
    must have thought that memmove takes n*u32 words by mistake.
    Tests work as good/bad as before after this patch.

    Cc: Joakim Bech
    Cc: stable@vger.kernel.org
    Reported-by: David Binderman
    Signed-off-by: Linus Walleij
    Signed-off-by: Herbert Xu

    Linus Walleij
     

11 Mar, 2016

1 commit


22 Dec, 2015

1 commit