[PATCH v11 08/12] cryptouser.h: fix include from userland

From: Nicolas Dichtel
Date: Mon Mar 27 2017 - 08:21:42 EST


This patch prepares the uapi export by fixing the following error:

.../linux/cryptouser.h:58:16: error: âCRYPTO_MAX_ALG_NAMEâ undeclared here (not in a function)
char cru_name[CRYPTO_MAX_ALG_NAME];

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>
Acked-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
include/linux/crypto.h | 2 +-
include/uapi/linux/crypto.h | 14 ++++++++++++++
include/uapi/linux/cryptouser.h | 6 ++++++
3 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 include/uapi/linux/crypto.h

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c0b0cf3d2d2f..cc2425ba8527 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/uaccess.h>
+#include <uapi/linux/crypto.h>

/*
* Autoloaded crypto modules should only use a prefixed name to avoid allowing
@@ -123,7 +124,6 @@
/*
* Miscellaneous stuff.
*/
-#define CRYPTO_MAX_ALG_NAME 64

/*
* The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual
diff --git a/include/uapi/linux/crypto.h b/include/uapi/linux/crypto.h
new file mode 100644
index 000000000000..e342c5a5ac50
--- /dev/null
+++ b/include/uapi/linux/crypto.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2017 Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _UAPI_CRYPTO_H
+#define _UAPI_CRYPTO_H
+
+#define CRYPTO_MAX_ALG_NAME 64
+
+#endif /* _UAPI_CRYPTO_H */
diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h
index c6a09c5261e7..751e7daef54a 100644
--- a/include/uapi/linux/cryptouser.h
+++ b/include/uapi/linux/cryptouser.h
@@ -18,6 +18,10 @@
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/

+#ifndef _UAPI_CRYPTOUSER_H
+#define _UAPI_CRYPTOUSER_H
+
+#include <linux/crypto.h>
#include <linux/types.h>

/* Netlink configuration messages. */
@@ -121,3 +125,5 @@ struct crypto_report_acomp {

#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
sizeof(struct crypto_report_blkcipher))
+
+#endif /* _UAPI_CRYPTOUSER_H */
--
2.8.1