summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-29 12:38:34 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-29 12:40:36 +0200
commit88a63dd0ad111d1c85e835f23153f9e346d6da58 (patch)
tree948bea103803dafd000b1305d920e0b8f5bf3d4e
parent8a7d715052011dcf74f1fc9e5f2e83aa63837736 (diff)
downloadgnutls-88a63dd0ad111d1c85e835f23153f9e346d6da58.tar.gz
Moved all openpgp-related variables and definitions into ifdef blocks
This allows compilation with -Werror even if openpgp is disabled. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/cert.c8
-rw-r--r--lib/pubkey.c8
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/cert.c b/lib/cert.c
index edcd413776..e6c2595dc8 100644
--- a/lib/cert.c
+++ b/lib/cert.c
@@ -749,8 +749,6 @@ gnutls_certificate_verify_peers(gnutls_session_t session,
unsigned int *status)
{
cert_auth_info_t info;
- const char *hostname = NULL;
- unsigned i, type = 0;
CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST);
@@ -768,7 +766,10 @@ gnutls_certificate_verify_peers(gnutls_session_t session,
return _gnutls_x509_cert_verify_peers(session, data, elements,
status);
#ifdef ENABLE_OPENPGP
- case GNUTLS_CRT_OPENPGP:
+ case GNUTLS_CRT_OPENPGP: {
+ const char *hostname = NULL;
+ unsigned i, type = 0;
+
for (i=0;i<elements;i++) {
if (data[i].type == GNUTLS_DT_DNS_HOSTNAME) {
hostname = (char*)data[i].data;
@@ -784,6 +785,7 @@ gnutls_certificate_verify_peers(gnutls_session_t session,
type,
hostname,
status);
+ }
#endif
default:
return GNUTLS_E_INVALID_REQUEST;
diff --git a/lib/pubkey.c b/lib/pubkey.c
index cbf7f47e0c..7c42f67805 100644
--- a/lib/pubkey.c
+++ b/lib/pubkey.c
@@ -39,10 +39,6 @@
#include <ecc.h>
-#define OPENPGP_KEY_PRIMARY 2
-#define OPENPGP_KEY_SUBKEY 1
-
-
unsigned pubkey_to_bits(gnutls_pk_algorithm_t pk, gnutls_pk_params_st * params)
{
switch (pk) {
@@ -405,6 +401,10 @@ gnutls_pubkey_import_pkcs11(gnutls_pubkey_t key,
#ifdef ENABLE_OPENPGP
+#define OPENPGP_KEY_PRIMARY 2
+#define OPENPGP_KEY_SUBKEY 1
+
+
/**
* gnutls_pubkey_import_openpgp:
* @key: The public key