gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r313 - GNUnet/src/util branches/GNUnet06/src/util


From: grothoff
Subject: [GNUnet-SVN] r313 - GNUnet/src/util branches/GNUnet06/src/util
Date: Fri, 25 Feb 2005 15:14:00 -0800 (PST)

Author: grothoff
Date: 2005-02-25 15:13:59 -0800 (Fri, 25 Feb 2005)
New Revision: 313

Modified:
   GNUnet/src/util/hashing.c
   branches/GNUnet06/src/util/hashing.c
Log:
fixing mantis 828

Modified: GNUnet/src/util/hashing.c
===================================================================
--- GNUnet/src/util/hashing.c   2005-02-25 20:12:12 UTC (rev 312)
+++ GNUnet/src/util/hashing.c   2005-02-25 23:13:59 UTC (rev 313)
@@ -40,6 +40,7 @@
 
 #if USE_GCRYPT
 #include <gcrypt.h>
+#include "locking_gcrypt.h"
 #endif
 
 /**
@@ -55,10 +56,12 @@
   RIPEMD160(block, size, (unsigned char*) ret);
 #endif
 #if USE_GCRYPT
+  lockGcrypt();
   gcry_md_hash_buffer(GCRY_MD_RMD160,
                      (char*) ret,
                      block,
                      size);
+  unlockGcrypt();
 #endif
 }
 
@@ -80,10 +83,13 @@
   gcry_md_hd_t hd;
   char * res;
 
+  lockGcrypt();
   if (0 != gcry_md_open(&hd,
-                       GCRY_MD_RMD160,
-                       0))
+                                               GCRY_MD_RMD160,
+                                               0)) {
+       unlockGcrypt();
     return SYSERR;
+  }
 #endif
 #if USE_OPENSSL
   RIPEMD160_CTX hd;  
@@ -94,6 +100,7 @@
   if (fh == -1) {
 #if USE_GCRYPT
     gcry_md_close(hd);
+       unlockGcrypt();
 #endif
 #if USE_OPENSSL
     RIPEMD160_Final((unsigned char*)ret,
@@ -114,6 +121,7 @@
       CLOSE(fh);
 #if USE_GCRYPT
       gcry_md_close(hd);
+         unlockGcrypt();
 #endif
 #if USE_OPENSSL
       RIPEMD160_Final((unsigned char*)ret,
@@ -141,6 +149,7 @@
         res,
         sizeof(HashCode160));
   gcry_md_close(hd);
+  unlockGcrypt();
 #endif
 #if USE_OPENSSL
   RIPEMD160_Final((unsigned char*)ret,

Modified: branches/GNUnet06/src/util/hashing.c
===================================================================
--- branches/GNUnet06/src/util/hashing.c        2005-02-25 20:12:12 UTC (rev 
312)
+++ branches/GNUnet06/src/util/hashing.c        2005-02-25 23:13:59 UTC (rev 
313)
@@ -40,6 +40,7 @@
 
 #if USE_GCRYPT
 #include <gcrypt.h>
+#include "locking_gcrypt.h"
 #endif
 
 /**
@@ -55,13 +56,16 @@
   RIPEMD160(block, size, (unsigned char*) ret);
 #endif
 #if USE_GCRYPT
+  lockGcrypt();
   gcry_md_hash_buffer(GCRY_MD_RMD160,
                      (char*) ret,
                      block,
                      size);
+  unlockGcrypt();
 #endif
 }
 
+
 /**
  * Compute the hash of an entire file.  Does NOT load the entire file
  * into memory but instead processes it in blocks.  Very important for
@@ -80,10 +84,13 @@
   gcry_md_hd_t hd;
   char * res;
 
+  lockGcrypt();
   if (0 != gcry_md_open(&hd,
-                       GCRY_MD_RMD160,
-                       0))
+                                               GCRY_MD_RMD160,
+                                               0)) {
+       unlockGcrypt();
     return SYSERR;
+  }
 #endif
 #if USE_OPENSSL
   RIPEMD160_CTX hd;  
@@ -94,6 +101,7 @@
   if (fh == -1) {
 #if USE_GCRYPT
     gcry_md_close(hd);
+       unlockGcrypt();
 #endif
 #if USE_OPENSSL
     RIPEMD160_Final((unsigned char*)ret,
@@ -114,6 +122,7 @@
       CLOSE(fh);
 #if USE_GCRYPT
       gcry_md_close(hd);
+         unlockGcrypt();
 #endif
 #if USE_OPENSSL
       RIPEMD160_Final((unsigned char*)ret,
@@ -141,6 +150,7 @@
         res,
         sizeof(HashCode160));
   gcry_md_close(hd);
+  unlockGcrypt();
 #endif
 #if USE_OPENSSL
   RIPEMD160_Final((unsigned char*)ret,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]