summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples/ex-client-resume.c6
-rw-r--r--lib/crypto.c2
-rw-r--r--lib/gnutls_compress_int.c8
-rw-r--r--lib/gnutls_extensions.c4
-rw-r--r--lib/gnutls_handshake.c6
-rw-r--r--lib/gnutls_openpgp.c50
-rw-r--r--lib/openpgp/extras.c2
-rw-r--r--lib/openpgp/output.c15
-rw-r--r--lib/openpgp/pgp.c12
-rw-r--r--lib/openpgp/privkey.c1
-rw-r--r--libextra/gnutls_extra.c2
-rw-r--r--libextra/gnutls_ia.c2
-rw-r--r--src/certtool.c7
-rw-r--r--src/serv.c29
14 files changed, 37 insertions, 109 deletions
diff --git a/doc/examples/ex-client-resume.c b/doc/examples/ex-client-resume.c
index 937f3d78b4..99679453e0 100644
--- a/doc/examples/ex-client-resume.c
+++ b/doc/examples/ex-client-resume.c
@@ -1,4 +1,4 @@
-/* Copyright 2007 Free Software Foundation
+/* Copyright 2007, 2008 Free Software Foundation
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
@@ -37,8 +37,8 @@ main (void)
/* variables used in session resuming
*/
int t;
- char *session_data;
- size_t session_data_size;
+ char *session_data = NULL;
+ size_t session_data_size = 0;
gnutls_global_init ();
diff --git a/lib/crypto.c b/lib/crypto.c
index fda2263699..e6cf097fc8 100644
--- a/lib/crypto.c
+++ b/lib/crypto.c
@@ -41,7 +41,7 @@ typedef struct algo_list {
static int _algo_register( algo_list* al, int algorithm, int priority, void* s)
{
algo_list* cl;
-algo_list* last_cl;
+algo_list* last_cl = NULL;
/* look if there is any cipher with lowest priority. In that case do not add.
*/
diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c
index 092b2e6f9b..f7ee1f387f 100644
--- a/lib/gnutls_compress_int.c
+++ b/lib/gnutls_compress_int.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
+ * Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -109,8 +109,8 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d)
break;
}
#endif
-#ifdef USE_LZO
case GNUTLS_COMP_LZO:
+#ifdef USE_LZO
if (d)
{ /* LZO does not use memory on decompressor *//* ret->handle = NULL; */
}
@@ -124,10 +124,10 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d)
goto cleanup_ret;
}
}
-
- break;
#endif
+ break;
case GNUTLS_COMP_NULL:
+ case GNUTLS_COMP_UNKNOWN:
break;
}
return ret;
diff --git a/lib/gnutls_extensions.c b/lib/gnutls_extensions.c
index ad1babad6d..6a934ce977 100644
--- a/lib/gnutls_extensions.c
+++ b/lib/gnutls_extensions.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -75,7 +75,7 @@ gnutls_extension_entry _gnutls_extensions[MAX_EXT_SIZE] = {
EXTENSION_TLS,
_gnutls_inner_application_recv_params,
_gnutls_inner_application_send_params),
- {0, 0, 0, 0}
+ {NULL, 0, 0, NULL, NULL}
};
#define GNUTLS_EXTENSION_LOOP2(b) \
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 71e6484afc..c8b0e3e298 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
+ * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -358,10 +358,10 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
pos += 2;
neg_version = _gnutls_negotiate_version( session, adv_version);
- if (neg_version < 0)
+ if (neg_version < 0)
{
gnutls_assert();
- return ret;
+ return neg_version;
}
/* Read client random value.
diff --git a/lib/gnutls_openpgp.c b/lib/gnutls_openpgp.c
index 590ca1aa8d..76a8be0680 100644
--- a/lib/gnutls_openpgp.c
+++ b/lib/gnutls_openpgp.c
@@ -40,23 +40,6 @@
#define datum_append(x, y, z) _gnutls_datum_append_m (x, y, z, gnutls_realloc)
-
-
-static void
-release_mpi_array (mpi_t * arr, size_t n)
-{
- mpi_t x;
-
- while (arr && n--)
- {
- x = *arr;
- _gnutls_mpi_release (&x);
- *arr = NULL;
- arr++;
- }
-}
-
-
/* Map an OpenCDK error type to a GnuTLS error type. */
int
_gnutls_map_cdk_rc (int rc)
@@ -286,36 +269,6 @@ leave:
return rc;
}
-
-/* Convert the stream to a datum. In this case we use the mmap
- function to map the entire stream to a buffer. */
-static int
-stream_to_datum (cdk_stream_t inp, gnutls_datum_t * raw)
-{
- uint8_t *buf;
- size_t buflen;
-
- if (!inp || !raw)
- {
- gnutls_assert ();
- return GNUTLS_E_INVALID_REQUEST;
- }
-
- cdk_stream_mmap (inp, &buf, &buflen);
- datum_append (raw, buf, buflen);
- cdk_free (buf);
-
- if (!buflen)
- {
- gnutls_assert ();
- return GNUTLS_E_INTERNAL_ERROR;
- }
-
- return 0;
-}
-
-
-
/**
* gnutls_certificate_set_openpgp_key_mem - Used to set OpenPGP keys
* @res: the destination context to save the data.
@@ -645,9 +598,6 @@ gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t
c, const opaque * data,
size_t dlen, gnutls_openpgp_crt_fmt_t format)
{
- cdk_stream_t inp;
- size_t count;
- uint8_t *buf;
gnutls_datum ddata;
int rc;
diff --git a/lib/openpgp/extras.c b/lib/openpgp/extras.c
index 82ce65f588..54b3c9ab12 100644
--- a/lib/openpgp/extras.c
+++ b/lib/openpgp/extras.c
@@ -130,7 +130,7 @@ gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t keyring,
{
cdk_error_t err;
cdk_stream_t input = NULL;
- size_t raw_len = 0, i;
+ size_t raw_len = 0;
opaque *raw_data = NULL;
_gnutls_debug_log ("PGP: keyring import format '%s'\n",
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index d39dc722de..0dc7759d99 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -75,19 +75,6 @@ hexprint (gnutls_string * str, const char *data, size_t len)
}
}
-
-static void
-asciiprint (gnutls_string * str, const char *data, size_t len)
-{
- size_t j;
-
- for (j = 0; j < len; j++)
- if (isprint (data[j]))
- addf (str, "%c", (unsigned char) data[j]);
- else
- addf (str, ".");
-}
-
static void
print_key_usage (gnutls_string * str, gnutls_openpgp_crt_t cert, unsigned int idx)
{
@@ -167,8 +154,6 @@ print_key_fingerprint (gnutls_string * str, gnutls_openpgp_crt_t cert)
static void
print_key_revoked (gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
{
- char fpr[128];
- size_t fpr_size = sizeof (fpr);
int err;
if (idx < 0)
diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c
index 5e57712f85..8520d3ce6b 100644
--- a/lib/openpgp/pgp.c
+++ b/lib/openpgp/pgp.c
@@ -529,7 +529,7 @@ gnutls_openpgp_crt_check_hostname (gnutls_openpgp_crt_t key,
{
char dnsname[MAX_CN];
size_t dnsnamesize;
- int ret;
+ int ret = 0;
int i;
/* Check through all included names. */
@@ -665,10 +665,8 @@ static cdk_packet_t _get_public_subkey(gnutls_openpgp_crt_t key, unsigned int in
cdk_packet_t _gnutls_openpgp_find_key( cdk_kbnode_t knode, uint32_t keyid[2],
unsigned int priv)
{
- cdk_pkt_pubkey_t ret;
cdk_kbnode_t p, ctx;
cdk_packet_t pkt;
- int subkeys;
uint32_t local_keyid[2];
ctx = NULL;
@@ -704,10 +702,9 @@ cdk_packet_t _gnutls_openpgp_find_key( cdk_kbnode_t knode, uint32_t keyid[2],
int _gnutls_openpgp_find_subkey_idx( cdk_kbnode_t knode, uint32_t keyid[2],
unsigned int priv)
{
- cdk_pkt_pubkey_t ret;
cdk_kbnode_t p, ctx;
cdk_packet_t pkt;
- int subkeys, i=0;
+ int i=0;
uint32_t local_keyid[2];
ctx = NULL;
@@ -918,7 +915,6 @@ int
gnutls_openpgp_crt_get_subkey_idx (gnutls_openpgp_crt_t key,
const gnutls_openpgp_keyid_t keyid)
{
- cdk_packet_t pkt;
int ret;
uint32_t kid[2];
@@ -980,7 +976,7 @@ int _gnutls_read_pgp_mpi( cdk_packet_t pkt, unsigned int priv, size_t idx, mpi_t
size_t buf_size = 512;
opaque * buf = gnutls_malloc( buf_size);
int err;
-int max_pub_params;
+int max_pub_params = 0;
if (priv !=0)
max_pub_params = cdk_pk_get_npkey(pkt->pkt.secret_key->pk->pubkey_algo);
@@ -1053,7 +1049,7 @@ int
_gnutls_openpgp_crt_get_mpis (gnutls_openpgp_crt_t cert, uint32_t *keyid /* [2] */,
mpi_t * params, int *params_size)
{
- int result, i, idx;
+ int result, i;
int pk_algorithm, local_params;
cdk_packet_t pkt;
diff --git a/lib/openpgp/privkey.c b/lib/openpgp/privkey.c
index f326bce88f..fa5c8fd5ba 100644
--- a/lib/openpgp/privkey.c
+++ b/lib/openpgp/privkey.c
@@ -450,7 +450,6 @@ int
gnutls_openpgp_privkey_get_subkey_idx (gnutls_openpgp_privkey_t key,
const gnutls_openpgp_keyid_t keyid)
{
- cdk_packet_t pkt;
int ret;
uint32_t kid[2];
diff --git a/libextra/gnutls_extra.c b/libextra/gnutls_extra.c
index 369e5d2f7b..bf81a501e6 100644
--- a/libextra/gnutls_extra.c
+++ b/libextra/gnutls_extra.c
@@ -97,8 +97,6 @@ static int _gnutls_init_extra = 0;
int
gnutls_global_init_extra (void)
{
- int ret;
-
/* If the version of libgnutls != version of
* libextra, then do not initialize the library.
* This is because it may break things.
diff --git a/libextra/gnutls_ia.c b/libextra/gnutls_ia.c
index ee23648d72..dac4198585 100644
--- a/libextra/gnutls_ia.c
+++ b/libextra/gnutls_ia.c
@@ -435,7 +435,7 @@ gnutls_ia_send (gnutls_session_t session, const char *data, size_t sizeofdata)
ssize_t
gnutls_ia_recv (gnutls_session_t session, char *data, size_t sizeofdata)
{
- gnutls_ia_apptype_t msg_type;
+ gnutls_ia_apptype_t msg_type = 0;
ssize_t len;
len = _gnutls_recv_inner_application (session, &msg_type, data, sizeofdata);
diff --git a/src/certtool.c b/src/certtool.c
index 6654db988f..a6d0c9d578 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -1034,7 +1034,7 @@ pgp_certificate_info (void)
{
gnutls_openpgp_crt_t crt;
size_t size;
- int ret, i, count;
+ int ret;
gnutls_datum_t pem, out_data;
pem.data = fread_file (infile, &size);
@@ -1085,7 +1085,6 @@ pgp_privkey_info (void)
int ret, i, subkeys;
gnutls_datum_t pem;
const char *cprint;
- const char *pass;
size = fread (buffer, 1, sizeof (buffer) - 1, infile);
buffer[size] = 0;
@@ -1211,7 +1210,7 @@ pgp_ring_info (void)
gnutls_openpgp_crt_t crt;
size_t size;
int ret, i, count;
- gnutls_datum_t pem, out_data;
+ gnutls_datum_t pem;
pem.data = fread_file (infile, &size);
pem.size = size;
@@ -1254,7 +1253,7 @@ pgp_ring_info (void)
}
fwrite (buffer, 1, size, outfile);
- fprintf (outfile, "\n\n", buffer);
+ fprintf (outfile, "\n\n");
gnutls_openpgp_crt_deinit (crt);
diff --git a/src/serv.c b/src/serv.c
index bb5bcce7c2..d77d0c67b9 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -906,21 +906,22 @@ main (int argc, char **argv)
}
if (pgp_certfile != NULL)
+ {
+ if (info.pgp_subkey != NULL)
+ ret = gnutls_certificate_set_openpgp_key_file2
+ (cert_cred, pgp_certfile, pgp_keyfile, info.pgp_subkey, GNUTLS_OPENPGP_FMT_BASE64);
+ else
+ ret = gnutls_certificate_set_openpgp_key_file
+ (cert_cred, pgp_certfile, pgp_keyfile, GNUTLS_OPENPGP_FMT_BASE64);
- if (info.pgp_subkey != NULL)
- ret = gnutls_certificate_set_openpgp_key_file2
- (cert_cred, pgp_certfile, pgp_keyfile, info.pgp_subkey, GNUTLS_OPENPGP_FMT_BASE64);
- else
- ret = gnutls_certificate_set_openpgp_key_file
- (cert_cred, pgp_certfile, pgp_keyfile, GNUTLS_OPENPGP_FMT_BASE64);
-
- if (ret < 0)
- {
- fprintf (stderr,
- "Error[%d] while reading the OpenPGP key pair ('%s', '%s')\n",
- ret, pgp_certfile, pgp_keyfile);
- GERR (ret);
- }
+ if (ret < 0)
+ {
+ fprintf (stderr,
+ "Error[%d] while reading the OpenPGP key pair ('%s', '%s')\n",
+ ret, pgp_certfile, pgp_keyfile);
+ GERR (ret);
+ }
+ }
#endif
if (x509_certfile != NULL)