crypto: shash - remove shash_desc::flags

The flags field in 'struct shash_desc' never actually does anything.
The only ostensibly supported flag is CRYPTO_TFM_REQ_MAY_SLEEP.
However, no shash algorithm ever sleeps, making this flag a no-op.

With this being the case, inevitably some users who can't sleep wrongly
pass MAY_SLEEP.  These would all need to be fixed if any shash algorithm
actually started sleeping.  For example, the shash_ahash_*() functions,
which wrap a shash algorithm with the ahash API, pass through MAY_SLEEP
from the ahash API to the shash API.  However, the shash functions are
called under kmap_atomic(), so actually they're assumed to never sleep.

Even if it turns out that some users do need preemption points while
hashing large buffers, we could easily provide a helper function
crypto_shash_update_large() which divides the data into smaller chunks
and calls crypto_shash_update() and cond_resched() for each chunk.  It's
not necessary to have a flag in 'struct shash_desc', nor is it necessary
to make individual shash algorithms aware of this at all.

Therefore, remove shash_desc::flags, and document that the
crypto_shash_*() functions can be called from any context.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Eric Biggers 2019-04-14 17:37:09 -07:00 committed by Herbert Xu
parent 75f2222832
commit 877b5691f2
66 changed files with 8 additions and 113 deletions

View File

@ -133,7 +133,6 @@ Code Example For Use of Operational State Memory With SHASH
if (!sdesc) if (!sdesc)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
sdesc->shash.tfm = alg; sdesc->shash.tfm = alg;
sdesc->shash.flags = 0x0;
return sdesc; return sdesc;
} }

View File

@ -186,7 +186,6 @@ static int ghash_async_init(struct ahash_request *req)
struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm); struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm);
desc->tfm = child; desc->tfm = child;
desc->flags = req->base.flags;
return crypto_shash_init(desc); return crypto_shash_init(desc);
} }
@ -243,7 +242,6 @@ static int ghash_async_digest(struct ahash_request *req)
struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm); struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm);
desc->tfm = child; desc->tfm = child;
desc->flags = req->base.flags;
return shash_ahash_digest(req, desc); return shash_ahash_digest(req, desc);
} }
} }
@ -256,7 +254,6 @@ static int ghash_async_import(struct ahash_request *req, const void *in)
struct shash_desc *desc = cryptd_shash_desc(cryptd_req); struct shash_desc *desc = cryptd_shash_desc(cryptd_req);
desc->tfm = cryptd_ahash_child(ctx->cryptd_tfm); desc->tfm = cryptd_ahash_child(ctx->cryptd_tfm);
desc->flags = req->base.flags;
return crypto_shash_import(desc, in); return crypto_shash_import(desc, in);
} }

View File

@ -172,7 +172,6 @@ static int ghash_async_init(struct ahash_request *req)
struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm); struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm);
desc->tfm = child; desc->tfm = child;
desc->flags = req->base.flags;
return crypto_shash_init(desc); return crypto_shash_init(desc);
} }
@ -252,7 +251,6 @@ static int ghash_async_digest(struct ahash_request *req)
struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm); struct crypto_shash *child = cryptd_ahash_child(cryptd_tfm);
desc->tfm = child; desc->tfm = child;
desc->flags = req->base.flags;
return shash_ahash_digest(req, desc); return shash_ahash_digest(req, desc);
} }
} }

View File

@ -90,7 +90,6 @@ static int get_e820_md5(struct e820_table *table, void *buf)
} }
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
size = offsetof(struct e820_table, entries) + size = offsetof(struct e820_table, entries) +
sizeof(struct e820_entry) * table->nr_entries; sizeof(struct e820_entry) * table->nr_entries;

View File

@ -265,7 +265,6 @@ static int adiantum_hash_message(struct skcipher_request *req,
int err; int err;
hash_desc->tfm = tctx->hash; hash_desc->tfm = tctx->hash;
hash_desc->flags = 0;
err = crypto_shash_init(hash_desc); err = crypto_shash_init(hash_desc);
if (err) if (err)

View File

@ -56,7 +56,6 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7,
goto error_no_desc; goto error_no_desc;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
/* Digest the message [RFC2315 9.3] */ /* Digest the message [RFC2315 9.3] */
ret = crypto_shash_digest(desc, pkcs7->data, pkcs7->data_len, ret = crypto_shash_digest(desc, pkcs7->data, pkcs7->data_len,

View File

@ -354,7 +354,6 @@ static int pefile_digest_pe(const void *pebuf, unsigned int pelen,
goto error_no_desc; goto error_no_desc;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ret = crypto_shash_init(desc); ret = crypto_shash_init(desc);
if (ret < 0) if (ret < 0)
goto error; goto error;

View File

@ -77,7 +77,6 @@ int x509_get_sig_params(struct x509_certificate *cert)
goto error; goto error;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest); ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest);
if (ret < 0) if (ret < 0)

View File

@ -545,7 +545,6 @@ static void cryptd_hash_init(struct crypto_async_request *req_async, int err)
goto out; goto out;
desc->tfm = child; desc->tfm = child;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_init(desc); err = crypto_shash_init(desc);
@ -637,7 +636,6 @@ static void cryptd_hash_digest(struct crypto_async_request *req_async, int err)
goto out; goto out;
desc->tfm = child; desc->tfm = child;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = shash_ahash_digest(req, desc); err = shash_ahash_digest(req, desc);
@ -666,7 +664,6 @@ static int cryptd_hash_import(struct ahash_request *req, const void *in)
struct shash_desc *desc = cryptd_shash_desc(req); struct shash_desc *desc = cryptd_shash_desc(req);
desc->tfm = ctx->child; desc->tfm = ctx->child;
desc->flags = req->base.flags;
return crypto_shash_import(desc, in); return crypto_shash_import(desc, in);
} }

View File

@ -1587,7 +1587,6 @@ static int drbg_init_hash_kernel(struct drbg_state *drbg)
} }
sdesc->shash.tfm = tfm; sdesc->shash.tfm = tfm;
sdesc->shash.flags = 0;
drbg->priv_data = sdesc; drbg->priv_data = sdesc;
return crypto_shash_alignmask(tfm); return crypto_shash_alignmask(tfm);

View File

@ -57,8 +57,6 @@ static int hmac_setkey(struct crypto_shash *parent,
unsigned int i; unsigned int i;
shash->tfm = hash; shash->tfm = hash;
shash->flags = crypto_shash_get_flags(parent)
& CRYPTO_TFM_REQ_MAY_SLEEP;
if (keylen > bs) { if (keylen > bs) {
int err; int err;
@ -91,8 +89,6 @@ static int hmac_export(struct shash_desc *pdesc, void *out)
{ {
struct shash_desc *desc = shash_desc_ctx(pdesc); struct shash_desc *desc = shash_desc_ctx(pdesc);
desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_export(desc, out); return crypto_shash_export(desc, out);
} }
@ -102,7 +98,6 @@ static int hmac_import(struct shash_desc *pdesc, const void *in)
struct hmac_ctx *ctx = hmac_ctx(pdesc->tfm); struct hmac_ctx *ctx = hmac_ctx(pdesc->tfm);
desc->tfm = ctx->hash; desc->tfm = ctx->hash;
desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_import(desc, in); return crypto_shash_import(desc, in);
} }
@ -117,8 +112,6 @@ static int hmac_update(struct shash_desc *pdesc,
{ {
struct shash_desc *desc = shash_desc_ctx(pdesc); struct shash_desc *desc = shash_desc_ctx(pdesc);
desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_update(desc, data, nbytes); return crypto_shash_update(desc, data, nbytes);
} }
@ -130,8 +123,6 @@ static int hmac_final(struct shash_desc *pdesc, u8 *out)
char *opad = crypto_shash_ctx_aligned(parent) + ss; char *opad = crypto_shash_ctx_aligned(parent) + ss;
struct shash_desc *desc = shash_desc_ctx(pdesc); struct shash_desc *desc = shash_desc_ctx(pdesc);
desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_final(desc, out) ?: return crypto_shash_final(desc, out) ?:
crypto_shash_import(desc, opad) ?: crypto_shash_import(desc, opad) ?:
crypto_shash_finup(desc, out, ds, out); crypto_shash_finup(desc, out, ds, out);
@ -147,8 +138,6 @@ static int hmac_finup(struct shash_desc *pdesc, const u8 *data,
char *opad = crypto_shash_ctx_aligned(parent) + ss; char *opad = crypto_shash_ctx_aligned(parent) + ss;
struct shash_desc *desc = shash_desc_ctx(pdesc); struct shash_desc *desc = shash_desc_ctx(pdesc);
desc->flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_finup(desc, data, nbytes, out) ?: return crypto_shash_finup(desc, data, nbytes, out) ?:
crypto_shash_import(desc, opad) ?: crypto_shash_import(desc, opad) ?:
crypto_shash_finup(desc, out, ds, out); crypto_shash_finup(desc, out, ds, out);

View File

@ -238,7 +238,6 @@ static int shash_async_init(struct ahash_request *req)
struct shash_desc *desc = ahash_request_ctx(req); struct shash_desc *desc = ahash_request_ctx(req);
desc->tfm = *ctx; desc->tfm = *ctx;
desc->flags = req->base.flags;
return crypto_shash_init(desc); return crypto_shash_init(desc);
} }
@ -293,7 +292,6 @@ static int shash_async_finup(struct ahash_request *req)
struct shash_desc *desc = ahash_request_ctx(req); struct shash_desc *desc = ahash_request_ctx(req);
desc->tfm = *ctx; desc->tfm = *ctx;
desc->flags = req->base.flags;
return shash_ahash_finup(req, desc); return shash_ahash_finup(req, desc);
} }
@ -328,7 +326,6 @@ static int shash_async_digest(struct ahash_request *req)
struct shash_desc *desc = ahash_request_ctx(req); struct shash_desc *desc = ahash_request_ctx(req);
desc->tfm = *ctx; desc->tfm = *ctx;
desc->flags = req->base.flags;
return shash_ahash_digest(req, desc); return shash_ahash_digest(req, desc);
} }
@ -344,7 +341,6 @@ static int shash_async_import(struct ahash_request *req, const void *in)
struct shash_desc *desc = ahash_request_ctx(req); struct shash_desc *desc = ahash_request_ctx(req);
desc->tfm = *ctx; desc->tfm = *ctx;
desc->flags = req->base.flags;
return crypto_shash_import(desc, in); return crypto_shash_import(desc, in);
} }

View File

@ -1328,7 +1328,6 @@ static void generate_random_hash_testvec(struct crypto_shash *tfm,
/* Digest */ /* Digest */
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
vec->digest_error = crypto_shash_digest(desc, vec->plaintext, vec->digest_error = crypto_shash_digest(desc, vec->plaintext,
vec->psize, (u8 *)vec->digest); vec->psize, (u8 *)vec->digest);
done: done:
@ -3027,7 +3026,6 @@ static int alg_test_crc32c(const struct alg_test_desc *desc,
u32 *ctx = (u32 *)shash_desc_ctx(shash); u32 *ctx = (u32 *)shash_desc_ctx(shash);
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
*ctx = 420553207; *ctx = 420553207;
err = crypto_shash_final(shash, (u8 *)&val); err = crypto_shash_final(shash, (u8 *)&val);

View File

@ -5443,7 +5443,6 @@ static int drbd_do_auth(struct drbd_connection *connection)
rcu_read_unlock(); rcu_read_unlock();
desc->tfm = connection->cram_hmac_tfm; desc->tfm = connection->cram_hmac_tfm;
desc->flags = 0;
rv = crypto_shash_setkey(connection->cram_hmac_tfm, (u8 *)secret, key_len); rv = crypto_shash_setkey(connection->cram_hmac_tfm, (u8 *)secret, key_len);
if (rv) { if (rv) {

View File

@ -304,7 +304,6 @@ void drbd_csum_ee(struct crypto_shash *tfm, struct drbd_peer_request *peer_req,
void *src; void *src;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
crypto_shash_init(desc); crypto_shash_init(desc);
@ -332,7 +331,6 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest)
struct bvec_iter iter; struct bvec_iter iter;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
crypto_shash_init(desc); crypto_shash_init(desc);

View File

@ -2247,8 +2247,6 @@ artpec6_crypto_hash_set_key(struct crypto_ahash *tfm,
SHASH_DESC_ON_STACK(hdesc, tfm_ctx->child_hash); SHASH_DESC_ON_STACK(hdesc, tfm_ctx->child_hash);
hdesc->tfm = tfm_ctx->child_hash; hdesc->tfm = tfm_ctx->child_hash;
hdesc->flags = crypto_ahash_get_flags(tfm) &
CRYPTO_TFM_REQ_MAY_SLEEP;
tfm_ctx->hmac_key_length = blocksize; tfm_ctx->hmac_key_length = blocksize;
ret = crypto_shash_digest(hdesc, key, keylen, ret = crypto_shash_digest(hdesc, key, keylen,

View File

@ -2140,7 +2140,6 @@ static int ahash_init(struct ahash_request *req)
goto err_hash; goto err_hash;
} }
ctx->shash->tfm = hash; ctx->shash->tfm = hash;
ctx->shash->flags = 0;
/* Set the key using data we already have from setkey */ /* Set the key using data we already have from setkey */
if (ctx->authkeylen > 0) { if (ctx->authkeylen > 0) {

View File

@ -242,7 +242,6 @@ int do_shash(unsigned char *name, unsigned char *result,
goto do_shash_err; goto do_shash_err;
} }
sdesc->shash.tfm = hash; sdesc->shash.tfm = hash;
sdesc->shash.flags = 0x0;
if (key_len > 0) { if (key_len > 0) {
rc = crypto_shash_setkey(hash, key, key_len); rc = crypto_shash_setkey(hash, key, key_len);

View File

@ -293,8 +293,6 @@ static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,
if (key_len > block_size) { if (key_len > block_size) {
/* Must hash the input key */ /* Must hash the input key */
sdesc->tfm = shash; sdesc->tfm = shash;
sdesc->flags = crypto_ahash_get_flags(tfm) &
CRYPTO_TFM_REQ_MAY_SLEEP;
ret = crypto_shash_digest(sdesc, key, key_len, ret = crypto_shash_digest(sdesc, key, key_len,
ctx->u.sha.key); ctx->u.sha.key);

View File

@ -2130,7 +2130,6 @@ static int chcr_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
* ipad in hmacctx->ipad and opad in hmacctx->opad location * ipad in hmacctx->ipad and opad in hmacctx->opad location
*/ */
shash->tfm = hmacctx->base_hash; shash->tfm = hmacctx->base_hash;
shash->flags = crypto_shash_get_flags(hmacctx->base_hash);
if (keylen > bs) { if (keylen > bs) {
err = crypto_shash_digest(shash, key, keylen, err = crypto_shash_digest(shash, key, keylen,
hmacctx->ipad); hmacctx->ipad);
@ -3517,7 +3516,6 @@ static int chcr_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
SHASH_DESC_ON_STACK(shash, base_hash); SHASH_DESC_ON_STACK(shash, base_hash);
shash->tfm = base_hash; shash->tfm = base_hash;
shash->flags = crypto_shash_get_flags(base_hash);
bs = crypto_shash_blocksize(base_hash); bs = crypto_shash_blocksize(base_hash);
align = KEYCTX_ALIGN_PAD(max_authsize); align = KEYCTX_ALIGN_PAD(max_authsize);
o_ptr = actx->h_iopad + param.result_size + align; o_ptr = actx->h_iopad + param.result_size + align;

View File

@ -365,7 +365,6 @@ static int mtk_sha_finish_hmac(struct ahash_request *req)
SHASH_DESC_ON_STACK(shash, bctx->shash); SHASH_DESC_ON_STACK(shash, bctx->shash);
shash->tfm = bctx->shash; shash->tfm = bctx->shash;
shash->flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */
return crypto_shash_init(shash) ?: return crypto_shash_init(shash) ?:
crypto_shash_update(shash, bctx->opad, ctx->bs) ?: crypto_shash_update(shash, bctx->opad, ctx->bs) ?:
@ -810,8 +809,6 @@ static int mtk_sha_setkey(struct crypto_ahash *tfm, const u8 *key,
SHASH_DESC_ON_STACK(shash, bctx->shash); SHASH_DESC_ON_STACK(shash, bctx->shash);
shash->tfm = bctx->shash; shash->tfm = bctx->shash;
shash->flags = crypto_shash_get_flags(bctx->shash) &
CRYPTO_TFM_REQ_MAY_SLEEP;
if (keylen > bs) { if (keylen > bs) {
err = crypto_shash_digest(shash, key, keylen, bctx->ipad); err = crypto_shash_digest(shash, key, keylen, bctx->ipad);

View File

@ -469,8 +469,6 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,
return err; return err;
shash->tfm = child_shash; shash->tfm = child_shash;
shash->flags = crypto_ahash_get_flags(tfm) &
CRYPTO_TFM_REQ_MAY_SLEEP;
bs = crypto_shash_blocksize(child_shash); bs = crypto_shash_blocksize(child_shash);
ds = crypto_shash_digestsize(child_shash); ds = crypto_shash_digestsize(child_shash);

View File

@ -1055,7 +1055,6 @@ static int omap_sham_finish_hmac(struct ahash_request *req)
SHASH_DESC_ON_STACK(shash, bctx->shash); SHASH_DESC_ON_STACK(shash, bctx->shash);
shash->tfm = bctx->shash; shash->tfm = bctx->shash;
shash->flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */
return crypto_shash_init(shash) ?: return crypto_shash_init(shash) ?:
crypto_shash_update(shash, bctx->opad, bs) ?: crypto_shash_update(shash, bctx->opad, bs) ?:
@ -1226,7 +1225,6 @@ static int omap_sham_shash_digest(struct crypto_shash *tfm, u32 flags,
SHASH_DESC_ON_STACK(shash, tfm); SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_digest(shash, data, len, out); return crypto_shash_digest(shash, data, len, out);
} }

View File

@ -39,7 +39,6 @@ static int padlock_sha_init(struct shash_desc *desc)
struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm); struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm);
dctx->fallback.tfm = ctx->fallback; dctx->fallback.tfm = ctx->fallback;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_init(&dctx->fallback); return crypto_shash_init(&dctx->fallback);
} }
@ -48,7 +47,6 @@ static int padlock_sha_update(struct shash_desc *desc,
{ {
struct padlock_sha_desc *dctx = shash_desc_ctx(desc); struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_update(&dctx->fallback, data, length); return crypto_shash_update(&dctx->fallback, data, length);
} }
@ -65,7 +63,6 @@ static int padlock_sha_import(struct shash_desc *desc, const void *in)
struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm); struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm);
dctx->fallback.tfm = ctx->fallback; dctx->fallback.tfm = ctx->fallback;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_import(&dctx->fallback, in); return crypto_shash_import(&dctx->fallback, in);
} }
@ -91,7 +88,6 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,
unsigned int leftover; unsigned int leftover;
int err; int err;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_export(&dctx->fallback, &state); err = crypto_shash_export(&dctx->fallback, &state);
if (err) if (err)
goto out; goto out;
@ -153,7 +149,6 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,
unsigned int leftover; unsigned int leftover;
int err; int err;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_export(&dctx->fallback, &state); err = crypto_shash_export(&dctx->fallback, &state);
if (err) if (err)
goto out; goto out;

View File

@ -164,7 +164,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
memset(ctx->ipad, 0, block_size); memset(ctx->ipad, 0, block_size);
memset(ctx->opad, 0, block_size); memset(ctx->opad, 0, block_size);
shash->tfm = ctx->hash_tfm; shash->tfm = ctx->hash_tfm;
shash->flags = 0x0;
if (auth_keylen > block_size) { if (auth_keylen > block_size) {
int ret = crypto_shash_digest(shash, auth_key, int ret = crypto_shash_digest(shash, auth_key,

View File

@ -1534,7 +1534,6 @@ static int s5p_hash_shash_digest(struct crypto_shash *tfm, u32 flags,
SHASH_DESC_ON_STACK(shash, tfm); SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = flags & ~CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_digest(shash, data, len, out); return crypto_shash_digest(shash, data, len, out);
} }

View File

@ -101,7 +101,6 @@ static int p8_ghash_init(struct shash_desc *desc)
dctx->bytes = 0; dctx->bytes = 0;
memset(dctx->shash, 0, GHASH_DIGEST_SIZE); memset(dctx->shash, 0, GHASH_DIGEST_SIZE);
dctx->fallback_desc.tfm = ctx->fallback; dctx->fallback_desc.tfm = ctx->fallback;
dctx->fallback_desc.flags = desc->flags;
return crypto_shash_init(&dctx->fallback_desc); return crypto_shash_init(&dctx->fallback_desc);
} }

View File

@ -80,7 +80,6 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe,
SHASH_DESC_ON_STACK(shash, rxe->tfm); SHASH_DESC_ON_STACK(shash, rxe->tfm);
shash->tfm = rxe->tfm; shash->tfm = rxe->tfm;
shash->flags = 0;
*(u32 *)shash_desc_ctx(shash) = crc; *(u32 *)shash_desc_ctx(shash) = crc;
err = crypto_shash_update(shash, next, len); err = crypto_shash_update(shash, next, len);
if (unlikely(err)) { if (unlikely(err)) {

View File

@ -332,7 +332,6 @@ static int crypt_iv_essiv_init(struct crypt_config *cc)
int err; int err;
desc->tfm = essiv->hash_tfm; desc->tfm = essiv->hash_tfm;
desc->flags = 0;
err = crypto_shash_digest(desc, cc->key, cc->key_size, essiv->salt); err = crypto_shash_digest(desc, cc->key, cc->key_size, essiv->salt);
shash_desc_zero(desc); shash_desc_zero(desc);
@ -606,7 +605,6 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
int i, r; int i, r;
desc->tfm = lmk->hash_tfm; desc->tfm = lmk->hash_tfm;
desc->flags = 0;
r = crypto_shash_init(desc); r = crypto_shash_init(desc);
if (r) if (r)
@ -768,7 +766,6 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
/* calculate crc32 for every 32bit part and xor it */ /* calculate crc32 for every 32bit part and xor it */
desc->tfm = tcw->crc32_tfm; desc->tfm = tcw->crc32_tfm;
desc->flags = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
r = crypto_shash_init(desc); r = crypto_shash_init(desc);
if (r) if (r)

View File

@ -532,7 +532,6 @@ static void section_mac(struct dm_integrity_c *ic, unsigned section, __u8 result
unsigned j, size; unsigned j, size;
desc->tfm = ic->journal_mac; desc->tfm = ic->journal_mac;
desc->flags = 0;
r = crypto_shash_init(desc); r = crypto_shash_init(desc);
if (unlikely(r)) { if (unlikely(r)) {
@ -1278,7 +1277,6 @@ static void integrity_sector_checksum(struct dm_integrity_c *ic, sector_t sector
unsigned digest_size; unsigned digest_size;
req->tfm = ic->internal_hash; req->tfm = ic->internal_hash;
req->flags = 0;
r = crypto_shash_init(req); r = crypto_shash_init(req);
if (unlikely(r < 0)) { if (unlikely(r < 0)) {

View File

@ -222,7 +222,6 @@ static void *mppe_alloc(unsigned char *options, int optlen)
goto out_free; goto out_free;
} }
state->sha1->tfm = shash; state->sha1->tfm = shash;
state->sha1->flags = 0;
digestsize = crypto_shash_digestsize(shash); digestsize = crypto_shash_digestsize(shash);
if (digestsize < MPPE_MAX_KEY_LEN) if (digestsize < MPPE_MAX_KEY_LEN)

View File

@ -65,7 +65,6 @@ int orinoco_mic(struct crypto_shash *tfm_michael, u8 *key,
hdr[ETH_ALEN * 2 + 3] = 0; hdr[ETH_ALEN * 2 + 3] = 0;
desc->tfm = tfm_michael; desc->tfm = tfm_michael;
desc->flags = 0;
err = crypto_shash_setkey(tfm_michael, key, MIC_KEYLEN); err = crypto_shash_setkey(tfm_michael, key, MIC_KEYLEN);
if (err) if (err)

View File

@ -449,7 +449,6 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
SHASH_DESC_ON_STACK(desc, tfm); SHASH_DESC_ON_STACK(desc, tfm);
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ret = crypto_shash_digest(desc, fw->image, image_size, ret = crypto_shash_digest(desc, fw->image, image_size,
hash_data); hash_data);

View File

@ -219,7 +219,6 @@ michael_mic(u8 *key, u8 *data, unsigned int len, u8 priority, u8 *result)
} }
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
ret = crypto_shash_init(desc); ret = crypto_shash_init(desc);
if (ret < 0) if (ret < 0)

View File

@ -507,7 +507,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr,
int err; int err;
desc->tfm = tfm_michael; desc->tfm = tfm_michael;
desc->flags = 0;
if (crypto_shash_setkey(tfm_michael, key, 8)) if (crypto_shash_setkey(tfm_michael, key, 8))
return -1; return -1;

View File

@ -503,7 +503,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr,
int err; int err;
desc->tfm = tfm_michael; desc->tfm = tfm_michael;
desc->flags = 0;
if (crypto_shash_setkey(tfm_michael, key, 8)) if (crypto_shash_setkey(tfm_michael, key, 8))
return -1; return -1;

View File

@ -252,7 +252,6 @@ static int chap_server_compute_md5(
} }
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
ret = crypto_shash_init(desc); ret = crypto_shash_init(desc);
if (ret < 0) { if (ret < 0) {

View File

@ -678,7 +678,6 @@ int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw)
} }
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
memset(hmac, 0, sizeof(hmac)); memset(hmac, 0, sizeof(hmac));
ret = crypto_shash_digest(shash, challenge, sizeof(hmac), hmac); ret = crypto_shash_digest(shash, challenge, sizeof(hmac), hmac);

View File

@ -917,7 +917,6 @@ cifs_alloc_hash(const char *name,
} }
(*sdesc)->shash.tfm = *shash; (*sdesc)->shash.tfm = *shash;
(*sdesc)->shash.flags = 0x0;
return 0; return 0;
} }

View File

@ -402,7 +402,6 @@ static int derive_essiv_salt(const u8 *key, int keysize, u8 *salt)
{ {
SHASH_DESC_ON_STACK(desc, tfm); SHASH_DESC_ON_STACK(desc, tfm);
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
return crypto_shash_digest(desc, key, keysize, salt); return crypto_shash_digest(desc, key, keysize, salt);
} }

View File

@ -68,7 +68,6 @@ static int ecryptfs_hash_digest(struct crypto_shash *tfm,
int err; int err;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_digest(desc, src, len, dst); err = crypto_shash_digest(desc, src, len, dst);
shash_desc_zero(desc); shash_desc_zero(desc);
return err; return err;

View File

@ -769,7 +769,6 @@ ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes,
} }
s->hash_desc->tfm = s->hash_tfm; s->hash_desc->tfm = s->hash_tfm;
s->hash_desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
rc = crypto_shash_digest(s->hash_desc, rc = crypto_shash_digest(s->hash_desc,
(u8 *)s->auth_tok->token.password.session_key_encryption_key, (u8 *)s->auth_tok->token.password.session_key_encryption_key,

View File

@ -2024,7 +2024,6 @@ static inline u32 ext4_chksum(struct ext4_sb_info *sbi, u32 crc,
BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx)); BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx));
desc.shash.tfm = sbi->s_chksum_driver; desc.shash.tfm = sbi->s_chksum_driver;
desc.shash.flags = 0;
*(u32 *)desc.ctx = crc; *(u32 *)desc.ctx = crc;
BUG_ON(crypto_shash_update(&desc.shash, address, length)); BUG_ON(crypto_shash_update(&desc.shash, address, length));

View File

@ -1422,7 +1422,6 @@ static inline u32 __f2fs_crc32(struct f2fs_sb_info *sbi, u32 crc,
BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver) != sizeof(desc.ctx)); BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver) != sizeof(desc.ctx));
desc.shash.tfm = sbi->s_chksum_driver; desc.shash.tfm = sbi->s_chksum_driver;
desc.shash.flags = 0;
*(u32 *)desc.ctx = crc; *(u32 *)desc.ctx = crc;
err = crypto_shash_update(&desc.shash, address, length); err = crypto_shash_update(&desc.shash, address, length);

View File

@ -126,7 +126,6 @@ nfs4_make_rec_clidname(char *dname, const struct xdr_netobj *clname)
SHASH_DESC_ON_STACK(desc, tfm); SHASH_DESC_ON_STACK(desc, tfm);
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
status = crypto_shash_digest(desc, clname->data, clname->len, status = crypto_shash_digest(desc, clname->data, clname->len,
cksum.data); cksum.data);

View File

@ -33,7 +33,6 @@ int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *node,
int err; int err;
shash->tfm = c->hash_tfm; shash->tfm = c->hash_tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_digest(shash, node, le32_to_cpu(ch->len), hash); err = crypto_shash_digest(shash, node, le32_to_cpu(ch->len), hash);
if (err < 0) if (err < 0)
@ -56,7 +55,6 @@ static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash,
int err; int err;
shash->tfm = c->hmac_tfm; shash->tfm = c->hmac_tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_digest(shash, hash, c->hash_len, hmac); err = crypto_shash_digest(shash, hash, c->hash_len, hmac);
if (err < 0) if (err < 0)
@ -88,7 +86,6 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
return -ENOMEM; return -ENOMEM;
hash_desc->tfm = c->hash_tfm; hash_desc->tfm = c->hash_tfm;
hash_desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ubifs_shash_copy_state(c, inhash, hash_desc); ubifs_shash_copy_state(c, inhash, hash_desc);
err = crypto_shash_final(hash_desc, hash); err = crypto_shash_final(hash_desc, hash);
@ -123,7 +120,6 @@ static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_init(desc); err = crypto_shash_init(desc);
if (err) { if (err) {
@ -364,7 +360,6 @@ static int ubifs_node_calc_hmac(const struct ubifs_info *c, const void *node,
ubifs_assert(c, ofs_hmac + hmac_len < len); ubifs_assert(c, ofs_hmac + hmac_len < len);
shash->tfm = c->hmac_tfm; shash->tfm = c->hmac_tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_init(shash); err = crypto_shash_init(shash);
if (err) if (err)
@ -483,7 +478,6 @@ int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac)
return 0; return 0;
shash->tfm = c->hmac_tfm; shash->tfm = c->hmac_tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_init(shash); err = crypto_shash_init(shash);
if (err) if (err)

View File

@ -576,7 +576,6 @@ static int authenticate_sleb_hash(struct ubifs_info *c, struct shash_desc *log_h
SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm); SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
hash_desc->tfm = c->hash_tfm; hash_desc->tfm = c->hash_tfm;
hash_desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ubifs_shash_copy_state(c, log_hash, hash_desc); ubifs_shash_copy_state(c, log_hash, hash_desc);
return crypto_shash_final(hash_desc, hash); return crypto_shash_final(hash_desc, hash);
@ -587,7 +586,6 @@ static int authenticate_sleb_hmac(struct ubifs_info *c, u8 *hash, u8 *hmac)
SHASH_DESC_ON_STACK(hmac_desc, c->hmac_tfm); SHASH_DESC_ON_STACK(hmac_desc, c->hmac_tfm);
hmac_desc->tfm = c->hmac_tfm; hmac_desc->tfm = c->hmac_tfm;
hmac_desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_digest(hmac_desc, hash, c->hash_len, hmac); return crypto_shash_digest(hmac_desc, hash, c->hash_len, hmac);
} }

View File

@ -146,8 +146,6 @@ struct ahash_alg {
struct shash_desc { struct shash_desc {
struct crypto_shash *tfm; struct crypto_shash *tfm;
u32 flags;
void *__ctx[] CRYPTO_MINALIGN_ATTR; void *__ctx[] CRYPTO_MINALIGN_ATTR;
}; };
@ -819,6 +817,7 @@ static inline void *shash_desc_ctx(struct shash_desc *desc)
* cipher handle must point to a keyed message digest cipher in order for this * cipher handle must point to a keyed message digest cipher in order for this
* function to succeed. * function to succeed.
* *
* Context: Any context.
* 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
*/ */
int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
@ -835,6 +834,7 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
* crypto_shash_update and crypto_shash_final. The parameters have the same * crypto_shash_update and crypto_shash_final. The parameters have the same
* meaning as discussed for those separate three functions. * meaning as discussed for those separate three functions.
* *
* Context: Any context.
* Return: 0 if the message digest creation was successful; < 0 if an error * Return: 0 if the message digest creation was successful; < 0 if an error
* occurred * occurred
*/ */
@ -850,6 +850,7 @@ int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
* caller-allocated output buffer out which must have sufficient size (e.g. by * caller-allocated output buffer out which must have sufficient size (e.g. by
* calling crypto_shash_descsize). * calling crypto_shash_descsize).
* *
* Context: Any context.
* Return: 0 if the export creation was successful; < 0 if an error occurred * Return: 0 if the export creation was successful; < 0 if an error occurred
*/ */
static inline int crypto_shash_export(struct shash_desc *desc, void *out) static inline int crypto_shash_export(struct shash_desc *desc, void *out)
@ -866,6 +867,7 @@ static inline int crypto_shash_export(struct shash_desc *desc, void *out)
* the input buffer. That buffer should have been generated with the * the input buffer. That buffer should have been generated with the
* crypto_ahash_export function. * crypto_ahash_export function.
* *
* Context: Any context.
* Return: 0 if the import was successful; < 0 if an error occurred * Return: 0 if the import was successful; < 0 if an error occurred
*/ */
static inline int crypto_shash_import(struct shash_desc *desc, const void *in) static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
@ -886,6 +888,7 @@ static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
* operational state handle. Any potentially existing state created by * operational state handle. Any potentially existing state created by
* previous operations is discarded. * previous operations is discarded.
* *
* Context: Any context.
* Return: 0 if the message digest initialization was successful; < 0 if an * Return: 0 if the message digest initialization was successful; < 0 if an
* error occurred * error occurred
*/ */
@ -907,6 +910,7 @@ static inline int crypto_shash_init(struct shash_desc *desc)
* *
* Updates the message digest state of the operational state handle. * Updates the message digest state of the operational state handle.
* *
* Context: Any context.
* Return: 0 if the message digest update was successful; < 0 if an error * Return: 0 if the message digest update was successful; < 0 if an error
* occurred * occurred
*/ */
@ -923,6 +927,7 @@ int crypto_shash_update(struct shash_desc *desc, const u8 *data,
* into the output buffer. The caller must ensure that the output buffer is * into the output buffer. The caller must ensure that the output buffer is
* large enough by using crypto_shash_digestsize. * large enough by using crypto_shash_digestsize.
* *
* Context: Any context.
* Return: 0 if the message digest creation was successful; < 0 if an error * Return: 0 if the message digest creation was successful; < 0 if an error
* occurred * occurred
*/ */
@ -939,6 +944,7 @@ int crypto_shash_final(struct shash_desc *desc, u8 *out);
* crypto_shash_update and crypto_shash_final. The parameters have the same * crypto_shash_update and crypto_shash_final. The parameters have the same
* meaning as discussed for those separate functions. * meaning as discussed for those separate functions.
* *
* Context: Any context.
* Return: 0 if the message digest creation was successful; < 0 if an error * Return: 0 if the message digest creation was successful; < 0 if an error
* occurred * occurred
*/ */

View File

@ -1606,7 +1606,6 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
JBD_MAX_CHECKSUM_SIZE); JBD_MAX_CHECKSUM_SIZE);
desc.shash.tfm = journal->j_chksum_driver; desc.shash.tfm = journal->j_chksum_driver;
desc.shash.flags = 0;
*(u32 *)desc.ctx = crc; *(u32 *)desc.ctx = crc;
err = crypto_shash_update(&desc.shash, address, length); err = crypto_shash_update(&desc.shash, address, length);

View File

@ -688,7 +688,6 @@ static int kexec_calculate_store_digests(struct kimage *image)
goto out_free_desc; goto out_free_desc;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
ret = crypto_shash_init(desc); ret = crypto_shash_init(desc);
if (ret < 0) if (ret < 0)

View File

@ -69,7 +69,6 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
rcu_read_lock(); rcu_read_lock();
desc.shash.tfm = rcu_dereference(crct10dif_tfm); desc.shash.tfm = rcu_dereference(crct10dif_tfm);
desc.shash.flags = 0;
*(__u16 *)desc.ctx = crc; *(__u16 *)desc.ctx = crc;
err = crypto_shash_update(&desc.shash, buffer, len); err = crypto_shash_update(&desc.shash, buffer, len);

View File

@ -240,7 +240,6 @@ int digsig_verify(struct key *keyring, const char *sig, int siglen,
goto err; goto err;
desc->tfm = shash; desc->tfm = shash;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
crypto_shash_init(desc); crypto_shash_init(desc);
crypto_shash_update(desc, data, datalen); crypto_shash_update(desc, data, datalen);

View File

@ -47,7 +47,6 @@ u32 crc32c(u32 crc, const void *address, unsigned int length)
int err; int err;
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
*ctx = crc; *ctx = crc;
err = crypto_shash_update(shash, address, length); err = crypto_shash_update(shash, address, length);

View File

@ -161,7 +161,6 @@ static int hmac_sha256(u8 *key, u8 ksize, char *plaintext, u8 psize, u8 *output)
} }
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
ret = crypto_shash_digest(shash, plaintext, psize, output); ret = crypto_shash_digest(shash, plaintext, psize, output);

View File

@ -183,7 +183,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m,
} }
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
/* Swap key and message from LSB to MSB */ /* Swap key and message from LSB to MSB */
swap_buf(k, tmp, 16); swap_buf(k, tmp, 16);

View File

@ -760,7 +760,6 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
SHASH_DESC_ON_STACK(desc, tfm); SHASH_DESC_ON_STACK(desc, tfm);
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
crypto_shash_digest(desc, (u8 *)auth, crypto_shash_digest(desc, (u8 *)auth,
end - (unsigned char *)auth, digest); end - (unsigned char *)auth, digest);
shash_desc_zero(desc); shash_desc_zero(desc);

View File

@ -1684,7 +1684,6 @@ static struct sctp_cookie_param *sctp_pack_cookie(
/* Sign the message. */ /* Sign the message. */
desc->tfm = sctp_sk(ep->base.sk)->hmac; desc->tfm = sctp_sk(ep->base.sk)->hmac;
desc->flags = 0;
err = crypto_shash_setkey(desc->tfm, ep->secret_key, err = crypto_shash_setkey(desc->tfm, ep->secret_key,
sizeof(ep->secret_key)) ?: sizeof(ep->secret_key)) ?:
@ -1755,7 +1754,6 @@ struct sctp_association *sctp_unpack_cookie(
int err; int err;
desc->tfm = sctp_sk(ep->base.sk)->hmac; desc->tfm = sctp_sk(ep->base.sk)->hmac;
desc->flags = 0;
err = crypto_shash_setkey(desc->tfm, ep->secret_key, err = crypto_shash_setkey(desc->tfm, ep->secret_key,
sizeof(ep->secret_key)) ?: sizeof(ep->secret_key)) ?:

View File

@ -977,7 +977,6 @@ krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
} }
desc->tfm = hmac; desc->tfm = hmac;
desc->flags = 0;
/* Compute intermediate Kseq from session key */ /* Compute intermediate Kseq from session key */
err = crypto_shash_setkey(hmac, kctx->Ksess, kctx->gk5e->keylength); err = crypto_shash_setkey(hmac, kctx->Ksess, kctx->gk5e->keylength);
@ -1045,7 +1044,6 @@ krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
} }
desc->tfm = hmac; desc->tfm = hmac;
desc->flags = 0;
/* Compute intermediate Kcrypt from session key */ /* Compute intermediate Kcrypt from session key */
for (i = 0; i < kctx->gk5e->keylength; i++) for (i = 0; i < kctx->gk5e->keylength; i++)

View File

@ -438,7 +438,6 @@ context_derive_keys_rc4(struct krb5_ctx *ctx)
} }
desc->tfm = hmac; desc->tfm = hmac;
desc->flags = 0;
err = crypto_shash_digest(desc, sigkeyconstant, slen, ctx->cksum); err = crypto_shash_digest(desc, sigkeyconstant, slen, ctx->cksum);
kzfree(desc); kzfree(desc);

View File

@ -501,7 +501,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr,
} }
desc->tfm = tfm_michael; desc->tfm = tfm_michael;
desc->flags = 0;
if (crypto_shash_setkey(tfm_michael, key, 8)) if (crypto_shash_setkey(tfm_michael, key, 8))
return -1; return -1;

View File

@ -43,7 +43,6 @@ char *aa_calc_hash(void *data, size_t len)
goto fail; goto fail;
desc->tfm = apparmor_tfm; desc->tfm = apparmor_tfm;
desc->flags = 0;
error = crypto_shash_init(desc); error = crypto_shash_init(desc);
if (error) if (error)
@ -81,7 +80,6 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
goto fail; goto fail;
desc->tfm = apparmor_tfm; desc->tfm = apparmor_tfm;
desc->flags = 0;
error = crypto_shash_init(desc); error = crypto_shash_init(desc);
if (error) if (error)

View File

@ -124,7 +124,6 @@ out:
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
desc->tfm = *tfm; desc->tfm = *tfm;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
rc = crypto_shash_init(desc); rc = crypto_shash_init(desc);
if (rc) { if (rc) {

View File

@ -333,7 +333,6 @@ static int ima_calc_file_hash_tfm(struct file *file,
SHASH_DESC_ON_STACK(shash, tfm); SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
hash->length = crypto_shash_digestsize(tfm); hash->length = crypto_shash_digestsize(tfm);
@ -469,7 +468,6 @@ static int ima_calc_field_array_hash_tfm(struct ima_field_data *field_data,
int rc, i; int rc, i;
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
hash->length = crypto_shash_digestsize(tfm); hash->length = crypto_shash_digestsize(tfm);
@ -591,7 +589,6 @@ static int calc_buffer_shash_tfm(const void *buf, loff_t size,
int rc; int rc;
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
hash->length = crypto_shash_digestsize(tfm); hash->length = crypto_shash_digestsize(tfm);
@ -664,7 +661,6 @@ static int __init ima_calc_boot_aggregate_tfm(char *digest,
SHASH_DESC_ON_STACK(shash, tfm); SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm; shash->tfm = tfm;
shash->flags = 0;
rc = crypto_shash_init(shash); rc = crypto_shash_init(shash);
if (rc != 0) if (rc != 0)

View File

@ -112,7 +112,6 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname)
if (!sdesc) if (!sdesc)
goto out_free_tfm; goto out_free_tfm;
sdesc->shash.tfm = tfm; sdesc->shash.tfm = tfm;
sdesc->shash.flags = 0x0;
*sdesc_ret = sdesc; *sdesc_ret = sdesc;

View File

@ -333,7 +333,6 @@ static int calc_hash(struct crypto_shash *tfm, u8 *digest,
int err; int err;
desc->tfm = tfm; desc->tfm = tfm;
desc->flags = 0;
err = crypto_shash_digest(desc, buf, buflen, digest); err = crypto_shash_digest(desc, buf, buflen, digest);
shash_desc_zero(desc); shash_desc_zero(desc);

View File

@ -55,7 +55,6 @@ static struct sdesc *init_sdesc(struct crypto_shash *alg)
if (!sdesc) if (!sdesc)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
sdesc->shash.tfm = alg; sdesc->shash.tfm = alg;
sdesc->shash.flags = 0x0;
return sdesc; return sdesc;
} }