Blame SOURCES/aide-0.15.1-fipsfix.patch

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