Dear,
Please find attached a patch which makes valgrind and friends happy. Some changes had been done in md_rand.c which broke the purpose of PURIFY. Needless to say that the define PURIFY is *not* for production system...
Best Regards,
Frederic Heem






______________________________________________________________________________

--- NOTICE ---

This  email  and  any  attachments  are  confidential and are intended for the
addressee  only.  If you have received this message by mistake, please contact
us  immediately and  then  delete the message from your system.   You must not
copy, distribute, disclose  or  act upon the contents of this email.  Personal
and corporate data submitted will be used in a correct, transparent and lawful
manner. The data collected will be processed in paper or computerized form for
the  performance  of  contractual  and  lawful  obligations as well as for the
effective  management of business relationship.   The data processor is Telsey
S.p.A.   The  data  subject may exercise all the rights set forth in art. 7 of
Law  by  Decree  30.06.2003  n.  196   as   reported   in  the  following  url
http://www.telsey.com/privacy.asp.

______________________________________________________________________________
798t8RfNa6Dl8Ilf
--- ../../../tmp/openssl-0.9.8h/crypto/rand/md_rand.c	2007-01-21 13:16:36.000000000 +0000
+++ md_rand.c	2008-07-17 17:53:01.000000000 +0100
@@ -331,7 +331,27 @@
 	pid_t curr_pid = getpid();
 #endif
 	int do_stir_pool = 0;
-
+#ifdef PURIFY
+  /* !!!! DO NOT USE PURIFY FOR PRODUCTION SYSTEM !!!!
+     this makes valgrind and friends happy.
+     Numbers below doesn't follow any particular rule, they are just not equal to 0 */
+  static int once = 0;
+  if(once == 0){
+    once = 1;
+    md_count[0] = 3;
+    md_count[0] = 7;
+    for(i = 0; i < MD_DIGEST_LENGTH; i++){
+      md[i] = i * i + 1;
+    }
+    for(i = 0; i < num; i++){
+      buf[i] = i * i + 2;
+    }
+    for(i = 0; i < (STATE_SIZE + MD_DIGEST_LENGTH); i++){
+      state[i] = i * i + 3;
+    }
+  }
+  memset(buf, 1, num);
+#endif
 #ifdef PREDICT
 	if (rand_predictable)
 		{
@@ -464,9 +484,7 @@
 #endif
 		MD_Update(&m,local_md,MD_DIGEST_LENGTH);
 		MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
-#ifndef PURIFY
 		MD_Update(&m,buf,j); /* purify complains */
-#endif
 		k=(st_idx+MD_DIGEST_LENGTH/2)-st_num;
 		if (k > 0)
 			{

Reply via email to