changeset 797:36821971d47b

Renamed GNUTLS_NEW_VERSION and added GNUTLS_VERSION_300 to prepare for API change in gnutls
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 20 Aug 2012 22:16:21 +0200
parents 514c898fb99c
children ca8e30a2426d
files cmake/Modules/FindGnuTLS.cmake include/freeDiameter/freeDiameter-host.h.in libfdcore/core.c
diffstat 3 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/cmake/Modules/FindGnuTLS.cmake	Mon Aug 20 22:15:38 2012 +0200
+++ b/cmake/Modules/FindGnuTLS.cmake	Mon Aug 20 22:16:21 2012 +0200
@@ -4,7 +4,8 @@
 #  GNUTLS_FOUND - True if gnutls found.
 #  GNUTLS_INCLUDE_DIR - where to find gnutls.h, etc.
 #  GNUTLS_LIBRARIES - List of libraries when using gnutls.
-#  GNUTLS_NEW_VERSION - true if GnuTLS version is >= 2.10.0 (does not require additional separate gcrypt initialization)
+#  GNUTLS_VERSION_210 - true if GnuTLS version is >= 2.10.0 (does not require additional separate gcrypt initialization)
+#  GNUTLS_VERSION_300 - true if GnuTLS version is >= 3.00.0 (x509 verification functions changed)
 
 if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES)
   set(GNUTLS_FIND_QUIETLY TRUE)
@@ -38,12 +39,16 @@
 MARK_AS_ADVANCED( GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR )
 
 # Now check if the library is recent. gnutls_hash was added in 2.10.0.
+# Also test library is even more recent. gnutls_x509_trust_list_verify_crt was added in 3.00.0.
 IF( NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
   INCLUDE (CheckLibraryExists) 
-  MESSAGE(STATUS "Rechecking GNUTLS_NEW_VERSION")
-  UNSET(GNUTLS_NEW_VERSION)
-  UNSET(GNUTLS_NEW_VERSION CACHE)
+  MESSAGE(STATUS "Rechecking GNUTLS_VERSION_210 and GNUTLS_VERSION_300")
+  UNSET(GNUTLS_VERSION_210)
+  UNSET(GNUTLS_VERSION_210 CACHE)
+  UNSET(GNUTLS_VERSION_300)
+  UNSET(GNUTLS_VERSION_300 CACHE)
   GET_FILENAME_COMPONENT(GNUTLS_PATH ${GNUTLS_LIBRARY} PATH)
-  CHECK_LIBRARY_EXISTS(gnutls gnutls_hash ${GNUTLS_PATH} GNUTLS_NEW_VERSION) 
+  CHECK_LIBRARY_EXISTS(gnutls gnutls_hash ${GNUTLS_PATH} GNUTLS_VERSION_210) 
+  CHECK_LIBRARY_EXISTS(gnutls gnutls_x509_trust_list_verify_crt ${GNUTLS_PATH} GNUTLS_VERSION_300) 
   SET( GNUTLS_VERSION_TEST_FOR ${GNUTLS_LIBRARY} CACHE INTERNAL "Version the test was made against" )
 ENDIF (NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
--- a/include/freeDiameter/freeDiameter-host.h.in	Mon Aug 20 22:15:38 2012 +0200
+++ b/include/freeDiameter/freeDiameter-host.h.in	Mon Aug 20 22:16:21 2012 +0200
@@ -50,7 +50,8 @@
 #cmakedefine SKIP_DLCLOSE
 #cmakedefine DIAMID_IDNA_IGNORE
 #cmakedefine DIAMID_IDNA_REJECT
-#cmakedefine GNUTLS_NEW_VERSION
+#cmakedefine GNUTLS_VERSION_210
+#cmakedefine GNUTLS_VERSION_300
 
 #cmakedefine ERRORS_ON_TODO
 #cmakedefine DEBUG
--- a/libfdcore/core.c	Mon Aug 20 22:15:38 2012 +0200
+++ b/libfdcore/core.c	Mon Aug 20 22:16:21 2012 +0200
@@ -183,20 +183,20 @@
 	fd_log_threadname("Main");
 	
 	/* Initialize gcrypt and gnutls */
-	#ifndef GNUTLS_NEW_VERSION
+	#ifndef GNUTLS_VERSION_210
 	GNUTLS_TRACE( (void) gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread) );
 	GNUTLS_TRACE( (void) gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0) );
-	#endif /* GNUTLS_NEW_VERSION */
+	#endif /* GNUTLS_VERSION_210 */
 	CHECK_GNUTLS_DO( gnutls_global_init(), return EINVAL );
 	if ( ! gnutls_check_version(GNUTLS_VERSION) ) {
 		fprintf(stderr, "The GNUTLS library is too old; found '%s', need '" GNUTLS_VERSION "'\n", gnutls_check_version(NULL));
 		return EINVAL;
 	} else {
-	#ifdef GNUTLS_NEW_VERSION
+	#ifdef GNUTLS_VERSION_210
 		TRACE_DEBUG(INFO, "libgnutls '%s' initialized.", gnutls_check_version(NULL) );
-	#else /* GNUTLS_NEW_VERSION */
+	#else /* GNUTLS_VERSION_210 */
 		TRACE_DEBUG(INFO, "libgnutls '%s', libgcrypt '%s', initialized.", gnutls_check_version(NULL), gcry_check_version(NULL) );
-	#endif /* GNUTLS_NEW_VERSION */
+	#endif /* GNUTLS_VERSION_210 */
 	}
 	
 	/* Initialize the config with default values */
"Welcome to our mercurial repository"