diff options
| author | Andy Moreton | 2017-12-20 20:07:54 -0500 |
|---|---|---|
| committer | Ted Zlatanov | 2017-12-20 20:07:54 -0500 |
| commit | c2ae057d0e455ed40127fec931b803ff628bffb7 (patch) | |
| tree | a8cab50465613fac9c4fa6bb051004c1d4cdd3b4 /src | |
| parent | 2f9d9efd080b46341f34b2cc2e29c907cd478de5 (diff) | |
| download | emacs-c2ae057d0e455ed40127fec931b803ff628bffb7.tar.gz emacs-c2ae057d0e455ed40127fec931b803ff628bffb7.zip | |
Work around GnuTLS version issues with %DUMBFW (tiny change)
* src/gnutls.c: Introduce HAVE_GNUTLS_EXT_GET_NAME and use it.
(init_gnutls_functions): Use it.
(Fgnutls_available_p): Use it (Bug#25061). Fix Vlibrary_cache bug.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gnutls.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/gnutls.c b/src/gnutls.c index 8db201ae834..48ea25397a1 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -46,6 +46,10 @@ 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 | |||
| 49 | #ifdef HAVE_GNUTLS | 53 | #ifdef HAVE_GNUTLS |
| 50 | 54 | ||
| 51 | # ifdef WINDOWSNT | 55 | # ifdef WINDOWSNT |
| @@ -237,6 +241,9 @@ DEF_DLL_FN (int, gnutls_hash_get_len, (gnutls_digest_algorithm_t)); | |||
| 237 | DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); | 241 | DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); |
| 238 | DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); | 242 | DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); |
| 239 | DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); | 243 | DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); |
| 244 | # ifdef HAVE_GNUTLS_EXT_GET_NAME | ||
| 245 | DEF_DLL_FN (const char *, gnutls_ext_get_name, (unsigned int)); | ||
| 246 | # endif | ||
| 240 | # endif /* HAVE_GNUTLS3 */ | 247 | # endif /* HAVE_GNUTLS3 */ |
| 241 | 248 | ||
| 242 | 249 | ||
| @@ -356,6 +363,9 @@ init_gnutls_functions (void) | |||
| 356 | LOAD_DLL_FN (library, gnutls_hash); | 363 | LOAD_DLL_FN (library, gnutls_hash); |
| 357 | LOAD_DLL_FN (library, gnutls_hash_deinit); | 364 | LOAD_DLL_FN (library, gnutls_hash_deinit); |
| 358 | LOAD_DLL_FN (library, gnutls_hash_output); | 365 | LOAD_DLL_FN (library, gnutls_hash_output); |
| 366 | # ifdef HAVE_GNUTLS_EXT_GET_NAME | ||
| 367 | LOAD_DLL_FN (library, gnutls_ext_get_name); | ||
| 368 | # endif | ||
| 359 | # endif /* HAVE_GNUTLS3 */ | 369 | # endif /* HAVE_GNUTLS3 */ |
| 360 | 370 | ||
| 361 | max_log_level = global_gnutls_log_level; | 371 | max_log_level = global_gnutls_log_level; |
| @@ -469,8 +479,12 @@ init_gnutls_functions (void) | |||
| 469 | # define gnutls_hash fn_gnutls_hash | 479 | # define gnutls_hash fn_gnutls_hash |
| 470 | # define gnutls_hash_deinit fn_gnutls_hash_deinit | 480 | # define gnutls_hash_deinit fn_gnutls_hash_deinit |
| 471 | # define gnutls_hash_output fn_gnutls_hash_output | 481 | # define gnutls_hash_output fn_gnutls_hash_output |
| 482 | # ifdef HAVE_GNUTLS_EXT_GET_NAME | ||
| 483 | # define gnutls_ext_get_name fn_gnutls_ext_get_name | ||
| 484 | # endif | ||
| 472 | # endif /* HAVE_GNUTLS3 */ | 485 | # endif /* HAVE_GNUTLS3 */ |
| 473 | 486 | ||
| 487 | |||
| 474 | /* This wrapper is called from fns.c, which doesn't know about the | 488 | /* This wrapper is called from fns.c, which doesn't know about the |
| 475 | LOAD_DLL_FN stuff above. */ | 489 | LOAD_DLL_FN stuff above. */ |
| 476 | int | 490 | int |
| @@ -2425,6 +2439,18 @@ Any GnuTLS extension with ID up to 100 | |||
| 2425 | 2439 | ||
| 2426 | #ifdef HAVE_GNUTLS | 2440 | #ifdef HAVE_GNUTLS |
| 2427 | 2441 | ||
| 2442 | # ifdef WINDOWSNT | ||
| 2443 | Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); | ||
| 2444 | if (CONSP (found)) | ||
| 2445 | return XCDR (found); | ||
| 2446 | |||
| 2447 | /* Load the GnuTLS DLL and find exported functions. The external | ||
| 2448 | library cache is updated after the capabilities have been | ||
| 2449 | determined. */ | ||
| 2450 | if (!init_gnutls_functions ()) | ||
| 2451 | return Qnil; | ||
| 2452 | # endif /* WINDOWSNT */ | ||
| 2453 | |||
| 2428 | capabilities = Fcons (intern("gnutls"), capabilities); | 2454 | capabilities = Fcons (intern("gnutls"), capabilities); |
| 2429 | 2455 | ||
| 2430 | # ifdef HAVE_GNUTLS3 | 2456 | # ifdef HAVE_GNUTLS3 |
| @@ -2437,8 +2463,8 @@ Any GnuTLS extension with ID up to 100 | |||
| 2437 | # endif | 2463 | # endif |
| 2438 | 2464 | ||
| 2439 | capabilities = Fcons (intern("macs"), capabilities); | 2465 | capabilities = Fcons (intern("macs"), capabilities); |
| 2440 | # endif /* HAVE_GNUTLS3 */ | ||
| 2441 | 2466 | ||
| 2467 | # ifdef HAVE_GNUTLS_EXT_GET_NAME | ||
| 2442 | for (unsigned int ext=0; ext < 100; ext++) | 2468 | for (unsigned int ext=0; ext < 100; ext++) |
| 2443 | { | 2469 | { |
| 2444 | const char* name = gnutls_ext_get_name(ext); | 2470 | const char* name = gnutls_ext_get_name(ext); |
| @@ -2447,18 +2473,11 @@ Any GnuTLS extension with ID up to 100 | |||
| 2447 | capabilities = Fcons (intern(name), capabilities); | 2473 | capabilities = Fcons (intern(name), capabilities); |
| 2448 | } | 2474 | } |
| 2449 | } | 2475 | } |
| 2476 | # endif | ||
| 2477 | # endif /* HAVE_GNUTLS3 */ | ||
| 2450 | 2478 | ||
| 2451 | # ifdef WINDOWSNT | 2479 | # ifdef WINDOWSNT |
| 2452 | Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); | 2480 | 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 */ | 2481 | # endif /* WINDOWSNT */ |
| 2463 | #endif /* HAVE_GNUTLS */ | 2482 | #endif /* HAVE_GNUTLS */ |
| 2464 | 2483 | ||