]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
crypto: kpp - constify buffer passed to crypto_kpp_set_secret()
authorEric Biggers <ebiggers@google.com>
Fri, 24 Feb 2017 23:46:58 +0000 (15:46 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Mar 2017 10:34:27 +0000 (18:34 +0800)
Constify the buffer passed to crypto_kpp_set_secret() and
kpp_alg.set_secret, since it is never modified.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/dh.c
crypto/ecdh.c
drivers/crypto/qat/qat_common/qat_asym_algs.c
include/crypto/kpp.h

index ddcb528ab2ccc7f56b48f4c9bc2108ebdfc9511c..87e3542cf1b89e836b1316476d09031010abdea7 100644 (file)
@@ -79,7 +79,8 @@ static int dh_set_params(struct dh_ctx *ctx, struct dh *params)
        return 0;
 }
 
-static int dh_set_secret(struct crypto_kpp *tfm, void *buf, unsigned int len)
+static int dh_set_secret(struct crypto_kpp *tfm, const void *buf,
+                        unsigned int len)
 {
        struct dh_ctx *ctx = dh_get_ctx(tfm);
        struct dh params;
index 3de289806d6784d0affcdc356d16a2fee3d31d65..63ca33771e4e771ebd0307d75e0e82c284cc51df 100644 (file)
@@ -38,7 +38,8 @@ static unsigned int ecdh_supported_curve(unsigned int curve_id)
        }
 }
 
-static int ecdh_set_secret(struct crypto_kpp *tfm, void *buf, unsigned int len)
+static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
+                          unsigned int len)
 {
        struct ecdh_ctx *ctx = ecdh_get_ctx(tfm);
        struct ecdh params;
index 0d35dca2e925ca7ec3f8d5b65def807bb86db2e0..2aab80bc241fa4d4fd74253579c6a4ad07c784c5 100644 (file)
@@ -491,7 +491,7 @@ static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx)
        ctx->g2 = false;
 }
 
-static int qat_dh_set_secret(struct crypto_kpp *tfm, void *buf,
+static int qat_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
                             unsigned int len)
 {
        struct qat_dh_ctx *ctx = kpp_tfm_ctx(tfm);
index 4307a2f2365f49433ecf46a03007a7316ab4df58..ce8e1f79374b64c30eb045d2cff8ad021bf340b1 100644 (file)
@@ -74,7 +74,7 @@ struct crypto_kpp {
  * @base:              Common crypto API algorithm data structure
  */
 struct kpp_alg {
-       int (*set_secret)(struct crypto_kpp *tfm, void *buffer,
+       int (*set_secret)(struct crypto_kpp *tfm, const void *buffer,
                          unsigned int len);
        int (*generate_public_key)(struct kpp_request *req);
        int (*compute_shared_secret)(struct kpp_request *req);
@@ -273,8 +273,8 @@ struct kpp_secret {
  *
  * Return: zero on success; error code in case of error
  */
-static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm, void *buffer,
-                                       unsigned int len)
+static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm,
+                                       const void *buffer, unsigned int len)
 {
        struct kpp_alg *alg = crypto_kpp_alg(tfm);