summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-03-13 19:33:40 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-03-13 19:35:48 +0100
commit2c1771acb108f868f0a64fe15f89a4c2e8081a8f (patch)
tree6c29f750bc553d45f1bb5772f7e67a9e27d8c786
parent7381666124d30961ecf5c77fdfc0977942d6862f (diff)
downloadgnutls-2c1771acb108f868f0a64fe15f89a4c2e8081a8f.tar.gz
Added several ifdefs to avoid using disabled code.
-rw-r--r--lib/algorithms/kx.c4
-rw-r--r--lib/auth/anon.c2
-rw-r--r--lib/auth/anon_ecdh.c2
-rw-r--r--lib/gnutlsxx.cpp17
-rw-r--r--src/cli-debug.c2
-rw-r--r--src/serv.c8
-rw-r--r--src/tests.c3
7 files changed, 27 insertions, 11 deletions
diff --git a/lib/algorithms/kx.c b/lib/algorithms/kx.c
index 430f8bc04a..cc378bc7d8 100644
--- a/lib/algorithms/kx.c
+++ b/lib/algorithms/kx.c
@@ -90,8 +90,10 @@ struct gnutls_kx_algo_entry
typedef struct gnutls_kx_algo_entry gnutls_kx_algo_entry;
static const gnutls_kx_algo_entry _gnutls_kx_algorithms[] = {
-#ifdef ENABLE_ANON
+#if defined(ENABLE_ANON) && defined(ENABLE_DHE)
{"ANON-DH", GNUTLS_KX_ANON_DH, &anon_auth_struct, 1, 0},
+#endif
+#if defined(ENABLE_ANON) && defined(ENABLE_ECDHE)
{"ANON-ECDH", GNUTLS_KX_ANON_ECDH, &anon_ecdh_auth_struct, 0, 0},
#endif
{"RSA", GNUTLS_KX_RSA, &rsa_auth_struct, 0, 0},
diff --git a/lib/auth/anon.c b/lib/auth/anon.c
index 8bbbd276a1..e30261dcf4 100644
--- a/lib/auth/anon.c
+++ b/lib/auth/anon.c
@@ -27,7 +27,7 @@
#include <gnutls_int.h>
-#ifdef ENABLE_ANON
+#if defined(ENABLE_ANON) && defined(ENABLE_DHE)
#include "gnutls_auth.h"
#include "gnutls_errors.h"
diff --git a/lib/auth/anon_ecdh.c b/lib/auth/anon_ecdh.c
index 622fc2c1df..3a99c482c6 100644
--- a/lib/auth/anon_ecdh.c
+++ b/lib/auth/anon_ecdh.c
@@ -27,7 +27,7 @@
#include <gnutls_int.h>
-#ifdef ENABLE_ANON
+#if defined(ENABLE_ANON) && defined(ENABLE_ECDHE)
#include "gnutls_auth.h"
#include "gnutls_errors.h"
diff --git a/lib/gnutlsxx.cpp b/lib/gnutlsxx.cpp
index a01f462757..2bd7a443c9 100644
--- a/lib/gnutlsxx.cpp
+++ b/lib/gnutlsxx.cpp
@@ -506,6 +506,7 @@ namespace gnutls
RETWRAP (gnutls_dh_get_pubkey (s, &raw_key));
}
+#ifdef ENABLE_RSA_EXPORT
void session::get_rsa_export_pubkey (gnutls_datum_t & exponent,
gnutls_datum_t & modulus) const
{
@@ -517,6 +518,13 @@ namespace gnutls
return RETWRAP (gnutls_rsa_export_get_modulus_bits (s));
}
+ void certificate_credentials::
+ set_rsa_export_params (const rsa_params & params)
+ {
+ gnutls_certificate_set_rsa_export_params (cred, params.get_params_t ());
+ }
+#endif
+
void server_session::
set_certificate_request (gnutls_certificate_request_t req)
{
@@ -618,12 +626,6 @@ namespace gnutls
gnutls_certificate_set_dh_params (cred, params.get_params_t ());
}
- void certificate_credentials::
- set_rsa_export_params (const rsa_params & params)
- {
- gnutls_certificate_set_rsa_export_params (cred, params.get_params_t ());
- }
-
void certificate_credentials::set_verify_flags (unsigned int flags)
{
gnutls_certificate_set_verify_flags (cred, flags);
@@ -927,6 +929,7 @@ psk_server_credentials::psk_server_credentials ():credentials
// RSA
+#ifdef ENABLE_RSA_EXPORT
rsa_params::rsa_params ()
{
RETWRAP (gnutls_rsa_params_init (&params));
@@ -996,5 +999,5 @@ psk_server_credentials::psk_server_credentials ():credentials
RETWRAP (gnutls_rsa_params_export_raw
(params, &m, &e, &d, &p, &q, &u, NULL));
}
-
+#endif
} // namespace gnutls
diff --git a/src/cli-debug.c b/src/cli-debug.c
index 95c33f1603..7ad02a0585 100644
--- a/src/cli-debug.c
+++ b/src/cli-debug.c
@@ -129,9 +129,11 @@ static const TLS_TEST tls_tests[] = {
*/
{"whether the server supports session resumption",
test_session_resume2, "yes", "no", "dunno"},
+#ifdef ENABLE_RSA_EXPORT
{"for export-grade ciphersuite support", test_export, "yes", "no",
"dunno"},
{"RSA-export ciphersuite info", test_export_info, "", "N/A", "N/A"},
+#endif
#ifdef ENABLE_ANON
{"for anonymous authentication support", test_anonymous, "yes", "no",
"dunno"},
diff --git a/src/serv.c b/src/serv.c
index 295725e18e..fab13117fd 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -302,6 +302,7 @@ get_params (gnutls_session_t session, gnutls_params_type_t type,
return 0;
}
+#ifdef ENABLE_RSA_EXPORT
static int
generate_rsa_params (void)
{
@@ -327,6 +328,13 @@ generate_rsa_params (void)
return 0;
}
+#else
+static int
+generate_rsa_params (void)
+{
+ return 0;
+}
+#endif
LIST_DECLARE_INIT (listener_list, listener_item, listener_free);
diff --git a/src/tests.c b/src/tests.c
index aad046cf8b..cbf792cc6f 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -185,6 +185,7 @@ static gnutls_datum_t exp = { NULL, 0 }, mod =
{
NULL, 0};
+#ifdef ENABLE_RSA_EXPORT
test_code_t
test_export (gnutls_session_t session)
{
@@ -253,8 +254,8 @@ test_export_info (gnutls_session_t session)
}
return ret;
-
}
+#endif
static gnutls_datum_t pubkey = { NULL, 0 };
static gnutls_ecc_curve_t curve = GNUTLS_ECC_CURVE_INVALID;