diff options
| author | Paul Eggert | 2019-11-23 15:28:45 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-11-23 15:48:45 -0800 |
| commit | 603a7c8a84a282e8610b5a5a842e5ba235d3b546 (patch) | |
| tree | 9c8912f186477536e5a316ae276e5af00802d13a /src/gnutls.c | |
| parent | c2bd42833f7f9881f52fe9a29d66ac64bc71f776 (diff) | |
| download | emacs-603a7c8a84a282e8610b5a5a842e5ba235d3b546.tar.gz emacs-603a7c8a84a282e8610b5a5a842e5ba235d3b546.zip | |
Port gnutls.c to --enable-gcc-warnings --without-gnutls
* src/gnutls.c: Move the "#ifdef HAVE_GNUTLS" earlier, so
that "./configure --enable-gcc-warnings --without-gnutls"
does not complain about macros being defined but never used.
Indent "#" directives more consistently.
Diffstat (limited to 'src/gnutls.c')
| -rw-r--r-- | src/gnutls.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/gnutls.c b/src/gnutls.c index 5f412b50042..ae7a5f27c03 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -27,40 +27,42 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 27 | #include "buffer.h" | 27 | #include "buffer.h" |
| 28 | #include "pdumper.h" | 28 | #include "pdumper.h" |
| 29 | 29 | ||
| 30 | #if GNUTLS_VERSION_NUMBER >= 0x030014 | 30 | #ifdef HAVE_GNUTLS |
| 31 | # define HAVE_GNUTLS_X509_SYSTEM_TRUST | ||
| 32 | #endif | ||
| 33 | 31 | ||
| 34 | #if GNUTLS_VERSION_NUMBER >= 0x030200 | 32 | # if GNUTLS_VERSION_NUMBER >= 0x030014 |
| 35 | # define HAVE_GNUTLS_CIPHER_GET_IV_SIZE | 33 | # define HAVE_GNUTLS_X509_SYSTEM_TRUST |
| 36 | #endif | 34 | # endif |
| 37 | 35 | ||
| 38 | #if GNUTLS_VERSION_NUMBER >= 0x030202 | 36 | # if GNUTLS_VERSION_NUMBER >= 0x030200 |
| 39 | # define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE | 37 | # define HAVE_GNUTLS_CIPHER_GET_IV_SIZE |
| 40 | # define HAVE_GNUTLS_DIGEST_LIST /* also gnutls_digest_get_name */ | 38 | # endif |
| 41 | #endif | ||
| 42 | 39 | ||
| 43 | #if GNUTLS_VERSION_NUMBER >= 0x030205 | 40 | # if GNUTLS_VERSION_NUMBER >= 0x030202 |
| 44 | # define HAVE_GNUTLS_EXT__DUMBFW | 41 | # define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE |
| 45 | #endif | 42 | # define HAVE_GNUTLS_DIGEST_LIST /* also gnutls_digest_get_name */ |
| 43 | # endif | ||
| 46 | 44 | ||
| 47 | #if GNUTLS_VERSION_NUMBER >= 0x030400 | 45 | # if GNUTLS_VERSION_NUMBER >= 0x030205 |
| 48 | # define HAVE_GNUTLS_ETM_STATUS | 46 | # define HAVE_GNUTLS_EXT__DUMBFW |
| 49 | #endif | 47 | # endif |
| 50 | 48 | ||
| 51 | #if GNUTLS_VERSION_NUMBER < 0x030600 | 49 | # if GNUTLS_VERSION_NUMBER >= 0x030400 |
| 52 | # define HAVE_GNUTLS_COMPRESSION_GET | 50 | # define HAVE_GNUTLS_ETM_STATUS |
| 53 | #endif | 51 | # endif |
| 52 | |||
| 53 | # if GNUTLS_VERSION_NUMBER < 0x030600 | ||
| 54 | # define HAVE_GNUTLS_COMPRESSION_GET | ||
| 55 | # endif | ||
| 54 | 56 | ||
| 55 | /* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was | 57 | /* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was |
| 56 | exported only since 3.3.0. */ | 58 | exported only since 3.3.0. */ |
| 57 | #if GNUTLS_VERSION_NUMBER >= 0x030300 | 59 | # if GNUTLS_VERSION_NUMBER >= 0x030300 |
| 58 | # define HAVE_GNUTLS_MAC_GET_NONCE_SIZE | 60 | # define HAVE_GNUTLS_MAC_GET_NONCE_SIZE |
| 59 | #endif | 61 | # endif |
| 60 | 62 | ||
| 61 | #if GNUTLS_VERSION_NUMBER >= 0x030501 | 63 | # if GNUTLS_VERSION_NUMBER >= 0x030501 |
| 62 | # define HAVE_GNUTLS_EXT_GET_NAME | 64 | # define HAVE_GNUTLS_EXT_GET_NAME |
| 63 | #endif | 65 | # endif |
| 64 | 66 | ||
| 65 | /* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14, | 67 | /* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14, |
| 66 | it was broken through at least GnuTLS 3.4.10; see: | 68 | it was broken through at least GnuTLS 3.4.10; see: |
| @@ -68,11 +70,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 68 | The relevant fix seems to have been made in GnuTLS 3.5.1; see: | 70 | The relevant fix seems to have been made in GnuTLS 3.5.1; see: |
| 69 | https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d | 71 | https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d |
| 70 | So, require 3.5.1. */ | 72 | So, require 3.5.1. */ |
| 71 | #if GNUTLS_VERSION_NUMBER >= 0x030501 | 73 | # if GNUTLS_VERSION_NUMBER >= 0x030501 |
| 72 | # define HAVE_GNUTLS_AEAD | 74 | # define HAVE_GNUTLS_AEAD |
| 73 | #endif | 75 | # endif |
| 74 | |||
| 75 | #ifdef HAVE_GNUTLS | ||
| 76 | 76 | ||
| 77 | # ifdef WINDOWSNT | 77 | # ifdef WINDOWSNT |
| 78 | # include <windows.h> | 78 | # include <windows.h> |
| @@ -221,12 +221,12 @@ DEF_DLL_FN (const char *, gnutls_cipher_get_name, | |||
| 221 | (gnutls_cipher_algorithm_t)); | 221 | (gnutls_cipher_algorithm_t)); |
| 222 | DEF_DLL_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t)); | 222 | DEF_DLL_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t)); |
| 223 | DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t)); | 223 | DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t)); |
| 224 | #ifdef HAVE_GNUTLS_COMPRESSION_GET | 224 | # ifdef HAVE_GNUTLS_COMPRESSION_GET |
| 225 | DEF_DLL_FN (gnutls_compression_method_t, gnutls_compression_get, | 225 | DEF_DLL_FN (gnutls_compression_method_t, gnutls_compression_get, |
| 226 | (gnutls_session_t)); | 226 | (gnutls_session_t)); |
| 227 | DEF_DLL_FN (const char *, gnutls_compression_get_name, | 227 | DEF_DLL_FN (const char *, gnutls_compression_get_name, |
| 228 | (gnutls_compression_method_t)); | 228 | (gnutls_compression_method_t)); |
| 229 | #endif | 229 | # endif |
| 230 | DEF_DLL_FN (unsigned, gnutls_safe_renegotiation_status, (gnutls_session_t)); | 230 | DEF_DLL_FN (unsigned, gnutls_safe_renegotiation_status, (gnutls_session_t)); |
| 231 | 231 | ||
| 232 | # ifdef HAVE_GNUTLS3 | 232 | # ifdef HAVE_GNUTLS3 |
| @@ -1408,11 +1408,11 @@ returned as the :certificate entry. */) | |||
| 1408 | if (verification & GNUTLS_CERT_EXPIRED) | 1408 | if (verification & GNUTLS_CERT_EXPIRED) |
| 1409 | warnings = Fcons (intern (":expired"), warnings); | 1409 | warnings = Fcons (intern (":expired"), warnings); |
| 1410 | 1410 | ||
| 1411 | #if GNUTLS_VERSION_NUMBER >= 0x030100 | 1411 | # if GNUTLS_VERSION_NUMBER >= 0x030100 |
| 1412 | if (verification & GNUTLS_CERT_SIGNATURE_FAILURE) | 1412 | if (verification & GNUTLS_CERT_SIGNATURE_FAILURE) |
| 1413 | warnings = Fcons (intern (":signature-failure"), warnings); | 1413 | warnings = Fcons (intern (":signature-failure"), warnings); |
| 1414 | 1414 | ||
| 1415 | # if GNUTLS_VERSION_NUMBER >= 0x030114 | 1415 | # if GNUTLS_VERSION_NUMBER >= 0x030114 |
| 1416 | if (verification & GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED) | 1416 | if (verification & GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED) |
| 1417 | warnings = Fcons (intern (":revocation-data-superseded"), warnings); | 1417 | warnings = Fcons (intern (":revocation-data-superseded"), warnings); |
| 1418 | 1418 | ||
| @@ -1422,20 +1422,20 @@ returned as the :certificate entry. */) | |||
| 1422 | if (verification & GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE) | 1422 | if (verification & GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE) |
| 1423 | warnings = Fcons (intern (":signer-constraints-failure"), warnings); | 1423 | warnings = Fcons (intern (":signer-constraints-failure"), warnings); |
| 1424 | 1424 | ||
| 1425 | # if GNUTLS_VERSION_NUMBER >= 0x030400 | 1425 | # if GNUTLS_VERSION_NUMBER >= 0x030400 |
| 1426 | if (verification & GNUTLS_CERT_PURPOSE_MISMATCH) | 1426 | if (verification & GNUTLS_CERT_PURPOSE_MISMATCH) |
| 1427 | warnings = Fcons (intern (":purpose-mismatch"), warnings); | 1427 | warnings = Fcons (intern (":purpose-mismatch"), warnings); |
| 1428 | 1428 | ||
| 1429 | # if GNUTLS_VERSION_NUMBER >= 0x030501 | 1429 | # if GNUTLS_VERSION_NUMBER >= 0x030501 |
| 1430 | if (verification & GNUTLS_CERT_MISSING_OCSP_STATUS) | 1430 | if (verification & GNUTLS_CERT_MISSING_OCSP_STATUS) |
| 1431 | warnings = Fcons (intern (":missing-ocsp-status"), warnings); | 1431 | warnings = Fcons (intern (":missing-ocsp-status"), warnings); |
| 1432 | 1432 | ||
| 1433 | if (verification & GNUTLS_CERT_INVALID_OCSP_STATUS) | 1433 | if (verification & GNUTLS_CERT_INVALID_OCSP_STATUS) |
| 1434 | warnings = Fcons (intern (":invalid-ocsp-status"), warnings); | 1434 | warnings = Fcons (intern (":invalid-ocsp-status"), warnings); |
| 1435 | # endif | ||
| 1435 | # endif | 1436 | # endif |
| 1436 | # endif | 1437 | # endif |
| 1437 | # endif | 1438 | # endif |
| 1438 | #endif | ||
| 1439 | 1439 | ||
| 1440 | if (XPROCESS (proc)->gnutls_extra_peer_verification & | 1440 | if (XPROCESS (proc)->gnutls_extra_peer_verification & |
| 1441 | CERTIFICATE_NOT_MATCHING) | 1441 | CERTIFICATE_NOT_MATCHING) |
| @@ -1505,19 +1505,19 @@ returned as the :certificate entry. */) | |||
| 1505 | (gnutls_mac_get (state))))); | 1505 | (gnutls_mac_get (state))))); |
| 1506 | 1506 | ||
| 1507 | /* Compression name. */ | 1507 | /* Compression name. */ |
| 1508 | #ifdef HAVE_GNUTLS_COMPRESSION_GET | 1508 | # ifdef HAVE_GNUTLS_COMPRESSION_GET |
| 1509 | result = nconc2 | 1509 | result = nconc2 |
| 1510 | (result, list2 (intern (":compression"), | 1510 | (result, list2 (intern (":compression"), |
| 1511 | build_string (gnutls_compression_get_name | 1511 | build_string (gnutls_compression_get_name |
| 1512 | (gnutls_compression_get (state))))); | 1512 | (gnutls_compression_get (state))))); |
| 1513 | #endif | 1513 | # endif |
| 1514 | 1514 | ||
| 1515 | /* Encrypt-then-MAC. */ | 1515 | /* Encrypt-then-MAC. */ |
| 1516 | #ifdef HAVE_GNUTLS_ETM_STATUS | 1516 | # ifdef HAVE_GNUTLS_ETM_STATUS |
| 1517 | result = nconc2 | 1517 | result = nconc2 |
| 1518 | (result, list2 (intern (":encrypt-then-mac"), | 1518 | (result, list2 (intern (":encrypt-then-mac"), |
| 1519 | gnutls_session_etm_status (state) ? Qt : Qnil)); | 1519 | gnutls_session_etm_status (state) ? Qt : Qnil)); |
| 1520 | #endif | 1520 | # endif |
| 1521 | 1521 | ||
| 1522 | /* Renegotiation Indication */ | 1522 | /* Renegotiation Indication */ |
| 1523 | if (proto <= GNUTLS_TLS1_2) | 1523 | if (proto <= GNUTLS_TLS1_2) |