]> err.no Git - linux-2.6/blobdiff - crypto/internal.h
/home/lenb/src/to-linus branch 'acpi-2.6.12'
[linux-2.6] / crypto / internal.h
index 83b1b6d6d92b9963d392dc9ea11c3f5eaa1c9ea9..37515beafc8ce44ff501d15d617968248656b59f 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/highmem.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <asm/kmap_types.h>
 
 extern enum km_type crypto_km_types[];
@@ -61,6 +62,33 @@ static inline void crypto_init_proc(void)
 { }
 #endif
 
+static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg,
+                                                int flags)
+{
+       return alg->cra_ctxsize;
+}
+
+static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg,
+                                                int flags)
+{
+       unsigned int len = alg->cra_ctxsize;
+       
+       switch (flags & CRYPTO_TFM_MODE_MASK) {
+       case CRYPTO_TFM_MODE_CBC:
+               len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1);
+               len += alg->cra_blocksize;
+               break;
+       }
+
+       return len;
+}
+
+static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg,
+                                                  int flags)
+{
+       return alg->cra_ctxsize;
+}
+
 int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
 int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
 int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);