Author: grothoff Date: 2006-06-24 20:28:16 -0700 (Sat, 24 Jun 2006) New Revision: 3050
Modified: GNUnet/src/util/crypto/hostkey_gcrypt.c GNUnet/src/util/crypto/kblockkey.c GNUnet/src/util/crypto/locking_gcrypt.c GNUnet/src/util/crypto/random.c GNUnet/src/util/crypto/symcipher_gcrypt.c Log: compiles Modified: GNUnet/src/util/crypto/hostkey_gcrypt.c =================================================================== --- GNUnet/src/util/crypto/hostkey_gcrypt.c 2006-06-25 03:09:02 UTC (rev 3049) +++ GNUnet/src/util/crypto/hostkey_gcrypt.c 2006-06-25 03:28:16 UTC (rev 3050) @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -276,7 +276,7 @@ if ( ( ntohs(publicKey->sizen) != RSA_ENC_LEN ) || ( ntohs(publicKey->len) != sizeof(PublicKey) - sizeof(publicKey->padding)) ) { - BREAK(); + GE_BREAK(NULL, 0); return NULL; } size = RSA_ENC_LEN; @@ -340,7 +340,7 @@ lockGcrypt(); #if EXTRA_CHECKS if (gcry_pk_testkey(hostkey->sexp)) { - BREAK(); + GE_BREAK(NULL, 0); unlockGcrypt(); return NULL; } @@ -411,7 +411,7 @@ sizes[i] = 0; } } - GNUNET_ASSERT(size < 65536); + GE_ASSERT(NULL, size < 65536); retval = MALLOC(size); retval->len = htons(size); i = 0; @@ -664,7 +664,7 @@ size_t erroff; int rc; - GNUNET_ASSERT(size <= sizeof(HashCode512)); + GE_ASSERT(NULL, size <= sizeof(HashCode512)); pubkey = public2PrivateKey(publicKey); isize = size; lockGcrypt(); @@ -1026,7 +1026,7 @@ gcry_sexp_release(data); gcry_sexp_release(sigdata); if (rc) { - GE_LOG(ectx, + GE_LOG(NULL, GE_WARNING | GE_USER | GE_BULK | GE_DEVELOPER, _("RSA signature verification failed at %s:%d: %s\n"), __FILE__, __LINE__, Modified: GNUnet/src/util/crypto/kblockkey.c =================================================================== --- GNUnet/src/util/crypto/kblockkey.c 2006-06-25 03:09:02 UTC (rev 3049) +++ GNUnet/src/util/crypto/kblockkey.c 2006-06-25 03:28:16 UTC (rev 3050) @@ -1,7 +1,7 @@ /* This file is part of GNUnet. Copyright (C) 1994, 1996, 1998, 2001, 2002, 2003 Free Software Foundation, Inc. - Copyright (C) 2004, 2005 Christian Grothoff (and other contributing authors) + Copyright (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -239,7 +239,8 @@ set_highbit(x, nbits-2 ); mpz_clrbit( x, nbits-2 ); } - GNUNET_ASSERT( mpz_cmp( x, nminus1 ) < 0 && mpz_cmp_ui( x, 1 ) > 0 ); + GE_ASSERT(NULL, + mpz_cmp( x, nminus1 ) < 0 && mpz_cmp_ui( x, 1 ) > 0 ); } mpz_powm ( y, x, q, n); if ( mpz_cmp_ui(y, 1) && mpz_cmp( y, nminus1 ) ) { @@ -274,7 +275,7 @@ int *mods; mpz_t tmp; - GNUNET_ASSERT(nbits >= 16); + GE_ASSERT(NULL, nbits >= 16); mods = MALLOC(no_of_small_prime_numbers * sizeof(*mods)); /* Make nbits fit into mpz_t implementation. */ @@ -518,7 +519,7 @@ static KBlockKeyCacheLine ** cache; static unsigned int cacheSize; -static Mutex lock; +static struct MUTEX * lock; /** * Deterministically (!) create a hostkey using only the @@ -529,12 +530,12 @@ KBlockKeyCacheLine * line; int i; - MUTEX_LOCK(&lock); + MUTEX_LOCK(lock); for (i=0;i<cacheSize;i++) { if (equalsHashCode512(hc, &cache[i]->hc)) { ret = decodePrivateKey(cache[i]->pke); - MUTEX_UNLOCK(&lock); + MUTEX_UNLOCK(lock); return ret; } } @@ -549,12 +550,12 @@ cacheSize+1); cache[cacheSize-1] = line; - MUTEX_UNLOCK(&lock); + MUTEX_UNLOCK(lock); return decodePrivateKey(line->pke); } void __attribute__ ((constructor)) gnunet_crypto_kblock_ltdl_init(void) { - MUTEX_CREATE(&lock); + lock = MUTEX_CREATE(NO); } void __attribute__ ((destructor)) gnunet_crypto_kblock_ltdl_fini(void) { @@ -566,7 +567,7 @@ GROW(cache, cacheSize, 0); - MUTEX_DESTROY(&lock); + MUTEX_DESTROY(lock); } /* end of kblockkey.c */ Modified: GNUnet/src/util/crypto/locking_gcrypt.c =================================================================== --- GNUnet/src/util/crypto/locking_gcrypt.c 2006-06-25 03:09:02 UTC (rev 3049) +++ GNUnet/src/util/crypto/locking_gcrypt.c 2006-06-25 03:28:16 UTC (rev 3050) @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2003, 2004 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -29,18 +29,18 @@ #include "locking_gcrypt.h" #include <gcrypt.h> -static Mutex gcrypt_shared_lock; +static struct MUTEX * gcrypt_shared_lock; void lockGcrypt() { - MUTEX_LOCK(&gcrypt_shared_lock); + MUTEX_LOCK(gcrypt_shared_lock); } void unlockGcrypt() { - MUTEX_UNLOCK(&gcrypt_shared_lock); + MUTEX_UNLOCK(gcrypt_shared_lock); } void __attribute__ ((constructor)) gnunet_crypto_ltdl_init() { - MUTEX_CREATE_RECURSIVE(&gcrypt_shared_lock); + gcrypt_shared_lock = MUTEX_CREATE(YES); gcry_control(GCRYCTL_DISABLE_SECMEM, 0); if (! gcry_check_version(GCRYPT_VERSION)) { fprintf(stderr, @@ -57,5 +57,7 @@ } void __attribute__ ((destructor)) gnunet_crypto_ltdl_fini() { - MUTEX_DESTROY(&gcrypt_shared_lock); + MUTEX_DESTROY(gcrypt_shared_lock); + gcrypt_shared_lock = NULL; } + Modified: GNUnet/src/util/crypto/random.c =================================================================== --- GNUnet/src/util/crypto/random.c 2006-06-25 03:09:02 UTC (rev 3049) +++ GNUnet/src/util/crypto/random.c 2006-06-25 03:28:16 UTC (rev 3050) @@ -20,12 +20,13 @@ */ /** - * @file util/random.c + * @file util/crypto/random.c * @brief functions to gather random numbers * @author Christian Grothoff */ #include "platform.h" #include "gnunet_util.h" +#include "gnunet_util_crypto.h" #include "locking_gcrypt.h" #include <gcrypt.h> @@ -114,7 +115,7 @@ unsigned long long weak_randomi64(unsigned long long u) { unsigned long long ret; - GE_ASSERT(u > 0); + GE_ASSERT(NULL, u > 0); ret = u * ((double) RANDOM() / RAND_MAX); if (ret >= u) ret = u-1; Modified: GNUnet/src/util/crypto/symcipher_gcrypt.c =================================================================== --- GNUnet/src/util/crypto/symcipher_gcrypt.c 2006-06-25 03:09:02 UTC (rev 3049) +++ GNUnet/src/util/crypto/symcipher_gcrypt.c 2006-06-25 03:28:16 UTC (rev 3050) @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -107,7 +107,10 @@ SESSIONKEY_LEN); if (rc && ((char)rc != GPG_ERR_WEAK_KEY)) { - LOG_GCRY(LOG_FAILURE, "gcry_cipher_setkey", rc); + LOG_GCRY(NULL, + GE_ERROR | GE_USER | GE_DEVELOPER | GE_BULK, + "gcry_cipher_setkey", + rc); gcry_cipher_close(handle); unlockGcrypt(); return -1; _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn