mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Revert "crypto: api - Add crypto_clone_tfm"
This reverts commitf688979e42which is commit3c3a24cb0aupstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I1614e323a505f05d64b0a5171b35cdd30cf29a42 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
59
crypto/api.c
59
crypto/api.c
@@ -488,44 +488,28 @@ err:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_alloc_base);
|
||||
|
||||
static void *crypto_alloc_tfmmem(struct crypto_alg *alg,
|
||||
const struct crypto_type *frontend, int node,
|
||||
gfp_t gfp)
|
||||
void *crypto_create_tfm_node(struct crypto_alg *alg,
|
||||
const struct crypto_type *frontend,
|
||||
int node)
|
||||
{
|
||||
struct crypto_tfm *tfm;
|
||||
char *mem;
|
||||
struct crypto_tfm *tfm = NULL;
|
||||
unsigned int tfmsize;
|
||||
unsigned int total;
|
||||
char *mem;
|
||||
int err = -ENOMEM;
|
||||
|
||||
tfmsize = frontend->tfmsize;
|
||||
total = tfmsize + sizeof(*tfm) + frontend->extsize(alg);
|
||||
|
||||
mem = kzalloc_node(total, gfp, node);
|
||||
mem = kzalloc_node(total, GFP_KERNEL, node);
|
||||
if (mem == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
goto out_err;
|
||||
|
||||
tfm = (struct crypto_tfm *)(mem + tfmsize);
|
||||
tfm->__crt_alg = alg;
|
||||
tfm->node = node;
|
||||
refcount_set(&tfm->refcnt, 1);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void *crypto_create_tfm_node(struct crypto_alg *alg,
|
||||
const struct crypto_type *frontend,
|
||||
int node)
|
||||
{
|
||||
struct crypto_tfm *tfm;
|
||||
char *mem;
|
||||
int err;
|
||||
|
||||
mem = crypto_alloc_tfmmem(alg, frontend, node, GFP_KERNEL);
|
||||
if (IS_ERR(mem))
|
||||
goto out;
|
||||
|
||||
tfm = (struct crypto_tfm *)(mem + frontend->tfmsize);
|
||||
|
||||
err = frontend->init_tfm(tfm);
|
||||
if (err)
|
||||
goto out_free_tfm;
|
||||
@@ -541,38 +525,13 @@ out_free_tfm:
|
||||
if (err == -EAGAIN)
|
||||
crypto_shoot_alg(alg);
|
||||
kfree(mem);
|
||||
out_err:
|
||||
mem = ERR_PTR(err);
|
||||
out:
|
||||
return mem;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_create_tfm_node);
|
||||
|
||||
void *crypto_clone_tfm(const struct crypto_type *frontend,
|
||||
struct crypto_tfm *otfm)
|
||||
{
|
||||
struct crypto_alg *alg = otfm->__crt_alg;
|
||||
struct crypto_tfm *tfm;
|
||||
char *mem;
|
||||
|
||||
mem = ERR_PTR(-ESTALE);
|
||||
if (unlikely(!crypto_mod_get(alg)))
|
||||
goto out;
|
||||
|
||||
mem = crypto_alloc_tfmmem(alg, frontend, otfm->node, GFP_ATOMIC);
|
||||
if (IS_ERR(mem)) {
|
||||
crypto_mod_put(alg);
|
||||
goto out;
|
||||
}
|
||||
|
||||
tfm = (struct crypto_tfm *)(mem + frontend->tfmsize);
|
||||
tfm->crt_flags = otfm->crt_flags;
|
||||
tfm->exit = otfm->exit;
|
||||
|
||||
out:
|
||||
return mem;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_clone_tfm);
|
||||
|
||||
struct crypto_alg *crypto_find_alg(const char *alg_name,
|
||||
const struct crypto_type *frontend,
|
||||
u32 type, u32 mask)
|
||||
|
||||
@@ -104,8 +104,6 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type,
|
||||
u32 mask);
|
||||
void *crypto_create_tfm_node(struct crypto_alg *alg,
|
||||
const struct crypto_type *frontend, int node);
|
||||
void *crypto_clone_tfm(const struct crypto_type *frontend,
|
||||
struct crypto_tfm *otfm);
|
||||
|
||||
static inline void *crypto_create_tfm(struct crypto_alg *alg,
|
||||
const struct crypto_type *frontend)
|
||||
|
||||
Reference in New Issue
Block a user