diff --git a/crypto/algapi.c b/crypto/algapi.c
index d2627a3d4ed8b15cf53127b11daaad412a950711..a60f62625b5f4e3117cb128c198ee6fa5ec741d1 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -964,6 +964,12 @@ void crypto_xor(u8 *dst, const u8 *src, unsigned int size)
 }
 EXPORT_SYMBOL_GPL(crypto_xor);
 
+unsigned int crypto_alg_extsize(struct crypto_alg *alg)
+{
+	return alg->cra_ctxsize;
+}
+EXPORT_SYMBOL_GPL(crypto_alg_extsize);
+
 static int __init crypto_algapi_init(void)
 {
 	crypto_init_proc();
diff --git a/crypto/internal.h b/crypto/internal.h
index bd39bfc92eabc1acf465e1cf8614d644eaafb402..ed7a70c6dbc1f04209e4a2bd94f1d7ab2b908177 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -103,6 +103,8 @@ int crypto_register_notifier(struct notifier_block *nb);
 int crypto_unregister_notifier(struct notifier_block *nb);
 int crypto_probing_notify(unsigned long val, void *v);
 
+unsigned int crypto_alg_extsize(struct crypto_alg *alg);
+
 static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
 {
 	atomic_inc(&alg->cra_refcnt);