X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgc-libgcrypt.c;h=2affba09a3caea17617f3159f5ebd041c4d35fd6;hb=35dda7458879acb367f2cba0aaf7856cd98f5b63;hp=6649660c43ab1b94ba6e95cf31fb6ca78baaaadc;hpb=b4b1d30cb940262c0a340112aef705a34b3439d9;p=gnulib.git diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c index 6649660c4..2affba09a 100644 --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -1,5 +1,5 @@ /* gc-libgcrypt.c --- Crypto wrappers around Libgcrypt for GC. - * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson + * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Simon Josefsson * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published @@ -46,6 +46,9 @@ gc_init (void) err = gcry_control (GCRYCTL_ANY_INITIALIZATION_P); if (err == GPG_ERR_NO_ERROR) { + if (gcry_control (GCRYCTL_DISABLE_SECMEM, NULL, 0)) + return GC_INIT_ERROR; + if (gcry_check_version (GCRYPT_VERSION) == NULL) return GC_INIT_ERROR; @@ -142,6 +145,16 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode, gcryalg = GCRY_CIPHER_RFC2268_40; break; +#ifdef HAVE_CAMELLIA + case GC_CAMELLIA128: + gcryalg = GCRY_CIPHER_CAMELLIA128; + break; + + case GC_CAMELLIA256: + gcryalg = GCRY_CIPHER_CAMELLIA256; + break; +#endif + default: return GC_INVALID_CIPHER; } @@ -240,7 +253,7 @@ Gc_rc gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) { _gc_hash_ctx *ctx; - int gcryalg, gcrymode; + int gcryalg = 0, gcrymode = 0; gcry_error_t err; Gc_rc rc = GC_OK; @@ -281,6 +294,10 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) gcryalg = GCRY_MD_SHA512; break; + case GC_SHA224: + gcryalg = GCRY_MD_SHA224; + break; + case GC_RMD160: gcryalg = GCRY_MD_RMD160; break; @@ -380,6 +397,10 @@ gc_hash_digest_length (Gc_hash hash) len = GC_SHA512_DIGEST_SIZE; break; + case GC_SHA224: + len = GC_SHA224_DIGEST_SIZE; + break; + default: return 0; } @@ -495,6 +516,12 @@ gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf) break; #endif +#ifdef GNULIB_GC_SHA224 + case GC_SHA224: + gcryalg = GCRY_MD_SHA224; + break; +#endif + #ifdef GNULIB_GC_RMD160 case GC_RMD160: gcryalg = GCRY_MD_RMD160;