Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37dc7956 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull crypto updates from Herbert Xu:
 "Here is the crypto update for 4.15:

  API:

   - Disambiguate EBUSY when queueing crypto request by adding ENOSPC.
     This change touches code outside the crypto API.
   - Reset settings when empty string is written to rng_current.

  Algorithms:

   - Add OSCCA SM3 secure hash.

  Drivers:

   - Remove old mv_cesa driver (replaced by marvell/cesa).
   - Enable rfc3686/ecb/cfb/ofb AES in crypto4xx.
   - Add ccm/gcm AES in crypto4xx.
   - Add support for BCM7278 in iproc-rng200.
   - Add hash support on Exynos in s5p-sss.
   - Fix fallback-induced error in vmx.
   - Fix output IV in atmel-aes.
   - Fix empty GCM hash in mediatek.

  Others:

   - Fix DoS potential in lib/mpi.
   - Fix potential out-of-order issues with padata"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (162 commits)
  lib/mpi: call cond_resched() from mpi_powm() loop
  crypto: stm32/hash - Fix return issue on update
  crypto: dh - Remove pointless checks for NULL 'p' and 'g'
  crypto: qat - Clean up error handling in qat_dh_set_secret()
  crypto: dh - Don't permit 'key' or 'g' size longer than 'p'
  crypto: dh - Don't permit 'p' to be 0
  crypto: dh - Fix double free of ctx->p
  hwrng: iproc-rng200 - Add support for BCM7278
  dt-bindings: rng: Document BCM7278 RNG200 compatible
  crypto: chcr - Replace _manual_ swap with swap macro
  crypto: marvell - Add a NULL entry at the end of mv_cesa_plat_id_table[]
  hwrng: virtio - Virtio RNG devices need to be re-registered after suspend/resume
  crypto: atmel - remove empty functions
  crypto: ecdh - remove empty exit()
  MAINTAINERS: update maintainer for qat
  crypto: caam - remove unused param of ctx_map_to_sec4_sg()
  crypto: caam - remove unneeded edesc zeroization
  crypto: atmel-aes - Reset the controller before each use
  crypto: atmel-aes - properly set IV after {en,de}crypt
  hwrng: core - Reset user selected rng by writing "" to rng_current
  ...
parents 894025f2 1d9ddde1
Loading
Loading
Loading
Loading
+10 −42
Original line number Original line Diff line number Diff line
@@ -7,59 +7,27 @@ Code Example For Symmetric Key Cipher Operation
::
::




    struct tcrypt_result {
        struct completion completion;
        int err;
    };

    /* tie all data structures together */
    /* tie all data structures together */
    struct skcipher_def {
    struct skcipher_def {
        struct scatterlist sg;
        struct scatterlist sg;
        struct crypto_skcipher *tfm;
        struct crypto_skcipher *tfm;
        struct skcipher_request *req;
        struct skcipher_request *req;
        struct tcrypt_result result;
        struct crypto_wait wait;
    };
    };


    /* Callback function */
    static void test_skcipher_cb(struct crypto_async_request *req, int error)
    {
        struct tcrypt_result *result = req->data;

        if (error == -EINPROGRESS)
            return;
        result->err = error;
        complete(&result->completion);
        pr_info("Encryption finished successfully\n");
    }

    /* Perform cipher operation */
    /* Perform cipher operation */
    static unsigned int test_skcipher_encdec(struct skcipher_def *sk,
    static unsigned int test_skcipher_encdec(struct skcipher_def *sk,
                         int enc)
                         int enc)
    {
    {
        int rc = 0;
        int rc;


        if (enc)
        if (enc)
            rc = crypto_skcipher_encrypt(sk->req);
            rc = crypto_wait_req(crypto_skcipher_encrypt(sk->req), &sk->wait);
        else
        else
            rc = crypto_skcipher_decrypt(sk->req);
            rc = crypto_wait_req(crypto_skcipher_decrypt(sk->req), &sk->wait);


        switch (rc) {
	if (rc)
        case 0:
		pr_info("skcipher encrypt returned with result %d\n", rc);
            break;
        case -EINPROGRESS:
        case -EBUSY:
            rc = wait_for_completion_interruptible(
                &sk->result.completion);
            if (!rc && !sk->result.err) {
                reinit_completion(&sk->result.completion);
                break;
            }
        default:
            pr_info("skcipher encrypt returned with %d result %d\n",
                rc, sk->result.err);
            break;
        }
        init_completion(&sk->result.completion);


        return rc;
        return rc;
    }
    }
@@ -89,8 +57,8 @@ Code Example For Symmetric Key Cipher Operation
        }
        }


        skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
        skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
                          test_skcipher_cb,
                          crypto_req_done,
                          &sk.result);
                          &sk.wait);


        /* AES 256 with random key */
        /* AES 256 with random key */
        get_random_bytes(&key, 32);
        get_random_bytes(&key, 32);
@@ -122,7 +90,7 @@ Code Example For Symmetric Key Cipher Operation
        /* We encrypt one block */
        /* We encrypt one block */
        sg_init_one(&sk.sg, scratchpad, 16);
        sg_init_one(&sk.sg, scratchpad, 16);
        skcipher_request_set_crypt(req, &sk.sg, &sk.sg, 16, ivdata);
        skcipher_request_set_crypt(req, &sk.sg, &sk.sg, 16, ivdata);
        init_completion(&sk.result.completion);
        crypto_init_wait(&sk.wait);


        /* encrypt data */
        /* encrypt data */
        ret = test_skcipher_encdec(&sk, 1);
        ret = test_skcipher_encdec(&sk, 1);
+3 −1
Original line number Original line Diff line number Diff line
HWRNG support for the iproc-rng200 driver
HWRNG support for the iproc-rng200 driver


Required properties:
Required properties:
- compatible : "brcm,iproc-rng200"
- compatible : Must be one of:
	       "brcm,bcm7278-rng200"
	       "brcm,iproc-rng200"
- reg : base address and size of control register block
- reg : base address and size of control register block


Example:
Example:
+2 −3
Original line number Original line Diff line number Diff line
@@ -5484,7 +5484,7 @@ F: include/uapi/linux/fb.h


FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
M:	Horia Geantă <horia.geanta@nxp.com>
M:	Horia Geantă <horia.geanta@nxp.com>
M:	Dan Douglass <dan.douglass@nxp.com>
M:	Aymen Sghaier <aymen.sghaier@nxp.com>
L:	linux-crypto@vger.kernel.org
L:	linux-crypto@vger.kernel.org
S:	Maintained
S:	Maintained
F:	drivers/crypto/caam/
F:	drivers/crypto/caam/
@@ -11060,7 +11060,6 @@ F: drivers/mtd/nand/pxa3xx_nand.c


QAT DRIVER
QAT DRIVER
M:	Giovanni Cabiddu <giovanni.cabiddu@intel.com>
M:	Giovanni Cabiddu <giovanni.cabiddu@intel.com>
M:	Salvatore Benedetto <salvatore.benedetto@intel.com>
L:	qat-linux@intel.com
L:	qat-linux@intel.com
S:	Supported
S:	Supported
F:	drivers/crypto/qat/
F:	drivers/crypto/qat/
@@ -11793,7 +11792,7 @@ L: linux-crypto@vger.kernel.org
L:	linux-samsung-soc@vger.kernel.org
L:	linux-samsung-soc@vger.kernel.org
S:	Maintained
S:	Maintained
F:	drivers/crypto/exynos-rng.c
F:	drivers/crypto/exynos-rng.c
F:	Documentation/devicetree/bindings/rng/samsung,exynos-rng4.txt
F:	Documentation/devicetree/bindings/crypto/samsung,exynos-rng4.txt


SAMSUNG FRAMEBUFFER DRIVER
SAMSUNG FRAMEBUFFER DRIVER
M:	Jingoo Han <jingoohan1@gmail.com>
M:	Jingoo Han <jingoohan1@gmail.com>
+1 −1
Original line number Original line Diff line number Diff line
@@ -140,6 +140,6 @@ CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_LZO=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_DEV_MV_CESA=y
CONFIG_CRYPTO_DEV_MARVELL_CESA=y
CONFIG_CRC_CCITT=y
CONFIG_CRC_CCITT=y
CONFIG_LIBCRC32C=y
CONFIG_LIBCRC32C=y
Loading