fd78a22
diff -up vim81/src/config.h.in.crypto vim81/src/config.h.in
fd78a22
--- vim81/src/config.h.in.crypto	2019-07-26 07:58:51.000000000 +0200
fd78a22
+++ vim81/src/config.h.in	2019-09-16 14:18:32.994110646 +0200
fd78a22
@@ -490,3 +490,12 @@
fd78a22
 
fd78a22
 /* Define to inline symbol or empty */
fd78a22
 #undef inline
fd78a22
+
fd78a22
+/* Do we need FIPS warning? */
fd78a22
+#undef HAVE_FIPS_WARNING
fd78a22
+
fd78a22
+/* Link to system-fips file */
fd78a22
+#undef SYSTEM_FIPS_FILE_LINK
fd78a22
+
fd78a22
+/* Link to fips_enabled file */
fd78a22
+#undef FIPS_ENABLED_FILE_LINK
fd78a22
diff -up vim81/src/configure.ac.crypto vim81/src/configure.ac
fd78a22
--- vim81/src/configure.ac.crypto	2019-09-16 14:18:32.990110675 +0200
fd78a22
+++ vim81/src/configure.ac	2019-09-16 14:18:32.996110631 +0200
fd78a22
@@ -534,6 +534,38 @@ else
fd78a22
   AC_MSG_RESULT(yes)
fd78a22
 fi
fd78a22
 
fd78a22
+dnl Checking if we want FIPS warning
fd78a22
+
fd78a22
+AC_MSG_CHECKING(--enable-fips-warning)
fd78a22
+AC_ARG_ENABLE([fips-warning],
fd78a22
+              AS_HELP_STRING([--enable-fips-warning], [Enable FIPS warning]),
fd78a22
+              ,[enable_fips_warning="no"])
fd78a22
+
fd78a22
+if test "$enable_fips_warning" = "yes"; then
fd78a22
+  AC_MSG_RESULT(yes)
fd78a22
+  AC_DEFINE([HAVE_FIPS_WARNING])
fd78a22
+
fd78a22
+  dnl Setting path for system-fips file
fd78a22
+
fd78a22
+  AC_MSG_CHECKING(--with-system-fips-file argument)
fd78a22
+  AC_ARG_WITH([system-fips-file], [  --with-system-fips-file=PATH       Link to system-fips file (default: /etc/system-fips)],
fd78a22
+	with_system_fips_file=$withval,
fd78a22
+       with_system_fips_file="/etc/system-fips")
fd78a22
+  AC_MSG_RESULT([$with_system_fips_file])
fd78a22
+  AC_DEFINE_UNQUOTED([SYSTEM_FIPS_FILE_LINK], ["$with_system_fips_file"])
fd78a22
+
fd78a22
+  dnl Setting link to fips_enabled file
fd78a22
+
fd78a22
+  AC_MSG_CHECKING(--with-fips-enabled-file argument)
fd78a22
+  AC_ARG_WITH([fips-enabled-file], [  --with-fips-enabled-file=PATH       Link to fibs_enabled file (default: /proc/sys/crypto/fips_enabled)],
fd78a22
+	with_fips_enabled_file=$withval,
fd78a22
+       with_fips_enabled_file="/proc/sys/crypto/fips_enabled")
fd78a22
+  AC_MSG_RESULT([$with_fips_enabled_file])
fd78a22
+  AC_DEFINE_UNQUOTED([FIPS_ENABLED_FILE_LINK], ["$with_fips_enabled_file"])
fd78a22
+else
fd78a22
+  AC_MSG_RESULT(no)
fd78a22
+fi
fd78a22
+
fd78a22
 dnl Check for Lua feature.
fd78a22
 AC_MSG_CHECKING(--enable-luainterp argument)
fd78a22
 AC_ARG_ENABLE(luainterp,
fd78a22
diff -up vim81/src/crypt.c.crypto vim81/src/crypt.c
fd78a22
--- vim81/src/crypt.c.crypto	2019-09-16 14:18:32.996110631 +0200
fd78a22
+++ vim81/src/crypt.c	2019-09-16 14:19:48.953550617 +0200
fd78a22
@@ -524,6 +524,21 @@ crypt_check_method(int method)
fd78a22
 	msg_scroll = TRUE;
fd78a22
 	msg(_("Warning: Using a weak encryption method; see :help 'cm'"));
fd78a22
     }
fd78a22
+#ifdef HAVE_FIPS_WARNING
fd78a22
+    FILE *fips_enable_fd = fopen(FIPS_ENABLED_FILE_LINK, "r");
fd78a22
+    if (fips_enable_fd == NULL)
fd78a22
+      return;
fd78a22
+
fd78a22
+    int enabled = fgetc(fips_enable_fd);
fd78a22
+
fd78a22
+    if ( access(SYSTEM_FIPS_FILE_LINK, F_OK) != -1 && enabled == '1')
fd78a22
+    {
fd78a22
+	msg_scroll = TRUE;
fd78a22
+	msg(_("Warning: This cryptography is not FIPS 140-2 compliant."));
fd78a22
+    }
fd78a22
+
fd78a22
+    fclose(fips_enable_fd);
fd78a22
+#endif
fd78a22
 }
fd78a22
 
fd78a22
     void