Lines Matching refs:tfm

177 	int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
183 int (*init)(struct crypto_skcipher *tfm);
184 void (*exit)(struct crypto_skcipher *tfm);
228 int (*setkey)(struct crypto_lskcipher *tfm, const u8 *key,
230 int (*encrypt)(struct crypto_lskcipher *tfm, const u8 *src,
232 int (*decrypt)(struct crypto_lskcipher *tfm, const u8 *src,
234 int (*init)(struct crypto_lskcipher *tfm);
235 void (*exit)(struct crypto_lskcipher *tfm);
242 * This performs a type-check against the "tfm" argument to make sure
243 * all users have the correct skcipher tfm for doing on-stack requests.
245 #define SYNC_SKCIPHER_REQUEST_ON_STACK(name, tfm) \
249 (typeof(tfm))1))) \
271 * For the symmetric key cipher API, the state is maintained with the tfm
272 * cipher handle. A single tfm can be used across multiple calls and in
284 struct crypto_tfm *tfm)
286 return container_of(tfm, struct crypto_skcipher, base);
328 struct crypto_skcipher *tfm)
330 return &tfm->base;
334 struct crypto_lskcipher *tfm)
336 return &tfm->base;
341 * @tfm: cipher handle to be freed
343 * If @tfm is a NULL or error pointer, this function does nothing.
345 static inline void crypto_free_skcipher(struct crypto_skcipher *tfm)
347 crypto_destroy_tfm(tfm, crypto_skcipher_tfm(tfm));
350 static inline void crypto_free_sync_skcipher(struct crypto_sync_skcipher *tfm)
352 crypto_free_skcipher(&tfm->base);
357 * @tfm: cipher handle to be freed
359 * If @tfm is a NULL or error pointer, this function does nothing.
361 static inline void crypto_free_lskcipher(struct crypto_lskcipher *tfm)
363 crypto_destroy_tfm(tfm, crypto_lskcipher_tfm(tfm));
379 struct crypto_skcipher *tfm)
381 return crypto_tfm_alg_driver_name(crypto_skcipher_tfm(tfm));
385 struct crypto_lskcipher *tfm)
387 return crypto_tfm_alg_driver_name(crypto_lskcipher_tfm(tfm));
391 struct crypto_skcipher *tfm)
393 return container_of(crypto_skcipher_tfm(tfm)->__crt_alg,
398 struct crypto_skcipher *tfm)
400 return container_of(crypto_skcipher_tfm(tfm)->__crt_alg,
405 struct crypto_lskcipher *tfm)
407 return container_of(crypto_lskcipher_tfm(tfm)->__crt_alg,
413 * @tfm: cipher handle
420 static inline unsigned int crypto_skcipher_ivsize(struct crypto_skcipher *tfm)
422 return crypto_skcipher_alg_common(tfm)->ivsize;
426 struct crypto_sync_skcipher *tfm)
428 return crypto_skcipher_ivsize(&tfm->base);
433 * @tfm: cipher handle
441 struct crypto_lskcipher *tfm)
443 return crypto_lskcipher_alg(tfm)->co.ivsize;
448 * @tfm: cipher handle
457 struct crypto_skcipher *tfm)
459 return crypto_tfm_alg_blocksize(crypto_skcipher_tfm(tfm));
464 * @tfm: cipher handle
473 struct crypto_lskcipher *tfm)
475 return crypto_tfm_alg_blocksize(crypto_lskcipher_tfm(tfm));
480 * @tfm: cipher handle
490 struct crypto_skcipher *tfm)
492 return crypto_skcipher_alg_common(tfm)->chunksize;
497 * @tfm: cipher handle
507 struct crypto_lskcipher *tfm)
509 return crypto_lskcipher_alg(tfm)->co.chunksize;
514 * @tfm: cipher handle
524 struct crypto_skcipher *tfm)
526 return crypto_skcipher_alg_common(tfm)->statesize;
531 * @tfm: cipher handle
541 struct crypto_lskcipher *tfm)
543 return crypto_lskcipher_alg(tfm)->co.statesize;
547 struct crypto_sync_skcipher *tfm)
549 return crypto_skcipher_blocksize(&tfm->base);
553 struct crypto_skcipher *tfm)
555 return crypto_tfm_alg_alignmask(crypto_skcipher_tfm(tfm));
559 struct crypto_lskcipher *tfm)
561 return crypto_tfm_alg_alignmask(crypto_lskcipher_tfm(tfm));
564 static inline u32 crypto_skcipher_get_flags(struct crypto_skcipher *tfm)
566 return crypto_tfm_get_flags(crypto_skcipher_tfm(tfm));
569 static inline void crypto_skcipher_set_flags(struct crypto_skcipher *tfm,
572 crypto_tfm_set_flags(crypto_skcipher_tfm(tfm), flags);
575 static inline void crypto_skcipher_clear_flags(struct crypto_skcipher *tfm,
578 crypto_tfm_clear_flags(crypto_skcipher_tfm(tfm), flags);
582 struct crypto_sync_skcipher *tfm)
584 return crypto_skcipher_get_flags(&tfm->base);
588 struct crypto_sync_skcipher *tfm, u32 flags)
590 crypto_skcipher_set_flags(&tfm->base, flags);
594 struct crypto_sync_skcipher *tfm, u32 flags)
596 crypto_skcipher_clear_flags(&tfm->base, flags);
599 static inline u32 crypto_lskcipher_get_flags(struct crypto_lskcipher *tfm)
601 return crypto_tfm_get_flags(crypto_lskcipher_tfm(tfm));
604 static inline void crypto_lskcipher_set_flags(struct crypto_lskcipher *tfm,
607 crypto_tfm_set_flags(crypto_lskcipher_tfm(tfm), flags);
610 static inline void crypto_lskcipher_clear_flags(struct crypto_lskcipher *tfm,
613 crypto_tfm_clear_flags(crypto_lskcipher_tfm(tfm), flags);
618 * @tfm: cipher handle
632 int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
635 static inline int crypto_sync_skcipher_setkey(struct crypto_sync_skcipher *tfm,
638 return crypto_skcipher_setkey(&tfm->base, key, keylen);
643 * @tfm: cipher handle
657 int crypto_lskcipher_setkey(struct crypto_lskcipher *tfm,
661 struct crypto_skcipher *tfm)
663 return crypto_skcipher_alg_common(tfm)->min_keysize;
667 struct crypto_skcipher *tfm)
669 return crypto_skcipher_alg_common(tfm)->max_keysize;
673 struct crypto_lskcipher *tfm)
675 return crypto_lskcipher_alg(tfm)->co.min_keysize;
679 struct crypto_lskcipher *tfm)
681 return crypto_lskcipher_alg(tfm)->co.max_keysize;
696 return __crypto_skcipher_cast(req->base.tfm);
702 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
704 return container_of(tfm, struct crypto_sync_skcipher, base);
768 * @tfm: lskcipher handle
782 int crypto_lskcipher_encrypt(struct crypto_lskcipher *tfm, const u8 *src,
787 * @tfm: lskcipher handle
802 int crypto_lskcipher_decrypt(struct crypto_lskcipher *tfm, const u8 *src,
818 * @tfm: cipher handle
822 static inline unsigned int crypto_skcipher_reqsize(struct crypto_skcipher *tfm)
824 return tfm->reqsize;
830 * @tfm: cipher handle that shall be added to the request handle
836 struct crypto_skcipher *tfm)
838 req->base.tfm = crypto_skcipher_tfm(tfm);
842 struct crypto_sync_skcipher *tfm)
844 skcipher_request_set_tfm(req, &tfm->base);
855 * @tfm: cipher handle to be registered with the request
865 struct crypto_skcipher *tfm, gfp_t gfp)
870 crypto_skcipher_reqsize(tfm), gfp);
873 skcipher_request_set_tfm(req, tfm);
889 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
891 memzero_explicit(req, sizeof(*req) + crypto_skcipher_reqsize(tfm));