Commit 15252d94 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: skcipher - remove crypto_skcipher::setkey

Due to the removal of the blkcipher and ablkcipher algorithm types,
crypto_skcipher::setkey now always points to skcipher_setkey().

Simplify by removing this function pointer and instead just making
skcipher_setkey() be crypto_skcipher_setkey() directly.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9ac0d136
...@@ -610,7 +610,7 @@ static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm, ...@@ -610,7 +610,7 @@ static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm,
return ret; return ret;
} }
static int skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, int crypto_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
unsigned int keylen) unsigned int keylen)
{ {
struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); struct skcipher_alg *cipher = crypto_skcipher_alg(tfm);
...@@ -635,6 +635,7 @@ static int skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, ...@@ -635,6 +635,7 @@ static int skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(crypto_skcipher_setkey);
int crypto_skcipher_encrypt(struct skcipher_request *req) int crypto_skcipher_encrypt(struct skcipher_request *req)
{ {
...@@ -683,7 +684,6 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm) ...@@ -683,7 +684,6 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);
struct skcipher_alg *alg = crypto_skcipher_alg(skcipher); struct skcipher_alg *alg = crypto_skcipher_alg(skcipher);
skcipher->setkey = skcipher_setkey;
skcipher->encrypt = alg->encrypt; skcipher->encrypt = alg->encrypt;
skcipher->decrypt = alg->decrypt; skcipher->decrypt = alg->decrypt;
......
...@@ -35,8 +35,6 @@ struct skcipher_request { ...@@ -35,8 +35,6 @@ struct skcipher_request {
}; };
struct crypto_skcipher { struct crypto_skcipher {
int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
unsigned int keylen);
int (*encrypt)(struct skcipher_request *req); int (*encrypt)(struct skcipher_request *req);
int (*decrypt)(struct skcipher_request *req); int (*decrypt)(struct skcipher_request *req);
...@@ -364,11 +362,8 @@ static inline void crypto_sync_skcipher_clear_flags( ...@@ -364,11 +362,8 @@ static inline void crypto_sync_skcipher_clear_flags(
* *
* Return: 0 if the setting of the key was successful; < 0 if an error occurred * Return: 0 if the setting of the key was successful; < 0 if an error occurred
*/ */
static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm, int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen) const u8 *key, unsigned int keylen);
{
return tfm->setkey(tfm, key, keylen);
}
static inline int crypto_sync_skcipher_setkey(struct crypto_sync_skcipher *tfm, static inline int crypto_sync_skcipher_setkey(struct crypto_sync_skcipher *tfm,
const u8 *key, unsigned int keylen) const u8 *key, unsigned int keylen)
......
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