diff options
Diffstat (limited to 'include/linux/crypto.h')
| -rw-r--r-- | include/linux/crypto.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 387da6a3e58c..5e2bcc636a02 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -61,6 +61,15 @@ | |||
| 61 | #define CRYPTO_DIR_DECRYPT 0 | 61 | #define CRYPTO_DIR_DECRYPT 0 |
| 62 | 62 | ||
| 63 | struct scatterlist; | 63 | struct scatterlist; |
| 64 | struct crypto_tfm; | ||
| 65 | |||
| 66 | struct cipher_desc { | ||
| 67 | struct crypto_tfm *tfm; | ||
| 68 | void (*crfn)(void *ctx, u8 *dst, const u8 *src); | ||
| 69 | unsigned int (*prfn)(const struct cipher_desc *desc, u8 *dst, | ||
| 70 | const u8 *src, unsigned int nbytes); | ||
| 71 | void *info; | ||
| 72 | }; | ||
| 64 | 73 | ||
| 65 | /* | 74 | /* |
| 66 | * Algorithms: modular crypto algorithm implementations, managed | 75 | * Algorithms: modular crypto algorithm implementations, managed |
| @@ -73,6 +82,19 @@ struct cipher_alg { | |||
| 73 | unsigned int keylen, u32 *flags); | 82 | unsigned int keylen, u32 *flags); |
| 74 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); | 83 | void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); |
| 75 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); | 84 | void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); |
| 85 | |||
| 86 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, | ||
| 87 | u8 *dst, const u8 *src, | ||
| 88 | unsigned int nbytes); | ||
| 89 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, | ||
| 90 | u8 *dst, const u8 *src, | ||
| 91 | unsigned int nbytes); | ||
| 92 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, | ||
| 93 | u8 *dst, const u8 *src, | ||
| 94 | unsigned int nbytes); | ||
| 95 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, | ||
| 96 | u8 *dst, const u8 *src, | ||
| 97 | unsigned int nbytes); | ||
| 76 | }; | 98 | }; |
| 77 | 99 | ||
| 78 | struct digest_alg { | 100 | struct digest_alg { |
| @@ -102,6 +124,7 @@ struct crypto_alg { | |||
| 102 | u32 cra_flags; | 124 | u32 cra_flags; |
| 103 | unsigned int cra_blocksize; | 125 | unsigned int cra_blocksize; |
| 104 | unsigned int cra_ctxsize; | 126 | unsigned int cra_ctxsize; |
| 127 | unsigned int cra_alignmask; | ||
| 105 | const char cra_name[CRYPTO_MAX_ALG_NAME]; | 128 | const char cra_name[CRYPTO_MAX_ALG_NAME]; |
| 106 | 129 | ||
| 107 | union { | 130 | union { |
| @@ -136,7 +159,6 @@ static inline int crypto_alg_available(const char *name, u32 flags) | |||
| 136 | * and core processing logic. Managed via crypto_alloc_tfm() and | 159 | * and core processing logic. Managed via crypto_alloc_tfm() and |
| 137 | * crypto_free_tfm(), as well as the various helpers below. | 160 | * crypto_free_tfm(), as well as the various helpers below. |
| 138 | */ | 161 | */ |
| 139 | struct crypto_tfm; | ||
| 140 | 162 | ||
| 141 | struct cipher_tfm { | 163 | struct cipher_tfm { |
| 142 | void *cit_iv; | 164 | void *cit_iv; |
| @@ -266,6 +288,16 @@ static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) | |||
| 266 | return tfm->__crt_alg->cra_digest.dia_digestsize; | 288 | return tfm->__crt_alg->cra_digest.dia_digestsize; |
| 267 | } | 289 | } |
| 268 | 290 | ||
| 291 | static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) | ||
| 292 | { | ||
| 293 | return tfm->__crt_alg->cra_alignmask; | ||
| 294 | } | ||
| 295 | |||
| 296 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | ||
| 297 | { | ||
| 298 | return (void *)&tfm[1]; | ||
| 299 | } | ||
| 300 | |||
| 269 | /* | 301 | /* |
| 270 | * API wrappers. | 302 | * API wrappers. |
| 271 | */ | 303 | */ |
