mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
crypto: algapi - Add driver template support to crypto_inst_setname
Add support to crypto_inst_setname for having a driver template name that differs from the algorithm template name. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
32a9fd8f49
commit
91b6ff579d
2 changed files with 14 additions and 6 deletions
|
@ -923,20 +923,20 @@ const char *crypto_attr_alg_name(struct rtattr *rta)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_attr_alg_name);
|
||||
|
||||
int crypto_inst_setname(struct crypto_instance *inst, const char *name,
|
||||
struct crypto_alg *alg)
|
||||
int __crypto_inst_setname(struct crypto_instance *inst, const char *name,
|
||||
const char *driver, struct crypto_alg *alg)
|
||||
{
|
||||
if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s(%s)", name,
|
||||
alg->cra_name) >= CRYPTO_MAX_ALG_NAME)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s(%s)",
|
||||
name, alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME)
|
||||
driver, alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_inst_setname);
|
||||
EXPORT_SYMBOL_GPL(__crypto_inst_setname);
|
||||
|
||||
void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen)
|
||||
{
|
||||
|
|
|
@ -146,8 +146,16 @@ void *crypto_spawn_tfm2(struct crypto_spawn *spawn);
|
|||
struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
|
||||
int crypto_check_attr_type(struct rtattr **tb, u32 type, u32 *mask_ret);
|
||||
const char *crypto_attr_alg_name(struct rtattr *rta);
|
||||
int crypto_inst_setname(struct crypto_instance *inst, const char *name,
|
||||
struct crypto_alg *alg);
|
||||
int __crypto_inst_setname(struct crypto_instance *inst, const char *name,
|
||||
const char *driver, struct crypto_alg *alg);
|
||||
|
||||
#define crypto_inst_setname(inst, name, ...) \
|
||||
CONCATENATE(crypto_inst_setname_, COUNT_ARGS(__VA_ARGS__))( \
|
||||
inst, name, ##__VA_ARGS__)
|
||||
#define crypto_inst_setname_1(inst, name, alg) \
|
||||
__crypto_inst_setname(inst, name, name, alg)
|
||||
#define crypto_inst_setname_2(inst, name, driver, alg) \
|
||||
__crypto_inst_setname(inst, name, driver, alg)
|
||||
|
||||
void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen);
|
||||
int crypto_enqueue_request(struct crypto_queue *queue,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue