crypto: shash - remove shash_desc::flags
authorEric Biggers <ebiggers@google.com>
Mon, 15 Apr 2019 00:37:09 +0000 (17:37 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 25 Apr 2019 07:38:12 +0000 (15:38 +0800)
commit877b5691f27a1aec0d9b53095a323e45c30069e2
tree59eba93e8d253fb0e12a0a2040de99e96e873933
parent75f2222832e0fecba7a45ca6ac07ea895ea1e046
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>
66 files changed:
Documentation/crypto/api-samples.rst
arch/arm/crypto/ghash-ce-glue.c
arch/x86/crypto/ghash-clmulni-intel_glue.c
arch/x86/power/hibernate.c
crypto/adiantum.c
crypto/asymmetric_keys/pkcs7_verify.c
crypto/asymmetric_keys/verify_pefile.c
crypto/asymmetric_keys/x509_public_key.c
crypto/cryptd.c
crypto/drbg.c
crypto/hmac.c
crypto/shash.c
crypto/testmgr.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_worker.c
drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/bcm/cipher.c
drivers/crypto/bcm/util.c
drivers/crypto/ccp/ccp-crypto-sha.c
drivers/crypto/chelsio/chcr_algo.c
drivers/crypto/mediatek/mtk-sha.c
drivers/crypto/n2_core.c
drivers/crypto/omap-sham.c
drivers/crypto/padlock-sha.c
drivers/crypto/qat/qat_common/qat_algs.c
drivers/crypto/s5p-sss.c
drivers/crypto/vmx/ghash.c
drivers/infiniband/sw/rxe/rxe.h
drivers/md/dm-crypt.c
drivers/md/dm-integrity.c
drivers/net/ppp/ppp_mppe.c
drivers/net/wireless/intersil/orinoco/mic.c
drivers/nfc/s3fwrn5/firmware.c
drivers/staging/ks7010/ks_hostif.c
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
drivers/target/iscsi/iscsi_target_auth.c
drivers/thunderbolt/domain.c
fs/cifs/misc.c
fs/crypto/keyinfo.c
fs/ecryptfs/crypto.c
fs/ecryptfs/keystore.c
fs/ext4/ext4.h
fs/f2fs/f2fs.h
fs/nfsd/nfs4recover.c
fs/ubifs/auth.c
fs/ubifs/replay.c
include/crypto/hash.h
include/linux/jbd2.h
kernel/kexec_file.c
lib/crc-t10dif.c
lib/digsig.c
lib/libcrc32c.c
net/bluetooth/amp.c
net/bluetooth/smp.c
net/sctp/auth.c
net/sctp/sm_make_chunk.c
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/gss_krb5_mech.c
net/wireless/lib80211_crypt_tkip.c
security/apparmor/crypto.c
security/integrity/evm/evm_crypto.c
security/integrity/ima/ima_crypto.c
security/keys/dh.c
security/keys/encrypted-keys/encrypted.c
security/keys/trusted.c