Blame SOURCES/aide-0.15.1-fipsfix.patch

c40f54
diff -up aide-0.15.1/src/aide.c.fipsfix aide-0.15.1/src/aide.c
c40f54
--- aide-0.15.1/src/aide.c.fipsfix	2010-08-08 19:39:31.000000000 +0200
c40f54
+++ aide-0.15.1/src/aide.c	2012-11-22 16:59:45.378713818 +0100
c40f54
@@ -484,9 +484,28 @@ int main(int argc,char**argv)
c40f54
 #endif
c40f54
   umask(0177);
c40f54
   init_sighandler();
c40f54
-
c40f54
   setdefaults_before_config();
c40f54
 
c40f54
+#if WITH_GCRYPT
c40f54
+  error(255,"Gcrypt library initialization\n");
c40f54
+  /*
c40f54
+   *  Initialize libgcrypt as per
c40f54
+   *  http://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
c40f54
+   *
c40f54
+   *
c40f54
+   */
c40f54
+  gcry_control(GCRYCTL_SET_ENFORCED_FIPS_FLAG, 0);
c40f54
+  gcry_control(GCRYCTL_INIT_SECMEM, 1);
c40f54
+
c40f54
+  if(!gcry_check_version(GCRYPT_VERSION)) {
c40f54
+      error(0,"libgcrypt version mismatch\n");
c40f54
+      exit(VERSION_MISMATCH_ERROR);
c40f54
+  }
c40f54
+
c40f54
+  gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
c40f54
+#endif /* WITH_GCRYPT */
c40f54
+
c40f54
+
c40f54
   if(read_param(argc,argv)==RETFAIL){
c40f54
     error(0, _("Invalid argument\n") );
c40f54
     exit(INVALID_ARGUMENT_ERROR);
c40f54
@@ -641,6 +660,9 @@ int main(int argc,char**argv)
c40f54
     }
c40f54
 #endif
c40f54
   }
c40f54
+#ifdef WITH_GCRYPT
c40f54
+  gcry_control(GCRYCTL_TERM_SECMEM, 0);
c40f54
+#endif /* WITH_GCRYPT */
c40f54
   return RETOK;
c40f54
 }
c40f54
 const char* aide_key_3=CONFHMACKEY_03;
c40f54
diff -up aide-0.15.1/src/md.c.fipsfix aide-0.15.1/src/md.c
c40f54
--- aide-0.15.1/src/md.c.fipsfix	2010-08-08 19:39:31.000000000 +0200
c40f54
+++ aide-0.15.1/src/md.c	2012-11-22 16:59:33.166673632 +0100
c40f54
@@ -201,14 +201,7 @@ int init_md(struct md_container* md) {
c40f54
   }
c40f54
 #endif 
c40f54
 #ifdef WITH_GCRYPT
c40f54
-  error(255,"Gcrypt library initialization\n");
c40f54
-  	if(!gcry_check_version(GCRYPT_VERSION)) {
c40f54
-		error(0,"libgcrypt version mismatch\n");
c40f54
-		exit(VERSION_MISMATCH_ERROR);
c40f54
-	}
c40f54
-	gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
c40f54
-	gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
c40f54
-	if(gcry_md_open(&md->mdh,0,0)!=GPG_ERR_NO_ERROR){
c40f54
+	if(gcry_md_open(&md->mdh,0,GCRY_MD_FLAG_SECURE)!=GPG_ERR_NO_ERROR){
c40f54
 		error(0,"gcrypt_md_open failed\n");
c40f54
 		exit(IO_ERROR);
c40f54
 	}
c40f54
@@ -299,7 +292,7 @@ int close_md(struct md_container* md) {
c40f54
   
c40f54
   /*.    There might be more hashes in the library. Add those here..   */
c40f54
   
c40f54
-  gcry_md_reset(md->mdh);
c40f54
+  gcry_md_close(md->mdh);
c40f54
 #endif  
c40f54
 
c40f54
 #ifdef WITH_MHASH
c40f54
diff -up aide-0.15.1/src/util.c.fipsfix aide-0.15.1/src/util.c
c40f54
--- aide-0.15.1/src/util.c.fipsfix	2010-08-08 19:39:31.000000000 +0200
c40f54
+++ aide-0.15.1/src/util.c	2012-11-22 16:59:33.166673632 +0100
c40f54
@@ -494,28 +494,5 @@ int syslog_facility_lookup(char *s)
c40f54
 	return(AIDE_SYSLOG_FACILITY);
c40f54
 }
c40f54
 
c40f54
-/* We need these dummy stubs to fool the linker into believing that
c40f54
-   we do not need them at link time */
c40f54
-
c40f54
-void* dlopen(char*filename,int flag)
c40f54
-{
c40f54
-  return NULL;
c40f54
-}
c40f54
-
c40f54
-void* dlsym(void*handle,char*symbol)
c40f54
-{
c40f54
-  return NULL;
c40f54
-}
c40f54
-
c40f54
-void* dlclose(void*handle)
c40f54
-{
c40f54
-  return NULL;
c40f54
-}
c40f54
-
c40f54
-const char* dlerror(void)
c40f54
-{
c40f54
-  return NULL;
c40f54
-}
c40f54
-
c40f54
 const char* aide_key_2=CONFHMACKEY_02;
c40f54
 const char* db_key_2=DBHMACKEY_02;