diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 18:25:18 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 18:25:18 -0500 |
commit | 9783e1df7a6bd1e4dc5e2cafcdc29b65a47473d6 (patch) | |
tree | 9216a285bfe23aa799ca6efa01a3f4063d798e64 /include/linux | |
parent | 4387ff75f29412a234d394b0276c2b239d3d3844 (diff) | |
parent | dc2e2f33bbf07344995357314fd8887f6564dba7 (diff) |
Merge branch 'HEAD' of master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
Conflicts:
crypto/Kconfig
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/crypto.h | 148 | ||||
-rw-r--r-- | include/linux/pfkeyv2.h | 1 |
2 files changed, 15 insertions, 134 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 4aa9046601da..779aa78ee643 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -51,15 +51,9 @@ | |||
51 | /* | 51 | /* |
52 | * Transform masks and values (for crt_flags). | 52 | * Transform masks and values (for crt_flags). |
53 | */ | 53 | */ |
54 | #define CRYPTO_TFM_MODE_MASK 0x000000ff | ||
55 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 | 54 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 |
56 | #define CRYPTO_TFM_RES_MASK 0xfff00000 | 55 | #define CRYPTO_TFM_RES_MASK 0xfff00000 |
57 | 56 | ||
58 | #define CRYPTO_TFM_MODE_ECB 0x00000001 | ||
59 | #define CRYPTO_TFM_MODE_CBC 0x00000002 | ||
60 | #define CRYPTO_TFM_MODE_CFB 0x00000004 | ||
61 | #define CRYPTO_TFM_MODE_CTR 0x00000008 | ||
62 | |||
63 | #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 | 57 | #define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 |
64 | #define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 | 58 | #define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 |
65 | #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 | 59 | #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 |
@@ -71,12 +65,8 @@ | |||
71 | /* | 65 | /* |
72 | * Miscellaneous stuff. | 66 | * Miscellaneous stuff. |
73 | */ | 67 | */ |
74 | #define CRYPTO_UNSPEC 0 | ||
75 | #define CRYPTO_MAX_ALG_NAME 64 | 68 | #define CRYPTO_MAX_ALG_NAME 64 |
76 | 69 | ||
77 | #define CRYPTO_DIR_ENCRYPT 1 | ||
78 | #define CRYPTO_DIR_DECRYPT 0 | ||
79 | |||
80 | /* | 70 | /* |
81 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual | 71 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual |
82 | * declaration) is used to ensure that the crypto_tfm context structure is | 72 | * declaration) is used to ensure that the crypto_tfm context structure is |
@@ -148,19 +138,6 @@ struct cipher_alg { | |||
148 | unsigned int keylen); | 138 | unsigned int keylen); |
149 | void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 139 | void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
150 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 140 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
151 | |||
152 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, | ||
153 | u8 *dst, const u8 *src, | ||
154 | unsigned int nbytes) __deprecated; | ||
155 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, | ||
156 | u8 *dst, const u8 *src, | ||
157 | unsigned int nbytes) __deprecated; | ||
158 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, | ||
159 | u8 *dst, const u8 *src, | ||
160 | unsigned int nbytes) __deprecated; | ||
161 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, | ||
162 | u8 *dst, const u8 *src, | ||
163 | unsigned int nbytes) __deprecated; | ||
164 | }; | 141 | }; |
165 | 142 | ||
166 | struct digest_alg { | 143 | struct digest_alg { |
@@ -243,11 +220,6 @@ int crypto_unregister_alg(struct crypto_alg *alg); | |||
243 | #ifdef CONFIG_CRYPTO | 220 | #ifdef CONFIG_CRYPTO |
244 | int crypto_has_alg(const char *name, u32 type, u32 mask); | 221 | int crypto_has_alg(const char *name, u32 type, u32 mask); |
245 | #else | 222 | #else |
246 | static inline int crypto_alg_available(const char *name, u32 flags) | ||
247 | { | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | static inline int crypto_has_alg(const char *name, u32 type, u32 mask) | 223 | static inline int crypto_has_alg(const char *name, u32 type, u32 mask) |
252 | { | 224 | { |
253 | return 0; | 225 | return 0; |
@@ -339,13 +311,18 @@ struct crypto_tfm { | |||
339 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; | 311 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; |
340 | }; | 312 | }; |
341 | 313 | ||
342 | #define crypto_cipher crypto_tfm | ||
343 | #define crypto_comp crypto_tfm | ||
344 | |||
345 | struct crypto_blkcipher { | 314 | struct crypto_blkcipher { |
346 | struct crypto_tfm base; | 315 | struct crypto_tfm base; |
347 | }; | 316 | }; |
348 | 317 | ||
318 | struct crypto_cipher { | ||
319 | struct crypto_tfm base; | ||
320 | }; | ||
321 | |||
322 | struct crypto_comp { | ||
323 | struct crypto_tfm base; | ||
324 | }; | ||
325 | |||
349 | struct crypto_hash { | 326 | struct crypto_hash { |
350 | struct crypto_tfm base; | 327 | struct crypto_tfm base; |
351 | }; | 328 | }; |
@@ -395,40 +372,11 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) | |||
395 | return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; | 372 | return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; |
396 | } | 373 | } |
397 | 374 | ||
398 | static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) | ||
399 | __deprecated; | ||
400 | static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) | ||
401 | { | ||
402 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
403 | return tfm->__crt_alg->cra_cipher.cia_min_keysize; | ||
404 | } | ||
405 | |||
406 | static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) | ||
407 | __deprecated; | ||
408 | static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) | ||
409 | { | ||
410 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
411 | return tfm->__crt_alg->cra_cipher.cia_max_keysize; | ||
412 | } | ||
413 | |||
414 | static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated; | ||
415 | static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) | ||
416 | { | ||
417 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
418 | return tfm->crt_cipher.cit_ivsize; | ||
419 | } | ||
420 | |||
421 | static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) | 375 | static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) |
422 | { | 376 | { |
423 | return tfm->__crt_alg->cra_blocksize; | 377 | return tfm->__crt_alg->cra_blocksize; |
424 | } | 378 | } |
425 | 379 | ||
426 | static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) | ||
427 | { | ||
428 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | ||
429 | return tfm->__crt_alg->cra_digest.dia_digestsize; | ||
430 | } | ||
431 | |||
432 | static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) | 380 | static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) |
433 | { | 381 | { |
434 | return tfm->__crt_alg->cra_alignmask; | 382 | return tfm->__crt_alg->cra_alignmask; |
@@ -633,7 +581,7 @@ static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name, | |||
633 | 581 | ||
634 | static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm) | 582 | static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm) |
635 | { | 583 | { |
636 | return tfm; | 584 | return &tfm->base; |
637 | } | 585 | } |
638 | 586 | ||
639 | static inline void crypto_free_cipher(struct crypto_cipher *tfm) | 587 | static inline void crypto_free_cipher(struct crypto_cipher *tfm) |
@@ -809,76 +757,6 @@ static inline int crypto_hash_setkey(struct crypto_hash *hash, | |||
809 | return crypto_hash_crt(hash)->setkey(hash, key, keylen); | 757 | return crypto_hash_crt(hash)->setkey(hash, key, keylen); |
810 | } | 758 | } |
811 | 759 | ||
812 | static int crypto_cipher_encrypt(struct crypto_tfm *tfm, | ||
813 | struct scatterlist *dst, | ||
814 | struct scatterlist *src, | ||
815 | unsigned int nbytes) __deprecated; | ||
816 | static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, | ||
817 | struct scatterlist *dst, | ||
818 | struct scatterlist *src, | ||
819 | unsigned int nbytes) | ||
820 | { | ||
821 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
822 | return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); | ||
823 | } | ||
824 | |||
825 | static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, | ||
826 | struct scatterlist *dst, | ||
827 | struct scatterlist *src, | ||
828 | unsigned int nbytes, u8 *iv) __deprecated; | ||
829 | static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, | ||
830 | struct scatterlist *dst, | ||
831 | struct scatterlist *src, | ||
832 | unsigned int nbytes, u8 *iv) | ||
833 | { | ||
834 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
835 | return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); | ||
836 | } | ||
837 | |||
838 | static int crypto_cipher_decrypt(struct crypto_tfm *tfm, | ||
839 | struct scatterlist *dst, | ||
840 | struct scatterlist *src, | ||
841 | unsigned int nbytes) __deprecated; | ||
842 | static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, | ||
843 | struct scatterlist *dst, | ||
844 | struct scatterlist *src, | ||
845 | unsigned int nbytes) | ||
846 | { | ||
847 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
848 | return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); | ||
849 | } | ||
850 | |||
851 | static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, | ||
852 | struct scatterlist *dst, | ||
853 | struct scatterlist *src, | ||
854 | unsigned int nbytes, u8 *iv) __deprecated; | ||
855 | static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, | ||
856 | struct scatterlist *dst, | ||
857 | struct scatterlist *src, | ||
858 | unsigned int nbytes, u8 *iv) | ||
859 | { | ||
860 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
861 | return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); | ||
862 | } | ||
863 | |||
864 | static void crypto_cipher_set_iv(struct crypto_tfm *tfm, | ||
865 | const u8 *src, unsigned int len) __deprecated; | ||
866 | static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, | ||
867 | const u8 *src, unsigned int len) | ||
868 | { | ||
869 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
870 | memcpy(tfm->crt_cipher.cit_iv, src, len); | ||
871 | } | ||
872 | |||
873 | static void crypto_cipher_get_iv(struct crypto_tfm *tfm, | ||
874 | u8 *dst, unsigned int len) __deprecated; | ||
875 | static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, | ||
876 | u8 *dst, unsigned int len) | ||
877 | { | ||
878 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
879 | memcpy(dst, tfm->crt_cipher.cit_iv, len); | ||
880 | } | ||
881 | |||
882 | static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm) | 760 | static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm) |
883 | { | 761 | { |
884 | return (struct crypto_comp *)tfm; | 762 | return (struct crypto_comp *)tfm; |
@@ -903,7 +781,7 @@ static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name, | |||
903 | 781 | ||
904 | static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm) | 782 | static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm) |
905 | { | 783 | { |
906 | return tfm; | 784 | return &tfm->base; |
907 | } | 785 | } |
908 | 786 | ||
909 | static inline void crypto_free_comp(struct crypto_comp *tfm) | 787 | static inline void crypto_free_comp(struct crypto_comp *tfm) |
@@ -934,14 +812,16 @@ static inline int crypto_comp_compress(struct crypto_comp *tfm, | |||
934 | const u8 *src, unsigned int slen, | 812 | const u8 *src, unsigned int slen, |
935 | u8 *dst, unsigned int *dlen) | 813 | u8 *dst, unsigned int *dlen) |
936 | { | 814 | { |
937 | return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen); | 815 | return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm), |
816 | src, slen, dst, dlen); | ||
938 | } | 817 | } |
939 | 818 | ||
940 | static inline int crypto_comp_decompress(struct crypto_comp *tfm, | 819 | static inline int crypto_comp_decompress(struct crypto_comp *tfm, |
941 | const u8 *src, unsigned int slen, | 820 | const u8 *src, unsigned int slen, |
942 | u8 *dst, unsigned int *dlen) | 821 | u8 *dst, unsigned int *dlen) |
943 | { | 822 | { |
944 | return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen); | 823 | return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm), |
824 | src, slen, dst, dlen); | ||
945 | } | 825 | } |
946 | 826 | ||
947 | #endif /* _LINUX_CRYPTO_H */ | 827 | #endif /* _LINUX_CRYPTO_H */ |
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 26a518b67c02..d9db5f62ee48 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
@@ -298,6 +298,7 @@ struct sadb_x_sec_ctx { | |||
298 | #define SADB_X_EALG_BLOWFISHCBC 7 | 298 | #define SADB_X_EALG_BLOWFISHCBC 7 |
299 | #define SADB_EALG_NULL 11 | 299 | #define SADB_EALG_NULL 11 |
300 | #define SADB_X_EALG_AESCBC 12 | 300 | #define SADB_X_EALG_AESCBC 12 |
301 | #define SADB_X_EALG_CAMELLIACBC 22 | ||
301 | #define SADB_EALG_MAX 253 /* last EALG */ | 302 | #define SADB_EALG_MAX 253 /* last EALG */ |
302 | /* private allocations should use 249-255 (RFC2407) */ | 303 | /* private allocations should use 249-255 (RFC2407) */ |
303 | #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ | 304 | #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ |