summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-08-13 08:26:52 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-08-13 08:26:52 +0000
commitba4aee5415a266f6f6c350b46969e1d277c9e287 (patch)
tree76065a541b86a14eaaf1e29b7c2fe1b3044017c3
parentfb662ce1b8c709f1fc36e37963567d7e0e0fb396 (diff)
downloadgnutls-ba4aee5415a266f6f6c350b46969e1d277c9e287.tar.gz
added better check for gcrypt library.
-rw-r--r--lib/gnutls_errors.c2
-rw-r--r--lib/gnutls_errors_int.h7
-rw-r--r--lib/gnutls_global.c6
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c
index f2dff9f2f2..30c366feaf 100644
--- a/lib/gnutls_errors.c
+++ b/lib/gnutls_errors.c
@@ -123,6 +123,8 @@ static gnutls_error_entry error_algorithms[] = {
ERROR_ENTRY("The initialization of GnuTLS-extra has failed.", GNUTLS_E_INIT_LIBEXTRA, 1 ),
ERROR_ENTRY("The GnuTLS library version does not match the GnuTLS-extra library version.",
GNUTLS_E_LIBRARY_VERSION_MISMATCH, 1 ),
+ ERROR_ENTRY("The gcrypt library version is too old.",
+ GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY, 1 ),
ERROR_ENTRY("The specified GnuPG TrustDB version is not supported. TrustDB v4 is supported.",
GNUTLS_E_OPENPGP_TRUSTDB_VERSION_UNSUPPORTED, 1 ),
ERROR_ENTRY("The initialization of LZO has failed.", GNUTLS_E_LZO_INIT_FAILED, 1 ),
diff --git a/lib/gnutls_errors_int.h b/lib/gnutls_errors_int.h
index 8bd3cea8eb..30dc5e1376 100644
--- a/lib/gnutls_errors_int.h
+++ b/lib/gnutls_errors_int.h
@@ -117,12 +117,13 @@
#define GNUTLS_E_INVALID_PASSWORD -99
#define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */
-#define GNUTLS_E_BASE64_ENCODING_ERROR -101
+#define GNUTLS_E_BASE64_ENCODING_ERROR -201
+#define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202
-#define GNUTLS_E_UNIMPLEMENTED_FEATURE -250
+#define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250
/* _INT_ internal errors. Not exported */
-#define GNUTLS_E_INT_RET_0 -251
+#define GNUTLS_E_INT_RET_0 -1251
#endif /* GNUTLS_ERRORS_IH */
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index e7f44fe6d4..4457d1ff00 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -167,7 +167,6 @@ int gnutls_global_init( void)
if (_gnutls_init) goto out;
_gnutls_init++;
- (void) gcry_check_version(NULL);
if (gcry_control( GCRYCTL_ANY_INITIALIZATION_P) == 0) {
/* for gcrypt in order to be able to allocate memory */
gcry_set_allocation_handler(gnutls_malloc, gnutls_secure_malloc, _gnutls_is_secure_memory, gnutls_realloc, gnutls_free);
@@ -183,6 +182,11 @@ int gnutls_global_init( void)
gcry_set_log_handler( _gnutls_gcry_log_handler, NULL);
#endif
}
+
+ if (gcry_check_version("1.1.43")==NULL) {
+ gnutls_assert();
+ return GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY;
+ }
result = _gnutls_register_rc2_cipher();
if (result < 0) {