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)
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

index 0f6ca8b..f14afaa 100644 (file)
@@ -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;
     }
 
index 60123e9..39d1cce 100644 (file)
@@ -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);
 }
index 4099a0a..e3f3e6f 100644 (file)
@@ -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);
        }
 }
index bcddf09..4845b8c 100644 (file)
@@ -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;
index e6de50f..395a3dd 100644 (file)
@@ -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)
index 97c77f6..f7b0980 100644 (file)
@@ -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,
index d178650..f8e4a93 100644 (file)
@@ -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;
index 9338b45..bd96683 100644 (file)
@@ -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)
index 42533cf..b3bb993 100644 (file)
@@ -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);
 }
index 710b304..2a5b16b 100644 (file)
@@ -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);
index 4ceb3f1..a68c126 100644 (file)
@@ -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);
index 5994684..e55c1f5 100644 (file)
@@ -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);
 }
index 87abfd1..2bd89a6 100644 (file)
@@ -1328,7 +1328,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:
@@ -3027,7 +3026,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);
index c7ad88d..843a9b9 100644 (file)
@@ -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) {
index 268ef0c..6781bcf 100644 (file)
@@ -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);
 
index 57e5dca..d2fb728 100644 (file)
@@ -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,
index 8862200..25f8d39 100644 (file)
@@ -2140,7 +2140,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) {
index d8cda5f..91ec563 100644 (file)
@@ -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);
index 10a61cd..3e10573 100644 (file)
@@ -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);
index 8d8cf80..8a76fce 100644 (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
         */
        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;
index 5f4f845..a0806ba 100644 (file)
@@ -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);
index df675ae..0d5d3d8 100644 (file)
@@ -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);
index 0641185..51b20ab 100644 (file)
@@ -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);
 }
index 21e5cae..e641481 100644 (file)
@@ -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;
index 975c751..c8d4016 100644 (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->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,
index 1afdcb8..9ef2523 100644 (file)
@@ -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);
 }
index 611ff59..b5a6883 100644 (file)
@@ -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);
 }
 
index 2e2dff4..ecf6e65 100644 (file)
@@ -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)) {
index dd65657..9faed1c 100644 (file)
@@ -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)
index d57d997..1366d88 100644 (file)
@@ -532,7 +532,6 @@ static void section_mac(struct dm_integrity_c *ic, unsigned section, __u8 result
        unsigned 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 sector
        unsigned digest_size;
 
        req->tfm = ic->internal_hash;
-       req->flags = 0;
 
        r = crypto_shash_init(req);
        if (unlikely(r < 0)) {
index 7ccdc62..ff61dd8 100644 (file)
@@ -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)
index 67b0c05..a324bc4 100644 (file)
@@ -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)
index b7828fb..b681073 100644 (file)
@@ -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);
index 06ebea0..122d4c0 100644 (file)
@@ -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)
index 55da8c9..a084e15 100644 (file)
@@ -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;
index 829fa4b..d67bb57 100644 (file)
@@ -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;
index 4e680d7..ca7d7e8 100644 (file)
@@ -252,7 +252,6 @@ static int chap_server_compute_md5(
        }
 
        desc->tfm = tfm;
-       desc->flags = 0;
 
        ret = crypto_shash_init(desc);
        if (ret < 0) {
index 7416bdb..b7980c8 100644 (file)
@@ -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);
index bee2030..1a60409 100644 (file)
@@ -917,7 +917,6 @@ cifs_alloc_hash(const char *name,
        }
 
        (*sdesc)->shash.tfm = *shash;
-       (*sdesc)->shash.flags = 0x0;
        return 0;
 }
 
index 322ce96..2cb4956 100644 (file)
@@ -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);
        }
index f664da5..491cf5b 100644 (file)
@@ -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;
index e74fe84..90fbac5 100644 (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->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
 
        rc = crypto_shash_digest(s->hash_desc,
                                 (u8 *)s->auth_tok->token.password.session_key_encryption_key,
index 82ffdac..0833b5f 100644 (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));
 
        desc.shash.tfm = sbi->s_chksum_driver;
-       desc.shash.flags = 0;
        *(u32 *)desc.ctx = crc;
 
        BUG_ON(crypto_shash_update(&desc.shash, address, length));
index 87f75eb..21b0ab6 100644 (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));
 
        desc.shash.tfm = sbi->s_chksum_driver;
-       desc.shash.flags = 0;
        *(u32 *)desc.ctx = crc;
 
        err = crypto_shash_update(&desc.shash, address, length);
index 5188f9f..8c85634 100644 (file)
@@ -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);
index 5bf5fd0..b758004 100644 (file)
@@ -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)
index 0a0e65c..5c8a81a 100644 (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);
 
        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);
 }
index 3b31c1b..d21bea2 100644 (file)
@@ -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
  */
index 0f919d5..c2ffff5 100644 (file)
@@ -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);
index f1d0e00..f7fb8f6 100644 (file)
@@ -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)
index 4d0d47c..e89ebfd 100644 (file)
@@ -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);
index 6ba6fcd..3b0a579 100644 (file)
@@ -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);
index f0a2934..4e9829c 100644 (file)
@@ -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);
index 78bec8d..aaa3940 100644 (file)
@@ -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);
 
index 621146d..e68c715 100644 (file)
@@ -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);
index 39d72e5..31569f4 100644 (file)
@@ -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);
index d05c576..72e7450 100644 (file)
@@ -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)) ?:
index 4f43383..6f2d30d 100644 (file)
@@ -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++)
index 56cc85c..6e5d6d2 100644 (file)
@@ -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);
index 35f0656..11eaa59 100644 (file)
@@ -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;
index af03d98..baba63b 100644 (file)
@@ -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)
index c37d081..e11564e 100644 (file)
@@ -124,7 +124,6 @@ out:
                return ERR_PTR(-ENOMEM);
 
        desc->tfm = *tfm;
-       desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
 
        rc = crypto_shash_init(desc);
        if (rc) {
index 16a4f45..a32878e 100644 (file)
@@ -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)
index 711e89d..23f95de 100644 (file)
@@ -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;
 
index 347108f..1b1456b 100644 (file)
@@ -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);
index bcc9c6e..45ffd9e 100644 (file)
@@ -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;
 }