diff options
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r-- | include/linux/crypto.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index c43dc47fdf75..3d2317e4af2e 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000008 | 38 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000008 |
39 | #define CRYPTO_ALG_TYPE_HASH 0x00000009 | 39 | #define CRYPTO_ALG_TYPE_HASH 0x00000009 |
40 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000a | 40 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000a |
41 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c | ||
41 | 42 | ||
42 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | 43 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
43 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c | 44 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c |
@@ -61,6 +62,14 @@ | |||
61 | #define CRYPTO_ALG_GENIV 0x00000200 | 62 | #define CRYPTO_ALG_GENIV 0x00000200 |
62 | 63 | ||
63 | /* | 64 | /* |
65 | * Set if the algorithm has passed automated run-time testing. Note that | ||
66 | * if there is no run-time testing for a given algorithm it is considered | ||
67 | * to have passed. | ||
68 | */ | ||
69 | |||
70 | #define CRYPTO_ALG_TESTED 0x00000400 | ||
71 | |||
72 | /* | ||
64 | * Transform masks and values (for crt_flags). | 73 | * Transform masks and values (for crt_flags). |
65 | */ | 74 | */ |
66 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 | 75 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 |
@@ -105,6 +114,7 @@ struct crypto_aead; | |||
105 | struct crypto_blkcipher; | 114 | struct crypto_blkcipher; |
106 | struct crypto_hash; | 115 | struct crypto_hash; |
107 | struct crypto_ahash; | 116 | struct crypto_ahash; |
117 | struct crypto_rng; | ||
108 | struct crypto_tfm; | 118 | struct crypto_tfm; |
109 | struct crypto_type; | 119 | struct crypto_type; |
110 | struct aead_givcrypt_request; | 120 | struct aead_givcrypt_request; |
@@ -290,6 +300,15 @@ struct compress_alg { | |||
290 | unsigned int slen, u8 *dst, unsigned int *dlen); | 300 | unsigned int slen, u8 *dst, unsigned int *dlen); |
291 | }; | 301 | }; |
292 | 302 | ||
303 | struct rng_alg { | ||
304 | int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata, | ||
305 | unsigned int dlen); | ||
306 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
307 | |||
308 | unsigned int seedsize; | ||
309 | }; | ||
310 | |||
311 | |||
293 | #define cra_ablkcipher cra_u.ablkcipher | 312 | #define cra_ablkcipher cra_u.ablkcipher |
294 | #define cra_aead cra_u.aead | 313 | #define cra_aead cra_u.aead |
295 | #define cra_blkcipher cra_u.blkcipher | 314 | #define cra_blkcipher cra_u.blkcipher |
@@ -298,6 +317,7 @@ struct compress_alg { | |||
298 | #define cra_hash cra_u.hash | 317 | #define cra_hash cra_u.hash |
299 | #define cra_ahash cra_u.ahash | 318 | #define cra_ahash cra_u.ahash |
300 | #define cra_compress cra_u.compress | 319 | #define cra_compress cra_u.compress |
320 | #define cra_rng cra_u.rng | ||
301 | 321 | ||
302 | struct crypto_alg { | 322 | struct crypto_alg { |
303 | struct list_head cra_list; | 323 | struct list_head cra_list; |
@@ -325,6 +345,7 @@ struct crypto_alg { | |||
325 | struct hash_alg hash; | 345 | struct hash_alg hash; |
326 | struct ahash_alg ahash; | 346 | struct ahash_alg ahash; |
327 | struct compress_alg compress; | 347 | struct compress_alg compress; |
348 | struct rng_alg rng; | ||
328 | } cra_u; | 349 | } cra_u; |
329 | 350 | ||
330 | int (*cra_init)(struct crypto_tfm *tfm); | 351 | int (*cra_init)(struct crypto_tfm *tfm); |
@@ -430,6 +451,12 @@ struct compress_tfm { | |||
430 | u8 *dst, unsigned int *dlen); | 451 | u8 *dst, unsigned int *dlen); |
431 | }; | 452 | }; |
432 | 453 | ||
454 | struct rng_tfm { | ||
455 | int (*rng_gen_random)(struct crypto_rng *tfm, u8 *rdata, | ||
456 | unsigned int dlen); | ||
457 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
458 | }; | ||
459 | |||
433 | #define crt_ablkcipher crt_u.ablkcipher | 460 | #define crt_ablkcipher crt_u.ablkcipher |
434 | #define crt_aead crt_u.aead | 461 | #define crt_aead crt_u.aead |
435 | #define crt_blkcipher crt_u.blkcipher | 462 | #define crt_blkcipher crt_u.blkcipher |
@@ -437,6 +464,7 @@ struct compress_tfm { | |||
437 | #define crt_hash crt_u.hash | 464 | #define crt_hash crt_u.hash |
438 | #define crt_ahash crt_u.ahash | 465 | #define crt_ahash crt_u.ahash |
439 | #define crt_compress crt_u.compress | 466 | #define crt_compress crt_u.compress |
467 | #define crt_rng crt_u.rng | ||
440 | 468 | ||
441 | struct crypto_tfm { | 469 | struct crypto_tfm { |
442 | 470 | ||
@@ -450,6 +478,7 @@ struct crypto_tfm { | |||
450 | struct hash_tfm hash; | 478 | struct hash_tfm hash; |
451 | struct ahash_tfm ahash; | 479 | struct ahash_tfm ahash; |
452 | struct compress_tfm compress; | 480 | struct compress_tfm compress; |
481 | struct rng_tfm rng; | ||
453 | } crt_u; | 482 | } crt_u; |
454 | 483 | ||
455 | struct crypto_alg *__crt_alg; | 484 | struct crypto_alg *__crt_alg; |
@@ -481,6 +510,10 @@ struct crypto_hash { | |||
481 | struct crypto_tfm base; | 510 | struct crypto_tfm base; |
482 | }; | 511 | }; |
483 | 512 | ||
513 | struct crypto_rng { | ||
514 | struct crypto_tfm base; | ||
515 | }; | ||
516 | |||
484 | enum { | 517 | enum { |
485 | CRYPTOA_UNSPEC, | 518 | CRYPTOA_UNSPEC, |
486 | CRYPTOA_ALG, | 519 | CRYPTOA_ALG, |
@@ -515,6 +548,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); | |||
515 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); | 548 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); |
516 | void crypto_free_tfm(struct crypto_tfm *tfm); | 549 | void crypto_free_tfm(struct crypto_tfm *tfm); |
517 | 550 | ||
551 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask); | ||
552 | |||
518 | /* | 553 | /* |
519 | * Transform helpers which query the underlying algorithm. | 554 | * Transform helpers which query the underlying algorithm. |
520 | */ | 555 | */ |