crypto: remove shash_desc::flags
Subsystems (47)
Eric Biggers
maintainerRFC PATCH 1/3 crypto: shash - remove useless crypto_yield() in shash_ahash_digest()
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
The crypto_yield() in shash_ahash_digest() occurs after the entire digest operation already happened, so there's no real point. Remove it.
--- crypto/shash.c | 1 - 1 file changed, 1 deletion(-)
crypto/shash.c +0 -1
@@ -314,7 +314,6 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc) err =crypto_shash_digest (desc, data + offset, nbytes, req->result);kunmap_atomic (data); -crypto_yield (desc->flags); }else err =crypto_shash_init (desc) ?:shash_ahash_finup (req, desc);
Signature · 1 line
2.21.0
Eric Biggers
maintainercover crypto: remove shash_desc::flags
This series removes the flags field from 'struct shash_desc', i.e. the ability to specify CRYPTO_TFM_REQ_MAY_SLEEP for shashes, because:
(1) It never actually does anything except in two cases, one of which is broken, and the other of which is useless and also redundant with the ahash_request flags.
(2) Users are incorrectly passing MAY_SLEEP when they can't sleep, so if we actually made any shash algorithm sleep, things would break.
(3) If any users actually need preemption points, we can just add a function that calls crypto_shash_update() multiple times with preemption points. No need to pass a flag down to every algorithm.
Eric Biggers (3):
crypto: shash - remove useless crypto_yield() in shash_ahash_digest()
crypto: nx - don't abuse shash MAY_SLEEP flag
crypto: shash - remove shash_desc::flags
Documentation/crypto/api-samples.rst | 1 - arch/arm/crypto/ghash-ce-glue.c | 3 --- arch/x86/crypto/ghash-clmulni-intel_glue.c | 2 -- arch/x86/power/hibernate.c | 1 - crypto/adiantum.c | 1 - crypto/asymmetric_keys/pkcs7_verify.c | 1 - crypto/asymmetric_keys/verify_pefile.c | 1 - crypto/asymmetric_keys/x509_public_key.c | 1 - crypto/cryptd.c | 3 --- crypto/drbg.c | 1 - crypto/hmac.c | 11 ----------- crypto/shash.c | 5 ----- crypto/testmgr.c | 2 -- drivers/block/drbd/drbd_receiver.c | 1 - drivers/block/drbd/drbd_worker.c | 2 -- drivers/crypto/axis/artpec6_crypto.c | 2 -- drivers/crypto/bcm/cipher.c | 1 - drivers/crypto/bcm/util.c | 1 - drivers/crypto/ccp/ccp-crypto-sha.c | 2 -- drivers/crypto/chelsio/chcr_algo.c | 2 -- drivers/crypto/mediatek/mtk-sha.c | 3 --- drivers/crypto/n2_core.c | 2 -- drivers/crypto/nx/nx-aes-xcbc.c | 12 ++++-------- drivers/crypto/nx/nx-sha256.c | 6 ++---- drivers/crypto/nx/nx-sha512.c | 6 ++---- drivers/crypto/omap-sham.c | 2 -- drivers/crypto/padlock-sha.c | 5 ----- drivers/crypto/qat/qat_common/qat_algs.c | 1 - drivers/crypto/s5p-sss.c | 1 - drivers/crypto/vmx/ghash.c | 1 - drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/md/dm-crypt.c | 3 --- drivers/md/dm-integrity.c | 2 -- drivers/net/ppp/ppp_mppe.c | 1 - drivers/net/wireless/intersil/orinoco/mic.c | 1 - drivers/nfc/s3fwrn5/firmware.c | 1 - drivers/staging/ks7010/ks_hostif.c | 1 - drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 1 - .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 1 - drivers/target/iscsi/iscsi_target_auth.c | 1 - drivers/thunderbolt/domain.c | 1 - fs/cifs/misc.c | 1 - fs/crypto/keyinfo.c | 1 - fs/ecryptfs/crypto.c | 1 - fs/ecryptfs/keystore.c | 1 - fs/ext4/ext4.h | 1 - fs/f2fs/f2fs.h | 1 - fs/nfsd/nfs4recover.c | 1 - fs/ubifs/auth.c | 6 ------ fs/ubifs/replay.c | 2 -- include/crypto/hash.h | 10 ++++++++-- include/linux/jbd2.h | 1 - kernel/kexec_file.c | 1 - lib/crc-t10dif.c | 1 - lib/digsig.c | 1 - lib/libcrc32c.c | 1 - net/bluetooth/amp.c | 1 - net/bluetooth/smp.c | 1 - net/sctp/auth.c | 1 - net/sctp/sm_make_chunk.c | 2 -- net/sunrpc/auth_gss/gss_krb5_crypto.c | 2 -- net/sunrpc/auth_gss/gss_krb5_mech.c | 1 - net/wireless/lib80211_crypt_tkip.c | 1 - security/apparmor/crypto.c | 2 -- security/integrity/evm/evm_crypto.c | 1 - security/integrity/ima/ima_crypto.c | 4 ---- security/keys/dh.c | 1 - security/keys/encrypted-keys/encrypted.c | 1 - security/keys/trusted.c | 1 - 69 files changed, 16 insertions(+), 130 deletions(-)
Signature · 1 line
2.21.0
Eric Biggers
maintainerRFC PATCH 2/3 crypto: nx - don't abuse shash MAY_SLEEP flag
From: Eric Biggers <[email protected]>
The nx driver uses the MAY_SLEEP flag in shash_desc::flags as an indicator to not retry sending the operation to the hardware as many times before returning -EBUSY. This is bogus because (1) that's not what the MAY_SLEEP flag is for, and (2) the shash API doesn't allow failing if the hardware is busy anyway.
For now, just make it always retry the larger number of times. This doesn't actually fix this driver, but it at least makes it not use the shash_desc::flags field anymore. Then this field can be removed, as no other drivers use it.
--- drivers/crypto/nx/nx-aes-xcbc.c | 12 ++++-------- drivers/crypto/nx/nx-sha256.c | 6 ++---- drivers/crypto/nx/nx-sha512.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-)
drivers/crypto/nx/nx-aes-xcbc.c +4 -8
@@ -105,8 +105,7 @@ static int nx_xcbc_empty(struct shash_desc *desc, u8 *out) nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) *sizeof (struct nx_sg ); nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) *sizeof (struct nx_sg ); - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;atomic_inc (&(nx_ctx->stats->aes_ops));
@@ -134,8 +133,7 @@ static int nx_xcbc_empty(struct shash_desc *desc, u8 *out) nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) *sizeof (struct nx_sg ); nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) *sizeof (struct nx_sg ); - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;atomic_inc (&(nx_ctx->stats->aes_ops));
@@ -279,8 +277,7 @@ static int nx_xcbc_update(struct shash_desc *desc, goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
@@ -361,8 +358,7 @@ static int nx_xcbc_final(struct shash_desc *desc, u8 *out) goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
drivers/crypto/nx/nx-sha256.c +2 -4
@@ -162,8 +162,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
@@ -243,8 +242,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out) goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
drivers/crypto/nx/nx-sha512.c +2 -4
@@ -166,8 +166,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
@@ -249,8 +248,7 @@ static int nx_sha512_final(struct shash_desc *desc, u8 *out) goto out; } - rc =nx_hcall_sync (nx_ctx, &nx_ctx->op, - desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ); + rc =nx_hcall_sync (nx_ctx, &nx_ctx->op,0 );if (rc) goto out;
Signature · 1 line
2.21.0
Eric Biggers
maintainerRFC PATCH 3/3 crypto: shash - remove shash_desc::flags
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
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.
--- Documentation/crypto/api-samples.rst | 1 - arch/arm/crypto/ghash-ce-glue.c | 3 --- arch/x86/crypto/ghash-clmulni-intel_glue.c | 2 -- arch/x86/power/hibernate.c | 1 - crypto/adiantum.c | 1 - crypto/asymmetric_keys/pkcs7_verify.c | 1 - crypto/asymmetric_keys/verify_pefile.c | 1 - crypto/asymmetric_keys/x509_public_key.c | 1 - crypto/cryptd.c | 3 --- crypto/drbg.c | 1 - crypto/hmac.c | 11 ----------- crypto/shash.c | 4 ---- crypto/testmgr.c | 2 -- drivers/block/drbd/drbd_receiver.c | 1 - drivers/block/drbd/drbd_worker.c | 2 -- drivers/crypto/axis/artpec6_crypto.c | 2 -- drivers/crypto/bcm/cipher.c | 1 - drivers/crypto/bcm/util.c | 1 - drivers/crypto/ccp/ccp-crypto-sha.c | 2 -- drivers/crypto/chelsio/chcr_algo.c | 2 -- drivers/crypto/mediatek/mtk-sha.c | 3 --- drivers/crypto/n2_core.c | 2 -- drivers/crypto/omap-sham.c | 2 -- drivers/crypto/padlock-sha.c | 5 ----- drivers/crypto/qat/qat_common/qat_algs.c | 1 - drivers/crypto/s5p-sss.c | 1 - drivers/crypto/vmx/ghash.c | 1 - drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/md/dm-crypt.c | 3 --- drivers/md/dm-integrity.c | 2 -- drivers/net/ppp/ppp_mppe.c | 1 - drivers/net/wireless/intersil/orinoco/mic.c | 1 - drivers/nfc/s3fwrn5/firmware.c | 1 - drivers/staging/ks7010/ks_hostif.c | 1 - drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 1 - .../staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 1 - drivers/target/iscsi/iscsi_target_auth.c | 1 - drivers/thunderbolt/domain.c | 1 - fs/cifs/misc.c | 1 - fs/crypto/keyinfo.c | 1 - fs/ecryptfs/crypto.c | 1 - fs/ecryptfs/keystore.c | 1 - fs/ext4/ext4.h | 1 - fs/f2fs/f2fs.h | 1 - fs/nfsd/nfs4recover.c | 1 - fs/ubifs/auth.c | 6 ------ fs/ubifs/replay.c | 2 -- include/crypto/hash.h | 10 ++++++++-- include/linux/jbd2.h | 1 - kernel/kexec_file.c | 1 - lib/crc-t10dif.c | 1 - lib/digsig.c | 1 - lib/libcrc32c.c | 1 - net/bluetooth/amp.c | 1 - net/bluetooth/smp.c | 1 - net/sctp/auth.c | 1 - net/sctp/sm_make_chunk.c | 2 -- net/sunrpc/auth_gss/gss_krb5_crypto.c | 2 -- net/sunrpc/auth_gss/gss_krb5_mech.c | 1 - net/wireless/lib80211_crypt_tkip.c | 1 - security/apparmor/crypto.c | 2 -- security/integrity/evm/evm_crypto.c | 1 - security/integrity/ima/ima_crypto.c | 4 ---- security/keys/dh.c | 1 - security/keys/encrypted-keys/encrypted.c | 1 - security/keys/trusted.c | 1 - 66 files changed, 8 insertions(+), 113 deletions(-)
Documentation/crypto/api-samples.rst +0 -1
@@ -133,7 +133,6 @@ Code Example For Use of Operational State Memory With SHASH if (!sdesc) return ERR_PTR(-ENOMEM); sdesc->shash.tfm = alg; - sdesc->shash.flags = 0x0; return sdesc; }
arch/arm/crypto/ghash-ce-glue.c +0 -3
@@ -186,7 +186,6 @@ static int ghash_async_init(struct ahash_request *req)struct crypto_shash *child =cryptd_ahash_child (cryptd_tfm); desc->tfm = child; - desc->flags = req->base.flags;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); desc->tfm = child; - desc->flags = req->base.flags;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); desc->tfm =cryptd_ahash_child (ctx->cryptd_tfm); - desc->flags = req->base.flags;return crypto_shash_import (desc, in); }
arch/x86/crypto/ghash-clmulni-intel_glue.c +0 -2
@@ -172,7 +172,6 @@ static int ghash_async_init(struct ahash_request *req)struct crypto_shash *child =cryptd_ahash_child (cryptd_tfm); desc->tfm = child; - desc->flags = req->base.flags;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); desc->tfm = child; - desc->flags = req->base.flags;return shash_ahash_digest (req, desc); } }
arch/x86/power/hibernate.c +0 -1
@@ -90,7 +90,6 @@ static int get_e820_md5(struct e820_table *table, void *buf) } desc->tfm = tfm; - desc->flags =0 ; size = offsetof(struct e820_table , entries) +sizeof (struct e820_entry ) * table->nr_entries;
crypto/adiantum.c +0 -1
@@ -265,7 +265,6 @@ static int adiantum_hash_message(struct skcipher_request *req,int err; hash_desc->tfm = tctx->hash; - hash_desc->flags =0 ; err =crypto_shash_init (hash_desc);if (err)
crypto/asymmetric_keys/pkcs7_verify.c +0 -1
@@ -56,7 +56,6 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7, goto error_no_desc; desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ;/* Digest the message [RFC2315 9.3] */ ret = crypto_shash_digest(desc, pkcs7->data, pkcs7->data_len,
crypto/asymmetric_keys/verify_pefile.c +0 -1
@@ -354,7 +354,6 @@ static int pefile_digest_pe(const void *pebuf, unsigned int pelen, goto error_no_desc; desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; ret =crypto_shash_init (desc);if (ret <0 ) goto error;
crypto/asymmetric_keys/x509_public_key.c +0 -1
@@ -77,7 +77,6 @@ int x509_get_sig_params(struct x509_certificate *cert) goto error; desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; ret =crypto_shash_digest (desc, cert->tbs, cert->tbs_size, sig->digest);if (ret <0 )
crypto/cryptd.c +0 -3
@@ -545,7 +545,6 @@ static void cryptd_hash_init(struct crypto_async_request *req_async, int err) goto out; desc->tfm = child; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_init (desc);
@@ -637,7 +636,6 @@ static void cryptd_hash_digest(struct crypto_async_request *req_async, int err) goto out; desc->tfm = child; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; 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); desc->tfm = ctx->child; - desc->flags = req->base.flags;return crypto_shash_import (desc, in); }
crypto/drbg.c +0 -1
@@ -1587,7 +1587,6 @@ static int drbg_init_hash_kernel(struct drbg_state *drbg) } sdesc->shash.tfm = tfm; - sdesc->shash.flags =0 ; drbg->priv_data = sdesc;return crypto_shash_alignmask (tfm);
crypto/hmac.c +0 -11
@@ -57,8 +57,6 @@ static int hmac_setkey(struct crypto_shash *parent,unsigned int i; shash->tfm = hash; - shash->flags =crypto_shash_get_flags (parent) - &CRYPTO_TFM_REQ_MAY_SLEEP ;if (keylen > bs) {int err;
@@ -91,8 +89,6 @@ static int hmac_export(struct shash_desc *pdesc, void *out) {struct shash_desc *desc =shash_desc_ctx (pdesc); - desc->flags = pdesc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ; -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); desc->tfm = ctx->hash; - desc->flags = pdesc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ;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); - desc->flags = pdesc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ; -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;struct shash_desc *desc =shash_desc_ctx (pdesc); - desc->flags = pdesc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ; -return crypto_shash_final (desc, out) ?:crypto_shash_import (desc, opad) ?: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;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) ?:crypto_shash_import (desc, opad) ?:crypto_shash_finup (desc, out, ds, out);
crypto/shash.c +0 -4
@@ -238,7 +238,6 @@ static int shash_async_init(struct ahash_request *req)struct shash_desc *desc =ahash_request_ctx (req); desc->tfm = *ctx; - desc->flags = req->base.flags;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); desc->tfm = *ctx; - desc->flags = req->base.flags;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); desc->tfm = *ctx; - desc->flags = req->base.flags;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); desc->tfm = *ctx; - desc->flags = req->base.flags;return crypto_shash_import (desc, in); }
crypto/testmgr.c +0 -2
@@ -1329,7 +1329,6 @@ static void generate_random_hash_testvec(struct crypto_shash *tfm,/* Digest */ desc->tfm = tfm; - desc->flags =0 ; vec->digest_error =crypto_shash_digest (desc, vec->plaintext, vec->psize, (u8 *)vec->digest); done:
@@ -3028,7 +3027,6 @@ static int alg_test_crc32c(const struct alg_test_desc *desc,u32 *ctx = (u32 *)shash_desc_ctx (shash); shash->tfm = tfm; - shash->flags =0 ; *ctx =420553207 ; err =crypto_shash_final (shash, (u8 *)&val);
drivers/block/drbd/drbd_receiver.c +0 -1
@@ -5443,7 +5443,6 @@ static int drbd_do_auth(struct drbd_connection *connection)rcu_read_unlock (); desc->tfm = connection->cram_hmac_tfm; - desc->flags =0 ; rv =crypto_shash_setkey (connection->cram_hmac_tfm, (u8 *)secret, key_len);if (rv) {
drivers/block/drbd/drbd_worker.c +0 -2
@@ -304,7 +304,6 @@ void drbd_csum_ee(struct crypto_shash *tfm, struct drbd_peer_request *peer_req,void *src; desc->tfm = tfm; - desc->flags =0 ;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; desc->tfm = tfm; - desc->flags =0 ;crypto_shash_init (desc);
drivers/crypto/axis/artpec6_crypto.c +0 -2
@@ -2247,8 +2247,6 @@ artpec6_crypto_hash_set_key(struct crypto_ahash *tfm,SHASH_DESC_ON_STACK (hdesc, 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; ret = crypto_shash_digest(hdesc, key, keylen,
drivers/crypto/bcm/cipher.c +0 -1
@@ -2139,7 +2139,6 @@ static int ahash_init(struct ahash_request *req) goto err_hash; } ctx->shash->tfm = hash; - ctx->shash->flags =0 ;/* Set the key using data we already have from setkey */ if (ctx->authkeylen >0 ) {
drivers/crypto/bcm/util.c +0 -1
@@ -242,7 +242,6 @@ int do_shash(unsigned char *name, unsigned char *result, goto do_shash_err; } sdesc->shash.tfm = hash; - sdesc->shash.flags =0x0 ;if (key_len >0 ) { rc =crypto_shash_setkey (hash, key, key_len);
drivers/crypto/ccp/ccp-crypto-sha.c +0 -2
@@ -293,8 +293,6 @@ static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,if (key_len > block_size) {/* Must hash the input key */ sdesc->tfm = shash; - sdesc->flags =crypto_ahash_get_flags (tfm) & -CRYPTO_TFM_REQ_MAY_SLEEP ; ret =crypto_shash_digest (sdesc, key, key_len, ctx->u.sha.key);
drivers/crypto/chelsio/chcr_algo.c +0 -2
@@ -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 */ shash->tfm = hmacctx->base_hash; - shash->flags =crypto_shash_get_flags (hmacctx->base_hash);if (keylen > bs) { err =crypto_shash_digest (shash, key, keylen, 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->tfm = base_hash; - shash->flags =crypto_shash_get_flags (base_hash); bs =crypto_shash_blocksize (base_hash); align =KEYCTX_ALIGN_PAD (max_authsize); o_ptr = actx->h_iopad + param.result_size + align;
drivers/crypto/mediatek/mtk-sha.c +0 -3
@@ -365,7 +365,6 @@ static int mtk_sha_finish_hmac(struct ahash_request *req)SHASH_DESC_ON_STACK (shash, bctx->shash); shash->tfm = bctx->shash; - shash->flags =0 ;/* not CRYPTO_TFM_REQ_MAY_SLEEP */ return crypto_shash_init (shash) ?: 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->tfm = bctx->shash; - shash->flags =crypto_shash_get_flags (bctx->shash) & -CRYPTO_TFM_REQ_MAY_SLEEP ;if (keylen > bs) { err =crypto_shash_digest (shash, key, keylen, bctx->ipad);
drivers/crypto/n2_core.c +0 -2
@@ -469,8 +469,6 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,return err; shash->tfm = child_shash; - shash->flags =crypto_ahash_get_flags (tfm) & -CRYPTO_TFM_REQ_MAY_SLEEP ; bs =crypto_shash_blocksize (child_shash); ds =crypto_shash_digestsize (child_shash);
drivers/crypto/omap-sham.c +0 -2
@@ -1055,7 +1055,6 @@ static int omap_sham_finish_hmac(struct ahash_request *req)SHASH_DESC_ON_STACK (shash, bctx->shash); shash->tfm = bctx->shash; - shash->flags =0 ;/* not CRYPTO_TFM_REQ_MAY_SLEEP */ return crypto_shash_init (shash) ?: 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->tfm = tfm; - shash->flags = flags &CRYPTO_TFM_REQ_MAY_SLEEP ;return crypto_shash_digest (shash, data, len, out); }
drivers/crypto/padlock-sha.c +0 -5
@@ -39,7 +39,6 @@ static int padlock_sha_init(struct shash_desc *desc)struct padlock_sha_ctx *ctx =crypto_shash_ctx (desc->tfm); dctx->fallback.tfm = ctx->fallback; - dctx->fallback.flags = desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ;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); - dctx->fallback.flags = desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ;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); dctx->fallback.tfm = ctx->fallback; - dctx->fallback.flags = desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ;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;int err; - dctx->fallback.flags = desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_export (&dctx->fallback, &state);if (err) goto out;
@@ -153,7 +149,6 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in,unsigned int leftover;int err; - dctx->fallback.flags = desc->flags &CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_export (&dctx->fallback, &state);if (err) goto out;
drivers/crypto/qat/qat_common/qat_algs.c +0 -1
@@ -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->opad,0 , block_size); shash->tfm = ctx->hash_tfm; - shash->flags =0x0 ;if (auth_keylen > block_size) { int ret = crypto_shash_digest(shash, auth_key,
drivers/crypto/s5p-sss.c +0 -1
@@ -1534,7 +1534,6 @@ static int s5p_hash_shash_digest(struct crypto_shash *tfm, u32 flags,SHASH_DESC_ON_STACK (shash, tfm); shash->tfm = tfm; - shash->flags = flags & ~CRYPTO_TFM_REQ_MAY_SLEEP ;return crypto_shash_digest (shash, data, len, out); }
drivers/crypto/vmx/ghash.c +0 -1
@@ -101,7 +101,6 @@ static int p8_ghash_init(struct shash_desc *desc) dctx->bytes =0 ;memset (dctx->shash,0 ,GHASH_DIGEST_SIZE ); dctx->fallback_desc.tfm = ctx->fallback; - dctx->fallback_desc.flags = desc->flags;return crypto_shash_init (&dctx->fallback_desc); }
drivers/infiniband/sw/rxe/rxe.h +0 -1
@@ -80,7 +80,6 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe,SHASH_DESC_ON_STACK (shash, rxe->tfm); shash->tfm = rxe->tfm; - shash->flags =0 ; *(u32 *)shash_desc_ctx (shash) = crc; err =crypto_shash_update (shash, next, len);if (unlikely (err)) {
drivers/md/dm-crypt.c +0 -3
@@ -332,7 +332,6 @@ static int crypt_iv_essiv_init(struct crypt_config *cc)int err; desc->tfm = essiv->hash_tfm; - desc->flags =0 ; err =crypto_shash_digest (desc, cc->key, cc->key_size, essiv->salt);shash_desc_zero (desc);
@@ -606,7 +605,6 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,int i, r; desc->tfm = lmk->hash_tfm; - desc->flags =0 ; r =crypto_shash_init (desc);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 */ desc->tfm = tcw->crc32_tfm; - desc->flags =0 ;for (i =0 ; i <4 ; i++) { r =crypto_shash_init (desc);if (r)
drivers/md/dm-integrity.c +0 -2
@@ -532,7 +532,6 @@ static void section_mac(struct dm_integrity_c *ic, unsigned section, __u8 resultunsigned j, size; desc->tfm = ic->journal_mac; - desc->flags =0 ; r =crypto_shash_init (desc);if (unlikely (r)) {
@@ -1278,7 +1277,6 @@ static void integrity_sector_checksum(struct dm_integrity_c *ic, sector_t sectorunsigned digest_size; req->tfm = ic->internal_hash; - req->flags =0 ; r =crypto_shash_init (req);if (unlikely (r <0 )) {
drivers/net/ppp/ppp_mppe.c +0 -1
@@ -222,7 +222,6 @@ static void *mppe_alloc(unsigned char *options, int optlen) goto out_free; } state->sha1->tfm = shash; - state->sha1->flags =0 ; digestsize =crypto_shash_digestsize (shash);if (digestsize <MPPE_MAX_KEY_LEN )
drivers/net/wireless/intersil/orinoco/mic.c +0 -1
@@ -65,7 +65,6 @@ int orinoco_mic(struct crypto_shash *tfm_michael, u8 *key, hdr[ETH_ALEN *2 +3 ] =0 ; desc->tfm = tfm_michael; - desc->flags =0 ; err =crypto_shash_setkey (tfm_michael, key,MIC_KEYLEN );if (err)
drivers/nfc/s3fwrn5/firmware.c +0 -1
@@ -449,7 +449,6 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)SHASH_DESC_ON_STACK (desc, tfm); desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; ret =crypto_shash_digest (desc, fw->image, image_size, hash_data);
drivers/staging/ks7010/ks_hostif.c +0 -1
@@ -219,7 +219,6 @@ michael_mic(u8 *key, u8 *data, unsigned int len, u8 priority, u8 *result) } desc->tfm = tfm; - desc->flags =0 ; ret =crypto_shash_init (desc);if (ret <0 )
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +0 -1
@@ -507,7 +507,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr,int err; desc->tfm = tfm_michael; - desc->flags =0 ;if (crypto_shash_setkey (tfm_michael, key,8 ))return -1 ;
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0 -1
@@ -503,7 +503,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr,int err; desc->tfm = tfm_michael; - desc->flags =0 ;if (crypto_shash_setkey (tfm_michael, key,8 ))return -1 ;
drivers/target/iscsi/iscsi_target_auth.c +0 -1
@@ -252,7 +252,6 @@ static int chap_server_compute_md5( } desc->tfm = tfm; - desc->flags =0 ; ret =crypto_shash_init (desc);if (ret <0 ) {
drivers/thunderbolt/domain.c +0 -1
@@ -678,7 +678,6 @@ int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw) } shash->tfm = tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ;memset (hmac,0 ,sizeof (hmac)); ret =crypto_shash_digest (shash, challenge,sizeof (hmac), hmac);
fs/cifs/misc.c +0 -1
@@ -917,7 +917,6 @@ cifs_alloc_hash(const char *name, } (*sdesc)->shash.tfm = *shash; - (*sdesc)->shash.flags =0x0 ;return 0 ; }
fs/crypto/keyinfo.c +0 -1
@@ -402,7 +402,6 @@ static int derive_essiv_salt(const u8 *key, int keysize, u8 *salt) {SHASH_DESC_ON_STACK (desc, tfm); desc->tfm = tfm; - desc->flags =0 ;return crypto_shash_digest (desc, key, keysize, salt); }
fs/ecryptfs/crypto.c +0 -1
@@ -68,7 +68,6 @@ static int ecryptfs_hash_digest(struct crypto_shash *tfm,int err; desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_digest (desc, src, len, dst);shash_desc_zero (desc);return err;
fs/ecryptfs/keystore.c +0 -1
@@ -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->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; rc = crypto_shash_digest(s->hash_desc, (u8 *)s->auth_tok->token.password.session_key_encryption_key,
fs/ext4/ext4.h +0 -1
@@ -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)); desc.shash.tfm = sbi->s_chksum_driver; - desc.shash.flags =0 ; *(u32 *)desc.ctx = crc;BUG_ON (crypto_shash_update (&desc.shash, address, length));
fs/f2fs/f2fs.h +0 -1
@@ -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)); desc.shash.tfm = sbi->s_chksum_driver; - desc.shash.flags =0 ; *(u32 *)desc.ctx = crc; err =crypto_shash_update (&desc.shash, address, length);
fs/nfsd/nfs4recover.c +0 -1
@@ -126,7 +126,6 @@ nfs4_make_rec_clidname(char *dname, const struct xdr_netobj *clname)SHASH_DESC_ON_STACK (desc, tfm); desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; status =crypto_shash_digest (desc, clname->data, clname->len, cksum.data);
fs/ubifs/auth.c +0 -6
@@ -33,7 +33,6 @@ int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *node,int err; shash->tfm = c->hash_tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_digest (shash, node,le32_to_cpu (ch->len), hash);if (err <0 )
@@ -56,7 +55,6 @@ static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash,int err; shash->tfm = c->hmac_tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_digest (shash, hash, c->hash_len, hmac);if (err <0 )
@@ -88,7 +86,6 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,return -ENOMEM ; hash_desc->tfm = c->hash_tfm; - hash_desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ;ubifs_shash_copy_state (c, inhash, hash_desc); 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 ); desc->tfm = tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_init (desc);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); shash->tfm = c->hmac_tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_init (shash);if (err)
@@ -483,7 +478,6 @@ int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac)return 0 ; shash->tfm = c->hmac_tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; err =crypto_shash_init (shash);if (err)
fs/ubifs/replay.c +0 -2
@@ -576,7 +576,6 @@ static int authenticate_sleb_hash(struct ubifs_info *c, struct shash_desc *log_hSHASH_DESC_ON_STACK (hash_desc, 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);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); 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); }
include/crypto/hash.h +8 -2
@@ -146,8 +146,6 @@ struct ahash_alg {struct shash_desc {struct crypto_shash *tfm; -u32 flags; - 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 * function to succeed. * +* Context: Any context. * 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,
@@ -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 * meaning as discussed for those separate three functions. * +* Context: Any context. * Return: 0 if the message digest creation was successful; < 0 if an error * 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 * calling crypto_shash_descsize). * +* Context: Any context. * 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)
@@ -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 * crypto_ahash_export function. * +* Context: Any context. * 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)
@@ -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 * previous operations is discarded. * +* Context: Any context. * Return: 0 if the message digest initialization was successful; < 0 if an * 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. * +* Context: Any context. * Return: 0 if the message digest update was successful; < 0 if an error * 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 * large enough by using crypto_shash_digestsize. * +* Context: Any context. * Return: 0 if the message digest creation was successful; < 0 if an error * 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 * meaning as discussed for those separate functions. * +* Context: Any context. * Return: 0 if the message digest creation was successful; < 0 if an error * occurred */
include/linux/jbd2.h +0 -1
@@ -1606,7 +1606,6 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc, JBD_MAX_CHECKSUM_SIZE); desc.shash.tfm = journal->j_chksum_driver; - desc.shash.flags =0 ; *(u32 *)desc.ctx = crc; err =crypto_shash_update (&desc.shash, address, length);
kernel/kexec_file.c +0 -1
@@ -688,7 +688,6 @@ static int kexec_calculate_store_digests(struct kimage *image) goto out_free_desc; desc->tfm = tfm; - desc->flags =0 ; ret =crypto_shash_init (desc);if (ret <0 )
lib/crc-t10dif.c +0 -1
@@ -69,7 +69,6 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)rcu_read_lock (); desc.shash.tfm =rcu_dereference (crct10dif_tfm); - desc.shash.flags =0 ; *(__u16 *)desc.ctx = crc; err =crypto_shash_update (&desc.shash, buffer, len);
lib/digsig.c +0 -1
@@ -240,7 +240,6 @@ int digsig_verify(struct key *keyring, const char *sig, int siglen, goto err; desc->tfm = shash; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ;crypto_shash_init (desc);crypto_shash_update (desc, data, datalen);
lib/libcrc32c.c +0 -1
@@ -47,7 +47,6 @@ u32 crc32c(u32 crc, const void *address, unsigned int length)int err; shash->tfm = tfm; - shash->flags =0 ; *ctx = crc; err =crypto_shash_update (shash, address, length);
net/bluetooth/amp.c +0 -1
@@ -161,7 +161,6 @@ static int hmac_sha256(u8 *key, u8 ksize, char *plaintext, u8 psize, u8 *output) } shash->tfm = tfm; - shash->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; ret =crypto_shash_digest (shash, plaintext, psize, output);
net/bluetooth/smp.c +0 -1
@@ -183,7 +183,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m, } desc->tfm = tfm; - desc->flags =0 ;/* Swap key and message from LSB to MSB */ swap_buf (k, tmp,16 );
net/sctp/auth.c +0 -1
@@ -760,7 +760,6 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,SHASH_DESC_ON_STACK (desc, tfm); desc->tfm = tfm; - desc->flags =0 ;crypto_shash_digest (desc, (u8 *)auth, end - (unsigned char *)auth, digest);shash_desc_zero (desc);
net/sctp/sm_make_chunk.c +0 -2
@@ -1684,7 +1684,6 @@ static struct sctp_cookie_param *sctp_pack_cookie(/* Sign the message. */ desc->tfm =sctp_sk (ep->base.sk)->hmac; - desc->flags =0 ; err =crypto_shash_setkey (desc->tfm, ep->secret_key, sizeof(ep->secret_key)) ?:
@@ -1755,7 +1754,6 @@ struct sctp_association *sctp_unpack_cookie(int err; desc->tfm =sctp_sk (ep->base.sk)->hmac; - desc->flags =0 ; err =crypto_shash_setkey (desc->tfm, ep->secret_key, sizeof(ep->secret_key)) ?:
net/sunrpc/auth_gss/gss_krb5_crypto.c +0 -2
@@ -977,7 +977,6 @@ krb5_rc4_setup_seq_key(struct krb5_ctx *kctx, } desc->tfm = hmac; - desc->flags =0 ;/* Compute intermediate Kseq from session key */ 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->flags =0 ;/* Compute intermediate Kcrypt from session key */ for (i =0 ; i < kctx->gk5e->keylength; i++)
net/sunrpc/auth_gss/gss_krb5_mech.c +0 -1
@@ -438,7 +438,6 @@ context_derive_keys_rc4(struct krb5_ctx *ctx) } desc->tfm = hmac; - desc->flags =0 ; err =crypto_shash_digest (desc, sigkeyconstant, slen, ctx->cksum);kzfree (desc);
net/wireless/lib80211_crypt_tkip.c +0 -1
@@ -501,7 +501,6 @@ static int michael_mic(struct crypto_shash *tfm_michael, u8 *key, u8 *hdr, } desc->tfm = tfm_michael; - desc->flags =0 ;if (crypto_shash_setkey (tfm_michael, key,8 ))return -1 ;
security/apparmor/crypto.c +0 -2
@@ -43,7 +43,6 @@ char *aa_calc_hash(void *data, size_t len) goto fail; desc->tfm = apparmor_tfm; - desc->flags =0 ; error =crypto_shash_init (desc);if (error)
@@ -81,7 +80,6 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, goto fail; desc->tfm = apparmor_tfm; - desc->flags =0 ; error =crypto_shash_init (desc);if (error)
security/integrity/evm/evm_crypto.c +0 -1
@@ -124,7 +124,6 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)return ERR_PTR (-ENOMEM ); desc->tfm = *tfm; - desc->flags =CRYPTO_TFM_REQ_MAY_SLEEP ; rc =crypto_shash_init (desc);if (rc) {
security/integrity/ima/ima_crypto.c +0 -4
@@ -333,7 +333,6 @@ static int ima_calc_file_hash_tfm(struct file *file,SHASH_DESC_ON_STACK (shash, tfm); shash->tfm = tfm; - shash->flags =0 ; 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; shash->tfm = tfm; - shash->flags =0 ; hash->length =crypto_shash_digestsize (tfm);
@@ -591,7 +589,6 @@ static int calc_buffer_shash_tfm(const void *buf, loff_t size,int rc; shash->tfm = tfm; - shash->flags =0 ; 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->tfm = tfm; - shash->flags =0 ; rc =crypto_shash_init (shash);if (rc !=0 )
security/keys/dh.c +0 -1
@@ -112,7 +112,6 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname)if (!sdesc) goto out_free_tfm; sdesc->shash.tfm = tfm; - sdesc->shash.flags =0x0 ; *sdesc_ret = sdesc;
security/keys/encrypted-keys/encrypted.c +0 -1
@@ -333,7 +333,6 @@ static int calc_hash(struct crypto_shash *tfm, u8 *digest,int err; desc->tfm = tfm; - desc->flags =0 ; err =crypto_shash_digest (desc, buf, buflen, digest);shash_desc_zero (desc);
security/keys/trusted.c +0 -1
@@ -55,7 +55,6 @@ static struct sdesc *init_sdesc(struct crypto_shash *alg)if (!sdesc)return ERR_PTR (-ENOMEM ); sdesc->shash.tfm = alg; - sdesc->shash.flags =0x0 ;return sdesc; }
Signature · 1 line
2.21.0
Michael Ellerman
reviewerRe: [RFC PATCH 2/3] crypto: nx - don't abuse shash MAY_SLEEP flag
In reply to Eric BiggersQuoted 7 lines · Eric Biggers
From: Eric Biggers <[email protected]>
The nx driver uses the
MAY_SLEEPflag inshash_desc::flagsas an indicator to not retry sending the operation to the hardware as many times before returning-EBUSY. This is bogus because (1) that's not what theMAY_SLEEPflag is for, and (2) the shash API doesn't allow failing if the hardware is busy anyway.
Can you elaborate a bit on that 2nd point? What is the driver meant to do if the hardware is busy or out to lunch? Retry forever?
Quoted 4 lines
For now, just make it always retry the larger number of times. This doesn't actually fix this driver, but it at least makes it not use the
shash_desc::flagsfield anymore. Then this field can be removed, as no other drivers use it.
This looks fine to me, thanks for fixing it up.
cheers
Herbert Xu
maintainerQuoted 81 lines · Eric Biggers
This series removes the flags field from 'struct
shash_desc', i.e. the ability to specifyCRYPTO_TFM_REQ_MAY_SLEEPfor shashes, because:(1) It never actually does anything except in two cases, one of which is broken, and the other of which is useless and also redundant with the
ahash_requestflags.(2) Users are incorrectly passing
MAY_SLEEPwhen they can't sleep, so if we actually made any shash algorithm sleep, things would break.(3) If any users actually need preemption points, we can just add a function that calls
crypto_shash_update()multiple times with preemption points. No need to pass a flag down to every algorithm.Eric Biggers (3):
crypto: shash - remove uselesscrypto_yield()inshash_ahash_digest()
crypto: nx - don't abuse shashMAY_SLEEPflag
crypto: shash - removeshash_desc::flagsDocumentation/crypto/api-samples.rst | 1 - arch/arm/crypto/ghash-ce-glue.c | 3 --- arch/x86/crypto/ghash-clmulni-intel_glue.c | 2 -- arch/x86/power/hibernate.c | 1 - crypto/adiantum.c | 1 - crypto/asymmetric_keys/pkcs7_verify.c | 1 - crypto/asymmetric_keys/verify_pefile.c | 1 - crypto/asymmetric_keys/x509_public_key.c | 1 - crypto/cryptd.c | 3 --- crypto/drbg.c | 1 - crypto/hmac.c | 11 ----------- crypto/shash.c | 5 ----- crypto/testmgr.c | 2 -- drivers/block/drbd/drbd_receiver.c | 1 - drivers/block/drbd/drbd_worker.c | 2 -- drivers/crypto/axis/artpec6_crypto.c | 2 -- drivers/crypto/bcm/cipher.c | 1 - drivers/crypto/bcm/util.c | 1 - drivers/crypto/ccp/ccp-crypto-sha.c | 2 -- drivers/crypto/chelsio/chcr_algo.c | 2 -- drivers/crypto/mediatek/mtk-sha.c | 3 --- drivers/crypto/n2_core.c | 2 -- drivers/crypto/nx/nx-aes-xcbc.c | 12 ++++-------- drivers/crypto/nx/nx-sha256.c | 6 ++---- drivers/crypto/nx/nx-sha512.c | 6 ++---- drivers/crypto/omap-sham.c | 2 -- drivers/crypto/padlock-sha.c | 5 ----- drivers/crypto/qat/qat_common/qat_algs.c | 1 - drivers/crypto/s5p-sss.c | 1 - drivers/crypto/vmx/ghash.c | 1 - drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/md/dm-crypt.c | 3 --- drivers/md/dm-integrity.c | 2 -- drivers/net/ppp/ppp_mppe.c | 1 - drivers/net/wireless/intersil/orinoco/mic.c | 1 - drivers/nfc/s3fwrn5/firmware.c | 1 - drivers/staging/ks7010/ks_hostif.c | 1 - drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 1 - .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 1 - drivers/target/iscsi/iscsi_target_auth.c | 1 - drivers/thunderbolt/domain.c | 1 - fs/cifs/misc.c | 1 - fs/crypto/keyinfo.c | 1 - fs/ecryptfs/crypto.c | 1 - fs/ecryptfs/keystore.c | 1 - fs/ext4/ext4.h | 1 - fs/f2fs/f2fs.h | 1 - fs/nfsd/nfs4recover.c | 1 - fs/ubifs/auth.c | 6 ------ fs/ubifs/replay.c | 2 -- include/crypto/hash.h | 10 ++++++++-- include/linux/jbd2.h | 1 - kernel/kexec_file.c | 1 - lib/crc-t10dif.c | 1 - lib/digsig.c | 1 - lib/libcrc32c.c | 1 - net/bluetooth/amp.c | 1 - net/bluetooth/smp.c | 1 - net/sctp/auth.c | 1 - net/sctp/sm_make_chunk.c | 2 -- net/sunrpc/auth_gss/gss_krb5_crypto.c | 2 -- net/sunrpc/auth_gss/gss_krb5_mech.c | 1 -
Quoted 8 lines
net/wireless/lib80211_crypt_tkip.c | 1 - security/apparmor/crypto.c | 2 -- security/integrity/evm/evm_crypto.c | 1 - security/integrity/ima/ima_crypto.c | 4 ---- security/keys/dh.c | 1 - security/keys/encrypted-keys/encrypted.c | 1 - security/keys/trusted.c | 1 - 69 files changed, 16 insertions(+), 130 deletions(-)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt