• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/crypto/

Lines Matching refs:alg

37 static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
39 atomic_inc(&alg->cra_refcnt);
40 return alg;
43 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg)
45 return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL;
49 void crypto_mod_put(struct crypto_alg *alg)
51 struct module *module = alg->cra_module;
53 crypto_alg_put(alg);
60 return larval->alg.cra_driver_name[0];
66 struct crypto_alg *q, *alg = NULL;
92 if (alg)
93 crypto_mod_put(alg);
94 alg = q;
100 return alg;
103 static void crypto_larval_destroy(struct crypto_alg *alg)
105 struct crypto_larval *larval = (void *)alg;
107 BUG_ON(!crypto_is_larval(alg));
122 larval->alg.cra_flags = CRYPTO_ALG_LARVAL | type;
123 larval->alg.cra_priority = -1;
124 larval->alg.cra_destroy = crypto_larval_destroy;
126 strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME);
136 struct crypto_alg *alg;
143 atomic_set(&larval->alg.cra_refcnt, 2);
146 alg = __crypto_alg_lookup(name, type, mask);
147 if (!alg) {
148 alg = &larval->alg;
149 list_add(&alg->cra_list, &crypto_alg_list);
153 if (alg != &larval->alg)
156 return alg;
159 void crypto_larval_kill(struct crypto_alg *alg)
161 struct crypto_larval *larval = (void *)alg;
164 list_del(&alg->cra_list);
167 crypto_alg_put(alg);
171 static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
173 struct crypto_larval *larval = (void *)alg;
179 alg = larval->adult;
181 alg = ERR_PTR(-EINTR);
183 alg = ERR_PTR(-ETIMEDOUT);
184 else if (!alg)
185 alg = ERR_PTR(-ENOENT);
187 !(alg->cra_flags & CRYPTO_ALG_TESTED))
188 alg = ERR_PTR(-EAGAIN);
189 else if (!crypto_mod_get(alg))
190 alg = ERR_PTR(-EAGAIN);
191 crypto_mod_put(&larval->alg);
193 return alg;
198 struct crypto_alg *alg;
201 alg = __crypto_alg_lookup(name, type, mask);
204 return alg;
210 struct crypto_alg *alg;
218 alg = crypto_alg_lookup(name, type, mask);
219 if (!alg) {
226 alg = crypto_alg_lookup(name, type, mask);
229 if (alg)
230 return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg;
252 struct crypto_alg *alg;
268 alg = crypto_larval_wait(larval);
271 alg = ERR_PTR(-ENOENT);
274 return alg;
324 static unsigned int crypto_ctxsize(struct crypto_alg *alg, u32 type, u32 mask)
326 const struct crypto_type *type_obj = alg->cra_type;
329 len = alg->cra_alignmask & ~(crypto_tfm_ctx_alignment() - 1);
331 return len + type_obj->ctxsize(alg, type, mask);
333 switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
338 len += crypto_cipher_ctxsize(alg);
342 len += crypto_compress_ctxsize(alg);
349 void crypto_shoot_alg(struct crypto_alg *alg)
352 alg->cra_flags |= CRYPTO_ALG_DYING;
357 struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type,
364 tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask);
369 tfm->__crt_alg = alg;
375 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm)))
384 crypto_shoot_alg(alg);
421 struct crypto_alg *alg;
423 alg = crypto_alg_mod_lookup(alg_name, type, mask);
424 if (IS_ERR(alg)) {
425 err = PTR_ERR(alg);
429 tfm = __crypto_alloc_tfm(alg, type, mask);
433 crypto_mod_put(alg);
449 void *crypto_create_tfm(struct crypto_alg *alg,
459 total = tfmsize + sizeof(*tfm) + frontend->extsize(alg);
466 tfm->__crt_alg = alg;
472 if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm)))
481 crypto_shoot_alg(alg);
538 struct crypto_alg *alg;
540 alg = crypto_find_alg(alg_name, frontend, type, mask);
541 if (IS_ERR(alg)) {
542 err = PTR_ERR(alg);
546 tfm = crypto_create_tfm(alg, frontend);
550 crypto_mod_put(alg);
576 struct crypto_alg *alg;
581 alg = tfm->__crt_alg;
583 if (!tfm->exit && alg->cra_exit)
584 alg->cra_exit(tfm);
586 crypto_mod_put(alg);
594 struct crypto_alg *alg = crypto_alg_mod_lookup(name, type, mask);
596 if (!IS_ERR(alg)) {
597 crypto_mod_put(alg);