Loading Documentation/DocBook/crypto-API.tmpl +0 −13 Original line number Diff line number Diff line Loading @@ -1761,19 +1761,6 @@ read(opfd, out, outlen); !Finclude/linux/crypto.h crypto_cipher_setkey !Finclude/linux/crypto.h crypto_cipher_encrypt_one !Finclude/linux/crypto.h crypto_cipher_decrypt_one </sect1> <sect1><title>Synchronous Message Digest API</title> !Pinclude/linux/crypto.h Synchronous Message Digest API !Finclude/linux/crypto.h crypto_alloc_hash !Finclude/linux/crypto.h crypto_free_hash !Finclude/linux/crypto.h crypto_has_hash !Finclude/linux/crypto.h crypto_hash_blocksize !Finclude/linux/crypto.h crypto_hash_digestsize !Finclude/linux/crypto.h crypto_hash_init !Finclude/linux/crypto.h crypto_hash_update !Finclude/linux/crypto.h crypto_hash_final !Finclude/linux/crypto.h crypto_hash_digest !Finclude/linux/crypto.h crypto_hash_setkey </sect1> <sect1><title>Message Digest Algorithm Definitions</title> !Pinclude/crypto/hash.h Message Digest Algorithm Definitions Loading crypto/ahash.c +0 −18 Original line number Diff line number Diff line Loading @@ -166,24 +166,6 @@ int crypto_ahash_walk_first(struct ahash_request *req, } EXPORT_SYMBOL_GPL(crypto_ahash_walk_first); int crypto_hash_walk_first_compat(struct hash_desc *hdesc, struct crypto_hash_walk *walk, struct scatterlist *sg, unsigned int len) { walk->total = len; if (!walk->total) { walk->entrylen = 0; return 0; } walk->alignmask = crypto_hash_alignmask(hdesc->tfm); walk->sg = sg; walk->flags = hdesc->flags & CRYPTO_TFM_REQ_MASK; return hash_walk_new_entry(walk); } static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen) { Loading crypto/shash.c +0 −147 Original line number Diff line number Diff line Loading @@ -369,151 +369,6 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm) return 0; } static int shash_compat_setkey(struct crypto_hash *tfm, const u8 *key, unsigned int keylen) { struct shash_desc **descp = crypto_hash_ctx(tfm); struct shash_desc *desc = *descp; return crypto_shash_setkey(desc->tfm, key, keylen); } static int shash_compat_init(struct hash_desc *hdesc) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; desc->flags = hdesc->flags; return crypto_shash_init(desc); } static int shash_compat_update(struct hash_desc *hdesc, struct scatterlist *sg, unsigned int len) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; struct crypto_hash_walk walk; int nbytes; for (nbytes = crypto_hash_walk_first_compat(hdesc, &walk, sg, len); nbytes > 0; nbytes = crypto_hash_walk_done(&walk, nbytes)) nbytes = crypto_shash_update(desc, walk.data, nbytes); return nbytes; } static int shash_compat_final(struct hash_desc *hdesc, u8 *out) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); return crypto_shash_final(*descp, out); } static int shash_compat_digest(struct hash_desc *hdesc, struct scatterlist *sg, unsigned int nbytes, u8 *out) { unsigned int offset = sg->offset; int err; if (nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset)) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; void *data; desc->flags = hdesc->flags; data = kmap_atomic(sg_page(sg)); err = crypto_shash_digest(desc, data + offset, nbytes, out); kunmap_atomic(data); crypto_yield(desc->flags); goto out; } err = shash_compat_init(hdesc); if (err) goto out; err = shash_compat_update(hdesc, sg, nbytes); if (err) goto out; err = shash_compat_final(hdesc, out); out: return err; } static void crypto_exit_shash_ops_compat(struct crypto_tfm *tfm) { struct shash_desc **descp = crypto_tfm_ctx(tfm); struct shash_desc *desc = *descp; crypto_free_shash(desc->tfm); kzfree(desc); } static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm) { struct hash_tfm *crt = &tfm->crt_hash; struct crypto_alg *calg = tfm->__crt_alg; struct shash_alg *alg = __crypto_shash_alg(calg); struct shash_desc **descp = crypto_tfm_ctx(tfm); struct crypto_shash *shash; struct shash_desc *desc; if (!crypto_mod_get(calg)) return -EAGAIN; shash = crypto_create_tfm(calg, &crypto_shash_type); if (IS_ERR(shash)) { crypto_mod_put(calg); return PTR_ERR(shash); } desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(shash), GFP_KERNEL); if (!desc) { crypto_free_shash(shash); return -ENOMEM; } *descp = desc; desc->tfm = shash; tfm->exit = crypto_exit_shash_ops_compat; crt->init = shash_compat_init; crt->update = shash_compat_update; crt->final = shash_compat_final; crt->digest = shash_compat_digest; crt->setkey = shash_compat_setkey; crt->digestsize = alg->digestsize; return 0; } static int crypto_init_shash_ops(struct crypto_tfm *tfm, u32 type, u32 mask) { switch (mask & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_HASH_MASK: return crypto_init_shash_ops_compat(tfm); } return -EINVAL; } static unsigned int crypto_shash_ctxsize(struct crypto_alg *alg, u32 type, u32 mask) { switch (mask & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_HASH_MASK: return sizeof(struct shash_desc *); } return 0; } static int crypto_shash_init_tfm(struct crypto_tfm *tfm) { struct crypto_shash *hash = __crypto_shash_cast(tfm); Loading Loading @@ -560,9 +415,7 @@ static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) } static const struct crypto_type crypto_shash_type = { .ctxsize = crypto_shash_ctxsize, .extsize = crypto_alg_extsize, .init = crypto_init_shash_ops, .init_tfm = crypto_shash_init_tfm, #ifdef CONFIG_PROC_FS .show = crypto_shash_show, Loading include/crypto/algapi.h +0 −18 Original line number Diff line number Diff line Loading @@ -349,24 +349,6 @@ static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm) return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher; } static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn) { u32 type = CRYPTO_ALG_TYPE_HASH; u32 mask = CRYPTO_ALG_TYPE_HASH_MASK; return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask)); } static inline void *crypto_hash_ctx(struct crypto_hash *tfm) { return crypto_tfm_ctx(&tfm->base); } static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) { return crypto_tfm_ctx_aligned(&tfm->base); } static inline void blkcipher_walk_init(struct blkcipher_walk *walk, struct scatterlist *dst, struct scatterlist *src, Loading include/crypto/internal/hash.h +0 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ int crypto_hash_walk_first(struct ahash_request *req, struct crypto_hash_walk *walk); int crypto_ahash_walk_first(struct ahash_request *req, struct crypto_hash_walk *walk); int crypto_hash_walk_first_compat(struct hash_desc *hdesc, struct crypto_hash_walk *walk, struct scatterlist *sg, unsigned int len); static inline int crypto_ahash_walk_done(struct crypto_hash_walk *walk, int err) Loading Loading
Documentation/DocBook/crypto-API.tmpl +0 −13 Original line number Diff line number Diff line Loading @@ -1761,19 +1761,6 @@ read(opfd, out, outlen); !Finclude/linux/crypto.h crypto_cipher_setkey !Finclude/linux/crypto.h crypto_cipher_encrypt_one !Finclude/linux/crypto.h crypto_cipher_decrypt_one </sect1> <sect1><title>Synchronous Message Digest API</title> !Pinclude/linux/crypto.h Synchronous Message Digest API !Finclude/linux/crypto.h crypto_alloc_hash !Finclude/linux/crypto.h crypto_free_hash !Finclude/linux/crypto.h crypto_has_hash !Finclude/linux/crypto.h crypto_hash_blocksize !Finclude/linux/crypto.h crypto_hash_digestsize !Finclude/linux/crypto.h crypto_hash_init !Finclude/linux/crypto.h crypto_hash_update !Finclude/linux/crypto.h crypto_hash_final !Finclude/linux/crypto.h crypto_hash_digest !Finclude/linux/crypto.h crypto_hash_setkey </sect1> <sect1><title>Message Digest Algorithm Definitions</title> !Pinclude/crypto/hash.h Message Digest Algorithm Definitions Loading
crypto/ahash.c +0 −18 Original line number Diff line number Diff line Loading @@ -166,24 +166,6 @@ int crypto_ahash_walk_first(struct ahash_request *req, } EXPORT_SYMBOL_GPL(crypto_ahash_walk_first); int crypto_hash_walk_first_compat(struct hash_desc *hdesc, struct crypto_hash_walk *walk, struct scatterlist *sg, unsigned int len) { walk->total = len; if (!walk->total) { walk->entrylen = 0; return 0; } walk->alignmask = crypto_hash_alignmask(hdesc->tfm); walk->sg = sg; walk->flags = hdesc->flags & CRYPTO_TFM_REQ_MASK; return hash_walk_new_entry(walk); } static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen) { Loading
crypto/shash.c +0 −147 Original line number Diff line number Diff line Loading @@ -369,151 +369,6 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm) return 0; } static int shash_compat_setkey(struct crypto_hash *tfm, const u8 *key, unsigned int keylen) { struct shash_desc **descp = crypto_hash_ctx(tfm); struct shash_desc *desc = *descp; return crypto_shash_setkey(desc->tfm, key, keylen); } static int shash_compat_init(struct hash_desc *hdesc) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; desc->flags = hdesc->flags; return crypto_shash_init(desc); } static int shash_compat_update(struct hash_desc *hdesc, struct scatterlist *sg, unsigned int len) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; struct crypto_hash_walk walk; int nbytes; for (nbytes = crypto_hash_walk_first_compat(hdesc, &walk, sg, len); nbytes > 0; nbytes = crypto_hash_walk_done(&walk, nbytes)) nbytes = crypto_shash_update(desc, walk.data, nbytes); return nbytes; } static int shash_compat_final(struct hash_desc *hdesc, u8 *out) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); return crypto_shash_final(*descp, out); } static int shash_compat_digest(struct hash_desc *hdesc, struct scatterlist *sg, unsigned int nbytes, u8 *out) { unsigned int offset = sg->offset; int err; if (nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset)) { struct shash_desc **descp = crypto_hash_ctx(hdesc->tfm); struct shash_desc *desc = *descp; void *data; desc->flags = hdesc->flags; data = kmap_atomic(sg_page(sg)); err = crypto_shash_digest(desc, data + offset, nbytes, out); kunmap_atomic(data); crypto_yield(desc->flags); goto out; } err = shash_compat_init(hdesc); if (err) goto out; err = shash_compat_update(hdesc, sg, nbytes); if (err) goto out; err = shash_compat_final(hdesc, out); out: return err; } static void crypto_exit_shash_ops_compat(struct crypto_tfm *tfm) { struct shash_desc **descp = crypto_tfm_ctx(tfm); struct shash_desc *desc = *descp; crypto_free_shash(desc->tfm); kzfree(desc); } static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm) { struct hash_tfm *crt = &tfm->crt_hash; struct crypto_alg *calg = tfm->__crt_alg; struct shash_alg *alg = __crypto_shash_alg(calg); struct shash_desc **descp = crypto_tfm_ctx(tfm); struct crypto_shash *shash; struct shash_desc *desc; if (!crypto_mod_get(calg)) return -EAGAIN; shash = crypto_create_tfm(calg, &crypto_shash_type); if (IS_ERR(shash)) { crypto_mod_put(calg); return PTR_ERR(shash); } desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(shash), GFP_KERNEL); if (!desc) { crypto_free_shash(shash); return -ENOMEM; } *descp = desc; desc->tfm = shash; tfm->exit = crypto_exit_shash_ops_compat; crt->init = shash_compat_init; crt->update = shash_compat_update; crt->final = shash_compat_final; crt->digest = shash_compat_digest; crt->setkey = shash_compat_setkey; crt->digestsize = alg->digestsize; return 0; } static int crypto_init_shash_ops(struct crypto_tfm *tfm, u32 type, u32 mask) { switch (mask & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_HASH_MASK: return crypto_init_shash_ops_compat(tfm); } return -EINVAL; } static unsigned int crypto_shash_ctxsize(struct crypto_alg *alg, u32 type, u32 mask) { switch (mask & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_HASH_MASK: return sizeof(struct shash_desc *); } return 0; } static int crypto_shash_init_tfm(struct crypto_tfm *tfm) { struct crypto_shash *hash = __crypto_shash_cast(tfm); Loading Loading @@ -560,9 +415,7 @@ static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) } static const struct crypto_type crypto_shash_type = { .ctxsize = crypto_shash_ctxsize, .extsize = crypto_alg_extsize, .init = crypto_init_shash_ops, .init_tfm = crypto_shash_init_tfm, #ifdef CONFIG_PROC_FS .show = crypto_shash_show, Loading
include/crypto/algapi.h +0 −18 Original line number Diff line number Diff line Loading @@ -349,24 +349,6 @@ static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm) return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher; } static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn) { u32 type = CRYPTO_ALG_TYPE_HASH; u32 mask = CRYPTO_ALG_TYPE_HASH_MASK; return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask)); } static inline void *crypto_hash_ctx(struct crypto_hash *tfm) { return crypto_tfm_ctx(&tfm->base); } static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) { return crypto_tfm_ctx_aligned(&tfm->base); } static inline void blkcipher_walk_init(struct blkcipher_walk *walk, struct scatterlist *dst, struct scatterlist *src, Loading
include/crypto/internal/hash.h +0 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ int crypto_hash_walk_first(struct ahash_request *req, struct crypto_hash_walk *walk); int crypto_ahash_walk_first(struct ahash_request *req, struct crypto_hash_walk *walk); int crypto_hash_walk_first_compat(struct hash_desc *hdesc, struct crypto_hash_walk *walk, struct scatterlist *sg, unsigned int len); static inline int crypto_ahash_walk_done(struct crypto_hash_walk *walk, int err) Loading