Commit 5527dfb6 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: kpp - constify buffer passed to crypto_kpp_set_secret()

Constify the buffer passed to crypto_kpp_set_secret() and
kpp_alg.set_secret, since it is never modified.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent cd220ae6
...@@ -79,7 +79,8 @@ static int dh_set_params(struct dh_ctx *ctx, struct dh *params) ...@@ -79,7 +79,8 @@ static int dh_set_params(struct dh_ctx *ctx, struct dh *params)
return 0; 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_ctx *ctx = dh_get_ctx(tfm);
struct dh params; struct dh params;
......
...@@ -38,7 +38,8 @@ static unsigned int ecdh_supported_curve(unsigned int curve_id) ...@@ -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_ctx *ctx = ecdh_get_ctx(tfm);
struct ecdh params; struct ecdh params;
......
...@@ -491,7 +491,7 @@ static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx) ...@@ -491,7 +491,7 @@ static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx)
ctx->g2 = false; 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) unsigned int len)
{ {
struct qat_dh_ctx *ctx = kpp_tfm_ctx(tfm); struct qat_dh_ctx *ctx = kpp_tfm_ctx(tfm);
......
...@@ -74,7 +74,7 @@ struct crypto_kpp { ...@@ -74,7 +74,7 @@ struct crypto_kpp {
* @base: Common crypto API algorithm data structure * @base: Common crypto API algorithm data structure
*/ */
struct kpp_alg { 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); unsigned int len);
int (*generate_public_key)(struct kpp_request *req); int (*generate_public_key)(struct kpp_request *req);
int (*compute_shared_secret)(struct kpp_request *req); int (*compute_shared_secret)(struct kpp_request *req);
...@@ -273,8 +273,8 @@ struct kpp_secret { ...@@ -273,8 +273,8 @@ struct kpp_secret {
* *
* Return: zero on success; error code in case of error * Return: zero on success; error code in case of error
*/ */
static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm, void *buffer, static inline int crypto_kpp_set_secret(struct crypto_kpp *tfm,
unsigned int len) const void *buffer, unsigned int len)
{ {
struct kpp_alg *alg = crypto_kpp_alg(tfm); struct kpp_alg *alg = crypto_kpp_alg(tfm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment