Blame SOURCES/aide-0.16b1-fipsfix.patch

6ac4f1
diff -up ./src/aide.c.orig ./aide-0.16b1/src/aide.c
6ac4f1
--- ./src/aide.c.orig	2016-07-12 11:10:08.013158385 +0200
6ac4f1
+++ ./src/aide.c	2016-07-12 11:30:54.867833064 +0200
6ac4f1
@@ -511,9 +511,28 @@ int main(int argc,char**argv)
6ac4f1
 #endif
6ac4f1
   umask(0177);
6ac4f1
   init_sighandler();
6ac4f1
-
6ac4f1
   setdefaults_before_config();
6ac4f1
 
6ac4f1
+#if WITH_GCRYPT
6ac4f1
+  error(255,"Gcrypt library initialization\n");
6ac4f1
+  /*
6ac4f1
+   *  Initialize libgcrypt as per
6ac4f1
+   *  http://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
6ac4f1
+   *
6ac4f1
+   *
6ac4f1
+   */
6ac4f1
+  gcry_control(GCRYCTL_SET_ENFORCED_FIPS_FLAG, 0);
6ac4f1
+  gcry_control(GCRYCTL_INIT_SECMEM, 1);
6ac4f1
+
6ac4f1
+  if(!gcry_check_version(GCRYPT_VERSION)) {
6ac4f1
+      error(0,"libgcrypt version mismatch\n");
6ac4f1
+      exit(VERSION_MISMATCH_ERROR);
6ac4f1
+  }
6ac4f1
+
6ac4f1
+  gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
6ac4f1
+#endif /* WITH_GCRYPT */
6ac4f1
+
6ac4f1
+
6ac4f1
   if(read_param(argc,argv)==RETFAIL){
6ac4f1
     error(0, _("Invalid argument\n") );
6ac4f1
     exit(INVALID_ARGUMENT_ERROR);
6ac4f1
@@ -646,6 +665,9 @@ int main(int argc,char**argv)
6ac4f1
     }
6ac4f1
 #endif
6ac4f1
   }
6ac4f1
+#ifdef WITH_GCRYPT
6ac4f1
+  gcry_control(GCRYCTL_TERM_SECMEM, 0);
6ac4f1
+#endif /* WITH_GCRYPT */
6ac4f1
   return RETOK;
6ac4f1
 }
6ac4f1
 const char* aide_key_3=CONFHMACKEY_03;
6ac4f1
diff -up ./src/md.c.orig ./aide-0.16b1/src/md.c
6ac4f1
--- ./src/md.c.orig	2016-04-15 23:30:16.000000000 +0200
6ac4f1
+++ ./src/md.c	2016-07-12 11:35:04.007675329 +0200
6ac4f1
@@ -201,14 +201,7 @@ int init_md(struct md_container* md) {
6ac4f1
   }
6ac4f1
 #endif 
6ac4f1
 #ifdef WITH_GCRYPT
6ac4f1
-  error(255,"Gcrypt library initialization\n");
6ac4f1
-  	if(!gcry_check_version(GCRYPT_VERSION)) {
6ac4f1
-		error(0,"libgcrypt version mismatch\n");
6ac4f1
-		exit(VERSION_MISMATCH_ERROR);
6ac4f1
-	}
6ac4f1
-	gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
6ac4f1
-	gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
6ac4f1
-	if(gcry_md_open(&md->mdh,0,0)!=GPG_ERR_NO_ERROR){
6ac4f1
+        if(gcry_md_open(&md->mdh,0,GCRY_MD_FLAG_SECURE)!=GPG_ERR_NO_ERROR){
6ac4f1
 		error(0,"gcrypt_md_open failed\n");
6ac4f1
 		exit(IO_ERROR);
6ac4f1
 	}
6ac4f1
@@ -299,7 +292,7 @@ int close_md(struct md_container* md) {
6ac4f1
   
6ac4f1
   /*.    There might be more hashes in the library. Add those here..   */
6ac4f1
   
6ac4f1
-  gcry_md_reset(md->mdh);
6ac4f1
+  gcry_md_close(md->mdh);
6ac4f1
 #endif  
6ac4f1
 
6ac4f1
 #ifdef WITH_MHASH
6ac4f1
diff -up ./src/util.c.orig ./aide-0.16b1/src/util.c
6ac4f1
--- ./src/util.c.orig	2016-07-12 11:39:17.023437355 +0200
6ac4f1
+++ ./src/util.c	2016-07-12 11:39:51.618721157 +0200
6ac4f1
@@ -519,28 +519,5 @@ int syslog_facility_lookup(char *s)
6ac4f1
 	return(AIDE_SYSLOG_FACILITY);
6ac4f1
 }
6ac4f1
 
6ac4f1
-/* We need these dummy stubs to fool the linker into believing that
6ac4f1
-   we do not need them at link time */
6ac4f1
-
6ac4f1
-void* dlopen(char*filename,int flag)
6ac4f1
-{
6ac4f1
-  return NULL;
6ac4f1
-}
6ac4f1
-
6ac4f1
-void* dlsym(void*handle,char*symbol)
6ac4f1
-{
6ac4f1
-  return NULL;
6ac4f1
-}
6ac4f1
-
6ac4f1
-void* dlclose(void*handle)
6ac4f1
-{
6ac4f1
-  return NULL;
6ac4f1
-}
6ac4f1
-
6ac4f1
-const char* dlerror(void)
6ac4f1
-{
6ac4f1
-  return NULL;
6ac4f1
-}
6ac4f1
-
6ac4f1
 const char* aide_key_2=CONFHMACKEY_02;
6ac4f1
 const char* db_key_2=DBHMACKEY_02;