summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-01-15 16:02:29 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-01-21 01:05:59 +0100
commit37c8eaecbdaebc62aa4c2e8671fb366d20f9bbe8 (patch)
tree97b62330682aa8a6912d8413088addbf52579c67 /src
parent99ad4c6b2ab76d386be76daed0c509e62d6334c7 (diff)
downloadgnutls-37c8eaecbdaebc62aa4c2e8671fb366d20f9bbe8.tar.gz
Fixed signed/unsigned warnings.
Dropped opaque type (replaced with uint8_t)
Diffstat (limited to 'src')
-rw-r--r--src/benchmark-tls.c4
-rw-r--r--src/certtool-common.c22
-rw-r--r--src/certtool.c28
-rw-r--r--src/cli.c11
-rw-r--r--src/common.c4
-rw-r--r--src/crywrap/crywrap.c4
-rw-r--r--src/dh.c4
-rw-r--r--src/pkcs11.c4
-rw-r--r--src/serv.c2
-rw-r--r--src/srptool.c8
10 files changed, 46 insertions, 45 deletions
diff --git a/src/benchmark-tls.c b/src/benchmark-tls.c
index 31d1feb101..eb16548e7d 100644
--- a/src/benchmark-tls.c
+++ b/src/benchmark-tls.c
@@ -213,7 +213,7 @@ static void test_ciphersuite(const char *cipher_prio, int size)
{
/* Server stuff. */
gnutls_anon_server_credentials_t s_anoncred;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen(pkcs3) };
+ const gnutls_datum_t p3 = { (void*) pkcs3, strlen(pkcs3) };
static gnutls_dh_params_t dh_params;
gnutls_session_t server;
int sret, cret;
@@ -313,7 +313,7 @@ static void test_ciphersuite_kx(const char *cipher_prio)
{
/* Server stuff. */
gnutls_anon_server_credentials_t s_anoncred;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen(pkcs3) };
+ const gnutls_datum_t p3 = { (void*) pkcs3, strlen(pkcs3) };
static gnutls_dh_params_t dh_params;
gnutls_session_t server;
int sret, cret;
diff --git a/src/certtool-common.c b/src/certtool-common.c
index 4c65ad26d9..e2fdab9ace 100644
--- a/src/certtool-common.c
+++ b/src/certtool-common.c
@@ -72,7 +72,7 @@ safe_open_rw (const char *file, int privkey_op)
gnutls_datum_t *
load_secret_key (int mand, common_info_st * info)
{
- unsigned char raw_key[64];
+ char raw_key[64];
size_t raw_key_size = sizeof (raw_key);
static gnutls_datum_t key;
gnutls_datum_t hex_key;
@@ -88,14 +88,14 @@ load_secret_key (int mand, common_info_st * info)
return NULL;
}
- hex_key.data = (char *) info->secret_key;
+ hex_key.data = (void *) info->secret_key;
hex_key.size = strlen (info->secret_key);
ret = gnutls_hex_decode (&hex_key, raw_key, &raw_key_size);
if (ret < 0)
error (EXIT_FAILURE, 0, "hex_decode: %s", gnutls_strerror (ret));
- key.data = raw_key;
+ key.data = (void*)raw_key;
key.size = raw_key_size;
return &key;
@@ -280,7 +280,7 @@ load_private_key (int mand, common_info_st * info)
return _load_pkcs11_privkey(info->privkey);
#endif
- dat.data = read_binary_file (info->privkey, &size);
+ dat.data = (void*)read_binary_file (info->privkey, &size);
dat.size = size;
if (!dat.data)
@@ -314,7 +314,7 @@ load_x509_private_key (int mand, common_info_st * info)
if (ret < 0)
error (EXIT_FAILURE, 0, "privkey_init: %s", gnutls_strerror (ret));
- dat.data = read_binary_file (info->privkey, &size);
+ dat.data = (void*)read_binary_file (info->privkey, &size);
dat.size = size;
if (!dat.data)
@@ -396,7 +396,7 @@ load_cert_list (int mand, size_t * crt_size, common_info_st * info)
fclose (fd);
- ptr = buffer;
+ ptr = (void*)buffer;
ptr_size = size;
for (i = 0; i < MAX_CERTS; i++)
@@ -405,7 +405,7 @@ load_cert_list (int mand, size_t * crt_size, common_info_st * info)
if (ret < 0)
error (EXIT_FAILURE, 0, "crt_init: %s", gnutls_strerror (ret));
- dat.data = ptr;
+ dat.data = (void*)ptr;
dat.size = ptr_size;
ret = gnutls_x509_crt_import (crt[i], &dat, info->incert_format);
@@ -450,7 +450,7 @@ load_request (common_info_st * info)
if (ret < 0)
error (EXIT_FAILURE, 0, "crq_init: %s", gnutls_strerror (ret));
- dat.data = read_binary_file (info->request, &size);
+ dat.data = (void*)read_binary_file (info->request, &size);
dat.size = size;
if (!dat.data)
@@ -488,7 +488,7 @@ load_ca_private_key (common_info_st * info)
return _load_pkcs11_privkey(info->ca_privkey);
#endif
- dat.data = read_binary_file (info->ca_privkey, &size);
+ dat.data = (void*)read_binary_file (info->ca_privkey, &size);
dat.size = size;
if (!dat.data)
@@ -519,7 +519,7 @@ load_ca_cert (common_info_st * info)
if (ret < 0)
error (EXIT_FAILURE, 0, "crt_init: %s", gnutls_strerror (ret));
- dat.data = read_binary_file (info->ca, &size);
+ dat.data = (void*)read_binary_file (info->ca, &size);
dat.size = size;
if (!dat.data)
@@ -561,7 +561,7 @@ load_pubkey (int mand, common_info_st * info)
if (ret < 0)
error (EXIT_FAILURE, 0, "privkey_init: %s", gnutls_strerror (ret));
- dat.data = read_binary_file (info->pubkey, &size);
+ dat.data = (void*)read_binary_file (info->pubkey, &size);
dat.size = size;
if (!dat.data)
diff --git a/src/certtool.c b/src/certtool.c
index 563152fa28..a409662811 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -1162,7 +1162,7 @@ certificate_info (int pubkey, common_info_st * cinfo)
gnutls_datum_t pem;
unsigned int crt_num;
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
crt_num = MAX_CRTS;
@@ -1227,7 +1227,7 @@ pgp_certificate_info (void)
gnutls_datum_t pem, out_data;
unsigned int verify_status;
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
ret = gnutls_openpgp_crt_init (&crt);
@@ -1441,7 +1441,7 @@ pgp_ring_info (void)
int ret, i, count;
gnutls_datum_t pem;
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
ret = gnutls_openpgp_keyring_init (&ring);
@@ -1562,7 +1562,7 @@ crl_info (void)
if (ret < 0)
error (EXIT_FAILURE, 0, "crl_init: %s", gnutls_strerror (ret));
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
if (!pem.data)
@@ -1628,7 +1628,7 @@ crq_info (void)
if (ret < 0)
error (EXIT_FAILURE, 0, "crq_init: %s", gnutls_strerror (ret));
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
if (!pem.data)
@@ -2044,7 +2044,7 @@ static int detailed_verification(gnutls_x509_crt_t cert,
strcpy(name, "unnumbered");
else
{
- data.data = tmp;
+ data.data = (void*)tmp;
data.size = name_size;
name_size = sizeof(name);
@@ -2225,7 +2225,7 @@ verify_chain (void)
char *buf;
size_t size;
- buf = fread_file (infile, &size);
+ buf = (void*)fread_file (infile, &size);
if (buf == NULL)
error (EXIT_FAILURE, errno, "reading chain");
@@ -2246,13 +2246,13 @@ verify_certificate (common_info_st * cinfo)
if (ca_file == NULL)
error (EXIT_FAILURE, errno, "opening CA file");
- cert = fread_file (infile, &cert_size);
+ cert = (void*)fread_file (infile, &cert_size);
if (cert == NULL)
error (EXIT_FAILURE, errno, "reading certificate chain");
cert[cert_size] = 0;
- cas = fread_file (ca_file, &ca_size);
+ cas = (void*)fread_file (ca_file, &ca_size);
if (cas == NULL)
error (EXIT_FAILURE, errno, "reading CA list");
@@ -2292,7 +2292,7 @@ verify_crl (common_info_st * cinfo)
if (ret < 0)
error (EXIT_FAILURE, 0, "crl_init: %s", gnutls_strerror (ret));
- pem.data = fread_file (infile, &size);
+ pem.data = (void*)fread_file (infile, &size);
pem.size = size;
ret = gnutls_x509_crl_import (crl, &pem, info.incert_format);
@@ -2667,7 +2667,7 @@ pkcs12_info (void)
if (result < 0)
error (EXIT_FAILURE, 0, "p12_init: %s", gnutls_strerror (result));
- data.data = fread_file (infile, &size);
+ data.data = (void*)fread_file (infile, &size);
data.size = size;
result = gnutls_pkcs12_import (pkcs12, &data, info.incert_format, 0);
@@ -2742,7 +2742,7 @@ pkcs7_info (void)
if (result < 0)
error (EXIT_FAILURE, 0, "p7_init: %s", gnutls_strerror (result));
- data.data = fread_file (infile, &size);
+ data.data = (void*)fread_file (infile, &size);
data.size = size;
result = gnutls_pkcs7_import (pkcs7, &data, info.incert_format);
@@ -2777,7 +2777,7 @@ pkcs7_info (void)
if (result < 0)
error (EXIT_FAILURE, 0, "encoding: %s", gnutls_strerror (result));
- fputs (b64.data, outfile);
+ fputs ((void*)b64.data, outfile);
gnutls_free (b64.data);
}
@@ -2808,7 +2808,7 @@ pkcs7_info (void)
if (result < 0)
error (EXIT_FAILURE, 0, "encoding: %s", gnutls_strerror (result));
- fputs (b64.data, outfile);
+ fputs ((void*)b64.data, outfile);
gnutls_free (b64.data);
}
}
diff --git a/src/cli.c b/src/cli.c
index 722f85f660..40610b6e78 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -123,7 +123,7 @@ load_file (const char *file)
gnutls_datum_t loaded_file = { NULL, 0 };
size_t length;
- loaded_file.data = read_binary_file (file, &length);
+ loaded_file.data = (void*)read_binary_file (file, &length);
if (loaded_file.data)
loaded_file.size = (unsigned int) length;
@@ -171,7 +171,8 @@ static void
load_keys (void)
{
unsigned int crt_num;
- int ret, i;
+ int ret;
+ unsigned int i;
gnutls_datum_t data = { NULL, 0 };
gnutls_x509_crt_t crt_list[MAX_CRT];
#ifdef ENABLE_PKCS11
@@ -1156,7 +1157,7 @@ static int
psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key)
{
const char *hint = gnutls_psk_client_get_hint (session);
- unsigned char *rawkey;
+ char *rawkey;
char *passwd;
int ret;
size_t res_size;
@@ -1203,7 +1204,7 @@ psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key)
return GNUTLS_E_INSUFFICIENT_CREDENTIALS;
}
- tmp.data = passwd;
+ tmp.data = (void*)passwd;
tmp.size = strlen (passwd);
res_size = tmp.size / 2 + 1;
@@ -1220,7 +1221,7 @@ psk_callback (gnutls_session_t session, char **username, gnutls_datum_t * key)
return ret;
}
- key->data = rawkey;
+ key->data = (void*)rawkey;
key->size = res_size;
if (info.debug)
diff --git a/src/common.c b/src/common.c
index a5b9b360fe..4c1ed32016 100644
--- a/src/common.c
+++ b/src/common.c
@@ -176,7 +176,7 @@ print_openpgp_info (gnutls_session_t session, const char *hostname,
gnutls_openpgp_crt_t crt;
const gnutls_datum_t *cert_list;
- int cert_list_size = 0;
+ unsigned int cert_list_size = 0;
int hostname_ok = 0;
int ret;
@@ -505,7 +505,7 @@ print_info (gnutls_session_t session, const char *hostname, int insecure)
if (verbose)
{
- char id[32];
+ unsigned char id[32];
size_t id_size = sizeof (id);
gnutls_session_get_id (session, id, &id_size);
printf ("- Session ID: %s\n", raw_to_string (id, id_size));
diff --git a/src/crywrap/crywrap.c b/src/crywrap/crywrap.c
index da41f854d8..8338d073a9 100644
--- a/src/crywrap/crywrap.c
+++ b/src/crywrap/crywrap.c
@@ -125,7 +125,7 @@ static const char *pidfile = _CRYWRAP_PIDFILE; /**< File to log our PID
*/
static gnutls_certificate_server_credentials cred;
static gnutls_dh_params dh_params; /**< GNUTLS DH parameters. */
-static gnutls_datum dh_file = { _crywrap_prime_dh_1024, sizeof(_crywrap_prime_dh_1024) }; /**< Diffie Hellman parameters */
+static gnutls_datum dh_file = { (void*)_crywrap_prime_dh_1024, sizeof(_crywrap_prime_dh_1024) }; /**< Diffie Hellman parameters */
/** Bugreport address.
* Used by the argp suite.
@@ -203,7 +203,7 @@ load_file (const char *file)
gnutls_datum_t loaded_file = { NULL, 0 };
size_t length;
- loaded_file.data = read_binary_file (file, &length);
+ loaded_file.data = (void*)read_binary_file (file, &length);
if (loaded_file.data)
loaded_file.size = (unsigned int) length;
diff --git a/src/dh.c b/src/dh.c
index cef97dd625..3c0eacbb17 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -40,7 +40,7 @@ extern FILE *infile;
static void
print_dh_info (gnutls_datum_t * p, gnutls_datum_t * g, unsigned int q_bits)
{
-int i;
+unsigned int i;
fprintf (outfile, "\nGenerator (%d bits): ", g->size*8);
@@ -90,7 +90,7 @@ void dh_info (common_info_st * ci)
exit (1);
}
- params.data = fread_file (infile, &size);
+ params.data = (void*)fread_file (infile, &size);
params.size = size;
ret =
diff --git a/src/pkcs11.c b/src/pkcs11.c
index b9f4332304..ad52d4ea31 100644
--- a/src/pkcs11.c
+++ b/src/pkcs11.c
@@ -76,10 +76,10 @@ pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login,
{
gnutls_pkcs11_obj_t *crt_list;
gnutls_x509_crt_t xcrt;
- unsigned int crt_list_size = 0;
+ unsigned int crt_list_size = 0, i;
int ret;
char *output;
- int i, attrs;
+ int attrs;
unsigned int obj_flags = 0;
if (login)
diff --git a/src/serv.c b/src/serv.c
index 1af21fec83..ee4e9530af 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -250,7 +250,7 @@ static char pkcs3[] =
static int
static_dh_params (void)
{
- gnutls_datum_t params = { pkcs3, sizeof (pkcs3) };
+ gnutls_datum_t params = { (void*)pkcs3, sizeof (pkcs3) };
int ret;
if (gnutls_dh_params_init (&dh_params) < 0)
diff --git a/src/srptool.c b/src/srptool.c
index f77a2e1ace..1d4db32fe8 100644
--- a/src/srptool.c
+++ b/src/srptool.c
@@ -187,7 +187,7 @@ _verify_passwd_int (const char *username, const char *passwd,
*pos = 0;
/* convert salt to binary. */
- tmp.data = _salt;
+ tmp.data = (void*)_salt;
tmp.size = strlen (_salt);
if (gnutls_srp_base64_decode_alloc (&tmp, &raw_salt) < 0)
@@ -496,7 +496,7 @@ static char *
_srp_crypt (const char *username, const char *passwd, int salt_size,
const gnutls_datum_t * g, const gnutls_datum_t * n)
{
- char salt[128];
+ unsigned char salt[128];
static char result[1024];
gnutls_datum_t dat_salt, txt_salt;
gnutls_datum_t verifier, txt_verifier;
@@ -704,7 +704,7 @@ read_conf_values (gnutls_datum_t * g, gnutls_datum_t * n, char *str)
if (p[len - 1] == '\n')
len--;
- dat.data = p;
+ dat.data = (void*)p;
dat.size = len;
ret = gnutls_srp_base64_decode_alloc (&dat, g);
@@ -724,7 +724,7 @@ read_conf_values (gnutls_datum_t * g, gnutls_datum_t * n, char *str)
*p = '\0';
p++;
- dat.data = p;
+ dat.data = (void*)p;
dat.size = strlen (p);
ret = gnutls_srp_base64_decode_alloc (&dat, n);