These patches glue for crypto api.
---
crypto/cipher.c | 8 ++++++++
crypto/internal.h | 16 ++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
45bc98c447c18976c1ea0982054f2d677358fc31
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 65bcea0..aa30aa9 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -453,6 +453,8 @@ int crypto_init_cipher_ops(struct crypto
addr = ALIGN(addr, align);
addr += ALIGN(tfm->__crt_alg->cra_ctxsize, align);
ops->cit_iv = (void *)addr;
+
+ ret = crypto_alloc_xcbc_block(tfm);
}
out:
@@ -461,4 +463,10 @@ out:
void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
{
+#ifdef CONFIG_CRYPTO_XCBC
+ struct cipher_tfm *ops = &tfm->crt_cipher;
+ if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) {
+ crypto_free_xcbc_block(tfm);
+ }
+#endif
}
diff --git a/crypto/internal.h b/crypto/internal.h
index 959e602..b65be33 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -62,6 +62,22 @@ static inline void crypto_free_hmac_bloc
{ }
#endif
+#ifdef CONFIG_CRYPTO_XCBC
+int crypto_alloc_xcbc_block(struct crypto_tfm *tfm);
+static inline void crypto_free_xcbc_block(struct crypto_tfm *tfm)
+{
+ kfree(tfm->crt_cipher.cit_xcbc_block);
+}
+#else
+static inline int crypto_alloc_xcbc_block(struct crypto_tfm *tfm)
+{
+ return 0;
+}
+
+static inline void crypto_free_xcbc_block(struct crypto_tfm *tfm)
+{ }
+#endif
+
#ifdef CONFIG_PROC_FS
void __init crypto_init_proc(void);
#else
--
Kazunori MIYAZAWA
Subject: [PATCH] add glue codes of xcbc
From: Kazunori MIYAZAWA <[EMAIL PROTECTED]>
Date: 1138249623 +0900
---
crypto/cipher.c | 8 ++++++++
crypto/internal.h | 16 ++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
45bc98c447c18976c1ea0982054f2d677358fc31
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 65bcea0..aa30aa9 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -453,6 +453,8 @@ int crypto_init_cipher_ops(struct crypto
addr = ALIGN(addr, align);
addr += ALIGN(tfm->__crt_alg->cra_ctxsize, align);
ops->cit_iv = (void *)addr;
+
+ ret = crypto_alloc_xcbc_block(tfm);
}
out:
@@ -461,4 +463,10 @@ out:
void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
{
+#ifdef CONFIG_CRYPTO_XCBC
+ struct cipher_tfm *ops = &tfm->crt_cipher;
+ if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) {
+ crypto_free_xcbc_block(tfm);
+ }
+#endif
}
diff --git a/crypto/internal.h b/crypto/internal.h
index 959e602..b65be33 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -62,6 +62,22 @@ static inline void crypto_free_hmac_bloc
{ }
#endif
+#ifdef CONFIG_CRYPTO_XCBC
+int crypto_alloc_xcbc_block(struct crypto_tfm *tfm);
+static inline void crypto_free_xcbc_block(struct crypto_tfm *tfm)
+{
+ kfree(tfm->crt_cipher.cit_xcbc_block);
+}
+#else
+static inline int crypto_alloc_xcbc_block(struct crypto_tfm *tfm)
+{
+ return 0;
+}
+
+static inline void crypto_free_xcbc_block(struct crypto_tfm *tfm)
+{ }
+#endif
+
#ifdef CONFIG_PROC_FS
void __init crypto_init_proc(void);
#else
--
1.1.3