Steve Grubb bafd84
diff -urp aide-0.13.1.orig/doc/aide.1.in aide-0.13.1/doc/aide.1.in
Steve Grubb bafd84
--- aide-0.13.1.orig/doc/aide.1.in	2009-12-01 12:23:10.000000000 -0500
Steve Grubb bafd84
+++ aide-0.13.1/doc/aide.1.in	2009-12-01 12:28:14.000000000 -0500
Steve Grubb bafd84
@@ -67,6 +67,7 @@ conditions:
Steve Grubb bafd84
 .IP "16 Unimplemented function error"
Steve Grubb bafd84
 .IP "17 Invalid configureline error"
Steve Grubb bafd84
 .IP "18 IO error"
Steve Grubb bafd84
+.IP "19 Version mismatch error"
Steve Grubb bafd84
 .PP
Steve Grubb bafd84
 .SH NOTES
Steve Grubb bafd84
 Please note that due to mmap issues, aide cannot be terminated with
Steve Grubb bafd84
diff -urp aide-0.13.1.orig/include/report.h aide-0.13.1/include/report.h
Steve Grubb bafd84
--- aide-0.13.1.orig/include/report.h	2009-12-01 12:23:10.000000000 -0500
Steve Grubb bafd84
+++ aide-0.13.1/include/report.h	2009-12-01 12:27:43.000000000 -0500
Steve Grubb bafd84
@@ -31,6 +31,7 @@
Steve Grubb bafd84
 #define UNIMPLEMENTED_FUNCTION_ERROR 16
Steve Grubb bafd84
 #define INVALID_CONFIGURELINE_ERROR 17
Steve Grubb bafd84
 #define IO_ERROR 18
Steve Grubb bafd84
+#define VERSION_MISMATCH_ERROR 19
Steve Grubb bafd84
 
Steve Grubb bafd84
 /* Errorcodes */
Steve Grubb bafd84
 #define HASH_ALGO_ERROR 30
Steve Grubb bafd84
diff -urp aide-0.13.1.orig/src/md.c aide-0.13.1/src/md.c
Steve Grubb bafd84
--- aide-0.13.1.orig/src/md.c	2009-12-01 12:23:10.000000000 -0500
Steve Grubb bafd84
+++ aide-0.13.1/src/md.c	2009-12-01 12:27:04.000000000 -0500
Steve Grubb d8359a
@@ -201,6 +201,15 @@ int init_md(struct md_container* md) {
Steve Grubb d8359a
 #endif 
Steve Grubb d8359a
 #ifdef WITH_GCRYPT
Steve Grubb d8359a
   error(255,"Gcrypt library initialization\n");
Steve Grubb d8359a
+  	/* 
Steve Grubb d8359a
+  	  Initialize libgcrypt as per
Steve Grubb d8359a
+  	  http://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
Steve Grubb d8359a
+  	 */
Steve Grubb d8359a
+  	if(!gcry_check_version(GCRYPT_VERSION)) {
Steve Grubb d8359a
+		error(0,"libgcrypt version mismatch\n");
Steve Grubb bafd84
+		exit(VERSION_MISMATCH_ERROR);
Steve Grubb d8359a
+	}
Steve Grubb d8359a
+	gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
Steve Grubb d8359a
 	if(gcry_md_open(&md->mdh,0,0)!=GPG_ERR_NO_ERROR){
Steve Grubb d8359a
 		error(0,"gcrypt_md_open failed\n");
Steve Grubb d8359a
 		exit(IO_ERROR);