Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Software async crypto daemon
0004  *
0005  * Added AEAD support to cryptd.
0006  *    Authors: Tadeusz Struk (tadeusz.struk@intel.com)
0007  *             Adrian Hoban <adrian.hoban@intel.com>
0008  *             Gabriele Paoloni <gabriele.paoloni@intel.com>
0009  *             Aidan O'Mahony (aidan.o.mahony@intel.com)
0010  *    Copyright (c) 2010, Intel Corporation.
0011  */
0012 
0013 #ifndef _CRYPTO_CRYPT_H
0014 #define _CRYPTO_CRYPT_H
0015 
0016 #include <linux/types.h>
0017 
0018 #include <crypto/aead.h>
0019 #include <crypto/hash.h>
0020 #include <crypto/skcipher.h>
0021 
0022 struct cryptd_skcipher {
0023     struct crypto_skcipher base;
0024 };
0025 
0026 /* alg_name should be algorithm to be cryptd-ed */
0027 struct cryptd_skcipher *cryptd_alloc_skcipher(const char *alg_name,
0028                           u32 type, u32 mask);
0029 struct crypto_skcipher *cryptd_skcipher_child(struct cryptd_skcipher *tfm);
0030 /* Must be called without moving CPUs. */
0031 bool cryptd_skcipher_queued(struct cryptd_skcipher *tfm);
0032 void cryptd_free_skcipher(struct cryptd_skcipher *tfm);
0033 
0034 struct cryptd_ahash {
0035     struct crypto_ahash base;
0036 };
0037 
0038 static inline struct cryptd_ahash *__cryptd_ahash_cast(
0039     struct crypto_ahash *tfm)
0040 {
0041     return (struct cryptd_ahash *)tfm;
0042 }
0043 
0044 /* alg_name should be algorithm to be cryptd-ed */
0045 struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name,
0046                     u32 type, u32 mask);
0047 struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm);
0048 struct shash_desc *cryptd_shash_desc(struct ahash_request *req);
0049 /* Must be called without moving CPUs. */
0050 bool cryptd_ahash_queued(struct cryptd_ahash *tfm);
0051 void cryptd_free_ahash(struct cryptd_ahash *tfm);
0052 
0053 struct cryptd_aead {
0054     struct crypto_aead base;
0055 };
0056 
0057 static inline struct cryptd_aead *__cryptd_aead_cast(
0058     struct crypto_aead *tfm)
0059 {
0060     return (struct cryptd_aead *)tfm;
0061 }
0062 
0063 struct cryptd_aead *cryptd_alloc_aead(const char *alg_name,
0064                       u32 type, u32 mask);
0065 
0066 struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm);
0067 /* Must be called without moving CPUs. */
0068 bool cryptd_aead_queued(struct cryptd_aead *tfm);
0069 
0070 void cryptd_free_aead(struct cryptd_aead *tfm);
0071 
0072 #endif