aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gnutls.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index 8db201ae834..c21421fe557 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -46,6 +46,14 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
46# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE 46# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE
47#endif 47#endif
48 48
49#if GNUTLS_VERSION_NUMBER >= 0x030501
50# define HAVE_GNUTLS_EXT_GET_NAME
51#endif
52
53#if GNUTLS_VERSION_NUMBER >= 0x030205
54# define HAVE_GNUTLS_EXT__DUMBFW
55#endif
56
49#ifdef HAVE_GNUTLS 57#ifdef HAVE_GNUTLS
50 58
51# ifdef WINDOWSNT 59# ifdef WINDOWSNT
@@ -237,6 +245,9 @@ DEF_DLL_FN (int, gnutls_hash_get_len, (gnutls_digest_algorithm_t));
237DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); 245DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t));
238DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); 246DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *));
239DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); 247DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *));
248# ifdef HAVE_GNUTLS_EXT_GET_NAME
249DEF_DLL_FN (const char *, gnutls_ext_get_name, (unsigned int));
250# endif
240# endif /* HAVE_GNUTLS3 */ 251# endif /* HAVE_GNUTLS3 */
241 252
242 253
@@ -356,6 +367,9 @@ init_gnutls_functions (void)
356 LOAD_DLL_FN (library, gnutls_hash); 367 LOAD_DLL_FN (library, gnutls_hash);
357 LOAD_DLL_FN (library, gnutls_hash_deinit); 368 LOAD_DLL_FN (library, gnutls_hash_deinit);
358 LOAD_DLL_FN (library, gnutls_hash_output); 369 LOAD_DLL_FN (library, gnutls_hash_output);
370# ifdef HAVE_GNUTLS_EXT_GET_NAME
371 LOAD_DLL_FN (library, gnutls_ext_get_name);
372# endif
359# endif /* HAVE_GNUTLS3 */ 373# endif /* HAVE_GNUTLS3 */
360 374
361 max_log_level = global_gnutls_log_level; 375 max_log_level = global_gnutls_log_level;
@@ -469,8 +483,12 @@ init_gnutls_functions (void)
469# define gnutls_hash fn_gnutls_hash 483# define gnutls_hash fn_gnutls_hash
470# define gnutls_hash_deinit fn_gnutls_hash_deinit 484# define gnutls_hash_deinit fn_gnutls_hash_deinit
471# define gnutls_hash_output fn_gnutls_hash_output 485# define gnutls_hash_output fn_gnutls_hash_output
486# ifdef HAVE_GNUTLS_EXT_GET_NAME
487# define gnutls_ext_get_name fn_gnutls_ext_get_name
488# endif
472# endif /* HAVE_GNUTLS3 */ 489# endif /* HAVE_GNUTLS3 */
473 490
491
474/* This wrapper is called from fns.c, which doesn't know about the 492/* This wrapper is called from fns.c, which doesn't know about the
475 LOAD_DLL_FN stuff above. */ 493 LOAD_DLL_FN stuff above. */
476int 494int
@@ -2425,6 +2443,18 @@ Any GnuTLS extension with ID up to 100
2425 2443
2426#ifdef HAVE_GNUTLS 2444#ifdef HAVE_GNUTLS
2427 2445
2446# ifdef WINDOWSNT
2447 Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache);
2448 if (CONSP (found))
2449 return XCDR (found);
2450
2451 /* Load the GnuTLS DLL and find exported functions. The external
2452 library cache is updated after the capabilities have been
2453 determined. */
2454 if (!init_gnutls_functions ())
2455 return Qnil;
2456# endif /* WINDOWSNT */
2457
2428 capabilities = Fcons (intern("gnutls"), capabilities); 2458 capabilities = Fcons (intern("gnutls"), capabilities);
2429 2459
2430# ifdef HAVE_GNUTLS3 2460# ifdef HAVE_GNUTLS3
@@ -2437,8 +2467,8 @@ Any GnuTLS extension with ID up to 100
2437# endif 2467# endif
2438 2468
2439 capabilities = Fcons (intern("macs"), capabilities); 2469 capabilities = Fcons (intern("macs"), capabilities);
2440# endif /* HAVE_GNUTLS3 */
2441 2470
2471# ifdef HAVE_GNUTLS_EXT_GET_NAME
2442 for (unsigned int ext=0; ext < 100; ext++) 2472 for (unsigned int ext=0; ext < 100; ext++)
2443 { 2473 {
2444 const char* name = gnutls_ext_get_name(ext); 2474 const char* name = gnutls_ext_get_name(ext);
@@ -2447,18 +2477,15 @@ Any GnuTLS extension with ID up to 100
2447 capabilities = Fcons (intern(name), capabilities); 2477 capabilities = Fcons (intern(name), capabilities);
2448 } 2478 }
2449 } 2479 }
2480# endif
2481# endif /* HAVE_GNUTLS3 */
2482
2483# ifdef HAVE_GNUTLS_EXT__DUMBFW
2484 capabilities = Fcons (intern("ClientHello Padding"), capabilities);
2485# endif
2450 2486
2451# ifdef WINDOWSNT 2487# ifdef WINDOWSNT
2452 Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); 2488 Vlibrary_cache = Fcons (Fcons (Qgnutls, capabilities), Vlibrary_cache);
2453 if (CONSP (found))
2454 return XCDR (found);
2455 else
2456 {
2457 Lisp_Object status;
2458 status = init_gnutls_functions () ? capabilities : Qnil;
2459 Vlibrary_cache = Fcons (Fcons (Qgnutls, status), Vlibrary_cache);
2460 return status;
2461 }
2462# endif /* WINDOWSNT */ 2489# endif /* WINDOWSNT */
2463#endif /* HAVE_GNUTLS */ 2490#endif /* HAVE_GNUTLS */
2464 2491