summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--doc/examples/ex-client-psk.c2
-rw-r--r--doc/examples/ex-pkcs11-list.c3
-rw-r--r--doc/examples/ex-pkcs12.c2
-rw-r--r--doc/examples/ex-serv-anon.c7
-rw-r--r--doc/examples/ex-serv-pgp.c7
-rw-r--r--doc/examples/ex-serv-psk.c7
-rw-r--r--doc/examples/ex-serv-srp.c7
-rw-r--r--doc/examples/ex-serv-x509.c2
-rw-r--r--doc/examples/tcp.c4
-rw-r--r--lib/abstract_int.h2
-rw-r--r--lib/accelerated/cryptodev.c4
-rw-r--r--lib/algorithms.h3
-rw-r--r--lib/algorithms/ciphersuites.c9
-rw-r--r--lib/algorithms/secparams.c10
-rw-r--r--lib/auth/anon.c8
-rw-r--r--lib/auth/anon_ecdh.c8
-rw-r--r--lib/auth/cert.c32
-rw-r--r--lib/auth/cert.h6
-rw-r--r--lib/auth/dh_common.c4
-rw-r--r--lib/auth/dh_common.h4
-rw-r--r--lib/auth/dhe.c10
-rw-r--r--lib/auth/dhe_psk.c12
-rw-r--r--lib/auth/ecdh_common.c6
-rw-r--r--lib/auth/ecdh_common.h4
-rw-r--r--lib/auth/psk.c16
-rw-r--r--lib/auth/psk_passwd.c2
-rw-r--r--lib/auth/rsa.c6
-rw-r--r--lib/auth/rsa_export.c8
-rw-r--r--lib/auth/srp.c10
-rw-r--r--lib/auth/srp.h8
-rw-r--r--lib/auth/srp_passwd.c4
-rw-r--r--lib/auth/srp_passwd.h2
-rw-r--r--lib/auth/srp_rsa.c6
-rw-r--r--lib/auth/srp_sb64.c40
-rw-r--r--lib/ext/cert_type.c4
-rw-r--r--lib/ext/ecc.c14
-rw-r--r--lib/ext/ecc.h2
-rw-r--r--lib/ext/max_record.c4
-rw-r--r--lib/ext/safe_renegotiation.c6
-rw-r--r--lib/ext/server_name.c10
-rw-r--r--lib/ext/server_name.h2
-rw-r--r--lib/ext/session_ticket.c24
-rw-r--r--lib/ext/signature.c16
-rw-r--r--lib/ext/signature.h4
-rw-r--r--lib/ext/srp.c13
-rw-r--r--lib/extras/randomart.c4
-rw-r--r--lib/gnutls_auth.h12
-rw-r--r--lib/gnutls_buffers.c15
-rw-r--r--lib/gnutls_buffers.h4
-rw-r--r--lib/gnutls_cipher.c44
-rw-r--r--lib/gnutls_cipher.h8
-rw-r--r--lib/gnutls_cipher_int.h22
-rw-r--r--lib/gnutls_compress.c8
-rw-r--r--lib/gnutls_compress.h8
-rw-r--r--lib/gnutls_constate.c16
-rw-r--r--lib/gnutls_datum.c8
-rw-r--r--lib/gnutls_datum.h8
-rw-r--r--lib/gnutls_dh_primes.c10
-rw-r--r--lib/gnutls_dtls.c12
-rw-r--r--lib/gnutls_ecc.c2
-rw-r--r--lib/gnutls_ecc.h2
-rw-r--r--lib/gnutls_extensions.c11
-rw-r--r--lib/gnutls_extensions.h2
-rw-r--r--lib/gnutls_handshake.c67
-rw-r--r--lib/gnutls_handshake.h10
-rw-r--r--lib/gnutls_hash_int.c40
-rw-r--r--lib/gnutls_hash_int.h10
-rw-r--r--lib/gnutls_int.h19
-rw-r--r--lib/gnutls_kx.c6
-rw-r--r--lib/gnutls_mbuffers.c2
-rw-r--r--lib/gnutls_mpi.c14
-rw-r--r--lib/gnutls_num.c14
-rw-r--r--lib/gnutls_num.h16
-rw-r--r--lib/gnutls_pcert.c3
-rw-r--r--lib/gnutls_pk.c4
-rw-r--r--lib/gnutls_psk.c4
-rw-r--r--lib/gnutls_pubkey.c19
-rw-r--r--lib/gnutls_record.c10
-rw-r--r--lib/gnutls_record.h2
-rw-r--r--lib/gnutls_session.c2
-rw-r--r--lib/gnutls_session_pack.c4
-rw-r--r--lib/gnutls_sig.c22
-rw-r--r--lib/gnutls_sig.h2
-rw-r--r--lib/gnutls_srp.c12
-rw-r--r--lib/gnutls_srp.h4
-rw-r--r--lib/gnutls_state.c22
-rw-r--r--lib/gnutls_state.h4
-rw-r--r--lib/gnutls_str.c32
-rw-r--r--lib/gnutls_str.h10
-rw-r--r--lib/gnutls_str_array.h4
-rw-r--r--lib/gnutls_supplemental.c4
-rw-r--r--lib/gnutls_ui.c4
-rw-r--r--lib/gnutls_v2_compat.c13
-rw-r--r--lib/gnutls_v2_compat.h2
-rw-r--r--lib/gnutls_x509.c22
-rw-r--r--lib/includes/gnutls/gnutls.h.in4
-rw-r--r--lib/includes/gnutls/pkcs11.h2
-rw-r--r--lib/includes/gnutls/x509.h4
-rw-r--r--lib/nettle/cipher.c2
-rw-r--r--lib/nettle/egd.c14
-rw-r--r--lib/nettle/mpi.c6
-rw-r--r--lib/nettle/pk.c12
-rw-r--r--lib/nettle/rnd.c4
-rw-r--r--lib/opencdk/context.h2
-rw-r--r--lib/opencdk/filters.h12
-rw-r--r--lib/opencdk/kbnode.c2
-rw-r--r--lib/opencdk/main.h2
-rw-r--r--lib/opencdk/stream.c30
-rw-r--r--lib/opencdk/stream.h4
-rw-r--r--lib/opencdk/write-packet.c2
-rw-r--r--lib/openpgp/extras.c2
-rw-r--r--lib/openpgp/gnutls_openpgp.c12
-rw-r--r--lib/openpgp/gnutls_openpgp.h4
-rw-r--r--lib/openpgp/output.c11
-rw-r--r--lib/openpgp/pgp.c2
-rw-r--r--lib/openpgp/privkey.c6
-rw-r--r--lib/pkcs11.c55
-rw-r--r--lib/pkcs11_int.h4
-rw-r--r--lib/pkcs11_secret.c2
-rw-r--r--lib/pkcs11_write.c20
-rw-r--r--lib/x509/common.c59
-rw-r--r--lib/x509/common.h8
-rw-r--r--lib/x509/crl.c10
-rw-r--r--lib/x509/crl_write.c2
-rw-r--r--lib/x509/crq.c8
-rw-r--r--lib/x509/dn.c10
-rw-r--r--lib/x509/extensions.c16
-rw-r--r--lib/x509/key_decode.c22
-rw-r--r--lib/x509/key_encode.c10
-rw-r--r--lib/x509/mpi.c6
-rw-r--r--lib/x509/output.c41
-rw-r--r--lib/x509/pbkdf2-sha1.c4
-rw-r--r--lib/x509/pbkdf2-sha1.h4
-rw-r--r--lib/x509/pkcs12.c16
-rw-r--r--lib/x509/pkcs12_encr.c11
-rw-r--r--lib/x509/pkcs7.c4
-rw-r--r--lib/x509/privkey.c5
-rw-r--r--lib/x509/privkey_pkcs8.c28
-rw-r--r--lib/x509/sign.c2
-rw-r--r--lib/x509/verify-high.c23
-rw-r--r--lib/x509/verify.c6
-rw-r--r--lib/x509/x509.c40
-rw-r--r--lib/x509/x509_int.h24
-rw-r--r--lib/x509/x509_write.c6
-rw-r--r--lib/x509_b64.c18
-rw-r--r--lib/x509_b64.h2
-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
-rw-r--r--tests/anonself.c4
-rw-r--r--tests/certificate_set_x509_crl.c3
-rw-r--r--tests/chainverify.c8
-rw-r--r--tests/cve-2008-4989.c6
-rw-r--r--tests/cve-2009-1415.c6
-rw-r--r--tests/dhepskself.c6
-rw-r--r--tests/dn.c2
-rw-r--r--tests/dn2.c5
-rw-r--r--tests/gc.c4
-rw-r--r--tests/hostname-check.c22
-rw-r--r--tests/infoaccess.c4
-rw-r--r--tests/mini-deflate.c2
-rw-r--r--tests/mini-eagain-dtls.c2
-rw-r--r--tests/mini-eagain.c2
-rw-r--r--tests/mini.c2
-rw-r--r--tests/moredn.c2
-rw-r--r--tests/nul-in-x509-names.c4
-rw-r--r--tests/openpgp-auth.c2
-rw-r--r--tests/openpgp-auth2.c2
-rw-r--r--tests/openpgpself.c6
-rw-r--r--tests/parse_ca.c2
-rw-r--r--tests/pkcs12_encode.c6
-rw-r--r--tests/pkcs12_s2k.c31
-rw-r--r--tests/pkcs12_s2k_pem.c4
-rw-r--r--tests/pskself.c6
-rw-r--r--tests/resume.c6
-rw-r--r--tests/rsa-encrypt-decrypt.c4
-rw-r--r--tests/slow/cipher-test.c44
-rw-r--r--tests/utils.c6
-rw-r--r--tests/utils.h4
-rw-r--r--tests/x509_altname.c2
-rw-r--r--tests/x509cert.c3
-rw-r--r--tests/x509dn.c14
-rw-r--r--tests/x509self.c12
-rw-r--r--tests/x509sign-verify.c8
192 files changed, 971 insertions, 936 deletions
diff --git a/configure.ac b/configure.ac
index f36e75bc2f..eecaec7e3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,12 +275,10 @@ if test "$gl_gcc_warnings" = yes; then
done
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
- gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
gl_WARN_ADD([-Wno-format-y2k]) # Too many warnings for now
gl_WARN_ADD([-Wno-suggest-attribute=pure]) # Too many warnings for now
gl_WARN_ADD([-Wno-suggest-attribute=const]) # Too many warnings for now
gl_WARN_ADD([-Wno-suggest-attribute=noreturn]) # Too many warnings for now
- gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
diff --git a/doc/examples/ex-client-psk.c b/doc/examples/ex-client-psk.c
index 7c0bd7e146..4f83ddebe0 100644
--- a/doc/examples/ex-client-psk.c
+++ b/doc/examples/ex-client-psk.c
@@ -30,7 +30,7 @@ main (void)
char buffer[MAX_BUF + 1];
const char *err;
gnutls_psk_client_credentials_t pskcred;
- const gnutls_datum_t key = { (char *) "DEADBEEF", 8 };
+ const gnutls_datum_t key = { (void *) "DEADBEEF", 8 };
gnutls_global_init ();
diff --git a/doc/examples/ex-pkcs11-list.c b/doc/examples/ex-pkcs11-list.c
index 35ef196063..70849beada 100644
--- a/doc/examples/ex-pkcs11-list.c
+++ b/doc/examples/ex-pkcs11-list.c
@@ -15,7 +15,8 @@ main (int argc, char** argv)
gnutls_x509_crt_t xcrt;
unsigned int obj_list_size = 0;
gnutls_datum_t cinfo;
- int i, ret;
+ int ret;
+ unsigned int i;
obj_list_size = 0;
ret = gnutls_pkcs11_obj_list_import_url (NULL, &obj_list_size, URL,
diff --git a/doc/examples/ex-pkcs12.c b/doc/examples/ex-pkcs12.c
index 0be058e924..69e7987618 100644
--- a/doc/examples/ex-pkcs12.c
+++ b/doc/examples/ex-pkcs12.c
@@ -33,7 +33,7 @@ write_pkcs12 (const gnutls_datum_t * cert,
/* A good idea might be to use gnutls_x509_privkey_get_key_id()
* to obtain a unique ID.
*/
- gnutls_datum_t key_id = { (char *) "\x00\x00\x07", 3 };
+ gnutls_datum_t key_id = { (void *) "\x00\x00\x07", 3 };
gnutls_global_init ();
diff --git a/doc/examples/ex-serv-anon.c b/doc/examples/ex-serv-anon.c
index 93c8a70fee..5263b01bae 100644
--- a/doc/examples/ex-serv-anon.c
+++ b/doc/examples/ex-serv-anon.c
@@ -19,7 +19,6 @@
*/
-#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
@@ -68,7 +67,7 @@ main (void)
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len;
+ socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
@@ -97,7 +96,7 @@ main (void)
setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval,
sizeof (int));
- err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv));
+ err = bind (listen_sd, (struct sockaddr *) & sa_serv, sizeof (sa_serv));
SOCKET_ERR (err, "bind");
err = listen (listen_sd, 1024);
SOCKET_ERR (err, "listen");
@@ -109,7 +108,7 @@ main (void)
{
session = initialize_tls_session ();
- sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
+ sd = accept (listen_sd, (struct sockaddr *) & sa_cli, &client_len);
printf ("- connection from %s, port %d\n",
inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
diff --git a/doc/examples/ex-serv-pgp.c b/doc/examples/ex-serv-pgp.c
index 5c73b93691..6946d2947c 100644
--- a/doc/examples/ex-serv-pgp.c
+++ b/doc/examples/ex-serv-pgp.c
@@ -24,7 +24,6 @@
*/
-#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
@@ -74,7 +73,7 @@ main (void)
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len;
+ socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
@@ -111,7 +110,7 @@ main (void)
setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval,
sizeof (int));
- err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv));
+ err = bind (listen_sd, (struct sockaddr *) & sa_serv, sizeof (sa_serv));
SOCKET_ERR (err, "bind");
err = listen (listen_sd, 1024);
SOCKET_ERR (err, "listen");
@@ -123,7 +122,7 @@ main (void)
{
session = initialize_tls_session ();
- sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
+ sd = accept (listen_sd, (struct sockaddr *) & sa_cli, &client_len);
printf ("- connection from %s, port %d\n",
inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
diff --git a/doc/examples/ex-serv-psk.c b/doc/examples/ex-serv-psk.c
index 5a53da02fc..70732f60e3 100644
--- a/doc/examples/ex-serv-psk.c
+++ b/doc/examples/ex-serv-psk.c
@@ -24,7 +24,6 @@
authentication.
*/
-#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
@@ -93,7 +92,7 @@ main (void)
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len;
+ socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
@@ -136,7 +135,7 @@ main (void)
setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval,
sizeof (int));
- err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv));
+ err = bind (listen_sd, (struct sockaddr *) & sa_serv, sizeof (sa_serv));
SOCKET_ERR (err, "bind");
err = listen (listen_sd, 1024);
SOCKET_ERR (err, "listen");
@@ -148,7 +147,7 @@ main (void)
{
session = initialize_tls_session ();
- sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
+ sd = accept (listen_sd, (struct sockaddr *) & sa_cli, &client_len);
printf ("- connection from %s, port %d\n",
inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
diff --git a/doc/examples/ex-serv-srp.c b/doc/examples/ex-serv-srp.c
index 0cff30c448..70ae1660bb 100644
--- a/doc/examples/ex-serv-srp.c
+++ b/doc/examples/ex-serv-srp.c
@@ -25,7 +25,6 @@
/* This is a sample TLS-SRP echo server.
*/
-#define SA struct sockaddr
#define SOCKET_ERR(err,s) if(err==-1) {perror(s);return(1);}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
@@ -62,7 +61,7 @@ main (void)
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len;
+ socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
@@ -98,7 +97,7 @@ main (void)
setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval,
sizeof (int));
- err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv));
+ err = bind (listen_sd, (struct sockaddr *) & sa_serv, sizeof (sa_serv));
SOCKET_ERR (err, "bind");
err = listen (listen_sd, 1024);
SOCKET_ERR (err, "listen");
@@ -110,7 +109,7 @@ main (void)
{
session = initialize_tls_session ();
- sd = accept (listen_sd, (SA *) & sa_cli, &client_len);
+ sd = accept (listen_sd, (struct sockaddr *) & sa_cli, &client_len);
printf ("- connection from %s, port %d\n",
inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf,
diff --git a/doc/examples/ex-serv-x509.c b/doc/examples/ex-serv-x509.c
index 5383fb3425..44c671a3f4 100644
--- a/doc/examples/ex-serv-x509.c
+++ b/doc/examples/ex-serv-x509.c
@@ -73,7 +73,7 @@ main (void)
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
- int client_len;
+ socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/doc/examples/tcp.c b/doc/examples/tcp.c
index 6961c4eef6..fcf8441297 100644
--- a/doc/examples/tcp.c
+++ b/doc/examples/tcp.c
@@ -13,8 +13,6 @@
#include <netinet/in.h>
#include <unistd.h>
-#define SA struct sockaddr
-
/* tcp.c */
int tcp_connect (void);
void tcp_close (int sd);
@@ -39,7 +37,7 @@ tcp_connect (void)
sa.sin_port = htons (atoi (PORT));
inet_pton (AF_INET, SERVER, &sa.sin_addr);
- err = connect (sd, (SA *) & sa, sizeof (sa));
+ err = connect (sd, (struct sockaddr *) & sa, sizeof (sa));
if (err < 0)
{
fprintf (stderr, "Connect error\n");
diff --git a/lib/abstract_int.h b/lib/abstract_int.h
index 06318d3791..27888ca033 100644
--- a/lib/abstract_int.h
+++ b/lib/abstract_int.h
@@ -28,6 +28,6 @@ int pubkey_verify_data (gnutls_pk_algorithm_t pk,
gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo,
- const gnutls_pk_params_st* params, int* hash_len);
+ const gnutls_pk_params_st* params, unsigned int* hash_len);
#endif
diff --git a/lib/accelerated/cryptodev.c b/lib/accelerated/cryptodev.c
index 2fb063bf67..da68474c15 100644
--- a/lib/accelerated/cryptodev.c
+++ b/lib/accelerated/cryptodev.c
@@ -48,8 +48,8 @@ struct cryptodev_ctx
{
struct session_op sess;
struct crypt_op cryp;
- opaque iv[EALG_MAX_BLOCK_LEN];
- opaque key[CRYPTO_CIPHER_MAX_KEY_LEN];
+ uint8_t iv[EALG_MAX_BLOCK_LEN];
+ uint8_t key[CRYPTO_CIPHER_MAX_KEY_LEN];
int cfd;
};
diff --git a/lib/algorithms.h b/lib/algorithms.h
index 7709557043..41fb34eefc 100644
--- a/lib/algorithms.h
+++ b/lib/algorithms.h
@@ -60,7 +60,8 @@ const char *_gnutls_digest_get_name (gnutls_digest_algorithm_t algorithm);
/* Functions for cipher suites. */
int _gnutls_supported_ciphersuites (gnutls_session_t session,
- uint8_t* cipher_suites, int max_cipher_suite_size);
+ uint8_t* cipher_suites,
+ unsigned int max_cipher_suite_size);
const char *_gnutls_cipher_suite_get_name (const uint8_t suite[2]);
gnutls_mac_algorithm_t _gnutls_cipher_suite_get_prf (const uint8_t suite[2]);
gnutls_cipher_algorithm_t _gnutls_cipher_suite_get_cipher_algo (const
diff --git a/lib/algorithms/ciphersuites.c b/lib/algorithms/ciphersuites.c
index 59aebb7fb3..05709c193f 100644
--- a/lib/algorithms/ciphersuites.c
+++ b/lib/algorithms/ciphersuites.c
@@ -799,12 +799,12 @@ _gnutls_cipher_suite_is_ok (const uint8_t suite[2])
-*/
int
_gnutls_supported_ciphersuites (gnutls_session_t session,
- uint8_t *cipher_suites, int max_cipher_suite_size)
+ uint8_t *cipher_suites, unsigned int max_cipher_suite_size)
{
unsigned int i, ret_count, j, z, k=0;
const gnutls_cipher_suite_entry * ce;
- int version = gnutls_protocol_get_version( session);
+ unsigned int version = gnutls_protocol_get_version( session);
for (i = 0; i < session->internals.priorities.kx.algorithms; i++)
for (j = 0; j < session->internals.priorities.cipher.algorithms; j++)
@@ -861,8 +861,9 @@ _gnutls_supported_ciphersuites (gnutls_session_t session,
int
gnutls_priority_get_cipher_suite_index (gnutls_priority_t pcache, unsigned int idx, unsigned int *sidx)
{
-int mac_idx, cipher_idx, kx_idx, i;
-int total = pcache->mac.algorithms * pcache->cipher.algorithms * pcache->kx.algorithms;
+int mac_idx, cipher_idx, kx_idx;
+unsigned int i;
+unsigned int total = pcache->mac.algorithms * pcache->cipher.algorithms * pcache->kx.algorithms;
if (idx >= total)
return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
diff --git a/lib/algorithms/secparams.c b/lib/algorithms/secparams.c
index 775d4d2a28..48e90a01fa 100644
--- a/lib/algorithms/secparams.c
+++ b/lib/algorithms/secparams.c
@@ -29,13 +29,13 @@ typedef struct
{
const char *name;
gnutls_sec_param_t sec_param;
- int bits; /* security level */
- int pk_bits; /* DH, RSA, SRP */
- int dsa_bits; /* bits for DSA. Handled differently since
+ unsigned int bits; /* security level */
+ unsigned int pk_bits; /* DH, RSA, SRP */
+ unsigned int dsa_bits; /* bits for DSA. Handled differently since
* choice of key size in DSA is political.
*/
- int subgroup_bits; /* subgroup bits */
- int ecc_bits; /* bits for ECC keys */
+ unsigned int subgroup_bits; /* subgroup bits */
+ unsigned int ecc_bits; /* bits for ECC keys */
} gnutls_sec_params_entry;
static const gnutls_sec_params_entry sec_params[] = {
diff --git a/lib/auth/anon.c b/lib/auth/anon.c
index a71f31a960..789e9084a9 100644
--- a/lib/auth/anon.c
+++ b/lib/auth/anon.c
@@ -39,8 +39,8 @@
#include <auth/dh_common.h>
static int gen_anon_server_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_anon_client_kx (gnutls_session_t, opaque *, size_t);
-static int proc_anon_server_kx (gnutls_session_t, opaque *, size_t);
+static int proc_anon_client_kx (gnutls_session_t, uint8_t *, size_t);
+static int proc_anon_server_kx (gnutls_session_t, uint8_t *, size_t);
const mod_auth_st anon_auth_struct = {
"ANON",
@@ -109,7 +109,7 @@ gen_anon_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
static int
-proc_anon_client_kx (gnutls_session_t session, opaque * data,
+proc_anon_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
gnutls_anon_server_credentials_t cred;
@@ -145,7 +145,7 @@ proc_anon_client_kx (gnutls_session_t session, opaque * data,
}
int
-proc_anon_server_kx (gnutls_session_t session, opaque * data,
+proc_anon_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
diff --git a/lib/auth/anon_ecdh.c b/lib/auth/anon_ecdh.c
index f16b6a46a5..63e72edd4a 100644
--- a/lib/auth/anon_ecdh.c
+++ b/lib/auth/anon_ecdh.c
@@ -40,8 +40,8 @@
#include <ext/ecc.h>
static int gen_anon_ecdh_server_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_anon_ecdh_client_kx (gnutls_session_t, opaque *, size_t);
-static int proc_anon_ecdh_server_kx (gnutls_session_t, opaque *, size_t);
+static int proc_anon_ecdh_client_kx (gnutls_session_t, uint8_t *, size_t);
+static int proc_anon_ecdh_server_kx (gnutls_session_t, uint8_t *, size_t);
const mod_auth_st anon_ecdh_auth_struct = {
"ANON ECDH",
@@ -93,7 +93,7 @@ gen_anon_ecdh_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
static int
-proc_anon_ecdh_client_kx (gnutls_session_t session, opaque * data,
+proc_anon_ecdh_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
gnutls_anon_server_credentials_t cred;
@@ -111,7 +111,7 @@ proc_anon_ecdh_client_kx (gnutls_session_t session, opaque * data,
}
int
-proc_anon_ecdh_server_kx (gnutls_session_t session, opaque * data,
+proc_anon_ecdh_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
diff --git a/lib/auth/cert.c b/lib/auth/cert.c
index b62c7007d2..b57c1dd908 100644
--- a/lib/auth/cert.c
+++ b/lib/auth/cert.c
@@ -220,13 +220,13 @@ _gnutls_cert_get_issuer_dn (gnutls_pcert_st * cert, gnutls_datum_t * odn)
*/
static int
_find_x509_cert (const gnutls_certificate_credentials_t cred,
- opaque * _data, size_t _data_size,
+ uint8_t * _data, size_t _data_size,
const gnutls_pk_algorithm_t * pk_algos,
int pk_algos_length, int *indx)
{
unsigned size;
gnutls_datum_t odn = { NULL, 0 };
- opaque *data = _data;
+ uint8_t *data = _data;
ssize_t data_size = _data_size;
unsigned i, j;
int result, cert_pk;
@@ -331,7 +331,7 @@ _find_openpgp_cert (const gnutls_certificate_credentials_t cred,
* certificate request packet.
*/
static int
-get_issuers_num (gnutls_session_t session, opaque * data, ssize_t data_size)
+get_issuers_num (gnutls_session_t session, uint8_t * data, ssize_t data_size)
{
int issuers_dn_len = 0, result;
unsigned size;
@@ -382,7 +382,7 @@ error:
static int
get_issuers (gnutls_session_t session,
gnutls_datum_t * issuers_dn, int issuers_len,
- opaque * data, size_t data_size)
+ uint8_t * data, size_t data_size)
{
int i;
unsigned size;
@@ -679,13 +679,13 @@ cleanup:
*/
static int
_select_client_cert (gnutls_session_t session,
- opaque * _data, size_t _data_size,
+ uint8_t * _data, size_t _data_size,
gnutls_pk_algorithm_t * pk_algos, int pk_algos_length)
{
int result;
int indx = -1;
gnutls_certificate_credentials_t cred;
- opaque *data = _data;
+ uint8_t *data = _data;
ssize_t data_size = _data_size;
int issuers_dn_length;
gnutls_datum_t *issuers_dn = NULL;
@@ -1062,10 +1062,10 @@ _gnutls_gen_cert_server_certificate (gnutls_session_t session,
#define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) gnutls_pcert_deinit(&peer_certificate_list[x])
static int
_gnutls_proc_x509_server_certificate (gnutls_session_t session,
- opaque * data, size_t data_size)
+ uint8_t * data, size_t data_size)
{
int size, len, ret;
- opaque *p = data;
+ uint8_t *p = data;
cert_auth_info_t info;
gnutls_certificate_credentials_t cred;
ssize_t dsize = data_size;
@@ -1203,10 +1203,10 @@ cleanup:
#ifdef ENABLE_OPENPGP
static int
_gnutls_proc_openpgp_server_certificate (gnutls_session_t session,
- opaque * data, size_t data_size)
+ uint8_t * data, size_t data_size)
{
int size, ret, len;
- opaque *p = data;
+ uint8_t *p = data;
cert_auth_info_t info;
gnutls_certificate_credentials_t cred;
ssize_t dsize = data_size;
@@ -1402,7 +1402,7 @@ cleanup:
int
_gnutls_proc_certificate (gnutls_session_t session,
- opaque * data, size_t data_size)
+ uint8_t * data, size_t data_size)
{
int ret;
gnutls_certificate_credentials_t cred;
@@ -1465,11 +1465,11 @@ _gnutls_check_supported_sign_algo (CertificateSigType algo)
}
int
-_gnutls_proc_cert_cert_req (gnutls_session_t session, opaque * data,
+_gnutls_proc_cert_cert_req (gnutls_session_t session, uint8_t * data,
size_t data_size)
{
int size, ret;
- opaque *p;
+ uint8_t *p;
gnutls_certificate_credentials_t cred;
ssize_t dsize;
int i;
@@ -1655,11 +1655,11 @@ cleanup:
int
_gnutls_proc_cert_client_cert_vrfy (gnutls_session_t session,
- opaque * data, size_t data_size)
+ uint8_t * data, size_t data_size)
{
int size, ret;
ssize_t dsize = data_size;
- opaque *pdata = data;
+ uint8_t *pdata = data;
gnutls_datum_t sig;
cert_auth_info_t info = _gnutls_get_auth_info (session);
gnutls_pcert_st peer_cert;
@@ -2140,7 +2140,7 @@ _gnutls_server_select_cert (gnutls_session_t session,
/* Otherwise... */
- get_server_name(session, server_name, sizeof(server_name));
+ get_server_name(session, (unsigned char*)server_name, sizeof(server_name));
idx = -1; /* default is use no certificate */
diff --git a/lib/auth/cert.h b/lib/auth/cert.h
index 277a52de61..b0931fb9f8 100644
--- a/lib/auth/cert.h
+++ b/lib/auth/cert.h
@@ -126,9 +126,9 @@ int _gnutls_gen_cert_server_certificate (gnutls_session_t, gnutls_buffer_st *);
int _gnutls_gen_cert_client_certificate (gnutls_session_t, gnutls_buffer_st *);
int _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t, gnutls_buffer_st *);
int _gnutls_gen_cert_server_cert_req (gnutls_session_t, gnutls_buffer_st *);
-int _gnutls_proc_cert_cert_req (gnutls_session_t, opaque *, size_t);
-int _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t, opaque *, size_t);
-int _gnutls_proc_certificate (gnutls_session_t, opaque *, size_t);
+int _gnutls_proc_cert_cert_req (gnutls_session_t, uint8_t *, size_t);
+int _gnutls_proc_cert_client_cert_vrfy (gnutls_session_t, uint8_t *, size_t);
+int _gnutls_proc_certificate (gnutls_session_t, uint8_t *, size_t);
int _gnutls_get_selected_cert (gnutls_session_t session,
gnutls_pcert_st ** apr_cert_list,
int *apr_cert_list_length,
diff --git a/lib/auth/dh_common.c b/lib/auth/dh_common.c
index 825fb43729..172c7d45c0 100644
--- a/lib/auth/dh_common.c
+++ b/lib/auth/dh_common.c
@@ -51,7 +51,7 @@ _gnutls_free_dh_info (dh_info_st * dh)
int
_gnutls_proc_dh_common_client_kx (gnutls_session_t session,
- opaque * data, size_t _data_size,
+ uint8_t * data, size_t _data_size,
bigint_t g, bigint_t p,
gnutls_datum_t* psk_key)
{
@@ -201,7 +201,7 @@ error:
/* Returns the bytes parsed */
int
_gnutls_proc_dh_common_server_kx (gnutls_session_t session,
- opaque * data, size_t _data_size)
+ uint8_t * data, size_t _data_size)
{
uint16_t n_Y, n_g, n_p;
size_t _n_Y, _n_g, _n_p;
diff --git a/lib/auth/dh_common.h b/lib/auth/dh_common.h
index e7487d17f4..f878374660 100644
--- a/lib/auth/dh_common.h
+++ b/lib/auth/dh_common.h
@@ -38,13 +38,13 @@ void _gnutls_free_dh_info (dh_info_st * dh);
int _gnutls_gen_dh_common_client_kx_int (gnutls_session_t, gnutls_buffer_st*, gnutls_datum_t *pskkey);
int _gnutls_gen_dh_common_client_kx (gnutls_session_t, gnutls_buffer_st*);
int _gnutls_proc_dh_common_client_kx (gnutls_session_t session,
- opaque * data, size_t _data_size,
+ uint8_t * data, size_t _data_size,
bigint_t p, bigint_t g,
gnutls_datum_t* psk_key);
int _gnutls_dh_common_print_server_kx (gnutls_session_t, bigint_t g,
bigint_t p, unsigned int q_bits,
gnutls_buffer_st* data);
-int _gnutls_proc_dh_common_server_kx (gnutls_session_t session, opaque * data,
+int _gnutls_proc_dh_common_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size);
#endif
diff --git a/lib/auth/dhe.c b/lib/auth/dhe.c
index d11575df98..fb84ceef16 100644
--- a/lib/auth/dhe.c
+++ b/lib/auth/dhe.c
@@ -40,8 +40,8 @@
#include <auth/ecdh_common.h>
static int gen_dhe_server_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_dhe_server_kx (gnutls_session_t, opaque *, size_t);
-static int proc_dhe_client_kx (gnutls_session_t, opaque *, size_t);
+static int proc_dhe_server_kx (gnutls_session_t, uint8_t *, size_t);
+static int proc_dhe_client_kx (gnutls_session_t, uint8_t *, size_t);
const mod_auth_st ecdhe_ecdsa_auth_struct = {
"ECDHE_ECDSA",
@@ -249,11 +249,11 @@ cleanup:
}
static int
-proc_dhe_server_kx (gnutls_session_t session, opaque * data,
+proc_dhe_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
int sigsize;
- opaque *sigdata;
+ uint8_t *sigdata;
gnutls_datum_t vparams, signature;
int ret;
cert_auth_info_t info = _gnutls_get_auth_info (session);
@@ -336,7 +336,7 @@ proc_dhe_server_kx (gnutls_session_t session, opaque * data,
static int
-proc_dhe_client_kx (gnutls_session_t session, opaque * data,
+proc_dhe_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
gnutls_certificate_credentials_t cred;
diff --git a/lib/auth/dhe_psk.c b/lib/auth/dhe_psk.c
index 98a7513b40..410c7c5de0 100644
--- a/lib/auth/dhe_psk.c
+++ b/lib/auth/dhe_psk.c
@@ -45,10 +45,10 @@
static int gen_psk_server_kx (gnutls_session_t, gnutls_buffer_st*);
static int gen_psk_client_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_psk_client_kx (gnutls_session_t, opaque *, size_t);
-static int proc_psk_server_kx (gnutls_session_t, opaque *, size_t);
+static int proc_psk_client_kx (gnutls_session_t, uint8_t *, size_t);
+static int proc_psk_server_kx (gnutls_session_t, uint8_t *, size_t);
static int gen_ecdhe_psk_server_kx (gnutls_session_t session, gnutls_buffer_st* data);
-static int proc_ecdhe_psk_client_kx (gnutls_session_t session, opaque * data,
+static int proc_ecdhe_psk_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size);
const mod_auth_st dhe_psk_auth_struct = {
@@ -211,7 +211,7 @@ gen_ecdhe_psk_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
static int
-proc_psk_client_kx (gnutls_session_t session, opaque * data,
+proc_psk_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
int ret;
@@ -290,7 +290,7 @@ proc_psk_client_kx (gnutls_session_t session, opaque * data,
}
static int
-proc_ecdhe_psk_client_kx (gnutls_session_t session, opaque * data,
+proc_ecdhe_psk_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
int ret;
@@ -355,7 +355,7 @@ proc_ecdhe_psk_client_kx (gnutls_session_t session, opaque * data,
}
int
-proc_psk_server_kx (gnutls_session_t session, opaque * data,
+proc_psk_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
diff --git a/lib/auth/ecdh_common.c b/lib/auth/ecdh_common.c
index 7112418ff2..72b75641da 100644
--- a/lib/auth/ecdh_common.c
+++ b/lib/auth/ecdh_common.c
@@ -94,7 +94,7 @@ cleanup:
int
_gnutls_proc_ecdh_common_client_kx (gnutls_session_t session,
- opaque * data, size_t _data_size,
+ uint8_t * data, size_t _data_size,
gnutls_ecc_curve_t curve,
gnutls_datum_t *psk_key)
{
@@ -166,7 +166,7 @@ _gnutls_gen_ecdh_common_client_kx_int (gnutls_session_t session,
/* Returns the bytes parsed */
int
_gnutls_proc_ecdh_common_server_kx (gnutls_session_t session,
- opaque * data, size_t _data_size)
+ uint8_t * data, size_t _data_size)
{
int i, ret, point_size;
gnutls_ecc_curve_t curve;
@@ -206,7 +206,7 @@ _gnutls_proc_ecdh_common_server_kx (gnutls_session_t session,
int _gnutls_ecdh_common_print_server_kx (gnutls_session_t session, gnutls_buffer_st* data,
gnutls_ecc_curve_t curve)
{
- opaque p;
+ uint8_t p;
int ret;
gnutls_datum_t out;
diff --git a/lib/auth/ecdh_common.h b/lib/auth/ecdh_common.h
index 9884cdfbb6..0f6893abc0 100644
--- a/lib/auth/ecdh_common.h
+++ b/lib/auth/ecdh_common.h
@@ -36,13 +36,13 @@ _gnutls_gen_ecdh_common_client_kx_int (gnutls_session_t session,
int
_gnutls_proc_ecdh_common_client_kx (gnutls_session_t session,
- opaque * data, size_t _data_size,
+ uint8_t * data, size_t _data_size,
gnutls_ecc_curve_t curve,
gnutls_datum_t *psk_key);
int _gnutls_ecdh_common_print_server_kx (gnutls_session_t, gnutls_buffer_st* data,
gnutls_ecc_curve_t curve);
-int _gnutls_proc_ecdh_common_server_kx (gnutls_session_t session, opaque * data,
+int _gnutls_proc_ecdh_common_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size);
diff --git a/lib/auth/psk.c b/lib/auth/psk.c
index d81a66a8aa..34d95decce 100644
--- a/lib/auth/psk.c
+++ b/lib/auth/psk.c
@@ -37,9 +37,9 @@
int _gnutls_gen_psk_server_kx (gnutls_session_t session, gnutls_buffer_st* data);
int _gnutls_gen_psk_client_kx (gnutls_session_t, gnutls_buffer_st*);
-int _gnutls_proc_psk_client_kx (gnutls_session_t, opaque *, size_t);
+int _gnutls_proc_psk_client_kx (gnutls_session_t, uint8_t *, size_t);
-int _gnutls_proc_psk_server_kx (gnutls_session_t session, opaque * data,
+int _gnutls_proc_psk_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size);
const mod_auth_st psk_auth_struct = {
@@ -130,7 +130,7 @@ int ret;
if (ret)
return gnutls_assert_val(ret);
- username->data = user_p;
+ username->data = (uint8_t*)user_p;
username->size = strlen(user_p);
*free = 1;
@@ -147,7 +147,7 @@ int ret;
*
* struct {
* select (KeyExchangeAlgorithm) {
- * opaque psk_identity<0..2^16-1>;
+ * uint8_t psk_identity<0..2^16-1>;
* } exchange_keys;
* } ClientKeyExchange;
*
@@ -200,7 +200,7 @@ cleanup:
/* just read the username from the client key exchange.
*/
int
-_gnutls_proc_psk_client_kx (gnutls_session_t session, opaque * data,
+_gnutls_proc_psk_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
ssize_t data_size = _data_size;
@@ -273,7 +273,7 @@ error:
* select (KeyExchangeAlgorithm) {
* // other cases for rsa, diffie_hellman, etc.
* case psk: // NEW
- * opaque psk_identity_hint<0..2^16-1>;
+ * uint8_t psk_identity_hint<0..2^16-1>;
* };
* } ServerKeyExchange;
*
@@ -300,7 +300,7 @@ _gnutls_gen_psk_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
return GNUTLS_E_INT_RET_0;
}
- hint.data = cred->hint;
+ hint.data = (uint8_t*)cred->hint;
hint.size = strlen (cred->hint);
return _gnutls_buffer_append_data_prefix(data, 16, hint.data, hint.size);
@@ -310,7 +310,7 @@ _gnutls_gen_psk_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
/* just read the hint from the server key exchange.
*/
int
-_gnutls_proc_psk_server_kx (gnutls_session_t session, opaque * data,
+_gnutls_proc_psk_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
ssize_t data_size = _data_size;
diff --git a/lib/auth/psk_passwd.c b/lib/auth/psk_passwd.c
index fefb120117..8e60bf2826 100644
--- a/lib/auth/psk_passwd.c
+++ b/lib/auth/psk_passwd.c
@@ -76,7 +76,7 @@ pwd_put_values (gnutls_datum_t * psk, char *str)
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_hex2bin ((opaque *) p, len, psk->data, &size);
+ ret = _gnutls_hex2bin (p, len, psk->data, &size);
psk->size = (unsigned int) size;
if (ret < 0)
{
diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
index 5cbb73cf69..3d1d79affc 100644
--- a/lib/auth/rsa.c
+++ b/lib/auth/rsa.c
@@ -42,7 +42,7 @@
#include <abstract_int.h>
int _gnutls_gen_rsa_client_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_rsa_client_kx (gnutls_session_t, opaque *, size_t);
+static int proc_rsa_client_kx (gnutls_session_t, uint8_t *, size_t);
const mod_auth_st rsa_auth_struct = {
"RSA",
@@ -70,7 +70,7 @@ _gnutls_get_public_rsa_params (gnutls_session_t session,
int ret;
cert_auth_info_t info;
gnutls_pcert_st peer_cert;
- int i;
+ unsigned int i;
/* normal non export case */
@@ -134,7 +134,7 @@ cleanup:
}
static int
-proc_rsa_client_kx (gnutls_session_t session, opaque * data,
+proc_rsa_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
gnutls_datum_t plaintext;
diff --git a/lib/auth/rsa_export.c b/lib/auth/rsa_export.c
index 7150d266ee..63458df2b5 100644
--- a/lib/auth/rsa_export.c
+++ b/lib/auth/rsa_export.c
@@ -44,8 +44,8 @@
int _gnutls_gen_rsa_client_kx (gnutls_session_t, gnutls_buffer_st*);
static int gen_rsa_export_server_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_rsa_export_server_kx (gnutls_session_t, opaque *, size_t);
-static int proc_rsa_export_client_kx (gnutls_session_t session, opaque * data,
+static int proc_rsa_export_server_kx (gnutls_session_t, uint8_t *, size_t);
+static int proc_rsa_export_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size);
const mod_auth_st rsa_export_auth_struct = {
@@ -119,7 +119,7 @@ _gnutls_get_private_rsa_params (gnutls_session_t session,
}
int
-proc_rsa_export_client_kx (gnutls_session_t session, opaque * data,
+proc_rsa_export_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
gnutls_datum_t plaintext;
@@ -371,7 +371,7 @@ _gnutls_peers_cert_less_512 (gnutls_session_t session)
static int
proc_rsa_export_server_kx (gnutls_session_t session,
- opaque * data, size_t _data_size)
+ uint8_t * data, size_t _data_size)
{
uint16_t n_m, n_e;
size_t _n_m, _n_e;
diff --git a/lib/auth/srp.c b/lib/auth/srp.c
index 867a457d79..539c6b3927 100644
--- a/lib/auth/srp.c
+++ b/lib/auth/srp.c
@@ -364,7 +364,7 @@ _gnutls_gen_srp_client_kx (gnutls_session_t session, gnutls_buffer_st* data)
/* just read A and put it to session */
int
-_gnutls_proc_srp_client_kx (gnutls_session_t session, opaque * data,
+_gnutls_proc_srp_client_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
size_t _n_A;
@@ -653,7 +653,7 @@ const gnutls_datum_t gnutls_srp_4096_group_prime = {
/* Check if G and N are parameters from the SRP draft.
*/
static int
-check_g_n (const opaque * g, size_t n_g, const opaque * n, size_t n_n)
+check_g_n (const uint8_t * g, size_t n_g, const uint8_t * n, size_t n_n)
{
if ((n_n == sizeof (srp_params_3072) &&
@@ -807,7 +807,7 @@ error:
/* receive the key exchange message ( n, g, s, B)
*/
int
-_gnutls_proc_srp_server_kx (gnutls_session_t session, opaque * data,
+_gnutls_proc_srp_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
uint8_t n_s;
@@ -818,7 +818,7 @@ _gnutls_proc_srp_server_kx (gnutls_session_t session, opaque * data,
const uint8_t *data_s;
const uint8_t *data_b;
int i, ret;
- opaque hd[SRP_MAX_HASH_SIZE];
+ uint8_t hd[SRP_MAX_HASH_SIZE];
char *username, *password;
ssize_t data_size = _data_size;
gnutls_srp_client_credentials_t cred;
@@ -951,7 +951,7 @@ _gnutls_proc_srp_server_kx (gnutls_session_t session, opaque * data,
* (or the equivalent using bcrypt)
*/
if ((ret =
- _gnutls_calc_srp_x (username, password, (opaque *) data_s, n_s,
+ _gnutls_calc_srp_x (username, password, (uint8_t *) data_s, n_s,
&_n_g, hd)) < 0)
{
gnutls_assert ();
diff --git a/lib/auth/srp.h b/lib/auth/srp.h
index 97f87fbd9d..e2ef6d813c 100644
--- a/lib/auth/srp.h
+++ b/lib/auth/srp.h
@@ -51,15 +51,15 @@ typedef struct srp_server_auth_info_st
#ifdef ENABLE_SRP
int _gnutls_proc_srp_server_hello (gnutls_session_t state,
- const opaque * data, size_t data_size);
-int _gnutls_gen_srp_server_hello (gnutls_session_t state, opaque * data,
+ const uint8_t * data, size_t data_size);
+int _gnutls_gen_srp_server_hello (gnutls_session_t state, uint8_t * data,
size_t data_size);
int _gnutls_gen_srp_server_kx (gnutls_session_t, gnutls_buffer_st*);
int _gnutls_gen_srp_client_kx (gnutls_session_t, gnutls_buffer_st*);
-int _gnutls_proc_srp_server_kx (gnutls_session_t, opaque *, size_t);
-int _gnutls_proc_srp_client_kx (gnutls_session_t, opaque *, size_t);
+int _gnutls_proc_srp_server_kx (gnutls_session_t, uint8_t *, size_t);
+int _gnutls_proc_srp_client_kx (gnutls_session_t, uint8_t *, size_t);
typedef struct srp_server_auth_info_st srp_server_auth_info_st;
diff --git a/lib/auth/srp_passwd.c b/lib/auth/srp_passwd.c
index 0038584ddb..78c9b0bb2c 100644
--- a/lib/auth/srp_passwd.c
+++ b/lib/auth/srp_passwd.c
@@ -49,7 +49,7 @@ pwd_put_values (SRP_PWD_ENTRY * entry, char *str)
{
char *p;
int len, ret;
- opaque *verifier;
+ uint8_t *verifier;
size_t verifier_size;
int indx;
@@ -139,7 +139,7 @@ pwd_put_values2 (SRP_PWD_ENTRY * entry, char *str)
{
char *p;
int len;
- opaque *tmp;
+ uint8_t *tmp;
int ret;
p = strrchr (str, ':'); /* we have g */
diff --git a/lib/auth/srp_passwd.h b/lib/auth/srp_passwd.h
index 9285fd03fa..628d45c4fc 100644
--- a/lib/auth/srp_passwd.h
+++ b/lib/auth/srp_passwd.h
@@ -36,7 +36,7 @@ typedef struct
int _gnutls_srp_pwd_read_entry (gnutls_session_t state, char *username,
SRP_PWD_ENTRY **);
void _gnutls_srp_entry_free (SRP_PWD_ENTRY * entry);
-int _gnutls_sbase64_decode (uint8_t * data, size_t data_size,
+int _gnutls_sbase64_decode (char * data, size_t data_size,
uint8_t ** result);
#endif /* ENABLE_SRP */
diff --git a/lib/auth/srp_rsa.c b/lib/auth/srp_rsa.c
index 3c3d3da99b..d425158a1c 100644
--- a/lib/auth/srp_rsa.c
+++ b/lib/auth/srp_rsa.c
@@ -40,7 +40,7 @@
#include <gnutls_x509.h>
static int gen_srp_cert_server_kx (gnutls_session_t, gnutls_buffer_st*);
-static int proc_srp_cert_server_kx (gnutls_session_t, opaque *, size_t);
+static int proc_srp_cert_server_kx (gnutls_session_t, uint8_t *, size_t);
const mod_auth_st srp_rsa_auth_struct = {
"SRP",
@@ -133,7 +133,7 @@ gen_srp_cert_server_kx (gnutls_session_t session, gnutls_buffer_st* data)
}
static int
-proc_srp_cert_server_kx (gnutls_session_t session, opaque * data,
+proc_srp_cert_server_kx (gnutls_session_t session, uint8_t * data,
size_t _data_size)
{
ssize_t ret;
@@ -142,7 +142,7 @@ proc_srp_cert_server_kx (gnutls_session_t session, opaque * data,
ssize_t data_size;
cert_auth_info_t info;
gnutls_pcert_st peer_cert;
- opaque *p;
+ uint8_t *p;
ret = _gnutls_proc_srp_server_kx (session, data, _data_size);
if (ret < 0)
diff --git a/lib/auth/srp_sb64.c b/lib/auth/srp_sb64.c
index c63b91950a..4298f33342 100644
--- a/lib/auth/srp_sb64.c
+++ b/lib/auth/srp_sb64.c
@@ -147,11 +147,11 @@ encode (uint8_t * result, const uint8_t * rdata, int left)
* The result_size is the return value
*/
static int
-_gnutls_sbase64_encode (uint8_t * data, size_t data_size, uint8_t ** result)
+_gnutls_sbase64_encode (uint8_t * data, size_t data_size, char ** result)
{
unsigned i, j;
int ret, tmp;
- opaque tmpres[4];
+ uint8_t tmpres[4];
int mod = data_size % 3;
ret = mod;
@@ -248,7 +248,7 @@ decode (uint8_t * result, const uint8_t * data)
* before calling it.
*/
int
-_gnutls_sbase64_decode (uint8_t * data, size_t idata_size, uint8_t ** result)
+_gnutls_sbase64_decode (char * data, size_t idata_size, uint8_t ** result)
{
unsigned i, j;
int ret, left;
@@ -291,7 +291,7 @@ _gnutls_sbase64_decode (uint8_t * data, size_t idata_size, uint8_t ** result)
/* rest data */
for (i = left, j = tmp; i < idata_size; i += 4)
{
- tmp = decode (tmpres, &data[i]);
+ tmp = decode (tmpres, (uint8_t*)&data[i]);
if (tmp < 0)
{
gnutls_free ((*result));
@@ -328,23 +328,23 @@ int
gnutls_srp_base64_encode (const gnutls_datum_t * data, char *result,
size_t * result_size)
{
- opaque *ret;
+ char *res;
int size;
- size = _gnutls_sbase64_encode (data->data, data->size, &ret);
+ size = _gnutls_sbase64_encode (data->data, data->size, &res);
if (size < 0)
return size;
if (result == NULL || *result_size < (size_t) size)
{
- gnutls_free (ret);
+ gnutls_free (res);
*result_size = size;
return GNUTLS_E_SHORT_MEMORY_BUFFER;
}
else
{
- memcpy (result, ret, size);
- gnutls_free (ret);
+ memcpy (result, res, size);
+ gnutls_free (res);
*result_size = size;
}
@@ -372,21 +372,21 @@ int
gnutls_srp_base64_encode_alloc (const gnutls_datum_t * data,
gnutls_datum_t * result)
{
- opaque *ret;
+ char *res;
int size;
- size = _gnutls_sbase64_encode (data->data, data->size, &ret);
+ size = _gnutls_sbase64_encode (data->data, data->size, &res);
if (size < 0)
return size;
if (result == NULL)
{
- gnutls_free (ret);
+ gnutls_free (res);
return GNUTLS_E_INVALID_REQUEST;
}
else
{
- result->data = ret;
+ result->data = (uint8_t*)res;
result->size = size;
}
@@ -414,23 +414,23 @@ int
gnutls_srp_base64_decode (const gnutls_datum_t * b64_data, char *result,
size_t * result_size)
{
- opaque *ret;
+ uint8_t *res;
int size;
- size = _gnutls_sbase64_decode (b64_data->data, b64_data->size, &ret);
+ size = _gnutls_sbase64_decode ((char*)b64_data->data, b64_data->size, &res);
if (size < 0)
return size;
if (result == NULL || *result_size < (size_t) size)
{
- gnutls_free (ret);
+ gnutls_free (res);
*result_size = size;
return GNUTLS_E_SHORT_MEMORY_BUFFER;
}
else
{
- memcpy (result, ret, size);
- gnutls_free (ret);
+ memcpy (result, res, size);
+ gnutls_free (res);
*result_size = size;
}
@@ -457,10 +457,10 @@ int
gnutls_srp_base64_decode_alloc (const gnutls_datum_t * b64_data,
gnutls_datum_t * result)
{
- opaque *ret;
+ uint8_t *ret;
int size;
- size = _gnutls_sbase64_decode (b64_data->data, b64_data->size, &ret);
+ size = _gnutls_sbase64_decode ((char*)b64_data->data, b64_data->size, &ret);
if (size < 0)
return size;
diff --git a/lib/ext/cert_type.c b/lib/ext/cert_type.c
index 635e06a26d..857d3efbdd 100644
--- a/lib/ext/cert_type.c
+++ b/lib/ext/cert_type.c
@@ -37,7 +37,7 @@
inline static int _gnutls_num2cert_type (int num);
inline static int _gnutls_cert_type2num (int record_size);
static int _gnutls_cert_type_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_cert_type_send_params (gnutls_session_t session,
gnutls_buffer_st * extdata);
@@ -65,7 +65,7 @@ extension_entry_st ext_mod_cert_type = {
static int
_gnutls_cert_type_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
int new_type = -1, ret, i;
ssize_t data_size = _data_size;
diff --git a/lib/ext/ecc.c b/lib/ext/ecc.c
index bc2ea98b39..c7ff7f5351 100644
--- a/lib/ext/ecc.c
+++ b/lib/ext/ecc.c
@@ -37,13 +37,13 @@
*/
static int _gnutls_supported_ecc_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_supported_ecc_send_params (gnutls_session_t session,
gnutls_buffer_st * extdata);
static int _gnutls_supported_ecc_pf_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_supported_ecc_pf_send_params (gnutls_session_t session,
gnutls_buffer_st * extdata);
@@ -82,12 +82,12 @@ extension_entry_st ext_mod_supported_ecc_pf = {
*/
static int
_gnutls_supported_ecc_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
int new_type = -1, ret, i;
ssize_t data_size = _data_size;
uint16_t len;
- const opaque* p = data;
+ const uint8_t* p = data;
if (session->security_parameters.entity == GNUTLS_CLIENT)
{
@@ -198,7 +198,7 @@ _gnutls_supported_ecc_send_params (gnutls_session_t session, gnutls_buffer_st* e
*/
static int
_gnutls_supported_ecc_pf_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
int len, i;
int uncompressed = 0;
@@ -236,7 +236,7 @@ int data_size = _data_size;
static int
_gnutls_supported_ecc_pf_send_params (gnutls_session_t session, gnutls_buffer_st* extdata)
{
- const opaque p[2] = {0x01, 0x00}; /* only support uncompressed point format */
+ const uint8_t p[2] = {0x01, 0x00}; /* only support uncompressed point format */
if (session->security_parameters.entity == GNUTLS_SERVER && !_gnutls_session_is_ecc(session))
return 0;
@@ -254,7 +254,7 @@ _gnutls_supported_ecc_pf_send_params (gnutls_session_t session, gnutls_buffer_st
* session. A negative error value is returned otherwise.
*/
int
-_gnutls_session_supports_ecc_curve (gnutls_session_t session, int ecc_type)
+_gnutls_session_supports_ecc_curve (gnutls_session_t session, unsigned int ecc_type)
{
unsigned i;
diff --git a/lib/ext/ecc.h b/lib/ext/ecc.h
index d7e70efa71..4307490f07 100644
--- a/lib/ext/ecc.h
+++ b/lib/ext/ecc.h
@@ -28,6 +28,6 @@ extern extension_entry_st ext_mod_supported_ecc;
extern extension_entry_st ext_mod_supported_ecc_pf;
int
-_gnutls_session_supports_ecc_curve (gnutls_session_t session, int ecc_type);
+_gnutls_session_supports_ecc_curve (gnutls_session_t session, unsigned int ecc_type);
#endif
diff --git a/lib/ext/max_record.c b/lib/ext/max_record.c
index 652a6e5aa5..2c45eb5157 100644
--- a/lib/ext/max_record.c
+++ b/lib/ext/max_record.c
@@ -31,7 +31,7 @@
#include <ext/max_record.h>
static int _gnutls_max_record_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_max_record_send_params (gnutls_session_t session,
gnutls_buffer_st* extdata);
@@ -72,7 +72,7 @@ extension_entry_st ext_mod_max_record_size = {
static int
_gnutls_max_record_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
ssize_t new_size;
ssize_t data_size = _data_size;
diff --git a/lib/ext/safe_renegotiation.c b/lib/ext/safe_renegotiation.c
index a94ddca674..503efda762 100644
--- a/lib/ext/safe_renegotiation.c
+++ b/lib/ext/safe_renegotiation.c
@@ -26,7 +26,7 @@
static int _gnutls_sr_recv_params (gnutls_session_t state,
- const opaque * data, size_t data_size);
+ const uint8_t * data, size_t data_size);
static int _gnutls_sr_send_params (gnutls_session_t state, gnutls_buffer_st*);
static void _gnutls_sr_deinit_data (extension_priv_data_t priv);
@@ -283,9 +283,9 @@ _gnutls_ext_sr_send_cs (gnutls_session_t session)
static int
_gnutls_sr_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
- int len = data[0];
+ unsigned int len = data[0];
ssize_t data_size = _data_size;
sr_ext_st *priv;
extension_priv_data_t epriv;
diff --git a/lib/ext/server_name.c b/lib/ext/server_name.c
index 5c6af0ea59..7cd70c87a1 100644
--- a/lib/ext/server_name.c
+++ b/lib/ext/server_name.c
@@ -28,7 +28,7 @@
#include <ext/server_name.h>
static int _gnutls_server_name_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_server_name_send_params (gnutls_session_t session,
gnutls_buffer_st* extdata);
@@ -63,7 +63,7 @@ extension_entry_st ext_mod_server_name = {
*/
static int
_gnutls_server_name_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
int i;
const unsigned char *p;
@@ -418,7 +418,8 @@ static int
_gnutls_server_name_pack (extension_priv_data_t epriv, gnutls_buffer_st * ps)
{
server_name_ext_st *priv = epriv.ptr;
- int i, ret;
+ unsigned int i;
+ int ret;
BUFFER_APPEND_NUM (ps, priv->server_names_size);
for (i = 0; i < priv->server_names_size; i++)
@@ -435,7 +436,8 @@ _gnutls_server_name_unpack (gnutls_buffer_st * ps,
extension_priv_data_t * _priv)
{
server_name_ext_st *priv;
- int i, ret;
+ unsigned int i;
+ int ret;
extension_priv_data_t epriv;
priv = gnutls_calloc (1, sizeof (*priv));
diff --git a/lib/ext/server_name.h b/lib/ext/server_name.h
index 4f94fdb48e..6bf67551c9 100644
--- a/lib/ext/server_name.h
+++ b/lib/ext/server_name.h
@@ -26,7 +26,7 @@
typedef struct
{
- opaque name[MAX_SERVER_NAME_SIZE];
+ uint8_t name[MAX_SERVER_NAME_SIZE];
unsigned name_length;
gnutls_server_name_type_t type;
} server_name_st;
diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c
index a7537f34e5..47e9da2c9f 100644
--- a/lib/ext/session_ticket.c
+++ b/lib/ext/session_ticket.c
@@ -42,7 +42,7 @@
#define MAC_SIZE 32
static int session_ticket_recv_params (gnutls_session_t session,
- const opaque * data, size_t data_size);
+ const uint8_t * data, size_t data_size);
static int session_ticket_send_params (gnutls_session_t session,
gnutls_buffer_st* extdata);
static int session_ticket_unpack (gnutls_buffer_st * ps,
@@ -72,26 +72,26 @@ typedef struct
{
int session_ticket_enable;
int session_ticket_renew;
- opaque session_ticket_IV[SESSION_TICKET_IV_SIZE];
+ uint8_t session_ticket_IV[SESSION_TICKET_IV_SIZE];
- opaque *session_ticket;
+ uint8_t *session_ticket;
int session_ticket_len;
- opaque key[SESSION_KEY_SIZE];
+ uint8_t key[SESSION_KEY_SIZE];
} session_ticket_ext_st;
struct ticket
{
- opaque key_name[KEY_NAME_SIZE];
- opaque IV[IV_SIZE];
- opaque *encrypted_state;
+ uint8_t key_name[KEY_NAME_SIZE];
+ uint8_t IV[IV_SIZE];
+ uint8_t *encrypted_state;
uint16_t encrypted_state_len;
- opaque mac[MAC_SIZE];
+ uint8_t mac[MAC_SIZE];
};
static int
digest_ticket (const gnutls_datum_t * key, struct ticket *ticket,
- opaque * digest)
+ uint8_t * digest)
{
digest_hd_st digest_hd;
uint16_t length16;
@@ -121,7 +121,7 @@ decrypt_ticket (gnutls_session_t session, session_ticket_ext_st * priv,
{
cipher_hd_st cipher_hd;
gnutls_datum_t key, IV, mac_secret, state;
- opaque final[MAC_SECRET_SIZE];
+ uint8_t final[MAC_SECRET_SIZE];
time_t timestamp = gnutls_time (0);
int ret;
@@ -261,7 +261,7 @@ encrypt_ticket (gnutls_session_t session, session_ticket_ext_st * priv,
static int
session_ticket_recv_params (gnutls_session_t session,
- const opaque * data, size_t _data_size)
+ const uint8_t * data, size_t _data_size)
{
ssize_t data_size = _data_size;
session_ticket_ext_st *priv = NULL;
@@ -283,7 +283,7 @@ session_ticket_recv_params (gnutls_session_t session,
if (session->security_parameters.entity == GNUTLS_SERVER)
{
struct ticket ticket;
- const opaque *encrypted_state;
+ const uint8_t *encrypted_state;
int ret;
/* The client requested a new session ticket. */
diff --git a/lib/ext/signature.c b/lib/ext/signature.c
index 019eb9c63f..855a8c4b33 100644
--- a/lib/ext/signature.c
+++ b/lib/ext/signature.c
@@ -34,7 +34,7 @@
#include <abstract_int.h>
static int _gnutls_signature_algorithm_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t data_size);
static int _gnutls_signature_algorithm_send_params (gnutls_session_t session,
gnutls_buffer_st * extdata);
@@ -67,11 +67,11 @@ typedef struct
* by using the setup priorities.
*/
int
-_gnutls_sign_algorithm_write_params (gnutls_session_t session, opaque * data,
+_gnutls_sign_algorithm_write_params (gnutls_session_t session, uint8_t * data,
size_t max_data_size)
{
- opaque *p = data, *len_p;
- int len, i, j;
+ uint8_t *p = data, *len_p;
+ unsigned int len, i, j;
const sign_algorithm_st *aid;
if (max_data_size < (session->internals.priorities.sign_algo.algorithms*2) + 2)
@@ -113,9 +113,9 @@ _gnutls_sign_algorithm_write_params (gnutls_session_t session, opaque * data,
*/
int
_gnutls_sign_algorithm_parse_data (gnutls_session_t session,
- const opaque * data, size_t data_size)
+ const uint8_t * data, size_t data_size)
{
- int sig, i;
+ unsigned int sig, i;
sig_ext_st *priv;
extension_priv_data_t epriv;
@@ -164,7 +164,7 @@ _gnutls_sign_algorithm_parse_data (gnutls_session_t session,
static int
_gnutls_signature_algorithm_recv_params (gnutls_session_t session,
- const opaque * data,
+ const uint8_t * data,
size_t _data_size)
{
ssize_t data_size = _data_size;
@@ -250,7 +250,7 @@ _gnutls_session_get_sign_algo (gnutls_session_t session, gnutls_pcert_st* cert)
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
sig_ext_st *priv;
extension_priv_data_t epriv;
- int cert_algo;
+ unsigned int cert_algo;
cert_algo = gnutls_pubkey_get_pk_algorithm(cert->pubkey, NULL);
diff --git a/lib/ext/signature.h b/lib/ext/signature.h
index d3e00d397f..bab4aa35eb 100644
--- a/lib/ext/signature.h
+++ b/lib/ext/signature.h
@@ -32,9 +32,9 @@ extern extension_entry_st ext_mod_sig;
gnutls_sign_algorithm_t
_gnutls_session_get_sign_algo (gnutls_session_t session, gnutls_pcert_st* cert);
int _gnutls_sign_algorithm_parse_data (gnutls_session_t session,
- const opaque * data, size_t data_size);
+ const uint8_t * data, size_t data_size);
int _gnutls_sign_algorithm_write_params (gnutls_session_t session,
- opaque * data, size_t max_data_size);
+ uint8_t * data, size_t max_data_size);
int _gnutls_session_sign_algo_enabled (gnutls_session_t session,
gnutls_sign_algorithm_t sig);
#endif
diff --git a/lib/ext/srp.c b/lib/ext/srp.c
index 51a1dc8eb8..1d971f719c 100644
--- a/lib/ext/srp.c
+++ b/lib/ext/srp.c
@@ -38,7 +38,7 @@ static int _gnutls_srp_pack (extension_priv_data_t epriv,
gnutls_buffer_st * ps);
static void _gnutls_srp_deinit_data (extension_priv_data_t epriv);
static int _gnutls_srp_recv_params (gnutls_session_t state,
- const opaque * data, size_t data_size);
+ const uint8_t * data, size_t data_size);
static int _gnutls_srp_send_params (gnutls_session_t state, gnutls_buffer_st * extdata);
extension_entry_st ext_mod_srp = {
@@ -55,7 +55,7 @@ extension_entry_st ext_mod_srp = {
static int
-_gnutls_srp_recv_params (gnutls_session_t session, const opaque * data,
+_gnutls_srp_recv_params (gnutls_session_t session, const uint8_t * data,
size_t _data_size)
{
uint8_t len;
@@ -221,9 +221,8 @@ _gnutls_srp_unpack (gnutls_buffer_st * ps, extension_priv_data_t * _priv)
srp_ext_st *priv;
int ret;
extension_priv_data_t epriv;
- gnutls_datum_t username = { NULL, 0 }, password =
- {
- NULL, 0};
+ gnutls_datum_t username = { NULL, 0 };
+ gnutls_datum_t password = { NULL, 0 };
priv = gnutls_calloc (1, sizeof (*priv));
if (priv == NULL)
@@ -235,8 +234,8 @@ _gnutls_srp_unpack (gnutls_buffer_st * ps, extension_priv_data_t * _priv)
BUFFER_POP_DATUM (ps, &username);
BUFFER_POP_DATUM (ps, &password);
- priv->username = username.data;
- priv->password = password.data;
+ priv->username = (char*)username.data;
+ priv->password = (char*)password.data;
epriv.ptr = priv;
*_priv = epriv;
diff --git a/lib/extras/randomart.c b/lib/extras/randomart.c
index 70becaf10b..7b661a9a25 100644
--- a/lib/extras/randomart.c
+++ b/lib/extras/randomart.c
@@ -73,10 +73,10 @@ _gnutls_key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
const char augmentation_string[] = " .o+=*BOX@%&#/^SE";
char *retval, *p;
uint8_t field[FLDSIZE_X][FLDSIZE_Y];
- u_int i, b;
+ unsigned int i, b;
int x, y;
const size_t len = sizeof(augmentation_string) - 2;
- int prefix_len = 0;
+ unsigned int prefix_len = 0;
if (prefix)
prefix_len = strlen(prefix);
diff --git a/lib/gnutls_auth.h b/lib/gnutls_auth.h
index cb686fad50..d431442837 100644
--- a/lib/gnutls_auth.h
+++ b/lib/gnutls_auth.h
@@ -36,15 +36,15 @@ typedef struct mod_auth_st_int
int (*gnutls_generate_server_certificate_request) (gnutls_session_t,
gnutls_buffer_st *);
- int (*gnutls_process_server_certificate) (gnutls_session_t, opaque *,
+ int (*gnutls_process_server_certificate) (gnutls_session_t, uint8_t *,
size_t);
- int (*gnutls_process_client_certificate) (gnutls_session_t, opaque *,
+ int (*gnutls_process_client_certificate) (gnutls_session_t, uint8_t *,
size_t);
- int (*gnutls_process_server_kx) (gnutls_session_t, opaque *, size_t);
- int (*gnutls_process_client_kx) (gnutls_session_t, opaque *, size_t);
- int (*gnutls_process_client_cert_vrfy) (gnutls_session_t, opaque *, size_t);
+ int (*gnutls_process_server_kx) (gnutls_session_t, uint8_t *, size_t);
+ int (*gnutls_process_client_kx) (gnutls_session_t, uint8_t *, size_t);
+ int (*gnutls_process_client_cert_vrfy) (gnutls_session_t, uint8_t *, size_t);
int (*gnutls_process_server_certificate_request) (gnutls_session_t,
- opaque *, size_t);
+ uint8_t *, size_t);
} mod_auth_st;
const void *_gnutls_get_cred (gnutls_key_st key,
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index 6c71fe223b..2576d1759a 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -97,8 +97,8 @@ gnutls_record_check_pending (gnutls_session_t session)
int
_gnutls_record_buffer_get (content_type_t type,
- gnutls_session_t session, opaque * data,
- size_t length, opaque seq[8])
+ gnutls_session_t session, uint8_t * data,
+ size_t length, uint8_t seq[8])
{
gnutls_datum_t msg;
mbuffer_st* bufel;
@@ -152,7 +152,7 @@ _gnutls_dgram_read (gnutls_session_t session, mbuffer_st **bufel,
gnutls_pull_func pull_func)
{
ssize_t i, ret;
- char *ptr;
+ uint8_t *ptr;
size_t max_size = _gnutls_get_max_decrypted_data(session);
size_t recv_size = MAX_RECV_SIZE(session);
gnutls_transport_ptr_t fd = session->internals.transport_recv_ptr;
@@ -226,7 +226,7 @@ _gnutls_stream_read (gnutls_session_t session, mbuffer_st **bufel,
size_t left;
ssize_t i = 0;
size_t max_size = _gnutls_get_max_decrypted_data(session);
- char *ptr;
+ uint8_t *ptr;
gnutls_transport_ptr_t fd = session->internals.transport_recv_ptr;
*bufel = _mbuffer_alloc (0, MAX(max_size, size));
@@ -314,10 +314,11 @@ _gnutls_read (gnutls_session_t session, mbuffer_st **bufel,
static ssize_t
_gnutls_writev_emu (gnutls_session_t session, gnutls_transport_ptr_t fd, const giovec_t * giovec,
- int giovec_cnt)
+ unsigned int giovec_cnt)
{
- int ret = 0, j = 0;
+ unsigned int j = 0;
size_t total = 0;
+ ssize_t ret = 0;
for (j = 0; j < giovec_cnt; j++)
{
@@ -328,7 +329,7 @@ _gnutls_writev_emu (gnutls_session_t session, gnutls_transport_ptr_t fd, const g
total += ret;
- if (ret != giovec[j].iov_len)
+ if ((size_t)ret != giovec[j].iov_len)
break;
}
diff --git a/lib/gnutls_buffers.h b/lib/gnutls_buffers.h
index 22e9d02c56..92b758a28c 100644
--- a/lib/gnutls_buffers.h
+++ b/lib/gnutls_buffers.h
@@ -35,8 +35,8 @@ _gnutls_record_buffer_get_size (content_type_t type, gnutls_session_t session)
}
int _gnutls_record_buffer_get (content_type_t type,
- gnutls_session_t session, opaque * data,
- size_t length, opaque seq[8]);
+ gnutls_session_t session, uint8_t * data,
+ size_t length, uint8_t seq[8]);
ssize_t _gnutls_io_read_buffered (gnutls_session_t, size_t n, content_type_t);
int _gnutls_io_clear_peeked_data (gnutls_session_t session);
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 6da32f42fe..ffe21fb4cd 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -42,13 +42,13 @@
#include <random.h>
static int compressed_to_ciphertext (gnutls_session_t session,
- opaque * cipher_data, int cipher_size,
+ uint8_t * cipher_data, int cipher_size,
gnutls_datum_t *compressed,
content_type_t _type,
record_parameters_st * params);
static int ciphertext_to_compressed (gnutls_session_t session,
gnutls_datum_t *ciphertext,
- opaque * compress_data,
+ uint8_t * compress_data,
int compress_size,
uint8_t type,
record_parameters_st * params, uint64* sequence);
@@ -78,9 +78,9 @@ is_read_comp_null (record_parameters_st * record_params)
* If random pad != 0 then the random pad data will be appended.
*/
int
-_gnutls_encrypt (gnutls_session_t session, const opaque * headers,
- size_t headers_size, const opaque * data,
- size_t data_size, opaque * ciphertext,
+_gnutls_encrypt (gnutls_session_t session, const uint8_t * headers,
+ size_t headers_size, const uint8_t * data,
+ size_t data_size, uint8_t * ciphertext,
size_t ciphertext_size, content_type_t type,
record_parameters_st * params)
{
@@ -90,7 +90,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers,
if (data_size == 0 || is_write_comp_null (params) == 0)
{
- comp.data = (opaque*)data;
+ comp.data = (uint8_t*)data;
comp.size = data_size;
}
else
@@ -140,7 +140,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers,
* Returns the decrypted data length.
*/
int
-_gnutls_decrypt (gnutls_session_t session, opaque * ciphertext,
+_gnutls_decrypt (gnutls_session_t session, uint8_t * ciphertext,
size_t ciphertext_size, uint8_t * data,
size_t max_data_size, content_type_t type,
record_parameters_st * params, uint64 *sequence)
@@ -166,7 +166,7 @@ _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext,
}
else
{
- opaque* tmp_data;
+ uint8_t* tmp_data;
tmp_data = gnutls_malloc(max_data_size);
if (tmp_data == NULL)
@@ -257,12 +257,12 @@ calc_enc_length (gnutls_session_t session, int data_size,
* and are not to be sent). Returns their size.
*/
static inline int
-make_preamble (opaque * uint64_data, opaque type, unsigned int length,
- opaque ver, opaque * preamble)
+make_preamble (uint8_t * uint64_data, uint8_t type, unsigned int length,
+ uint8_t ver, uint8_t * preamble)
{
- opaque minor = _gnutls_version_get_minor (ver);
- opaque major = _gnutls_version_get_major (ver);
- opaque *p = preamble;
+ uint8_t minor = _gnutls_version_get_minor (ver);
+ uint8_t major = _gnutls_version_get_major (ver);
+ uint8_t *p = preamble;
uint16_t c_length;
c_length = _gnutls_conv_uint16 (length);
@@ -290,7 +290,7 @@ make_preamble (opaque * uint64_data, opaque type, unsigned int length,
*/
static int
compressed_to_ciphertext (gnutls_session_t session,
- opaque * cipher_data, int cipher_size,
+ uint8_t * cipher_data, int cipher_size,
gnutls_datum_t *compressed,
content_type_t type,
record_parameters_st * params)
@@ -298,13 +298,13 @@ compressed_to_ciphertext (gnutls_session_t session,
uint8_t * tag_ptr = NULL;
uint8_t pad;
int length, length_to_encrypt, ret;
- opaque preamble[MAX_PREAMBLE_SIZE];
+ uint8_t preamble[MAX_PREAMBLE_SIZE];
int preamble_size;
int tag_size = _gnutls_auth_cipher_tag_len (&params->write.cipher_state);
int blocksize = gnutls_cipher_get_block_size (params->cipher_algorithm);
unsigned block_algo =
_gnutls_cipher_is_block (params->cipher_algorithm);
- opaque *data_ptr;
+ uint8_t *data_ptr;
int ver = gnutls_protocol_get_version (session);
int explicit_iv = _gnutls_version_has_explicit_iv (session->security_parameters.version);
int auth_cipher = _gnutls_auth_cipher_is_aead(&params->write.cipher_state);
@@ -430,7 +430,7 @@ compressed_to_ciphertext (gnutls_session_t session,
static int
ciphertext_to_compressed (gnutls_session_t session,
gnutls_datum_t *ciphertext,
- opaque * compress_data,
+ uint8_t * compress_data,
int compress_size,
uint8_t type, record_parameters_st * params,
uint64* sequence)
@@ -440,11 +440,11 @@ ciphertext_to_compressed (gnutls_session_t session,
int length, length_to_decrypt;
uint16_t blocksize;
int ret, i, pad_failed = 0;
- opaque preamble[MAX_PREAMBLE_SIZE];
- int preamble_size;
- int ver = gnutls_protocol_get_version (session);
- int tag_size = _gnutls_auth_cipher_tag_len (&params->read.cipher_state);
- int explicit_iv = _gnutls_version_has_explicit_iv (session->security_parameters.version);
+ uint8_t preamble[MAX_PREAMBLE_SIZE];
+ unsigned int preamble_size;
+ unsigned int ver = gnutls_protocol_get_version (session);
+ unsigned int tag_size = _gnutls_auth_cipher_tag_len (&params->read.cipher_state);
+ unsigned int explicit_iv = _gnutls_version_has_explicit_iv (session->security_parameters.version);
blocksize = gnutls_cipher_get_block_size (params->cipher_algorithm);
diff --git a/lib/gnutls_cipher.h b/lib/gnutls_cipher.h
index a0b2bffbd0..482fa49633 100644
--- a/lib/gnutls_cipher.h
+++ b/lib/gnutls_cipher.h
@@ -20,13 +20,13 @@
*
*/
-int _gnutls_encrypt (gnutls_session_t session, const opaque * headers,
- size_t headers_size, const opaque * data,
- size_t data_size, opaque * ciphertext,
+int _gnutls_encrypt (gnutls_session_t session, const uint8_t * headers,
+ size_t headers_size, const uint8_t * data,
+ size_t data_size, uint8_t * ciphertext,
size_t ciphertext_size, content_type_t type,
record_parameters_st * params);
-int _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext,
+int _gnutls_decrypt (gnutls_session_t session, uint8_t * ciphertext,
size_t ciphertext_size, uint8_t * data, size_t data_size,
content_type_t type, record_parameters_st * params,
uint64* sequence);
diff --git a/lib/gnutls_cipher_int.h b/lib/gnutls_cipher_int.h
index 5e7b7a1711..77f0d87fed 100644
--- a/lib/gnutls_cipher_int.h
+++ b/lib/gnutls_cipher_int.h
@@ -50,8 +50,8 @@ typedef struct
cipher_setiv_func setiv;
cipher_deinit_func deinit;
- int tag_size;
- int is_aead:1;
+ size_t tag_size;
+ unsigned int is_aead:1;
} cipher_hd_st;
int _gnutls_cipher_init (cipher_hd_st *, gnutls_cipher_algorithm_t cipher,
@@ -59,14 +59,14 @@ int _gnutls_cipher_init (cipher_hd_st *, gnutls_cipher_algorithm_t cipher,
const gnutls_datum_t * iv, int enc);
inline static void _gnutls_cipher_setiv (const cipher_hd_st * handle,
- const void *iv, int ivlen)
+ const void *iv, size_t ivlen)
{
handle->setiv(handle->handle, iv, ivlen);
}
inline static int
_gnutls_cipher_encrypt2 (const cipher_hd_st * handle, const void *text,
- int textlen, void *ciphertext, int ciphertextlen)
+ size_t textlen, void *ciphertext, size_t ciphertextlen)
{
if (handle != NULL && handle->handle != NULL)
{
@@ -79,7 +79,7 @@ _gnutls_cipher_encrypt2 (const cipher_hd_st * handle, const void *text,
inline static int
_gnutls_cipher_decrypt2 (const cipher_hd_st * handle, const void *ciphertext,
- int ciphertextlen, void *text, int textlen)
+ size_t ciphertextlen, void *text, size_t textlen)
{
if (handle != NULL && handle->handle != NULL)
{
@@ -101,7 +101,7 @@ _gnutls_cipher_deinit (cipher_hd_st * handle)
}
int _gnutls_cipher_exists(gnutls_cipher_algorithm_t cipher);
-inline static unsigned int _gnutls_cipher_tag_len( cipher_hd_st * handle)
+inline static size_t _gnutls_cipher_tag_len( cipher_hd_st * handle)
{
return handle->tag_size;
}
@@ -112,7 +112,7 @@ inline static unsigned int _gnutls_cipher_is_aead( cipher_hd_st * handle)
}
/* returns the tag in AUTHENC ciphers */
-inline static void _gnutls_cipher_tag( const cipher_hd_st * handle, void* tag, int tag_size)
+inline static void _gnutls_cipher_tag( const cipher_hd_st * handle, void* tag, size_t tag_size)
{
if (handle != NULL && handle->handle != NULL)
{
@@ -123,7 +123,7 @@ inline static void _gnutls_cipher_tag( const cipher_hd_st * handle, void* tag, i
/* Add auth data for AUTHENC ciphers
*/
inline static int _gnutls_cipher_auth (const cipher_hd_st * handle, const void *text,
- int textlen)
+ size_t textlen)
{
if (handle != NULL && handle->handle != NULL)
{
@@ -145,7 +145,7 @@ typedef struct
unsigned int is_mac:1;
unsigned int ssl_hmac:1;
unsigned int is_null:1;
- int tag_size;
+ size_t tag_size;
} auth_cipher_hd_st;
int _gnutls_auth_cipher_init (auth_cipher_hd_st * handle,
@@ -168,12 +168,12 @@ int _gnutls_auth_cipher_decrypt2 (auth_cipher_hd_st * handle,
int _gnutls_auth_cipher_tag( auth_cipher_hd_st * handle, void* tag, int tag_size);
inline static void _gnutls_auth_cipher_setiv (const auth_cipher_hd_st * handle,
- const void *iv, int ivlen)
+ const void *iv, size_t ivlen)
{
_gnutls_cipher_setiv(&handle->cipher, iv, ivlen);
}
-inline static unsigned int _gnutls_auth_cipher_tag_len( auth_cipher_hd_st * handle)
+inline static size_t _gnutls_auth_cipher_tag_len( auth_cipher_hd_st * handle)
{
return handle->tag_size;
}
diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c
index 792e48440f..eaa342fa80 100644
--- a/lib/gnutls_compress.c
+++ b/lib/gnutls_compress.c
@@ -329,8 +329,8 @@ _gnutls_comp_deinit (comp_hd_st* handle, int d)
*/
int
-_gnutls_compress (comp_hd_st *handle, const opaque * plain,
- size_t plain_size, opaque * compressed,
+_gnutls_compress (comp_hd_st *handle, const uint8_t * plain,
+ size_t plain_size, uint8_t * compressed,
size_t max_comp_size)
{
int compressed_size = GNUTLS_E_COMPRESSION_FAILED;
@@ -383,8 +383,8 @@ _gnutls_compress (comp_hd_st *handle, const opaque * plain,
int
-_gnutls_decompress (comp_hd_st *handle, opaque * compressed,
- size_t compressed_size, opaque * plain,
+_gnutls_decompress (comp_hd_st *handle, uint8_t * compressed,
+ size_t compressed_size, uint8_t * plain,
size_t max_plain_size)
{
int plain_size = GNUTLS_E_DECOMPRESSION_FAILED;
diff --git a/lib/gnutls_compress.h b/lib/gnutls_compress.h
index 0146375606..151e54f6b7 100644
--- a/lib/gnutls_compress.h
+++ b/lib/gnutls_compress.h
@@ -44,11 +44,11 @@ typedef struct comp_hd_st
int _gnutls_comp_init (comp_hd_st*, gnutls_compression_method_t, int d);
void _gnutls_comp_deinit (comp_hd_st* handle, int d);
-int _gnutls_decompress (comp_hd_st* handle, opaque * compressed,
- size_t compressed_size, opaque * plain,
+int _gnutls_decompress (comp_hd_st* handle, uint8_t * compressed,
+ size_t compressed_size, uint8_t * plain,
size_t max_plain_size);
-int _gnutls_compress (comp_hd_st*, const opaque * plain, size_t plain_size,
- opaque * compressed, size_t max_comp_size);
+int _gnutls_compress (comp_hd_st*, const uint8_t * plain, size_t plain_size,
+ uint8_t * compressed, size_t max_comp_size);
struct gnutls_compression_entry
{
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index f44ac43f74..cac88824dc 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -61,13 +61,13 @@ _gnutls_set_keys (gnutls_session_t session, record_parameters_st * params,
{
/* FIXME: This function is too long
*/
- opaque rnd[2 * GNUTLS_RANDOM_SIZE];
- opaque rrnd[2 * GNUTLS_RANDOM_SIZE];
+ uint8_t rnd[2 * GNUTLS_RANDOM_SIZE];
+ uint8_t rrnd[2 * GNUTLS_RANDOM_SIZE];
int pos, ret;
int block_size;
char buf[65];
/* avoid using malloc */
- opaque key_block[2 * MAX_HASH_SIZE + 2 * MAX_CIPHER_KEY_SIZE +
+ uint8_t key_block[2 * MAX_HASH_SIZE + 2 * MAX_CIPHER_KEY_SIZE +
2 * MAX_CIPHER_BLOCK_SIZE];
record_state_st *client_write, *server_write;
@@ -137,9 +137,9 @@ _gnutls_set_keys (gnutls_session_t session, record_parameters_st * params,
if (key_size > 0)
{
- opaque key1[EXPORT_FINAL_KEY_SIZE];
- opaque key2[EXPORT_FINAL_KEY_SIZE];
- opaque *client_write_key, *server_write_key;
+ uint8_t key1[EXPORT_FINAL_KEY_SIZE];
+ uint8_t key2[EXPORT_FINAL_KEY_SIZE];
+ uint8_t *client_write_key, *server_write_key;
int client_write_key_size, server_write_key_size;
if (export_flag == 0)
@@ -254,7 +254,7 @@ _gnutls_set_keys (gnutls_session_t session, record_parameters_st * params,
}
else if (IV_size > 0 && export_flag != 0)
{
- opaque iv_block[MAX_CIPHER_BLOCK_SIZE * 2];
+ uint8_t iv_block[MAX_CIPHER_BLOCK_SIZE * 2];
if (session->security_parameters.version == GNUTLS_SSL3)
{ /* SSL 3 */
@@ -273,7 +273,7 @@ _gnutls_set_keys (gnutls_session_t session, record_parameters_st * params,
}
else
{ /* TLS 1.0 */
- ret = _gnutls_PRF (session, "", 0,
+ ret = _gnutls_PRF (session, (uint8_t*)"", 0,
ivblock, ivblock_length, rrnd,
2 * GNUTLS_RANDOM_SIZE, IV_size * 2, iv_block);
}
diff --git a/lib/gnutls_datum.c b/lib/gnutls_datum.c
index 8218bb3168..0b14c7d74d 100644
--- a/lib/gnutls_datum.c
+++ b/lib/gnutls_datum.c
@@ -33,7 +33,7 @@
void
-_gnutls_write_datum16 (opaque * dest, gnutls_datum_t dat)
+_gnutls_write_datum16 (uint8_t * dest, gnutls_datum_t dat)
{
_gnutls_write_uint16 (dat.size, dest);
if (dat.data != NULL)
@@ -41,7 +41,7 @@ _gnutls_write_datum16 (opaque * dest, gnutls_datum_t dat)
}
void
-_gnutls_write_datum24 (opaque * dest, gnutls_datum_t dat)
+_gnutls_write_datum24 (uint8_t * dest, gnutls_datum_t dat)
{
_gnutls_write_uint24 (dat.size, dest);
if (dat.data != NULL)
@@ -49,7 +49,7 @@ _gnutls_write_datum24 (opaque * dest, gnutls_datum_t dat)
}
void
-_gnutls_write_datum32 (opaque * dest, gnutls_datum_t dat)
+_gnutls_write_datum32 (uint8_t * dest, gnutls_datum_t dat)
{
_gnutls_write_uint32 (dat.size, dest);
if (dat.data != NULL)
@@ -57,7 +57,7 @@ _gnutls_write_datum32 (opaque * dest, gnutls_datum_t dat)
}
void
-_gnutls_write_datum8 (opaque * dest, gnutls_datum_t dat)
+_gnutls_write_datum8 (uint8_t * dest, gnutls_datum_t dat)
{
dest[0] = (uint8_t) dat.size;
if (dat.data != NULL)
diff --git a/lib/gnutls_datum.h b/lib/gnutls_datum.h
index 2c0c95ef20..775a5ca2e8 100644
--- a/lib/gnutls_datum.h
+++ b/lib/gnutls_datum.h
@@ -23,10 +23,10 @@
#ifndef GNUTLS_DATUM_H
#define GNUTLS_DATUM_H
-void _gnutls_write_datum16 (opaque * dest, gnutls_datum_t dat);
-void _gnutls_write_datum24 (opaque * dest, gnutls_datum_t dat);
-void _gnutls_write_datum32 (opaque * dest, gnutls_datum_t dat);
-void _gnutls_write_datum8 (opaque * dest, gnutls_datum_t dat);
+void _gnutls_write_datum16 (uint8_t * dest, gnutls_datum_t dat);
+void _gnutls_write_datum24 (uint8_t * dest, gnutls_datum_t dat);
+void _gnutls_write_datum32 (uint8_t * dest, gnutls_datum_t dat);
+void _gnutls_write_datum8 (uint8_t * dest, gnutls_datum_t dat);
int _gnutls_set_datum_m (gnutls_datum_t * dat, const void *data,
size_t data_size, gnutls_alloc_function);
diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c
index d820ddce45..d5d685220f 100644
--- a/lib/gnutls_dh_primes.c
+++ b/lib/gnutls_dh_primes.c
@@ -230,7 +230,7 @@ gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params,
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
result = _gnutls_fbase64_decode ("DH PARAMETERS",
pkcs3_params->data,
@@ -350,8 +350,8 @@ gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params,
ASN1_TYPE c2;
int result, _params_data_size;
size_t g_size, p_size;
- opaque *p_data, *g_data;
- opaque *all_data;
+ uint8_t *p_data, *g_data;
+ uint8_t *all_data;
_gnutls_mpi_print_lz (params->params[1], NULL, &g_size);
_gnutls_mpi_print_lz (params->params[0], NULL, &p_size);
@@ -442,8 +442,8 @@ gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params,
}
else
{ /* PEM */
- opaque *tmp;
- opaque *out;
+ uint8_t *tmp;
+ uint8_t *out;
int len;
len = 0;
diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index 7ecf003224..3536a87e8a 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -42,7 +42,7 @@ static inline int
transmit_message (gnutls_session_t session,
mbuffer_st *bufel)
{
- opaque *data, *mtu_data;
+ uint8_t *data, *mtu_data;
int ret = 0;
unsigned int offset, frag_len, data_size;
const unsigned int mtu = gnutls_dtls_get_data_mtu(session) - DTLS_HANDSHAKE_HEADER_SIZE;
@@ -519,7 +519,7 @@ int gnutls_dtls_cookie_send(gnutls_datum_t* key, void* client_data, size_t clien
gnutls_dtls_prestate_st* prestate,
gnutls_transport_ptr_t ptr, gnutls_push_func push_func)
{
-opaque hvr[20+DTLS_HANDSHAKE_HEADER_SIZE+COOKIE_SIZE];
+uint8_t hvr[20+DTLS_HANDSHAKE_HEADER_SIZE+COOKIE_SIZE];
int hvr_size = 0, ret;
uint8_t digest[C_HASH_SIZE];
@@ -533,7 +533,7 @@ uint8_t digest[C_HASH_SIZE];
* uint16 epoch; - 2 bytes (0, 0)
* uint48 sequence_number; - 4 bytes (0,0,0,0)
* uint16 length; - 2 bytes (COOKIE_SIZE+1+2)+DTLS_HANDSHAKE_HEADER_SIZE
- * opaque fragment[DTLSPlaintext.length];
+ * uint8_t fragment[DTLSPlaintext.length];
* } DTLSPlaintext;
*
*
@@ -547,7 +547,7 @@ uint8_t digest[C_HASH_SIZE];
*
* struct {
* ProtocolVersion server_version;
- * opaque cookie<0..32>;
+ * uint8_t cookie<0..32>;
* } HelloVerifyRequest;
*/
@@ -622,8 +622,8 @@ int gnutls_dtls_cookie_verify(gnutls_datum_t* key,
void* _msg, size_t msg_size, gnutls_dtls_prestate_st* prestate)
{
gnutls_datum_t cookie;
-int sid_size;
-int pos, ret;
+int ret;
+unsigned int pos, sid_size;
uint8_t * msg = _msg;
uint8_t digest[C_HASH_SIZE];
diff --git a/lib/gnutls_ecc.c b/lib/gnutls_ecc.c
index d9798a3a22..5b52a3c3d2 100644
--- a/lib/gnutls_ecc.c
+++ b/lib/gnutls_ecc.c
@@ -71,7 +71,7 @@ _gnutls_ecc_ansi_x963_export (gnutls_ecc_curve_t curve, bigint_t x, bigint_t y,
int
-_gnutls_ecc_ansi_x963_import (const opaque * in,
+_gnutls_ecc_ansi_x963_import (const uint8_t * in,
unsigned long inlen, bigint_t * x, bigint_t * y)
{
int ret;
diff --git a/lib/gnutls_ecc.h b/lib/gnutls_ecc.h
index 2ae454171b..82216e8a86 100644
--- a/lib/gnutls_ecc.h
+++ b/lib/gnutls_ecc.h
@@ -1,7 +1,7 @@
#ifndef GNUTLS_ECC_H
# define GNUTLS_ECC_H
-int _gnutls_ecc_ansi_x963_import(const opaque *in, unsigned long inlen, bigint_t* x, bigint_t* y);
+int _gnutls_ecc_ansi_x963_import(const uint8_t *in, unsigned long inlen, bigint_t* x, bigint_t* y);
int _gnutls_ecc_ansi_x963_export(gnutls_ecc_curve_t curve, bigint_t x, bigint_t y, gnutls_datum_t * out);
int _gnutls_ecc_curve_fill_params(gnutls_ecc_curve_t curve, gnutls_pk_params_st* params);
#endif
diff --git a/lib/gnutls_extensions.c b/lib/gnutls_extensions.c
index 9a08d15924..54db8d0d57 100644
--- a/lib/gnutls_extensions.c
+++ b/lib/gnutls_extensions.c
@@ -137,12 +137,12 @@ _gnutls_extension_list_check (gnutls_session_t session, uint16_t type)
int
_gnutls_parse_extensions (gnutls_session_t session,
gnutls_ext_parse_type_t parse_type,
- const opaque * data, int data_size)
+ const uint8_t * data, int data_size)
{
int next, ret;
int pos = 0;
uint16_t type;
- const opaque *sdata;
+ const uint8_t *sdata;
gnutls_ext_recv_func ext_recv;
uint16_t size;
@@ -381,7 +381,8 @@ _gnutls_ext_register (extension_entry_st * mod)
int
_gnutls_ext_pack (gnutls_session_t session, gnutls_buffer_st * packed)
{
- int i, ret;
+ unsigned int i;
+ int ret;
extension_priv_data_t data;
int cur_size;
int size_offset;
@@ -597,7 +598,7 @@ _gnutls_ext_unset_resumed_session_data (gnutls_session_t session,
void
_gnutls_ext_free_session_data (gnutls_session_t session)
{
- int i;
+ unsigned int i;
for (i = 0; i < extfunc_size; i++)
{
@@ -619,7 +620,7 @@ void
_gnutls_ext_set_session_data (gnutls_session_t session, uint16_t type,
extension_priv_data_t data)
{
- int i;
+ unsigned int i;
gnutls_ext_deinit_data_func deinit;
deinit = _gnutls_ext_func_deinit (type);
diff --git a/lib/gnutls_extensions.h b/lib/gnutls_extensions.h
index c1d6a8d8ed..9aeae13f4a 100644
--- a/lib/gnutls_extensions.h
+++ b/lib/gnutls_extensions.h
@@ -32,7 +32,7 @@ typedef int (*gnutls_ext_send_func) (gnutls_session_t session,
int _gnutls_parse_extensions (gnutls_session_t session,
gnutls_ext_parse_type_t parse_type,
- const opaque * data, int data_size);
+ const uint8_t * data, int data_size);
int _gnutls_gen_extensions (gnutls_session_t session, gnutls_buffer_st * extdata,
gnutls_ext_parse_type_t);
int _gnutls_ext_init (void);
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 167bb3daf0..b8edb574c9 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -64,7 +64,7 @@
#define FALSE 0
static int _gnutls_server_select_comp_method (gnutls_session_t session,
- opaque * data, int datalen);
+ uint8_t * data, int datalen);
static int
_gnutls_remove_unwanted_ciphersuites (gnutls_session_t session,
uint8_t * cipher_suites,
@@ -88,17 +88,17 @@ _gnutls_handshake_hash_buffer_empty (gnutls_session_t session)
static int
_gnutls_handshake_hash_add_recvd (gnutls_session_t session,
gnutls_handshake_description_t recv_type,
- opaque * header, uint16_t header_size,
- opaque * dataptr, uint32_t datalen);
+ uint8_t * header, uint16_t header_size,
+ uint8_t * dataptr, uint32_t datalen);
static int
_gnutls_handshake_hash_add_sent (gnutls_session_t session,
gnutls_handshake_description_t type,
- opaque * dataptr, uint32_t datalen);
+ uint8_t * dataptr, uint32_t datalen);
static int
_gnutls_recv_hello_verify_request (gnutls_session_t session,
- opaque * data, int datalen);
+ uint8_t * data, int datalen);
/* Clears the handshake hash buffers and handles.
@@ -180,7 +180,7 @@ _gnutls_set_client_random (gnutls_session_t session, uint8_t * rnd)
#define SSL3_SERVER_MSG "SRVR"
#define SSL_MSG_LEN 4
static int
-_gnutls_ssl3_finished (gnutls_session_t session, int type, opaque * ret, int sending)
+_gnutls_ssl3_finished (gnutls_session_t session, int type, uint8_t * ret, int sending)
{
digest_hd_st td_md5;
digest_hd_st td_sha;
@@ -247,7 +247,7 @@ static int
_gnutls_finished (gnutls_session_t session, int type, void *ret, int sending)
{
const int siz = TLS_MSG_LEN;
- opaque concat[MAX_HASH_SIZE + 16 /*MD5 */ ];
+ uint8_t concat[MAX_HASH_SIZE + 16 /*MD5 */ ];
size_t hash_len;
const char *mesg;
int rc, len;
@@ -297,7 +297,7 @@ _gnutls_finished (gnutls_session_t session, int type, void *ret, int sending)
* and put it to dst.
*/
int
-_gnutls_tls_create_random (opaque * dst)
+_gnutls_tls_create_random (uint8_t * dst)
{
uint32_t tim;
int ret;
@@ -387,7 +387,7 @@ _gnutls_user_hello_func (gnutls_session_t session,
* since SSL version 2.0 is not supported).
*/
static int
-_gnutls_read_client_hello (gnutls_session_t session, opaque * data,
+_gnutls_read_client_hello (gnutls_session_t session, uint8_t * data,
int datalen)
{
uint8_t session_id_len;
@@ -396,7 +396,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data,
gnutls_protocol_t adv_version;
int neg_version;
int len = datalen;
- opaque rnd[GNUTLS_RANDOM_SIZE], *suite_ptr, *comp_ptr, *session_id;
+ uint8_t rnd[GNUTLS_RANDOM_SIZE], *suite_ptr, *comp_ptr, *session_id;
DECR_LEN (len, 2);
@@ -598,7 +598,7 @@ static int
_gnutls_send_finished (gnutls_session_t session, int again)
{
mbuffer_st *bufel;
- opaque *data;
+ uint8_t *data;
int ret;
size_t vdata_size = 0;
@@ -765,14 +765,14 @@ cleanup:
* RSA algorithms, PK_DSA if DSS, and PK_ANY for both or PK_NONE for none.
*/
static int
-server_find_pk_algos_in_ciphersuites (const opaque *
+server_find_pk_algos_in_ciphersuites (const uint8_t *
data, unsigned int datalen,
gnutls_pk_algorithm_t * algos,
size_t* algos_size)
{
unsigned int j;
gnutls_kx_algorithm_t kx;
- int max = *algos_size;
+ unsigned int max = *algos_size;
if (datalen % 2 != 0)
{
@@ -800,10 +800,11 @@ server_find_pk_algos_in_ciphersuites (const opaque *
* it adds the suite to the session and performs some checks.
*/
int
-_gnutls_server_select_suite (gnutls_session_t session, opaque * data,
+_gnutls_server_select_suite (gnutls_session_t session, uint8_t * data,
unsigned int datalen)
{
- int i, j, ret, cipher_suites_size;
+ int ret;
+ unsigned int i, j, cipher_suites_size;
size_t pk_algos_size;
uint8_t cipher_suites[MAX_CIPHERSUITE_SIZE];
int retval, err;
@@ -815,7 +816,7 @@ _gnutls_server_select_suite (gnutls_session_t session, opaque * data,
*/
if (session->internals.priorities.sr != SR_DISABLED)
{
- int offset;
+ unsigned int offset;
for (offset = 0; offset < datalen; offset += 2)
{
@@ -976,7 +977,7 @@ finish:
*/
static int
_gnutls_server_select_comp_method (gnutls_session_t session,
- opaque * data, int datalen)
+ uint8_t * data, int datalen)
{
int x, i, j;
uint8_t comps[MAX_ALGOS];
@@ -1185,8 +1186,8 @@ _gnutls_send_handshake (gnutls_session_t session, mbuffer_st * bufel,
static int
_gnutls_handshake_hash_add_recvd (gnutls_session_t session,
gnutls_handshake_description_t recv_type,
- opaque * header, uint16_t header_size,
- opaque * dataptr, uint32_t datalen)
+ uint8_t * header, uint16_t header_size,
+ uint8_t * dataptr, uint32_t datalen)
{
int ret;
@@ -1219,7 +1220,7 @@ _gnutls_handshake_hash_add_recvd (gnutls_session_t session,
static int
_gnutls_handshake_hash_add_sent (gnutls_session_t session,
gnutls_handshake_description_t type,
- opaque * dataptr, uint32_t datalen)
+ uint8_t * dataptr, uint32_t datalen)
{
int ret;
@@ -1359,7 +1360,7 @@ cleanup:
* to the session;
*/
static int
-_gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2])
+_gnutls_client_set_ciphersuite (gnutls_session_t session, uint8_t suite[2])
{
uint8_t z;
uint8_t cipher_suites[MAX_CIPHERSUITE_SIZE];
@@ -1440,7 +1441,7 @@ _gnutls_client_set_ciphersuite (gnutls_session_t session, opaque suite[2])
/* This function sets the given comp method to the session.
*/
static int
-_gnutls_client_set_comp_method (gnutls_session_t session, opaque comp_method)
+_gnutls_client_set_comp_method (gnutls_session_t session, uint8_t comp_method)
{
int comp_methods_num;
uint8_t compression_methods[MAX_ALGOS];
@@ -1485,9 +1486,9 @@ _gnutls_client_set_comp_method (gnutls_session_t session, opaque comp_method)
*/
static int
_gnutls_client_check_if_resuming (gnutls_session_t session,
- opaque * session_id, int session_id_len)
+ uint8_t * session_id, int session_id_len)
{
- opaque buf[2 * TLS_MAX_SESSION_ID_SIZE + 1];
+ char buf[2 * TLS_MAX_SESSION_ID_SIZE + 1];
_gnutls_handshake_log ("HSK[%p]: SessionID length: %d\n", session,
session_id_len);
@@ -1539,7 +1540,7 @@ _gnutls_client_check_if_resuming (gnutls_session_t session,
*/
static int
_gnutls_read_server_hello (gnutls_session_t session,
- opaque * data, int datalen)
+ uint8_t * data, int datalen)
{
uint8_t session_id_len = 0;
int pos = 0;
@@ -1741,10 +1742,10 @@ static int
_gnutls_send_client_hello (gnutls_session_t session, int again)
{
mbuffer_st *bufel = NULL;
- opaque *data = NULL;
+ uint8_t *data = NULL;
int pos = 0, type;
int datalen = 0, ret = 0;
- opaque rnd[GNUTLS_RANDOM_SIZE];
+ uint8_t rnd[GNUTLS_RANDOM_SIZE];
gnutls_protocol_t hver;
gnutls_buffer_st extdata;
int rehandshake = 0;
@@ -1948,13 +1949,13 @@ static int
_gnutls_send_server_hello (gnutls_session_t session, int again)
{
mbuffer_st *bufel = NULL;
- opaque *data = NULL;
+ uint8_t *data = NULL;
gnutls_buffer_st extdata;
int pos = 0;
int datalen, ret = 0;
uint8_t comp;
uint8_t session_id_len = session->security_parameters.session_id_size;
- opaque buf[2 * TLS_MAX_SESSION_ID_SIZE + 1];
+ char buf[2 * TLS_MAX_SESSION_ID_SIZE + 1];
datalen = 0;
@@ -2047,7 +2048,7 @@ _gnutls_send_hello (gnutls_session_t session, int again)
* and internals.compression_method.
*/
int
-_gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen)
+_gnutls_recv_hello (gnutls_session_t session, uint8_t * data, int datalen)
{
int ret;
@@ -2083,7 +2084,7 @@ _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen)
static int
_gnutls_recv_hello_verify_request (gnutls_session_t session,
- opaque * data, int datalen)
+ uint8_t * data, int datalen)
{
ssize_t len = datalen;
size_t pos = 0;
@@ -2569,7 +2570,7 @@ _gnutls_handshake_client (gnutls_session_t session)
static ssize_t
send_change_cipher_spec (gnutls_session_t session, int again)
{
- opaque* data;
+ uint8_t* data;
mbuffer_st * bufel;
int ret;
@@ -2892,7 +2893,7 @@ _gnutls_handshake_common (gnutls_session_t session)
}
int
-_gnutls_generate_session_id (opaque * session_id, uint8_t * len)
+_gnutls_generate_session_id (uint8_t * session_id, uint8_t * len)
{
int ret;
diff --git a/lib/gnutls_handshake.h b/lib/gnutls_handshake.h
index 7cc227147f..42e5b613c8 100644
--- a/lib/gnutls_handshake.h
+++ b/lib/gnutls_handshake.h
@@ -31,20 +31,20 @@ int _gnutls_send_handshake (gnutls_session_t session, mbuffer_st * bufel,
int _gnutls_recv_hello_request (gnutls_session_t session, void *data,
uint32_t data_size);
int _gnutls_send_hello (gnutls_session_t session, int again);
-int _gnutls_recv_hello (gnutls_session_t session, opaque * data, int datalen);
+int _gnutls_recv_hello (gnutls_session_t session, uint8_t * data, int datalen);
int _gnutls_recv_handshake (gnutls_session_t session,
gnutls_handshake_description_t type,
optional_t optional, gnutls_buffer_st* buf);
-int _gnutls_generate_session_id (opaque * session_id, uint8_t * len);
+int _gnutls_generate_session_id (uint8_t * session_id, uint8_t * len);
int _gnutls_handshake_common (gnutls_session_t session);
int _gnutls_handshake_client (gnutls_session_t session);
int _gnutls_handshake_server (gnutls_session_t session);
void _gnutls_set_server_random (gnutls_session_t session, uint8_t * rnd);
void _gnutls_set_client_random (gnutls_session_t session, uint8_t * rnd);
-int _gnutls_tls_create_random (opaque * dst);
+int _gnutls_tls_create_random (uint8_t * dst);
-int _gnutls_find_pk_algos_in_ciphersuites (opaque * data, int datalen);
-int _gnutls_server_select_suite (gnutls_session_t session, opaque * data,
+int _gnutls_find_pk_algos_in_ciphersuites (uint8_t * data, int datalen);
+int _gnutls_server_select_suite (gnutls_session_t session, uint8_t * data,
unsigned int datalen);
int _gnutls_negotiate_version (gnutls_session_t session,
diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c
index e34014b898..22fa2f76d3 100644
--- a/lib/gnutls_hash_int.c
+++ b/lib/gnutls_hash_int.c
@@ -29,7 +29,7 @@
#include <gnutls_hash_int.h>
#include <gnutls_errors.h>
-static int
+static size_t
digest_length (int algo)
{
switch (algo)
@@ -119,7 +119,7 @@ _gnutls_hash_deinit (digest_hd_st * handle, void *digest)
/* returns the output size of the given hash/mac algorithm
*/
-int
+size_t
_gnutls_hash_get_algo_len (gnutls_digest_algorithm_t algorithm)
{
return digest_length (algorithm);
@@ -316,7 +316,7 @@ int
_gnutls_mac_init_ssl3 (digest_hd_st * ret, gnutls_mac_algorithm_t algorithm,
void *key, int keylen)
{
- opaque ipad[48];
+ uint8_t ipad[48];
int padsize, result;
padsize = get_padsize (algorithm);
@@ -348,7 +348,7 @@ _gnutls_mac_init_ssl3 (digest_hd_st * ret, gnutls_mac_algorithm_t algorithm,
void
_gnutls_mac_reset_ssl3 (digest_hd_st * handle)
{
- opaque ipad[48];
+ uint8_t ipad[48];
int padsize;
padsize = get_padsize (handle->algorithm);
@@ -367,9 +367,9 @@ _gnutls_mac_reset_ssl3 (digest_hd_st * handle)
int
_gnutls_mac_output_ssl3 (digest_hd_st * handle, void *digest)
{
- opaque ret[MAX_HASH_SIZE];
+ uint8_t ret[MAX_HASH_SIZE];
digest_hd_st td;
- opaque opad[48];
+ uint8_t opad[48];
int padsize;
int block, rc;
@@ -415,13 +415,13 @@ int ret = 0;
int
_gnutls_mac_deinit_ssl3_handshake (digest_hd_st * handle,
- void *digest, opaque * key,
+ void *digest, uint8_t * key,
uint32_t key_size)
{
- opaque ret[MAX_HASH_SIZE];
+ uint8_t ret[MAX_HASH_SIZE];
digest_hd_st td;
- opaque opad[48];
- opaque ipad[48];
+ uint8_t opad[48];
+ uint8_t ipad[48];
int padsize;
int block, rc;
@@ -466,11 +466,11 @@ cleanup:
}
static int
-ssl3_sha (int i, opaque * secret, int secret_len,
- opaque * rnd, int rnd_len, void *digest)
+ssl3_sha (int i, uint8_t * secret, int secret_len,
+ uint8_t * rnd, int rnd_len, void *digest)
{
int j, ret;
- opaque text1[26];
+ uint8_t text1[26];
digest_hd_st td;
@@ -498,10 +498,10 @@ ssl3_sha (int i, opaque * secret, int secret_len,
#define MD5_DIGEST_OUTPUT 16
static int
-ssl3_md5 (int i, opaque * secret, int secret_len,
- opaque * rnd, int rnd_len, void *digest)
+ssl3_md5 (int i, uint8_t * secret, int secret_len,
+ uint8_t * rnd, int rnd_len, void *digest)
{
- opaque tmp[MAX_HASH_SIZE];
+ uint8_t tmp[MAX_HASH_SIZE];
digest_hd_st td;
int ret;
@@ -531,9 +531,9 @@ ssl3_md5 (int i, opaque * secret, int secret_len,
int
_gnutls_ssl3_hash_md5 (const void *first, int first_len,
const void *second, int second_len,
- int ret_len, opaque * ret)
+ int ret_len, uint8_t * ret)
{
- opaque digest[MAX_HASH_SIZE];
+ uint8_t digest[MAX_HASH_SIZE];
digest_hd_st td;
int block = MD5_DIGEST_OUTPUT;
int rc;
@@ -565,10 +565,10 @@ _gnutls_ssl3_hash_md5 (const void *first, int first_len,
int
_gnutls_ssl3_generate_random (void *secret, int secret_len,
void *rnd, int rnd_len,
- int ret_bytes, opaque * ret)
+ int ret_bytes, uint8_t * ret)
{
int i = 0, copy, output_bytes;
- opaque digest[MAX_HASH_SIZE];
+ uint8_t digest[MAX_HASH_SIZE];
int block = MD5_DIGEST_OUTPUT;
int result, times;
diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h
index 58bfaaee51..40a4f3dc03 100644
--- a/lib/gnutls_hash_int.h
+++ b/lib/gnutls_hash_int.h
@@ -61,7 +61,7 @@ typedef struct
int _gnutls_hmac_exists(gnutls_mac_algorithm_t algorithm);
int _gnutls_hmac_init (digest_hd_st *, gnutls_mac_algorithm_t algorithm,
const void *key, int keylen);
-int _gnutls_hash_get_algo_len (gnutls_digest_algorithm_t algorithm);
+size_t _gnutls_hash_get_algo_len (gnutls_digest_algorithm_t algorithm);
#define _gnutls_hmac_get_algo_len _gnutls_hash_get_algo_len
int _gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void *key,
int keylen, const void *text, size_t textlen,
@@ -80,7 +80,7 @@ _gnutls_hmac (digest_hd_st * handle, const void *text, size_t textlen)
inline static void
_gnutls_hmac_output (digest_hd_st * handle, void *digest)
{
- int maclen;
+ size_t maclen;
maclen = _gnutls_hmac_get_algo_len (handle->algorithm);
@@ -159,15 +159,15 @@ int _gnutls_mac_output_ssl3 (digest_hd_st * handle, void *digest);
int _gnutls_ssl3_generate_random (void *secret, int secret_len,
void *rnd, int random_len, int bytes,
- opaque * ret);
+ uint8_t * ret);
int _gnutls_ssl3_hash_md5 (const void *first, int first_len,
const void *second, int second_len,
- int ret_len, opaque * ret);
+ int ret_len, uint8_t * ret);
void _gnutls_mac_reset_ssl3 (digest_hd_st * handle);
int _gnutls_mac_deinit_ssl3_handshake (digest_hd_st * handle, void *digest,
- opaque * key, uint32_t key_size);
+ uint8_t * key, uint32_t key_size);
int _gnutls_hash_copy (digest_hd_st * dst_handle, digest_hd_st * src_handle);
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 08762612e3..f68a01380e 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -210,10 +210,9 @@ typedef enum transport_t
#define GNUTLS_POINTER_TO_INT(_) ((int) GNUTLS_POINTER_TO_INT_CAST (_))
#define GNUTLS_INT_TO_POINTER(_) ((void*) GNUTLS_POINTER_TO_INT_CAST (_))
-typedef unsigned char opaque;
typedef struct
{
- opaque pint[3];
+ uint8_t pint[3];
} uint24;
#include <gnutls_mpi.h>
@@ -285,7 +284,7 @@ typedef struct
uint32_t start_offset;
uint32_t end_offset;
- opaque header[MAX_HANDSHAKE_HEADER_SIZE];
+ uint8_t header[MAX_HANDSHAKE_HEADER_SIZE];
int header_size;
gnutls_buffer_st data;
@@ -474,10 +473,10 @@ typedef struct
*/
uint8_t cipher_suite[2];
gnutls_compression_method_t compression_method;
- opaque master_secret[GNUTLS_MASTER_SIZE];
- opaque client_random[GNUTLS_RANDOM_SIZE];
- opaque server_random[GNUTLS_RANDOM_SIZE];
- opaque session_id[TLS_MAX_SESSION_ID_SIZE];
+ uint8_t master_secret[GNUTLS_MASTER_SIZE];
+ uint8_t client_random[GNUTLS_RANDOM_SIZE];
+ uint8_t server_random[GNUTLS_RANDOM_SIZE];
+ uint8_t session_id[TLS_MAX_SESSION_ID_SIZE];
uint8_t session_id_size;
time_t timestamp;
@@ -601,7 +600,7 @@ typedef struct
typedef struct
{
/* HelloVerifyRequest DOS prevention cookie */
- opaque cookie[DTLS_MAX_COOKIE_SIZE];
+ uint8_t cookie[DTLS_MAX_COOKIE_SIZE];
uint8_t cookie_len;
/* For DTLS handshake fragmentation and reassembly. */
@@ -779,7 +778,7 @@ typedef struct
/* This holds the default version that our first
* record packet will have. */
- opaque default_record_version[2];
+ uint8_t default_record_version[2];
void *user_ptr;
@@ -807,7 +806,7 @@ typedef struct
* PMS secret. Can be used by clients to test whether the
* server checks that version. (** only used in gnutls-cli-debug)
*/
- opaque rsa_pms_version[2];
+ uint8_t rsa_pms_version[2];
/* Here we cache the DH or RSA parameters got from the
* credentials structure, or from a callback. That is to
diff --git a/lib/gnutls_kx.c b/lib/gnutls_kx.c
index 9596692b34..7b510f0979 100644
--- a/lib/gnutls_kx.c
+++ b/lib/gnutls_kx.c
@@ -42,7 +42,7 @@
internal API is changed to use mbuffers. For now we don't avoid the
extra alloc + memcpy. */
static inline int
-send_handshake (gnutls_session_t session, opaque * data, size_t size,
+send_handshake (gnutls_session_t session, uint8_t * data, size_t size,
gnutls_handshake_description_t type)
{
mbuffer_st *bufel;
@@ -107,7 +107,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster)
if (gnutls_protocol_get_version (session) == GNUTLS_SSL3)
{
- opaque rnd[2 * GNUTLS_RANDOM_SIZE + 1];
+ uint8_t rnd[2 * GNUTLS_RANDOM_SIZE + 1];
memcpy (rnd, session->security_parameters.client_random,
GNUTLS_RANDOM_SIZE);
@@ -124,7 +124,7 @@ generate_normal_master (gnutls_session_t session, int keep_premaster)
}
else
{
- opaque rnd[2 * GNUTLS_RANDOM_SIZE + 1];
+ uint8_t rnd[2 * GNUTLS_RANDOM_SIZE + 1];
memcpy (rnd, session->security_parameters.client_random,
GNUTLS_RANDOM_SIZE);
diff --git a/lib/gnutls_mbuffers.c b/lib/gnutls_mbuffers.c
index 79527814b2..24888655f2 100644
--- a/lib/gnutls_mbuffers.c
+++ b/lib/gnutls_mbuffers.c
@@ -293,7 +293,7 @@ _mbuffer_alloc (size_t payload_size, size_t maximum_size)
}
/* payload points after the mbuffer_st structure */
- st->msg.data = (opaque *) st + sizeof (mbuffer_st);
+ st->msg.data = (uint8_t *) st + sizeof (mbuffer_st);
st->msg.size = payload_size;
st->maximum_size = maximum_size;
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index 4df0373142..12ab1c36af 100644
--- a/lib/gnutls_mpi.c
+++ b/lib/gnutls_mpi.c
@@ -46,8 +46,8 @@ _gnutls_mpi_randomize (bigint_t r, unsigned int bits,
int ret;
int rem, i;
bigint_t tmp;
- char tmpbuf[512];
- opaque *buf;
+ uint8_t tmpbuf[512];
+ uint8_t *buf;
int buf_release = 0;
if (size < sizeof (tmpbuf))
@@ -181,7 +181,7 @@ int
_gnutls_mpi_dprint_lz (const bigint_t a, gnutls_datum_t * dest)
{
int ret;
- opaque *buf = NULL;
+ uint8_t *buf = NULL;
size_t bytes = 0;
if (dest == NULL || a == NULL)
@@ -210,7 +210,7 @@ int
_gnutls_mpi_dprint (const bigint_t a, gnutls_datum_t * dest)
{
int ret;
- opaque *buf = NULL;
+ uint8_t *buf = NULL;
size_t bytes = 0;
if (dest == NULL || a == NULL)
@@ -242,7 +242,7 @@ int
_gnutls_mpi_dprint_size (const bigint_t a, gnutls_datum_t * dest, size_t size)
{
int ret;
- opaque *buf = NULL;
+ uint8_t *buf = NULL;
size_t bytes = 0;
unsigned int i;
@@ -286,7 +286,7 @@ int
_gnutls_x509_read_int (ASN1_TYPE node, const char *value, bigint_t * ret_mpi)
{
int result;
- opaque *tmpstr = NULL;
+ uint8_t *tmpstr = NULL;
int tmpstr_size;
tmpstr_size = 0;
@@ -330,7 +330,7 @@ int
_gnutls_x509_write_int (ASN1_TYPE node, const char *value, bigint_t mpi,
int lz)
{
- opaque *tmpstr;
+ uint8_t *tmpstr;
size_t s_len;
int result;
diff --git a/lib/gnutls_num.c b/lib/gnutls_num.c
index a316c3c6d9..bfc7d8680d 100644
--- a/lib/gnutls_num.c
+++ b/lib/gnutls_num.c
@@ -114,7 +114,7 @@ _gnutls_uint32touint24 (uint32_t num)
/* data should be at least 3 bytes */
uint32_t
-_gnutls_read_uint24 (const opaque * data)
+_gnutls_read_uint24 (const uint8_t * data)
{
uint32_t res;
uint24 num;
@@ -131,7 +131,7 @@ _gnutls_read_uint24 (const opaque * data)
}
void
-_gnutls_write_uint64 (uint64_t num, opaque * data)
+_gnutls_write_uint64 (uint64_t num, uint8_t * data)
{
#ifndef WORDS_BIGENDIAN
num = bswap_64 (num);
@@ -140,7 +140,7 @@ _gnutls_write_uint64 (uint64_t num, opaque * data)
}
void
-_gnutls_write_uint24 (uint32_t num, opaque * data)
+_gnutls_write_uint24 (uint32_t num, uint8_t * data)
{
uint24 tmp;
@@ -155,7 +155,7 @@ _gnutls_write_uint24 (uint32_t num, opaque * data)
}
uint32_t
-_gnutls_read_uint32 (const opaque * data)
+_gnutls_read_uint32 (const uint8_t * data)
{
uint32_t res;
@@ -167,7 +167,7 @@ _gnutls_read_uint32 (const opaque * data)
}
void
-_gnutls_write_uint32 (uint32_t num, opaque * data)
+_gnutls_write_uint32 (uint32_t num, uint8_t * data)
{
#ifndef WORDS_BIGENDIAN
@@ -177,7 +177,7 @@ _gnutls_write_uint32 (uint32_t num, opaque * data)
}
uint16_t
-_gnutls_read_uint16 (const opaque * data)
+_gnutls_read_uint16 (const uint8_t * data)
{
uint16_t res;
memcpy (&res, data, sizeof (uint16_t));
@@ -188,7 +188,7 @@ _gnutls_read_uint16 (const opaque * data)
}
void
-_gnutls_write_uint16 (uint16_t num, opaque * data)
+_gnutls_write_uint16 (uint16_t num, uint8_t * data)
{
#ifndef WORDS_BIGENDIAN
diff --git a/lib/gnutls_num.h b/lib/gnutls_num.h
index 0590184bee..e7632ef656 100644
--- a/lib/gnutls_num.h
+++ b/lib/gnutls_num.h
@@ -29,16 +29,16 @@
uint32_t _gnutls_uint24touint32 (uint24 num);
uint24 _gnutls_uint32touint24 (uint32_t num);
-uint64_t _gnutls_read_uint48 (const opaque * data);
-uint32_t _gnutls_read_uint32 (const opaque * data);
-uint16_t _gnutls_read_uint16 (const opaque * data);
+uint64_t _gnutls_read_uint48 (const uint8_t * data);
+uint32_t _gnutls_read_uint32 (const uint8_t * data);
+uint16_t _gnutls_read_uint16 (const uint8_t * data);
uint32_t _gnutls_conv_uint32 (uint32_t data);
uint16_t _gnutls_conv_uint16 (uint16_t data);
-uint32_t _gnutls_read_uint24 (const opaque * data);
-void _gnutls_write_uint64 (uint64_t num, opaque * data);
-void _gnutls_write_uint24 (uint32_t num, opaque * data);
-void _gnutls_write_uint32 (uint32_t num, opaque * data);
-void _gnutls_write_uint16 (uint16_t num, opaque * data);
+uint32_t _gnutls_read_uint24 (const uint8_t * data);
+void _gnutls_write_uint64 (uint64_t num, uint8_t * data);
+void _gnutls_write_uint24 (uint32_t num, uint8_t * data);
+void _gnutls_write_uint32 (uint32_t num, uint8_t * data);
+void _gnutls_write_uint16 (uint16_t num, uint8_t * data);
uint32_t _gnutls_uint64touint32 (const uint64 *);
int _gnutls_uint64pp (uint64 *);
diff --git a/lib/gnutls_pcert.c b/lib/gnutls_pcert.c
index d87d5a51eb..973402e77f 100644
--- a/lib/gnutls_pcert.c
+++ b/lib/gnutls_pcert.c
@@ -126,7 +126,8 @@ gnutls_pcert_list_import_x509_raw (gnutls_pcert_st * pcerts,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int flags)
{
-int ret, i = 0, j;
+int ret;
+unsigned int i = 0, j;
gnutls_x509_crt_t *crt;
crt = gnutls_malloc((*pcert_max) * sizeof(gnutls_x509_crt_t));
diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c
index 3529c1d203..ef544c1321 100644
--- a/lib/gnutls_pk.c
+++ b/lib/gnutls_pk.c
@@ -47,7 +47,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
{
unsigned int i, pad;
int ret;
- opaque *edata, *ps;
+ uint8_t *edata, *ps;
size_t k, psize;
size_t mod_bits;
gnutls_datum_t to_encrypt, encrypted;
@@ -447,7 +447,7 @@ _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r,
int _gnutls_pk_params_copy (gnutls_pk_params_st * dst, const gnutls_pk_params_st * src)
{
- int i, j;
+ unsigned int i, j;
dst->params_nr = 0;
if (src == NULL || src->params_nr == 0)
diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c
index af01ffda0c..8fcc636399 100644
--- a/lib/gnutls_psk.c
+++ b/lib/gnutls_psk.c
@@ -380,13 +380,13 @@ gnutls_psk_client_get_hint (gnutls_session_t session)
* long enough, or 0 on success.
**/
int
-gnutls_hex_decode (const gnutls_datum_t * hex_data, char *result,
+gnutls_hex_decode (const gnutls_datum_t * hex_data, void *result,
size_t * result_size)
{
int ret;
ret =
- _gnutls_hex2bin (hex_data->data, hex_data->size, (opaque *) result,
+ _gnutls_hex2bin ((char*)hex_data->data, hex_data->size, (uint8_t *) result,
result_size);
if (ret < 0)
return ret;
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index a5ff3ef719..5e7f94a7e7 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -833,7 +833,7 @@ gnutls_pubkey_import (gnutls_pubkey_t key,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
/* Try the first header */
result =
@@ -1473,8 +1473,8 @@ gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key,
int _gnutls_pubkey_compatible_with_sig(gnutls_pubkey_t pubkey, gnutls_protocol_t ver,
gnutls_sign_algorithm_t sign)
{
-int hash_size;
-int hash_algo;
+unsigned int hash_size;
+unsigned int hash_algo;
if (pubkey->pk_algorithm == GNUTLS_PK_DSA)
{
@@ -1540,8 +1540,8 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text,
{
gnutls_mac_algorithm_t hash = GNUTLS_MAC_UNKNOWN;
int ret;
- opaque digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE], *cmp;
- int digest_size;
+ uint8_t digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE], *cmp;
+ unsigned int digest_size;
digest_hd_st hd;
gnutls_datum_t decrypted;
@@ -1616,8 +1616,8 @@ dsa_verify_hashed_data (const gnutls_datum_t * hash,
gnutls_pk_params_st* params)
{
gnutls_datum_t digest;
- gnutls_digest_algorithm_t algo;
- int hash_len;
+ unsigned int algo;
+ unsigned int hash_len;
algo = _gnutls_dsa_q_to_hash (pk, params, &hash_len);
@@ -1645,7 +1645,7 @@ dsa_verify_data (gnutls_pk_algorithm_t pk,
gnutls_pk_params_st* params)
{
int ret;
- opaque _digest[MAX_HASH_SIZE];
+ uint8_t _digest[MAX_HASH_SIZE];
gnutls_datum_t digest;
digest_hd_st hd;
@@ -1749,7 +1749,8 @@ pubkey_verify_data (gnutls_pk_algorithm_t pk,
}
gnutls_digest_algorithm_t
-_gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo, const gnutls_pk_params_st* params, int* hash_len)
+_gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo, const gnutls_pk_params_st* params,
+ unsigned int* hash_len)
{
int bits = 0;
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index 85b37a38a9..cec3d92948 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -269,7 +269,7 @@ session_is_valid (gnutls_session_t session)
*/
inline static void
copy_record_version (gnutls_session_t session,
- gnutls_handshake_description_t htype, opaque version[2])
+ gnutls_handshake_description_t htype, uint8_t version[2])
{
gnutls_protocol_t lver;
@@ -488,7 +488,7 @@ check_recv_type (gnutls_session_t session, content_type_t recv_type)
*/
static int
check_buffers (gnutls_session_t session, content_type_t type,
- opaque * data, int data_size, void* seq)
+ uint8_t * data, int data_size, void* seq)
{
if ((type == GNUTLS_APPLICATION_DATA ||
type == GNUTLS_HANDSHAKE ||
@@ -516,7 +516,7 @@ check_buffers (gnutls_session_t session, content_type_t type,
*/
inline static int
record_check_version (gnutls_session_t session,
- gnutls_handshake_description_t htype, opaque version[2])
+ gnutls_handshake_description_t htype, uint8_t version[2])
{
if (htype == GNUTLS_HANDSHAKE_CLIENT_HELLO)
{
@@ -973,7 +973,7 @@ begin:
if (decrypted == NULL)
return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
- ciphertext = (opaque*)_mbuffer_get_udata_ptr(bufel) + record.header_size;
+ ciphertext = (uint8_t*)_mbuffer_get_udata_ptr(bufel) + record.header_size;
/* decrypt the data we got.
*/
@@ -1115,7 +1115,7 @@ recv_error:
ssize_t
_gnutls_recv_int (gnutls_session_t session, content_type_t type,
gnutls_handshake_description_t htype,
- opaque * data, size_t data_size, void* seq)
+ uint8_t * data, size_t data_size, void* seq)
{
int ret;
diff --git a/lib/gnutls_record.h b/lib/gnutls_record.h
index a46a5ec03f..b171591a20 100644
--- a/lib/gnutls_record.h
+++ b/lib/gnutls_record.h
@@ -31,7 +31,7 @@ ssize_t _gnutls_send_int (gnutls_session_t session, content_type_t type,
unsigned int epoch_rel, const void *data,
size_t sizeofdata, unsigned int mflags);
ssize_t _gnutls_recv_int (gnutls_session_t session, content_type_t type,
- gnutls_handshake_description_t, opaque * data,
+ gnutls_handshake_description_t, uint8_t * data,
size_t sizeofdata, void* seq);
int _gnutls_get_max_decrypted_data(gnutls_session_t session);
diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c
index 6c163d9df1..ca7202252b 100644
--- a/lib/gnutls_session.c
+++ b/lib/gnutls_session.c
@@ -193,7 +193,7 @@ gnutls_session_set_data (gnutls_session_t session,
int ret;
gnutls_datum_t psession;
- psession.data = (opaque *) session_data;
+ psession.data = (uint8_t *) session_data;
psession.size = session_data_size;
if (session_data == NULL || session_data_size == 0)
diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c
index e7b34c7978..aec35b77cd 100644
--- a/lib/gnutls_session_pack.c
+++ b/lib/gnutls_session_pack.c
@@ -82,7 +82,7 @@ _gnutls_session_pack (gnutls_session_t session,
{
int ret;
gnutls_buffer_st sb;
- opaque id;
+ uint8_t id;
if (packed_session == NULL)
{
@@ -173,7 +173,7 @@ _gnutls_session_unpack (gnutls_session_t session,
{
int ret;
gnutls_buffer_st sb;
- opaque id;
+ uint8_t id;
_gnutls_buffer_init (&sb);
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index 004934b488..78aee30776 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -69,7 +69,7 @@ _gnutls_handshake_sign_data (gnutls_session_t session, gnutls_pcert_st* cert,
gnutls_datum_t dconcat;
int ret;
digest_hd_st td_sha;
- opaque concat[MAX_SIG_SIZE];
+ uint8_t concat[MAX_SIG_SIZE];
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
gnutls_digest_algorithm_t hash_algo;
@@ -350,7 +350,7 @@ _gnutls_handshake_verify_data (gnutls_session_t session, gnutls_pcert_st* cert,
int ret;
digest_hd_st td_md5;
digest_hd_st td_sha;
- opaque concat[MAX_SIG_SIZE];
+ uint8_t concat[MAX_SIG_SIZE];
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
gnutls_digest_algorithm_t hash_algo;
@@ -443,7 +443,7 @@ _gnutls_handshake_verify_cert_vrfy12 (gnutls_session_t session,
gnutls_sign_algorithm_t sign_algo)
{
int ret;
- opaque concat[MAX_HASH_SIZE];
+ uint8_t concat[MAX_HASH_SIZE];
gnutls_datum_t dconcat;
gnutls_digest_algorithm_t hash_algo;
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
@@ -486,7 +486,7 @@ _gnutls_handshake_verify_cert_vrfy (gnutls_session_t session,
gnutls_sign_algorithm_t sign_algo)
{
int ret;
- opaque concat[MAX_SIG_SIZE];
+ uint8_t concat[MAX_SIG_SIZE];
digest_hd_st td_md5;
digest_hd_st td_sha;
gnutls_datum_t dconcat;
@@ -580,7 +580,7 @@ _gnutls_handshake_sign_cert_vrfy12 (gnutls_session_t session,
{
gnutls_datum_t dconcat;
int ret;
- opaque concat[MAX_SIG_SIZE];
+ uint8_t concat[MAX_SIG_SIZE];
gnutls_sign_algorithm_t sign_algo;
gnutls_digest_algorithm_t hash_algo;
@@ -633,7 +633,7 @@ _gnutls_handshake_sign_cert_vrfy (gnutls_session_t session,
{
gnutls_datum_t dconcat;
int ret;
- opaque concat[MAX_SIG_SIZE];
+ uint8_t concat[MAX_SIG_SIZE];
digest_hd_st td_md5;
digest_hd_st td_sha;
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
@@ -795,7 +795,7 @@ pk_prepare_hash (gnutls_pk_algorithm_t pk,
int
decode_ber_digest_info (const gnutls_datum_t * info,
gnutls_mac_algorithm_t * hash,
- opaque * digest, int *digest_size)
+ uint8_t * digest, unsigned int *digest_size)
{
ASN1_TYPE dinfo = ASN1_TYPE_EMPTY;
int result;
@@ -852,14 +852,18 @@ decode_ber_digest_info (const gnutls_datum_t * info,
return GNUTLS_E_ASN1_GENERIC_ERROR;
}
- result = asn1_read_value (dinfo, "digest", digest, digest_size);
+ len = *digest_size;
+ result = asn1_read_value (dinfo, "digest", digest, &len);
+
if (result != ASN1_SUCCESS)
{
gnutls_assert ();
+ *digest_size = len;
asn1_delete_structure (&dinfo);
return _gnutls_asn2err (result);
}
+ *digest_size = len;
asn1_delete_structure (&dinfo);
return 0;
@@ -876,7 +880,7 @@ encode_ber_digest_info (gnutls_digest_algorithm_t hash,
ASN1_TYPE dinfo = ASN1_TYPE_EMPTY;
int result;
const char *algo;
- opaque *tmp_output;
+ uint8_t *tmp_output;
int tmp_output_size;
algo = _gnutls_x509_mac_to_oid ((gnutls_mac_algorithm_t) hash);
diff --git a/lib/gnutls_sig.h b/lib/gnutls_sig.h
index 950d365575..420b27368c 100644
--- a/lib/gnutls_sig.h
+++ b/lib/gnutls_sig.h
@@ -67,6 +67,6 @@ _gnutls_privkey_sign_hash (gnutls_privkey_t key,
int
decode_ber_digest_info (const gnutls_datum_t * info,
gnutls_mac_algorithm_t * hash,
- opaque * digest, int *digest_size);
+ uint8_t * digest, unsigned int *digest_size);
#endif
diff --git a/lib/gnutls_srp.c b/lib/gnutls_srp.c
index d4d59972f4..1046e04f8b 100644
--- a/lib/gnutls_srp.c
+++ b/lib/gnutls_srp.c
@@ -41,7 +41,7 @@
*/
static int
-_gnutls_srp_gx (opaque * text, size_t textsize, opaque ** result,
+_gnutls_srp_gx (uint8_t * text, size_t textsize, uint8_t ** result,
bigint_t g, bigint_t prime)
{
bigint_t x, e;
@@ -170,7 +170,7 @@ bigint_t
_gnutls_calc_srp_u (bigint_t A, bigint_t B, bigint_t n)
{
size_t b_size, a_size;
- opaque *holder, hd[MAX_HASH_SIZE];
+ uint8_t *holder, hd[MAX_HASH_SIZE];
size_t holder_size, hash_size, n_size;
int ret;
bigint_t res;
@@ -289,11 +289,11 @@ _gnutls_calc_srp_A (bigint_t * a, bigint_t g, bigint_t n)
*/
static int
_gnutls_calc_srp_sha (const char *username, const char *password,
- opaque * salt, int salt_size, size_t * size,
+ uint8_t * salt, int salt_size, size_t * size,
void *digest)
{
digest_hd_st td;
- opaque res[MAX_HASH_SIZE];
+ uint8_t res[MAX_HASH_SIZE];
int ret;
*size = 20;
@@ -324,7 +324,7 @@ _gnutls_calc_srp_sha (const char *username, const char *password,
}
int
-_gnutls_calc_srp_x (char *username, char *password, opaque * salt,
+_gnutls_calc_srp_x (char *username, char *password, uint8_t * salt,
size_t salt_size, size_t * size, void *digest)
{
@@ -688,7 +688,7 @@ gnutls_srp_verifier (const char *username, const char *password,
bigint_t _n, _g;
int ret;
size_t digest_size = 20, size;
- opaque digest[20];
+ uint8_t digest[20];
ret = _gnutls_calc_srp_sha (username, password, salt->data,
salt->size, &digest_size, digest);
diff --git a/lib/gnutls_srp.h b/lib/gnutls_srp.h
index cb632d69b3..c04f7a614a 100644
--- a/lib/gnutls_srp.h
+++ b/lib/gnutls_srp.h
@@ -30,9 +30,9 @@ bigint_t _gnutls_calc_srp_S1 (bigint_t A, bigint_t b, bigint_t u, bigint_t v,
bigint_t _gnutls_calc_srp_A (bigint_t * a, bigint_t g, bigint_t n);
bigint_t _gnutls_calc_srp_S2 (bigint_t B, bigint_t g, bigint_t x, bigint_t a,
bigint_t u, bigint_t n);
-int _gnutls_calc_srp_x (char *username, char *password, opaque * salt,
+int _gnutls_calc_srp_x (char *username, char *password, uint8_t * salt,
size_t salt_size, size_t * size, void *digest);
-int _gnutls_srp_gn (opaque ** ret_g, opaque ** ret_n, int bits);
+int _gnutls_srp_gn (uint8_t ** ret_g, uint8_t ** ret_n, int bits);
/* g is defined to be 2 */
#define SRP_MAX_HASH_SIZE 24
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index ef6cf5f387..3d7317f31f 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -806,14 +806,14 @@ _gnutls_cal_PRF_A (gnutls_mac_algorithm_t algorithm,
*/
static int
P_hash (gnutls_mac_algorithm_t algorithm,
- const opaque * secret, int secret_size,
- const opaque * seed, int seed_size,
- int total_bytes, opaque * ret)
+ const uint8_t * secret, int secret_size,
+ const uint8_t * seed, int seed_size,
+ int total_bytes, uint8_t * ret)
{
digest_hd_st td2;
int i, times, how, blocksize, A_size;
- opaque final[MAX_HASH_SIZE], Atmp[MAX_SEED_SIZE];
+ uint8_t final[MAX_HASH_SIZE], Atmp[MAX_SEED_SIZE];
int output_bytes, result;
if (seed_size > MAX_SEED_SIZE || total_bytes <= 0)
@@ -889,14 +889,14 @@ P_hash (gnutls_mac_algorithm_t algorithm,
*/
int
_gnutls_PRF (gnutls_session_t session,
- const opaque * secret, unsigned int secret_size, const char *label,
- int label_size, const opaque * seed, int seed_size,
+ const uint8_t * secret, unsigned int secret_size, const char *label,
+ int label_size, const uint8_t * seed, int seed_size,
int total_bytes, void *ret)
{
int l_s, s_seed_size;
- const opaque *s1, *s2;
- opaque s_seed[MAX_SEED_SIZE];
- opaque o1[MAX_PRF_BYTES], o2[MAX_PRF_BYTES];
+ const uint8_t *s1, *s2;
+ uint8_t s_seed[MAX_SEED_SIZE];
+ uint8_t o1[MAX_PRF_BYTES], o2[MAX_PRF_BYTES];
int result;
gnutls_protocol_t ver = gnutls_protocol_get_version (session);
@@ -1009,7 +1009,7 @@ gnutls_prf_raw (gnutls_session_t session,
session->security_parameters.master_secret,
GNUTLS_MASTER_SIZE,
label,
- label_size, (opaque *) seed, seed_size, outsize, out);
+ label_size, (uint8_t *) seed, seed_size, outsize, out);
return ret;
}
@@ -1051,7 +1051,7 @@ gnutls_prf (gnutls_session_t session,
size_t extra_size, const char *extra, size_t outsize, char *out)
{
int ret;
- opaque *seed;
+ uint8_t *seed;
size_t seedsize = 2 * GNUTLS_RANDOM_SIZE + extra_size;
seed = gnutls_malloc (seedsize);
diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h
index 491d71287c..b2e5511f16 100644
--- a/lib/gnutls_state.h
+++ b/lib/gnutls_state.h
@@ -76,9 +76,9 @@ int _gnutls_session_is_psk (gnutls_session_t session);
int _gnutls_openpgp_send_fingerprint (gnutls_session_t session);
int _gnutls_PRF (gnutls_session_t session,
- const opaque * secret, unsigned int secret_size,
+ const uint8_t * secret, unsigned int secret_size,
const char *label, int label_size,
- const opaque * seed, int seed_size,
+ const uint8_t * seed, int seed_size,
int total_bytes, void *ret);
#define DEFAULT_CERT_TYPE GNUTLS_CRT_X509
diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c
index 11fec4ae77..0d6d087f8d 100644
--- a/lib/gnutls_str.c
+++ b/lib/gnutls_str.c
@@ -355,7 +355,7 @@ _gnutls_buffer_escape (gnutls_buffer_st * dest, int all,
{
int rv = -1;
char t[5];
- int pos = 0;
+ unsigned int pos = 0;
while (pos < dest->length)
{
@@ -390,7 +390,7 @@ int
_gnutls_buffer_unescape (gnutls_buffer_st * dest)
{
int rv = -1;
- int pos = 0;
+ unsigned int pos = 0;
while (pos < dest->length)
{
@@ -430,7 +430,7 @@ _gnutls_bin2hex (const void *_old, size_t oldlen,
char *buffer, size_t buffer_size, const char *separator)
{
unsigned int i, j;
- const opaque *old = _old;
+ const uint8_t *old = _old;
int step = 2;
const char empty[] = "";
@@ -476,17 +476,17 @@ _gnutls_bin2hex (const void *_old, size_t oldlen,
**/
int
gnutls_hex2bin (const char *hex_data,
- size_t hex_size, char *bin_data, size_t * bin_size)
+ size_t hex_size, void *bin_data, size_t * bin_size)
{
- return _gnutls_hex2bin (hex_data, (int) hex_size, bin_data, bin_size);
+ return _gnutls_hex2bin (hex_data, hex_size, (void*)bin_data, bin_size);
}
int
-_gnutls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data,
+_gnutls_hex2bin (const char * hex_data, size_t hex_size, uint8_t * bin_data,
size_t * bin_size)
{
- int i, j;
- opaque hex2_data[3];
+ unsigned int i, j;
+ uint8_t hex2_data[3];
unsigned long val;
hex2_data[2] = 0;
@@ -578,7 +578,7 @@ _gnutls_hostname_compare (const char *certname,
int
_gnutls_buffer_append_prefix (gnutls_buffer_st * buf, int pfx_size, size_t data_size)
{
- opaque ss[4];
+ uint8_t ss[4];
if (pfx_size == 32)
{
@@ -732,24 +732,26 @@ _gnutls_buffer_pop_data_prefix (gnutls_buffer_st * buf, void *data,
void
_gnutls_buffer_hexprint (gnutls_buffer_st * str,
- const char *data, size_t len)
+ const void *_data, size_t len)
{
size_t j;
+ const unsigned char* data = _data;
if (len == 0)
_gnutls_buffer_append_str (str, "00");
else
{
for (j = 0; j < len; j++)
- _gnutls_buffer_append_printf (str, "%.2x", (unsigned char) data[j]);
+ _gnutls_buffer_append_printf (str, "%.2x", (unsigned) data[j]);
}
}
void
-_gnutls_buffer_hexdump (gnutls_buffer_st * str, const char *data, size_t len,
+_gnutls_buffer_hexdump (gnutls_buffer_st * str, const void *_data, size_t len,
const char *spc)
{
size_t j;
+ const unsigned char* data = _data;
if (spc)
_gnutls_buffer_append_str (str, spc);
@@ -757,14 +759,14 @@ _gnutls_buffer_hexdump (gnutls_buffer_st * str, const char *data, size_t len,
{
if (((j + 1) % 16) == 0)
{
- _gnutls_buffer_append_printf (str, "%.2x\n", (unsigned char) data[j]);
+ _gnutls_buffer_append_printf (str, "%.2x\n", (unsigned)data[j]);
if (spc && j != (len - 1))
_gnutls_buffer_append_str (str, spc);
}
else if (j == (len - 1))
- _gnutls_buffer_append_printf (str, "%.2x", (unsigned char) data[j]);
+ _gnutls_buffer_append_printf (str, "%.2x", (unsigned)data[j]);
else
- _gnutls_buffer_append_printf (str, "%.2x:", (unsigned char) data[j]);
+ _gnutls_buffer_append_printf (str, "%.2x:", (unsigned)data[j]);
}
if ((j % 16) != 0)
_gnutls_buffer_append_str (str, "\n");
diff --git a/lib/gnutls_str.h b/lib/gnutls_str.h
index 5a063ff69b..965d2fc3a7 100644
--- a/lib/gnutls_str.h
+++ b/lib/gnutls_str.h
@@ -33,8 +33,8 @@ void _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src);
typedef struct
{
- opaque *allocd; /* pointer to allocated data */
- opaque *data; /* API: pointer to data to copy from */
+ uint8_t *allocd; /* pointer to allocated data */
+ uint8_t *data; /* API: pointer to data to copy from */
size_t max_length;
size_t length; /* API: current length */
} gnutls_buffer_st;
@@ -93,15 +93,15 @@ int _gnutls_buffer_append_printf (gnutls_buffer_st * dest, const char *fmt,
__attribute__ ((format (printf, 2, 3)));
void _gnutls_buffer_hexprint (gnutls_buffer_st * str,
- const char *data, size_t len);
-void _gnutls_buffer_hexdump (gnutls_buffer_st * str, const char *data,
+ const void *data, size_t len);
+void _gnutls_buffer_hexdump (gnutls_buffer_st * str, const void *data,
size_t len, const char *spc);
void _gnutls_buffer_asciiprint (gnutls_buffer_st * str,
const char *data, size_t len);
char *_gnutls_bin2hex (const void *old, size_t oldlen, char *buffer,
size_t buffer_size, const char *separator);
-int _gnutls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data,
+int _gnutls_hex2bin (const char * hex_data, size_t hex_size, uint8_t * bin_data,
size_t * bin_size);
int _gnutls_hostname_compare (const char *certname, size_t certnamesize,
diff --git a/lib/gnutls_str_array.h b/lib/gnutls_str_array.h
index 31d40556a5..fdf3a1d987 100644
--- a/lib/gnutls_str_array.h
+++ b/lib/gnutls_str_array.h
@@ -33,7 +33,7 @@
typedef struct gnutls_str_array_st
{
char* str;
- int len;
+ unsigned int len;
struct gnutls_str_array_st* next;
} *gnutls_str_array_t;
@@ -70,7 +70,7 @@ inline static int _gnutls_str_array_match (gnutls_str_array_t head, const char*
inline static void append(gnutls_str_array_t array, const char* str, int len)
{
- array->str = ((uint8_t*)array) + sizeof(struct gnutls_str_array_st);
+ array->str = ((char*)array) + sizeof(struct gnutls_str_array_st);
memcpy(array->str, str, len);
array->str[len] = 0;
array->len = len;
diff --git a/lib/gnutls_supplemental.c b/lib/gnutls_supplemental.c
index 80c72f5722..70c1af79ee 100644
--- a/lib/gnutls_supplemental.c
+++ b/lib/gnutls_supplemental.c
@@ -49,7 +49,7 @@
#include "gnutls_num.h"
typedef int (*supp_recv_func) (gnutls_session_t session,
- const opaque * data, size_t data_size);
+ const uint8_t * data, size_t data_size);
typedef int (*supp_send_func) (gnutls_session_t session,
gnutls_buffer_st * buf);
@@ -159,7 +159,7 @@ int
_gnutls_parse_supplemental (gnutls_session_t session,
const uint8_t * data, int datalen)
{
- const opaque *p = data;
+ const uint8_t *p = data;
ssize_t dsize = datalen;
size_t total_size;
diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c
index 0f4bba9e49..a82dc648a8 100644
--- a/lib/gnutls_ui.c
+++ b/lib/gnutls_ui.c
@@ -59,11 +59,11 @@ int gnutls_random_art (gnutls_random_art_t type,
if (type != GNUTLS_RANDOM_ART_OPENSSH)
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
- art->data = _gnutls_key_fingerprint_randomart(fpr, fpr_size, key_type, key_size, NULL);
+ art->data = (void*)_gnutls_key_fingerprint_randomart(fpr, fpr_size, key_type, key_size, NULL);
if (art->data == NULL)
return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
- art->size = strlen(art->data);
+ art->size = strlen((char*)art->data);
return 0;
}
diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c
index aada12bafd..1876d3f0d8 100644
--- a/lib/gnutls_v2_compat.c
+++ b/lib/gnutls_v2_compat.c
@@ -45,10 +45,11 @@
/* This selects the best supported ciphersuite from the ones provided */
static int
_gnutls_handshake_select_v2_suite (gnutls_session_t session,
- opaque * data, unsigned int datalen)
+ uint8_t * data, unsigned int datalen)
{
- int i, j, ret;
- opaque *_data;
+ unsigned int i, j;
+ int ret;
+ uint8_t *_data;
int _datalen;
_gnutls_handshake_log ("HSK[%p]: Parsing a version 2.0 client hello.\n",
@@ -90,7 +91,7 @@ _gnutls_handshake_select_v2_suite (gnutls_session_t session,
* However they set their version to 3.0 or 3.1.
*/
int
-_gnutls_read_client_hello_v2 (gnutls_session_t session, opaque * data,
+_gnutls_read_client_hello_v2 (gnutls_session_t session, uint8_t * data,
unsigned int datalen)
{
uint16_t session_id_len = 0;
@@ -98,11 +99,11 @@ _gnutls_read_client_hello_v2 (gnutls_session_t session, opaque * data,
int ret = 0;
uint16_t sizeOfSuites;
gnutls_protocol_t adv_version;
- opaque rnd[GNUTLS_RANDOM_SIZE];
+ uint8_t rnd[GNUTLS_RANDOM_SIZE];
int len = datalen;
int err;
uint16_t challenge;
- opaque session_id[TLS_MAX_SESSION_ID_SIZE];
+ uint8_t session_id[TLS_MAX_SESSION_ID_SIZE];
DECR_LEN (len, 2);
diff --git a/lib/gnutls_v2_compat.h b/lib/gnutls_v2_compat.h
index 613af139e3..5ea43b9f49 100644
--- a/lib/gnutls_v2_compat.h
+++ b/lib/gnutls_v2_compat.h
@@ -20,5 +20,5 @@
*
*/
-int _gnutls_read_client_hello_v2 (gnutls_session_t session, opaque * data,
+int _gnutls_read_client_hello_v2 (gnutls_session_t session, uint8_t * data,
unsigned int datalen);
diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index 4f51be798b..c048feadf3 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -196,7 +196,7 @@ _gnutls_x509_cert_verify_peers (gnutls_session_t session,
static int
_gnutls_check_key_cert_match (gnutls_certificate_credentials_t res)
{
- unsigned int pk = gnutls_pubkey_get_pk_algorithm(res->certs[res->ncerts-1].cert_list[0].pubkey, NULL);
+ int pk = gnutls_pubkey_get_pk_algorithm(res->certs[res->ncerts-1].cert_list[0].pubkey, NULL);
if (gnutls_privkey_get_pk_algorithm (res->pkey[res->ncerts - 1], NULL) !=
pk)
@@ -301,7 +301,7 @@ parse_der_cert_mem (gnutls_certificate_credentials_t res,
goto cleanup;
}
- tmp.data = (opaque *) input_cert;
+ tmp.data = (uint8_t *) input_cert;
tmp.size = input_cert_size;
ret = gnutls_x509_crt_import (crt, &tmp, GNUTLS_X509_FMT_DER);
@@ -534,7 +534,7 @@ read_key_mem (gnutls_certificate_credentials_t res,
if (key)
{
- tmp.data = (opaque *) key;
+ tmp.data = (uint8_t *) key;
tmp.size = key_size;
ret = _gnutls_x509_raw_privkey_to_privkey (&privkey, &tmp, type);
@@ -1338,7 +1338,7 @@ _gnutls_check_key_usage (const gnutls_pcert_st* cert, gnutls_kx_algorithm_t alg)
static int
parse_pem_ca_mem (gnutls_certificate_credentials_t res,
- const opaque * input_cert, int input_cert_size)
+ const uint8_t * input_cert, int input_cert_size)
{
gnutls_x509_crt_t *x509_cert_list;
unsigned int x509_ncerts;
@@ -1568,7 +1568,7 @@ gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_t cred,
}
#endif
- cas.data = read_binary_file (cafile, &size);
+ cas.data = (void*)read_binary_file (cafile, &size);
if (cas.data == NULL)
{
gnutls_assert ();
@@ -1594,7 +1594,7 @@ gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_t cred,
static int
parse_pem_crl_mem (gnutls_x509_trust_list_t tlist,
- const opaque * input_crl, int input_crl_size)
+ const char * input_crl, unsigned int input_crl_size)
{
gnutls_x509_crl_t *x509_crl_list;
unsigned int x509_ncrls;
@@ -1629,7 +1629,7 @@ cleanup:
*/
static int
parse_der_crl_mem (gnutls_x509_trust_list_t tlist,
- const void *input_crl, int input_crl_size)
+ const void *input_crl, unsigned int input_crl_size)
{
gnutls_x509_crl_t crl;
gnutls_datum_t tmp;
@@ -1789,7 +1789,7 @@ gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t res,
{
int ret;
size_t size;
- char *data = read_binary_file (crlfile, &size);
+ char *data = (void*)read_binary_file (crlfile, &size);
if (data == NULL)
{
@@ -1827,8 +1827,8 @@ parse_pkcs12 (gnutls_certificate_credentials_t res,
int ret;
size_t cert_id_size = 0;
size_t key_id_size = 0;
- opaque cert_id[20];
- opaque key_id[20];
+ uint8_t cert_id[20];
+ uint8_t key_id[20];
int privkey_ok = 0;
*cert = NULL;
@@ -2154,7 +2154,7 @@ int
size_t size;
int ret;
- p12blob.data = read_binary_file (pkcs12file, &size);
+ p12blob.data = (void*)read_binary_file (pkcs12file, &size);
p12blob.size = (unsigned int) size;
if (p12blob.data == NULL)
{
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 2af7ae5884..f3dfed064f 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -1438,7 +1438,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
int gnutls_hex_encode (const gnutls_datum_t * data, char *result,
size_t * result_size);
- int gnutls_hex_decode (const gnutls_datum_t * hex_data, char *result,
+ int gnutls_hex_decode (const gnutls_datum_t * hex_data, void *result,
size_t * result_size);
void
@@ -1639,7 +1639,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
gnutls_params_function * func);
int gnutls_hex2bin (const char *hex_data, size_t hex_size,
- char *bin_data, size_t * bin_size);
+ void *bin_data, size_t * bin_size);
/* Gnutls error codes. The mapping to a TLS alert is also shown in
* comments.
diff --git a/lib/includes/gnutls/pkcs11.h b/lib/includes/gnutls/pkcs11.h
index 01c19010fc..91976616a3 100644
--- a/lib/includes/gnutls/pkcs11.h
+++ b/lib/includes/gnutls/pkcs11.h
@@ -287,7 +287,7 @@ gnutls_pkcs11_token_init (const char *token_url,
const char *so_pin, const char *label);
int
-gnutls_pkcs11_token_get_mechanism (const char *url, int idx,
+gnutls_pkcs11_token_get_mechanism (const char *url, unsigned int idx,
unsigned long *mechanism);
int gnutls_pkcs11_token_set_pin (const char *token_url,
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index 7597639d1e..c001142d51 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -192,7 +192,7 @@ extern "C"
unsigned int seq,
int what,
gnutls_datum_t * data,
- int *critical);
+ unsigned int *critical);
#define GNUTLS_CRL_REASON_UNUSED 128
#define GNUTLS_CRL_REASON_KEY_COMPROMISE 64
@@ -508,7 +508,7 @@ extern "C"
int gnutls_x509_crl_get_extension_info (gnutls_x509_crl_t crl, int indx,
void *oid, size_t * sizeof_oid,
- int *critical);
+ unsigned int *critical);
int gnutls_x509_crl_get_extension_data (gnutls_x509_crl_t crl, int indx,
void *data, size_t * sizeof_data);
diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c
index 09750a3458..ce01ed7637 100644
--- a/lib/nettle/cipher.c
+++ b/lib/nettle/cipher.c
@@ -217,7 +217,7 @@ static int
wrap_nettle_cipher_setkey (void *_ctx, const void *key, size_t keysize)
{
struct nettle_cipher_ctx *ctx = _ctx;
- opaque des_key[DES3_KEY_SIZE];
+ uint8_t des_key[DES3_KEY_SIZE];
switch (ctx->algo)
{
diff --git a/lib/nettle/egd.c b/lib/nettle/egd.c
index 9deaa49168..efe98229af 100644
--- a/lib/nettle/egd.c
+++ b/lib/nettle/egd.c
@@ -74,7 +74,8 @@ do_write (int fd, void *buf, size_t nbytes)
static int
do_read (int fd, void *buf, size_t nbytes)
{
- int n, nread = 0;
+ int n;
+ size_t nread = 0;
do
{
@@ -84,7 +85,11 @@ do_read (int fd, void *buf, size_t nbytes)
}
while (n == -1 && errno == EINTR);
if (n == -1)
- return nread ? nread : -1;
+ {
+ if (nread > 0)
+ return nread;
+ else return -1;
+ }
if (n == 0)
return -1;
nread += n;
@@ -188,17 +193,16 @@ _rndegd_connect_socket (void)
int
_rndegd_read (int *fd, void *_output, size_t _length)
{
- int n;
+ ssize_t n;
uint8_t buffer[256 + 2];
int nbytes;
int do_restart = 0;
unsigned char *output = _output;
- size_t length = _length;
+ ssize_t length = (ssize_t)_length;
if (!length)
return 0;
-
restart:
if (*fd == -1 || do_restart)
*fd = _rndegd_connect_socket ();
diff --git a/lib/nettle/mpi.c b/lib/nettle/mpi.c
index 173bbca97e..47568744c1 100644
--- a/lib/nettle/mpi.c
+++ b/lib/nettle/mpi.c
@@ -68,7 +68,7 @@ wrap_nettle_mpi_print (const bigint_t a, void *buffer, size_t * nbytes,
if (format == GNUTLS_MPI_FORMAT_PGP)
{
- opaque *buf = buffer;
+ uint8_t *buf = buffer;
unsigned int nbits = _gnutls_mpi_get_nbits (a);
buf[0] = (nbits >> 8) & 0xff;
buf[1] = (nbits) & 0xff;
@@ -121,7 +121,7 @@ wrap_nettle_mpi_scan (const void *buffer, size_t nbytes,
}
else if (format == GNUTLS_MPI_FORMAT_PGP)
{
- const opaque *buf = buffer;
+ const uint8_t *buf = buffer;
size_t size;
if (nbytes < 3)
@@ -417,7 +417,7 @@ gen_group (mpz_t * prime, mpz_t * generator, unsigned int nbits, unsigned int *q
{
mpz_t q, w, r;
unsigned int p_bytes = nbits / 8;
- opaque *buffer = NULL;
+ uint8_t *buffer = NULL;
unsigned int q_bytes, w_bytes, r_bytes, w_bits;
int ret;
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
index ad9c1979f0..854af79456 100644
--- a/lib/nettle/pk.c
+++ b/lib/nettle/pk.c
@@ -369,7 +369,9 @@ _wrap_nettle_pk_sign (gnutls_pk_algorithm_t algo,
const gnutls_datum_t * vdata,
const gnutls_pk_params_st * pk_params)
{
- int ret, hash;
+ int ret;
+ unsigned int hash;
+ unsigned int hash_len;
switch (algo)
{
@@ -377,7 +379,6 @@ _wrap_nettle_pk_sign (gnutls_pk_algorithm_t algo,
{
ecc_key priv;
struct dsa_signature sig;
- int hash_len;
_ecc_params_to_privkey(pk_params, &priv);
@@ -418,7 +419,6 @@ _wrap_nettle_pk_sign (gnutls_pk_algorithm_t algo,
struct dsa_public_key pub;
struct dsa_private_key priv;
struct dsa_signature sig;
- int hash_len;
memset(&priv, 0, sizeof(priv));
memset(&pub, 0, sizeof(pub));
@@ -550,7 +550,7 @@ _wrap_nettle_pk_verify (gnutls_pk_algorithm_t algo,
const gnutls_pk_params_st * pk_params)
{
int ret;
- int hash_len;
+ unsigned int hash_len;
bigint_t tmp[2] = { NULL, NULL };
switch (algo)
@@ -670,8 +670,8 @@ wrap_nettle_pk_generate_params (gnutls_pk_algorithm_t algo,
unsigned int level /*bits */ ,
gnutls_pk_params_st * params)
{
- int ret, i;
- int q_bits;
+ int ret;
+ unsigned int i, q_bits;
memset(params, 0, sizeof(*params));
diff --git a/lib/nettle/rnd.c b/lib/nettle/rnd.c
index 336f594c54..1704edcdea 100644
--- a/lib/nettle/rnd.c
+++ b/lib/nettle/rnd.c
@@ -227,7 +227,7 @@ static int
do_device_source_urandom (int init)
{
time_t now = gnutls_time (NULL);
- int read_size = DEVICE_READ_SIZE;
+ unsigned int read_size = DEVICE_READ_SIZE;
if (init)
{
@@ -292,7 +292,7 @@ static int
do_device_source_egd (int init)
{
time_t now = gnutls_time (NULL);
- int read_size = DEVICE_READ_SIZE;
+ unsigned int read_size = DEVICE_READ_SIZE;
if (init)
{
diff --git a/lib/opencdk/context.h b/lib/opencdk/context.h
index da4a441dd0..380d2e35b5 100644
--- a/lib/opencdk/context.h
+++ b/lib/opencdk/context.h
@@ -84,7 +84,7 @@ struct cdk_ctx_s
cdk_keydb_hd_t pub;
unsigned int close_db:1;
} db;
- char *(*passphrase_cb) (void *opaque, const char *prompt);
+ char *(*passphrase_cb) (void *uint8_t, const char *prompt);
void *passphrase_cb_value;
};
diff --git a/lib/opencdk/filters.h b/lib/opencdk/filters.h
index 47b0200a86..2af2fa4086 100644
--- a/lib/opencdk/filters.h
+++ b/lib/opencdk/filters.h
@@ -92,18 +92,18 @@ typedef struct
/*-- armor.c -*/
-int _cdk_filter_armor (void *opaque, int ctl, FILE * in, FILE * out);
+int _cdk_filter_armor (void *uint8_t, int ctl, FILE * in, FILE * out);
/*-- cipher.c --*/
-cdk_error_t _cdk_filter_hash (void *opaque, int ctl, FILE * in, FILE * out);
-cdk_error_t _cdk_filter_cipher (void *opaque, int ctl, FILE * in, FILE * out);
+cdk_error_t _cdk_filter_hash (void *uint8_t, int ctl, FILE * in, FILE * out);
+cdk_error_t _cdk_filter_cipher (void *uint8_t, int ctl, FILE * in, FILE * out);
/*-- literal.c --*/
-int _cdk_filter_literal (void *opaque, int ctl, FILE * in, FILE * out);
-int _cdk_filter_text (void *opaque, int ctl, FILE * in, FILE * out);
+int _cdk_filter_literal (void *uint8_t, int ctl, FILE * in, FILE * out);
+int _cdk_filter_text (void *uint8_t, int ctl, FILE * in, FILE * out);
/*-- compress.c --*/
-cdk_error_t _cdk_filter_compress (void *opaque, int ctl,
+cdk_error_t _cdk_filter_compress (void *uint8_t, int ctl,
FILE * in, FILE * out);
#endif /* CDK_FILTERS_H */
diff --git a/lib/opencdk/kbnode.c b/lib/opencdk/kbnode.c
index 73816ed5ad..8d0d6fe440 100644
--- a/lib/opencdk/kbnode.c
+++ b/lib/opencdk/kbnode.c
@@ -571,7 +571,7 @@ cdk_kbnode_write_to_mem (cdk_kbnode_t node, byte * buf, size_t * r_nbytes)
/**
* cdk_kbnode_hash:
* @node: the key node
- * @hashctx: opaque pointer to the hash context
+ * @hashctx: uint8_t pointer to the hash context
* @is_v4: OpenPGP signature (yes=1, no=0)
* @pkttype: packet type to hash (if (0) use the packet type from the node)
* @flags: flags which depend on the operation
diff --git a/lib/opencdk/main.h b/lib/opencdk/main.h
index 41e0281f7c..5eaf5bc1e4 100644
--- a/lib/opencdk/main.h
+++ b/lib/opencdk/main.h
@@ -150,7 +150,7 @@ cdk_error_t _cdk_sig_complete (cdk_pkt_signature_t sig, cdk_pkt_seckey_t sk,
void _cdk_stream_set_compress_algo (cdk_stream_t s, int algo);
cdk_error_t _cdk_stream_open_mode (const char *file, const char *mode,
cdk_stream_t * ret_s);
-void *_cdk_stream_get_opaque (cdk_stream_t s, int fid);
+void *_cdk_stream_get_uint8_t (cdk_stream_t s, int fid);
const char *_cdk_stream_get_fname (cdk_stream_t s);
FILE *_cdk_stream_get_fp (cdk_stream_t s);
int _cdk_stream_gets (cdk_stream_t s, char *buf, size_t count);
diff --git a/lib/opencdk/stream.c b/lib/opencdk/stream.c
index 38066d8f1f..bc5adbbc5f 100644
--- a/lib/opencdk/stream.c
+++ b/lib/opencdk/stream.c
@@ -115,7 +115,7 @@ _cdk_stream_open_mode (const char *file, const char *mode,
/**
* cdk_stream_new_from_cbs:
* @cbs: the callback context with all user callback functions
- * @opa: opaque handle which is passed to all callbacks.
+ * @opa: uint8_t handle which is passed to all callbacks.
* @ret_s: the allocated stream
*
* This function creates a stream which uses user callback
@@ -495,7 +495,7 @@ cdk_stream_close (cdk_stream_t s)
{
f2 = f->next;
if (f->fnct)
- f->fnct (f->opaque, STREAMCTL_FREE, NULL, NULL);
+ f->fnct (f->uint8_t, STREAMCTL_FREE, NULL, NULL);
cdk_free (f);
f = f2;
}
@@ -632,30 +632,30 @@ filter_search (cdk_stream_t s, filter_fnct_t fnc)
}
static inline void
-set_opaque (struct stream_filter_s *f)
+set_uint8_t (struct stream_filter_s *f)
{
switch (f->type)
{
case fARMOR:
- f->opaque = &f->u.afx;
+ f->uint8_t = &f->u.afx;
break;
case fCIPHER:
- f->opaque = &f->u.cfx;
+ f->uint8_t = &f->u.cfx;
break;
case fLITERAL:
- f->opaque = &f->u.pfx;
+ f->uint8_t = &f->u.pfx;
break;
case fCOMPRESS:
- f->opaque = &f->u.zfx;
+ f->uint8_t = &f->u.zfx;
break;
case fHASH:
- f->opaque = &f->u.mfx;
+ f->uint8_t = &f->u.mfx;
break;
case fTEXT:
- f->opaque = &f->u.tfx;
+ f->uint8_t = &f->u.tfx;
break;
default:
- f->opaque = NULL;
+ f->uint8_t = NULL;
}
}
@@ -679,7 +679,7 @@ filter_add (cdk_stream_t s, filter_fnct_t fnc, int type)
f->tmp = NULL;
f->type = type;
- set_opaque (f);
+ set_uint8_t (f);
return f;
}
@@ -811,7 +811,7 @@ stream_filter_write (cdk_stream_t s)
if (rc)
break;
}
- rc = f->fnct (f->opaque, f->ctl, s->fp, f->tmp);
+ rc = f->fnct (f->uint8_t, f->ctl, s->fp, f->tmp);
_gnutls_read_log ("filter [write]: type=%d rc=%d\n", f->type, rc);
if (!rc)
rc = stream_fp_replace (s, &f->tmp);
@@ -862,7 +862,7 @@ stream_filter_read (cdk_stream_t s)
rc = CDK_File_Error;
break;
}
- rc = f->fnct (f->opaque, f->ctl, s->fp, f->tmp);
+ rc = f->fnct (f->uint8_t, f->ctl, s->fp, f->tmp);
_gnutls_read_log ("filter %s [read]: type=%d rc=%d\n",
s->fname ? s->fname : "[temp]", f->type, rc);
if (rc)
@@ -901,7 +901,7 @@ stream_filter_read (cdk_stream_t s)
void *
-_cdk_stream_get_opaque (cdk_stream_t s, int fid)
+_cdk_stream_get_uint8_t (cdk_stream_t s, int fid)
{
struct stream_filter_s *f;
@@ -911,7 +911,7 @@ _cdk_stream_get_opaque (cdk_stream_t s, int fid)
for (f = s->filters; f; f = f->next)
{
if ((int) f->type == fid)
- return f->opaque;
+ return f->uint8_t;
}
return NULL;
}
diff --git a/lib/opencdk/stream.h b/lib/opencdk/stream.h
index ec91a5aa4a..a0b431088c 100644
--- a/lib/opencdk/stream.h
+++ b/lib/opencdk/stream.h
@@ -38,7 +38,7 @@ enum
};
/* Type definition for the filter function. */
-typedef cdk_error_t (*filter_fnct_t) (void *opaque, int ctl, FILE * in,
+typedef cdk_error_t (*filter_fnct_t) (void *uint8_t, int ctl, FILE * in,
FILE * out);
/* The stream filter context structure. */
@@ -46,7 +46,7 @@ struct stream_filter_s
{
struct stream_filter_s *next;
filter_fnct_t fnct;
- void *opaque;
+ void *uint8_t;
FILE *tmp;
union
{
diff --git a/lib/opencdk/write-packet.c b/lib/opencdk/write-packet.c
index c4ee7fd7b3..5f795dabf2 100644
--- a/lib/opencdk/write-packet.c
+++ b/lib/opencdk/write-packet.c
@@ -543,7 +543,7 @@ write_secret_key (cdk_stream_t out, cdk_pkt_seckey_t sk,
size += calc_mpisize (sk->mpi, nskey);
}
else /* We do not know anything about the encrypted mpi's so we
- treat the data as opaque. */
+ treat the data as uint8_t. */
size += sk->enclen;
pkttype = is_subkey ? CDK_PKT_SECRET_SUBKEY : CDK_PKT_SECRET_KEY;
diff --git a/lib/openpgp/extras.c b/lib/openpgp/extras.c
index 5cc51c39bd..37f5b0786a 100644
--- a/lib/openpgp/extras.c
+++ b/lib/openpgp/extras.c
@@ -127,7 +127,7 @@ gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t keyring,
cdk_error_t err;
cdk_stream_t input = NULL;
size_t raw_len = 0;
- opaque *raw_data = NULL;
+ uint8_t *raw_data = NULL;
if (data->data == NULL || data->size == 0)
{
diff --git a/lib/openpgp/gnutls_openpgp.c b/lib/openpgp/gnutls_openpgp.c
index af266e665d..b6cc7976de 100644
--- a/lib/openpgp/gnutls_openpgp.c
+++ b/lib/openpgp/gnutls_openpgp.c
@@ -183,7 +183,7 @@ cleanup:
int
gnutls_openpgp_get_key (gnutls_datum_t * key,
gnutls_openpgp_keyring_t keyring, key_attr_t by,
- opaque * pattern)
+ uint8_t * pattern)
{
cdk_kbnode_t knode = NULL;
unsigned long keyid[2];
@@ -453,7 +453,7 @@ gnutls_certificate_set_openpgp_key_file2 (gnutls_certificate_credentials_t
return GNUTLS_E_FILE_ERROR;
}
- cert.data = read_binary_file (certfile, &size);
+ cert.data = (void*)read_binary_file (certfile, &size);
cert.size = (unsigned int) size;
if (cert.data == NULL)
{
@@ -461,7 +461,7 @@ gnutls_certificate_set_openpgp_key_file2 (gnutls_certificate_credentials_t
return GNUTLS_E_FILE_ERROR;
}
- key.data = read_binary_file (keyfile, &size);
+ key.data = (void*)read_binary_file (keyfile, &size);
key.size = (unsigned int) size;
if (key.data == NULL)
{
@@ -550,7 +550,7 @@ gnutls_certificate_set_openpgp_keyring_file (gnutls_certificate_credentials_t c,
return GNUTLS_E_INVALID_REQUEST;
}
- ring.data = read_binary_file (file, &size);
+ ring.data = (void*)read_binary_file (file, &size);
ring.size = (unsigned int) size;
if (ring.data == NULL)
{
@@ -584,7 +584,7 @@ gnutls_certificate_set_openpgp_keyring_file (gnutls_certificate_credentials_t c,
**/
int
gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t
- c, const opaque * data,
+ c, const uint8_t * data,
size_t dlen,
gnutls_openpgp_crt_fmt_t format)
{
@@ -632,7 +632,7 @@ gnutls_certificate_set_openpgp_keyring_mem (gnutls_certificate_credentials_t
int
_gnutls_openpgp_request_key (gnutls_session_t session, gnutls_datum_t * ret,
const gnutls_certificate_credentials_t cred,
- opaque * key_fpr, int key_fpr_size)
+ uint8_t * key_fpr, int key_fpr_size)
{
int rc = 0;
diff --git a/lib/openpgp/gnutls_openpgp.h b/lib/openpgp/gnutls_openpgp.h
index b5616b8a58..59ff2abeba 100644
--- a/lib/openpgp/gnutls_openpgp.h
+++ b/lib/openpgp/gnutls_openpgp.h
@@ -22,7 +22,7 @@ int gnutls_openpgp_count_key_names (const gnutls_datum_t * cert);
int gnutls_openpgp_get_key (gnutls_datum_t * key,
gnutls_openpgp_keyring_t keyring,
- key_attr_t by, opaque * pattern);
+ key_attr_t by, uint8_t * pattern);
/* internal */
int
@@ -32,7 +32,7 @@ int
_gnutls_openpgp_request_key (gnutls_session_t,
gnutls_datum_t * ret,
const gnutls_certificate_credentials_t cred,
- opaque * key_fpr, int key_fpr_size);
+ uint8_t * key_fpr, int key_fpr_size);
int _gnutls_openpgp_verify_key (const gnutls_certificate_credentials_t,
const gnutls_datum_t * cert_list,
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index 4f25eee248..1f1b73223f 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -98,7 +98,7 @@ print_key_id (gnutls_buffer_st * str, gnutls_openpgp_crt_t cert, int idx)
static void
print_key_fingerprint (gnutls_buffer_st * str, gnutls_openpgp_crt_t cert)
{
- char fpr[128];
+ uint8_t fpr[128];
size_t fpr_size = sizeof (fpr);
int err;
const char* name;
@@ -500,6 +500,7 @@ gnutls_openpgp_crt_print (gnutls_openpgp_crt_t cert,
gnutls_datum_t * out)
{
gnutls_buffer_st str;
+ int ret;
_gnutls_buffer_init (&str);
@@ -514,8 +515,8 @@ gnutls_openpgp_crt_print (gnutls_openpgp_crt_t cert,
_gnutls_buffer_append_data (&str, "\0", 1);
- out->data = str.data;
- out->size = strlen (str.data);
-
- return 0;
+ ret = _gnutls_buffer_to_datum( &str, out);
+ if (out->size > 0) out->size--;
+
+ return ret;
}
diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c
index ef6bd6bc94..7ace55da5f 100644
--- a/lib/openpgp/pgp.c
+++ b/lib/openpgp/pgp.c
@@ -1073,7 +1073,7 @@ _gnutls_read_pgp_mpi (cdk_packet_t pkt, unsigned int priv, size_t idx,
bigint_t * m)
{
size_t buf_size = 512;
- opaque *buf = gnutls_malloc (buf_size);
+ uint8_t *buf = gnutls_malloc (buf_size);
int err;
unsigned int max_pub_params = 0;
diff --git a/lib/openpgp/privkey.c b/lib/openpgp/privkey.c
index 6fafe32663..9be87b0206 100644
--- a/lib/openpgp/privkey.c
+++ b/lib/openpgp/privkey.c
@@ -87,7 +87,7 @@ _gnutls_openpgp_privkey_cpy (gnutls_openpgp_privkey_t dest, gnutls_openpgp_privk
{
int ret;
size_t raw_size=0;
- opaque *der;
+ uint8_t *der;
gnutls_datum_t tmp;
ret = gnutls_openpgp_privkey_export (src, GNUTLS_OPENPGP_FMT_RAW, NULL, 0, NULL, &raw_size);
@@ -730,8 +730,8 @@ _gnutls_openpgp_privkey_get_mpis (gnutls_openpgp_privkey_t pkey,
uint32_t * keyid /*[2] */ ,
gnutls_pk_params_st * params)
{
- int result, i;
- int pk_algorithm;
+ int result;
+ unsigned int i, pk_algorithm;
cdk_packet_t pkt;
gnutls_pk_params_init(params);
diff --git a/lib/pkcs11.c b/lib/pkcs11.c
index 3208e30f6b..8b1d3c5d78 100644
--- a/lib/pkcs11.c
+++ b/lib/pkcs11.c
@@ -46,7 +46,7 @@ struct gnutls_pkcs11_provider_s
unsigned long nslots;
ck_slot_id_t *slots;
struct ck_info info;
- int initialized;
+ unsigned int initialized;
};
struct flags_find_data_st
@@ -71,8 +71,8 @@ struct crt_find_data_st
static struct gnutls_pkcs11_provider_s providers[MAX_PROVIDERS];
-static int active_providers = 0;
-static int initialized_registered = 0;
+static unsigned int active_providers = 0;
+static unsigned int initialized_registered = 0;
static gnutls_pkcs11_pin_callback_t pin_func;
static void *pin_data;
@@ -181,7 +181,7 @@ static int
pkcs11_add_module (const char *name, struct ck_function_list *module)
{
struct ck_info info;
- int i;
+ unsigned int i;
if (active_providers >= MAX_PROVIDERS)
{
@@ -323,7 +323,7 @@ pkcs11_get_info (struct p11_kit_uri *info,
{
struct ck_attribute *attr = NULL;
struct ck_version *version = NULL;
- const char *str = NULL;
+ const uint8_t *str = NULL;
size_t str_max = 0;
int terminate = 0;
int hexify = 0;
@@ -389,7 +389,7 @@ pkcs11_get_info (struct p11_kit_uri *info,
}
else if (str != NULL)
{
- data = str;
+ data = (void*)str;
length = p11_kit_space_strlen (str, str_max);
terminate = 1;
}
@@ -575,7 +575,7 @@ gnutls_pkcs11_init (unsigned int flags, const char *deprecated_config_file)
void
gnutls_pkcs11_deinit (void)
{
- int i;
+ unsigned int i;
init--;
if (init > 0)
@@ -845,7 +845,7 @@ int
pkcs11_find_slot (struct ck_function_list ** module, ck_slot_id_t * slot,
struct p11_kit_uri *info, struct token_info *_tinfo)
{
- int x, z;
+ unsigned int x, z;
for (x = 0; x < active_providers; x++)
{
@@ -941,7 +941,8 @@ _pkcs11_traverse_tokens (find_func_t find_func, void *input,
struct p11_kit_uri *info, unsigned int flags)
{
ck_rv_t rv;
- int found = 0, x, z, ret;
+ unsigned int found = 0, x, z;
+ int ret;
ck_session_handle_t pks = 0;
struct ck_function_list *module = NULL;
@@ -1116,8 +1117,8 @@ static int read_pkcs11_pubkey(struct ck_function_list *module,
ck_key_type_t key_type, gnutls_datum_t * pubkey)
{
struct ck_attribute a[4];
- opaque tmp1[2048];
- opaque tmp2[2048];
+ uint8_t tmp1[2048];
+ uint8_t tmp2[2048];
int ret;
switch (key_type)
@@ -1369,12 +1370,12 @@ find_obj_url (struct ck_function_list *module, ck_session_handle_t pks,
struct ck_attribute a[4];
struct ck_attribute *attr;
ck_object_class_t class = -1;
- ck_certificate_type_t type = -1;
+ ck_certificate_type_t type = (ck_certificate_type_t)-1;
ck_rv_t rv;
ck_object_handle_t obj;
unsigned long count, a_vals;
int found = 0, ret;
- opaque *cert_data = NULL;
+ uint8_t *cert_data = NULL;
char label_tmp[PKCS11_LABEL_SIZE];
if (info == NULL)
@@ -1423,7 +1424,7 @@ find_obj_url (struct ck_function_list *module, ck_session_handle_t pks,
a_vals++;
}
- if (type != -1)
+ if (type != (ck_certificate_type_t)-1)
{
a[a_vals].type = CKA_CERTIFICATE_TYPE;
a[a_vals].value = &type;
@@ -1670,7 +1671,7 @@ gnutls_pkcs11_token_get_info (const char *url,
void *output, size_t * output_size)
{
struct p11_kit_uri *info = NULL;
- const char *str;
+ const uint8_t *str;
size_t str_max;
size_t len;
int ret;
@@ -2150,18 +2151,18 @@ find_objs (struct ck_function_list * module, ck_session_handle_t pks,
struct crt_find_data_st *find_data = input;
struct ck_attribute a[4];
struct ck_attribute *attr;
- ck_object_class_t class = -1;
- ck_certificate_type_t type = -1;
+ ck_object_class_t class = (ck_object_class_t)-1;
+ ck_certificate_type_t type = (ck_certificate_type_t)-1;
unsigned int trusted;
ck_rv_t rv;
ck_object_handle_t obj;
unsigned long count;
- opaque *cert_data;
+ uint8_t *cert_data;
char certid_tmp[PKCS11_ID_SIZE];
char label_tmp[PKCS11_LABEL_SIZE];
- int ret, i;
+ int ret;
struct pkey_list plist; /* private key holder */
- int tot_values = 0;
+ unsigned int i, tot_values = 0;
if (info == NULL)
{ /* final call */
@@ -2268,14 +2269,14 @@ find_objs (struct ck_function_list * module, ck_session_handle_t pks,
}
else if (find_data->flags == GNUTLS_PKCS11_OBJ_ATTR_ALL)
{
- if (class != -1)
+ if (class != (ck_object_class_t)-1)
{
a[tot_values].type = CKA_CLASS;
a[tot_values].value = &class;
a[tot_values].value_len = sizeof class;
tot_values++;
}
- if (type != -1)
+ if (type != (ck_certificate_type_t)-1)
{
a[tot_values].type = CKA_CERTIFICATE_TYPE;
a[tot_values].value = &type;
@@ -2594,7 +2595,7 @@ gnutls_x509_crt_list_import_pkcs11 (gnutls_x509_crt_t * certs,
gnutls_pkcs11_obj_t * const objs,
unsigned int flags)
{
- int i, j;
+ unsigned int i, j;
int ret;
for (i = 0; i < cert_max; i++)
@@ -2711,7 +2712,7 @@ gnutls_pkcs11_token_get_flags (const char *url, unsigned int *flags)
* Since: 2.12.0
**/
int
-gnutls_pkcs11_token_get_mechanism (const char *url, int idx,
+gnutls_pkcs11_token_get_mechanism (const char *url, unsigned int idx,
unsigned long *mechanism)
{
int ret;
@@ -2969,12 +2970,12 @@ pkcs11_init_pin (struct ck_function_list *module,
ck_rv_t
pkcs11_set_pin (struct ck_function_list *module,
ck_session_handle_t sess,
- unsigned char *old_pin,
+ const char *old_pin,
unsigned long old_len,
- unsigned char *new_pin,
+ const char *new_pin,
unsigned long new_len)
{
- return (module)->C_SetPIN (sess, old_pin, old_len, new_pin, new_len);
+ return (module)->C_SetPIN (sess, (uint8_t*)old_pin, old_len, (uint8_t*)new_pin, new_len);
}
const char *
diff --git a/lib/pkcs11_int.h b/lib/pkcs11_int.h
index 7d2cbe40b3..ddd5823f0b 100644
--- a/lib/pkcs11_int.h
+++ b/lib/pkcs11_int.h
@@ -245,9 +245,9 @@ pkcs11_init_pin (struct ck_function_list *module,
ck_rv_t
pkcs11_set_pin (struct ck_function_list *module,
ck_session_handle_t sess,
- unsigned char *old_pin,
+ const char *old_pin,
unsigned long old_len,
- unsigned char *new_pin,
+ const char *new_pin,
unsigned long new_len);
const char *
diff --git a/lib/pkcs11_secret.c b/lib/pkcs11_secret.c
index e189b91482..54205f741e 100644
--- a/lib/pkcs11_secret.c
+++ b/lib/pkcs11_secret.c
@@ -60,7 +60,7 @@ gnutls_pkcs11_copy_secret_key (const char *token_url, gnutls_datum_t * key,
ck_key_type_t keytype = CKK_GENERIC_SECRET;
ck_bool_t tval = 1;
int a_val;
- opaque id[16];
+ uint8_t id[16];
ret = pkcs11_url_to_info (token_url, &info);
if (ret < 0)
diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c
index 859ef79feb..aa474a6694 100644
--- a/lib/pkcs11_write.c
+++ b/lib/pkcs11_write.c
@@ -55,8 +55,8 @@ gnutls_pkcs11_copy_x509_crt (const char *token_url,
struct p11_kit_uri *info = NULL;
ck_rv_t rv;
size_t der_size, id_size;
- opaque *der = NULL;
- opaque id[20];
+ uint8_t *der = NULL;
+ uint8_t id[20];
struct ck_attribute a[16];
ck_object_class_t class = CKO_CERTIFICATE;
ck_certificate_type_t type = CKC_X_509;
@@ -233,7 +233,7 @@ gnutls_pkcs11_copy_x509_privkey (const char *token_url,
struct p11_kit_uri *info = NULL;
ck_rv_t rv;
size_t id_size;
- opaque id[20];
+ uint8_t id[20];
struct ck_attribute a[16];
ck_object_class_t class = CKO_PRIVATE_KEY;
ck_object_handle_t obj;
@@ -544,7 +544,7 @@ delete_obj_url (struct ck_function_list *module,
struct ck_attribute a[4];
struct ck_attribute *attr;
ck_object_class_t class;
- ck_certificate_type_t type = -1;
+ ck_certificate_type_t type = (ck_certificate_type_t)-1;
ck_rv_t rv;
ck_object_handle_t obj;
unsigned long count, a_vals;
@@ -591,7 +591,7 @@ delete_obj_url (struct ck_function_list *module,
a_vals++;
}
- if (type != -1)
+ if (type != (ck_certificate_type_t)-1)
{
a[a_vals].type = CKA_CERTIFICATE_TYPE;
a[a_vals].value = &type;
@@ -737,8 +737,8 @@ gnutls_pkcs11_token_init (const char *token_url,
memcpy (flabel, label, strlen (label));
rv =
- pkcs11_init_token (module, slot, (char *) so_pin, strlen (so_pin),
- flabel);
+ pkcs11_init_token (module, slot, (uint8_t*)so_pin, strlen (so_pin),
+ (uint8_t*)flabel);
if (rv != CKR_OK)
{
gnutls_assert ();
@@ -800,7 +800,7 @@ gnutls_pkcs11_token_set_pin (const char *token_url,
if (oldpin == NULL)
{
- rv = pkcs11_init_pin (module, pks, (char *) newpin, strlen (newpin));
+ rv = pkcs11_init_pin (module, pks, (uint8_t *) newpin, strlen (newpin));
if (rv != CKR_OK)
{
gnutls_assert ();
@@ -812,8 +812,8 @@ gnutls_pkcs11_token_set_pin (const char *token_url,
else
{
rv = pkcs11_set_pin (module, pks,
- (char *) oldpin, strlen (oldpin),
- (char *) newpin, strlen (newpin));
+ oldpin, strlen (oldpin),
+ newpin, strlen (newpin));
if (rv != CKR_OK)
{
gnutls_assert ();
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 7777267674..7397a4e475 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -290,12 +290,12 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
str[len] = 0;
/* Refuse to deal with strings containing NULs. */
- if (strlen (str) != len)
+ if (strlen (str) != (size_t)len)
return GNUTLS_E_ASN1_DER_ERROR;
if (res)
_gnutls_str_cpy (res, *res_size, str);
- *res_size = len;
+ *res_size = (size_t)len;
asn1_delete_structure (&tmpasn);
}
@@ -347,16 +347,16 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
str[len] = 0;
/* Refuse to deal with strings containing NULs. */
- if (strlen (str) != len)
+ if (strlen (str) != (size_t)len)
return GNUTLS_E_ASN1_DER_ERROR;
if (res)
_gnutls_str_cpy (res, *res_size, str);
- *res_size = len;
+ *res_size = (size_t)len;
}
else
{
- result = _gnutls_x509_data2hex (str, len, res, res_size);
+ result = _gnutls_x509_data2hex (str, (size_t)len, res, res_size);
if (result < 0)
{
gnutls_assert ();
@@ -373,12 +373,13 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
* something like '#01020304'
*/
int
-_gnutls_x509_data2hex (const opaque * data, size_t data_size,
- opaque * out, size_t * sizeof_out)
+_gnutls_x509_data2hex (const void * data, size_t data_size,
+ void * _out, size_t * sizeof_out)
{
char *res;
char escaped[MAX_STRING_LEN];
unsigned int size;
+ char* out = _out;
if (2 * data_size + 1 > MAX_STRING_LEN)
{
@@ -455,7 +456,7 @@ static time_t
mktime_utc (const struct fake_tm *tm)
{
time_t result = 0;
- unsigned int i;
+ int i;
/* We do allow some ill-formed dates, but we don't do anything special
* with them and our callers really shouldn't pass them to us. Do
@@ -586,7 +587,7 @@ _gnutls_x509_utcTime2gtime (const char *ttime)
* YEAR(2)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2)|SEC(2)
*/
static int
-_gnutls_x509_gtime2utcTime (time_t gtime, char *str_time, int str_time_size)
+_gnutls_x509_gtime2utcTime (time_t gtime, char *str_time, size_t str_time_size)
{
size_t ret;
struct tm _tm;
@@ -778,7 +779,7 @@ _gnutls_x509_export_int_named (ASN1_TYPE asn1_data, const char *name,
asn1_der_coding (asn1_data, name, output_data, &len,
NULL)) != ASN1_SUCCESS)
{
- *output_data_size = len;
+ *output_data_size = (size_t)len;
if (result == ASN1_MEM_ERROR)
{
return GNUTLS_E_SHORT_MEMORY_BUFFER;
@@ -787,12 +788,12 @@ _gnutls_x509_export_int_named (ASN1_TYPE asn1_data, const char *name,
return _gnutls_asn2err (result);
}
- *output_data_size = len;
+ *output_data_size = (size_t)len;
}
else
{ /* PEM */
- opaque *out;
+ uint8_t *out;
gnutls_datum_t tmp;
result = _gnutls_x509_der_encode (asn1_data, name, &tmp, 0);
@@ -818,23 +819,23 @@ _gnutls_x509_export_int_named (ASN1_TYPE asn1_data, const char *name,
return GNUTLS_E_INTERNAL_ERROR;
}
- if ((unsigned) result > *output_data_size)
+ if ((size_t) result > *output_data_size)
{
gnutls_assert ();
gnutls_free (out);
- *output_data_size = result;
+ *output_data_size = (size_t)result;
return GNUTLS_E_SHORT_MEMORY_BUFFER;
}
- *output_data_size = result;
+ *output_data_size = (size_t)result;
if (output_data)
{
- memcpy (output_data, out, result);
+ memcpy (output_data, out, (size_t)result);
/* do not include the null character into output size.
*/
- *output_data_size = result - 1;
+ *output_data_size = (size_t)result - 1;
}
gnutls_free (out);
@@ -861,8 +862,8 @@ _gnutls_x509_export_int (ASN1_TYPE asn1_data,
*/
int
_gnutls_x509_decode_octet_string (const char *string_type,
- const opaque * der, size_t der_size,
- opaque * output, size_t * output_size)
+ const uint8_t * der, size_t der_size,
+ uint8_t * output, size_t * output_size)
{
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
int result, tmp_output_size;
@@ -894,7 +895,7 @@ _gnutls_x509_decode_octet_string (const char *string_type,
tmp_output_size = *output_size;
result = asn1_read_value (c2, "", output, &tmp_output_size);
- *output_size = tmp_output_size;
+ *output_size = (size_t)tmp_output_size;
if (result != ASN1_SUCCESS)
{
@@ -925,7 +926,7 @@ _gnutls_x509_read_value (ASN1_TYPE c, const char *root,
{
int len = 0, result;
size_t slen;
- opaque *tmp = NULL;
+ uint8_t *tmp = NULL;
result = asn1_read_value (c, root, NULL, &len);
if (result != ASN1_MEM_ERROR)
@@ -938,7 +939,7 @@ _gnutls_x509_read_value (ASN1_TYPE c, const char *root,
if (flags == 2)
len /= 8;
- tmp = gnutls_malloc (len);
+ tmp = gnutls_malloc ((size_t)len);
if (tmp == NULL)
{
gnutls_assert ();
@@ -962,7 +963,7 @@ _gnutls_x509_read_value (ASN1_TYPE c, const char *root,
if (flags == 1)
{
- slen = len;
+ slen = (size_t)len;
result = _gnutls_x509_decode_octet_string (NULL, tmp, slen, tmp, &slen);
if (result < 0)
{
@@ -973,7 +974,7 @@ _gnutls_x509_read_value (ASN1_TYPE c, const char *root,
}
ret->data = tmp;
- ret->size = len;
+ ret->size = (unsigned)len;
return 0;
@@ -993,7 +994,7 @@ _gnutls_x509_der_encode (ASN1_TYPE src, const char *src_name,
{
int size, result;
int asize;
- opaque *data = NULL;
+ uint8_t *data = NULL;
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
size = 0;
@@ -1012,7 +1013,7 @@ _gnutls_x509_der_encode (ASN1_TYPE src, const char *src_name,
size += 16; /* for later to include the octet tags */
asize = size;
- data = gnutls_malloc (size);
+ data = gnutls_malloc ((size_t)size);
if (data == NULL)
{
gnutls_assert ();
@@ -1060,7 +1061,7 @@ _gnutls_x509_der_encode (ASN1_TYPE src, const char *src_name,
}
res->data = data;
- res->size = size;
+ res->size = (unsigned)size;
return 0;
cleanup:
@@ -1093,7 +1094,7 @@ _gnutls_x509_der_encode_and_copy (ASN1_TYPE src, const char *src_name,
/* Write the data.
*/
- result = asn1_write_value (dest, dest_name, encoded.data, encoded.size);
+ result = asn1_write_value (dest, dest_name, encoded.data, (int)encoded.size);
_gnutls_free_datum (&encoded);
@@ -1422,7 +1423,7 @@ _gnutls_x509_get_signature_algorithm (ASN1_TYPE src, const char *src_name)
return result;
}
- result = _gnutls_x509_oid2sign_algorithm (sa.data);
+ result = _gnutls_x509_oid2sign_algorithm ( (char*)sa.data);
_gnutls_free_datum (&sa);
diff --git a/lib/x509/common.h b/lib/x509/common.h
index 886f1817d1..59b661a1eb 100644
--- a/lib/x509/common.h
+++ b/lib/x509/common.h
@@ -69,13 +69,13 @@
int _gnutls_x509_set_time (ASN1_TYPE c2, const char *where, time_t tim);
int _gnutls_x509_decode_octet_string (const char *string_type,
- const opaque * der, size_t der_size,
- opaque * output, size_t * output_size);
+ const uint8_t * der, size_t der_size,
+ uint8_t * output, size_t * output_size);
int _gnutls_x509_oid_data2string (const char *OID, void *value,
int value_size, char *res,
size_t * res_size);
-int _gnutls_x509_data2hex (const opaque * data, size_t data_size,
- opaque * out, size_t * sizeof_out);
+int _gnutls_x509_data2hex (const void * data, size_t data_size,
+ void * out, size_t * sizeof_out);
const char *_gnutls_x509_oid2asn_string (const char *oid);
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index ef8a0b0891..3b744a935d 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -120,7 +120,7 @@ gnutls_x509_crl_import (gnutls_x509_crl_t crl,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
result = _gnutls_fbase64_decode (PEM_CRL, data->data, data->size, &out);
@@ -353,7 +353,7 @@ gnutls_x509_crl_get_signature (gnutls_x509_crl_t crl,
len = bits / 8;
- if (*sizeof_sig < len)
+ if (*sizeof_sig < (unsigned)len)
{
*sizeof_sig = bits / 8;
return GNUTLS_E_SHORT_MEMORY_BUFFER;
@@ -380,7 +380,7 @@ gnutls_x509_crl_get_signature (gnutls_x509_crl_t crl,
int
gnutls_x509_crl_get_version (gnutls_x509_crl_t crl)
{
- opaque version[8];
+ uint8_t version[8];
int len, result;
if (crl == NULL)
@@ -661,7 +661,7 @@ _gnutls_x509_crl_cpy (gnutls_x509_crl_t dest, gnutls_x509_crl_t src)
{
int ret;
size_t der_size;
- opaque *der;
+ uint8_t *der;
gnutls_datum_t tmp;
ret = gnutls_x509_crl_export (src, GNUTLS_X509_FMT_DER, NULL, &der_size);
@@ -922,7 +922,7 @@ gnutls_x509_crl_get_extension_oid (gnutls_x509_crl_t crl, int indx,
int
gnutls_x509_crl_get_extension_info (gnutls_x509_crl_t crl, int indx,
void *oid, size_t * sizeof_oid,
- int *critical)
+ unsigned int *critical)
{
int result;
char str_critical[10];
diff --git a/lib/x509/crl_write.c b/lib/x509/crl_write.c
index 15d7aa06e4..a61606fc77 100644
--- a/lib/x509/crl_write.c
+++ b/lib/x509/crl_write.c
@@ -283,7 +283,7 @@ gnutls_x509_crl_set_crt (gnutls_x509_crl_t crl, gnutls_x509_crt_t crt,
time_t revocation_time)
{
int ret;
- opaque serial[128];
+ uint8_t serial[128];
size_t serial_size;
if (crl == NULL || crt == NULL)
diff --git a/lib/x509/crq.c b/lib/x509/crq.c
index 35029e26e5..a569cebacb 100644
--- a/lib/x509/crq.c
+++ b/lib/x509/crq.c
@@ -128,7 +128,7 @@ gnutls_x509_crq_import (gnutls_x509_crq_t crq,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
/* Try the first header */
result = _gnutls_fbase64_decode (PEM_CRQ, data->data, data->size, &out);
@@ -740,7 +740,7 @@ gnutls_x509_crq_set_version (gnutls_x509_crq_t crq, unsigned int version)
int
gnutls_x509_crq_get_version (gnutls_x509_crq_t crq)
{
- opaque version[8];
+ uint8_t version[8];
int len, result;
if (crq == NULL)
@@ -1508,7 +1508,7 @@ gnutls_x509_crq_get_key_usage (gnutls_x509_crq_t crq,
{
int result;
uint16_t _usage;
- opaque buf[128];
+ uint8_t buf[128];
size_t buf_size = sizeof (buf);
if (crq == NULL)
@@ -1567,7 +1567,7 @@ gnutls_x509_crq_get_basic_constraints (gnutls_x509_crq_t crq,
{
int result;
unsigned int tmp_ca;
- opaque buf[256];
+ uint8_t buf[256];
size_t buf_size = sizeof (buf);
if (crq == NULL)
diff --git a/lib/x509/dn.c b/lib/x509/dn.c
index af70130c93..e1acb942b1 100644
--- a/lib/x509/dn.c
+++ b/lib/x509/dn.c
@@ -78,7 +78,7 @@ _gnutls_x509_parse_dn (ASN1_TYPE asn1_struct,
char tmpbuffer1[ASN1_MAX_NAME_SIZE];
char tmpbuffer2[ASN1_MAX_NAME_SIZE];
char tmpbuffer3[ASN1_MAX_NAME_SIZE];
- opaque value[MAX_STRING_LEN], *value2 = NULL;
+ uint8_t value[MAX_STRING_LEN], *value2 = NULL;
char *escaped = NULL;
const char *ldap_desc;
char oid[MAX_OID_SIZE];
@@ -331,7 +331,7 @@ _gnutls_x509_parse_dn_oid (ASN1_TYPE asn1_struct,
char tmpbuffer1[ASN1_MAX_NAME_SIZE];
char tmpbuffer2[ASN1_MAX_NAME_SIZE];
char tmpbuffer3[ASN1_MAX_NAME_SIZE];
- opaque value[256];
+ uint8_t value[256];
char oid[MAX_OID_SIZE];
int len, printable;
int i = 0;
@@ -630,7 +630,7 @@ _gnutls_x509_encode_and_write_attribute (const char *given_oid,
int sizeof_data, int multi)
{
const char *val_name;
- const opaque *data = _data;
+ const uint8_t *data = _data;
char tmp[128];
ASN1_TYPE c2;
int result;
@@ -993,7 +993,7 @@ gnutls_x509_dn_import (gnutls_x509_dn_t dn, const gnutls_datum_t * data)
/**
* gnutls_x509_dn_deinit:
- * @dn: a DN opaque object pointer.
+ * @dn: a DN uint8_t object pointer.
*
* This function deallocates the DN object as returned by
* gnutls_x509_dn_import().
@@ -1201,7 +1201,7 @@ _gnutls_x509_compare_raw_dn (const gnutls_datum_t * dn1,
/**
* gnutls_x509_dn_export:
- * @dn: Holds the opaque DN object
+ * @dn: Holds the uint8_t DN object
* @format: the format of output params. One of PEM or DER.
* @output_data: will contain a DN PEM or DER encoded
* @output_data_size: holds the size of output_data (and will be
diff --git a/lib/x509/extensions.c b/lib/x509/extensions.c
index 610b61615b..166e63d287 100644
--- a/lib/x509/extensions.c
+++ b/lib/x509/extensions.c
@@ -615,7 +615,7 @@ _gnutls_x509_crq_set_extension (gnutls_x509_crq_t crq,
*/
int
_gnutls_x509_ext_extract_keyUsage (uint16_t * keyUsage,
- opaque * extnValue, int extnValueLen)
+ uint8_t * extnValue, int extnValueLen)
{
ASN1_TYPE ext = ASN1_TYPE_EMPTY;
int len, result;
@@ -661,7 +661,7 @@ _gnutls_x509_ext_extract_keyUsage (uint16_t * keyUsage,
int
_gnutls_x509_ext_extract_basicConstraints (unsigned int *CA,
int *pathLenConstraint,
- opaque * extnValue,
+ uint8_t * extnValue,
int extnValueLen)
{
ASN1_TYPE ext = ASN1_TYPE_EMPTY;
@@ -778,9 +778,9 @@ _gnutls_x509_ext_gen_basicConstraints (int CA,
/* extract an INTEGER from the DER encoded extension
*/
int
-_gnutls_x509_ext_extract_number (opaque * number,
+_gnutls_x509_ext_extract_number (uint8_t * number,
size_t * _nr_size,
- opaque * extnValue, int extnValueLen)
+ uint8_t * extnValue, int extnValueLen)
{
ASN1_TYPE ext = ASN1_TYPE_EMPTY;
int result;
@@ -823,7 +823,7 @@ _gnutls_x509_ext_extract_number (opaque * number,
/* generate an INTEGER in a DER encoded extension
*/
int
-_gnutls_x509_ext_gen_number (const opaque * number, size_t nr_size,
+_gnutls_x509_ext_gen_number (const uint8_t * number, size_t nr_size,
gnutls_datum_t * der_ext)
{
ASN1_TYPE ext = ASN1_TYPE_EMPTY;
@@ -1222,7 +1222,7 @@ _gnutls_x509_ext_extract_proxyCertInfo (int *pathLenConstraint,
char **policyLanguage,
char **policy,
size_t * sizeof_policy,
- opaque * extnValue, int extnValueLen)
+ uint8_t * extnValue, int extnValueLen)
{
ASN1_TYPE ext = ASN1_TYPE_EMPTY;
int result;
@@ -1266,7 +1266,7 @@ _gnutls_x509_ext_extract_proxyCertInfo (int *pathLenConstraint,
}
if (policyLanguage)
- *policyLanguage = gnutls_strdup (value.data);
+ *policyLanguage = gnutls_strdup ((char*)value.data);
result = _gnutls_x509_read_value (ext, "proxyPolicy.policy", &value, 0);
if (result == GNUTLS_E_ASN1_ELEMENT_NOT_FOUND)
@@ -1285,7 +1285,7 @@ _gnutls_x509_ext_extract_proxyCertInfo (int *pathLenConstraint,
else
{
if (policy)
- *policy = value.data;
+ *policy = (char*)value.data;
if (sizeof_policy)
*sizeof_policy = value.size;
}
diff --git a/lib/x509/key_decode.c b/lib/x509/key_decode.c
index 0f8766b6ce..b2ff84077c 100644
--- a/lib/x509/key_decode.c
+++ b/lib/x509/key_decode.c
@@ -30,15 +30,15 @@
#include <gnutls_num.h>
#include <gnutls_ecc.h>
-static int _gnutls_x509_read_rsa_pubkey (opaque * der, int dersize,
+static int _gnutls_x509_read_rsa_pubkey (uint8_t * der, int dersize,
gnutls_pk_params_st* params);
-static int _gnutls_x509_read_dsa_pubkey (opaque * der, int dersize,
+static int _gnutls_x509_read_dsa_pubkey (uint8_t * der, int dersize,
gnutls_pk_params_st * params);
-static int _gnutls_x509_read_ecc_pubkey (opaque * der, int dersize,
+static int _gnutls_x509_read_ecc_pubkey (uint8_t * der, int dersize,
gnutls_pk_params_st * params);
static int
-_gnutls_x509_read_dsa_params (opaque * der, int dersize, gnutls_pk_params_st * params);
+_gnutls_x509_read_dsa_params (uint8_t * der, int dersize, gnutls_pk_params_st * params);
/*
* some x509 certificate parsing functions that relate to MPI parameter
@@ -46,7 +46,7 @@ _gnutls_x509_read_dsa_params (opaque * der, int dersize, gnutls_pk_params_st * p
* Returns 2 parameters (m,e). It does not set params_nr.
*/
int
-_gnutls_x509_read_rsa_pubkey (opaque * der, int dersize, gnutls_pk_params_st * params)
+_gnutls_x509_read_rsa_pubkey (uint8_t * der, int dersize, gnutls_pk_params_st * params)
{
int result;
ASN1_TYPE spk = ASN1_TYPE_EMPTY;
@@ -97,7 +97,7 @@ _gnutls_x509_read_rsa_pubkey (opaque * der, int dersize, gnutls_pk_params_st * p
* Returns 2 parameters (m,e). It does not set params_nr.
*/
int
-_gnutls_x509_read_ecc_pubkey (opaque * der, int dersize, gnutls_pk_params_st * params)
+_gnutls_x509_read_ecc_pubkey (uint8_t * der, int dersize, gnutls_pk_params_st * params)
{
/* Eventhough RFC5480 defines the public key to be an ECPoint (i.e. OCTET STRING),
* it is actually copied in raw there. Why do they use ASN.1 anyway?
@@ -112,7 +112,7 @@ _gnutls_x509_read_ecc_pubkey (opaque * der, int dersize, gnutls_pk_params_st * p
* params[0-2]. It does NOT set params_nr.
*/
static int
-_gnutls_x509_read_dsa_params (opaque * der, int dersize, gnutls_pk_params_st * params)
+_gnutls_x509_read_dsa_params (uint8_t * der, int dersize, gnutls_pk_params_st * params)
{
int result;
ASN1_TYPE spk = ASN1_TYPE_EMPTY;
@@ -178,7 +178,7 @@ _gnutls_x509_read_dsa_params (opaque * der, int dersize, gnutls_pk_params_st * p
* params[0-4]. It does NOT set params_nr.
*/
int
-_gnutls_x509_read_ecc_params (opaque * der, int dersize, gnutls_pk_params_st * params)
+_gnutls_x509_read_ecc_params (uint8_t * der, int dersize, gnutls_pk_params_st * params)
{
int ret;
ASN1_TYPE spk = ASN1_TYPE_EMPTY;
@@ -238,7 +238,7 @@ cleanup:
}
-int _gnutls_x509_read_pubkey (gnutls_pk_algorithm_t algo, opaque * der, int dersize,
+int _gnutls_x509_read_pubkey (gnutls_pk_algorithm_t algo, uint8_t * der, int dersize,
gnutls_pk_params_st * params)
{
int ret;
@@ -264,7 +264,7 @@ int ret;
return ret;
}
-int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t algo, opaque * der, int dersize,
+int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t algo, uint8_t * der, int dersize,
gnutls_pk_params_st * params)
{
switch(algo)
@@ -285,7 +285,7 @@ int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t algo, opaque * der, i
* only sets params[3]
*/
int
-_gnutls_x509_read_dsa_pubkey (opaque * der, int dersize, gnutls_pk_params_st * params)
+_gnutls_x509_read_dsa_pubkey (uint8_t * der, int dersize, gnutls_pk_params_st * params)
{
/* do not set a number */
params->params_nr = 0;
diff --git a/lib/x509/key_encode.c b/lib/x509/key_encode.c
index 05b097b57e..9aebf505ba 100644
--- a/lib/x509/key_encode.c
+++ b/lib/x509/key_encode.c
@@ -356,7 +356,7 @@ static int
_gnutls_asn1_encode_rsa (ASN1_TYPE * c2, gnutls_pk_params_st * params)
{
int result;
- opaque null = '\0';
+ uint8_t null = '\0';
gnutls_pk_params_st pk_params;
gnutls_datum_t m, e, d, p, q, u, exp1, exp2;
@@ -571,7 +571,7 @@ static int
_gnutls_asn1_encode_ecc (ASN1_TYPE * c2, gnutls_pk_params_st * params)
{
int ret;
- opaque one = '\x01';
+ uint8_t one = '\x01';
gnutls_datum pubkey = { NULL, 0 };
const char *oid;
@@ -657,9 +657,9 @@ _gnutls_asn1_encode_dsa (ASN1_TYPE * c2, gnutls_pk_params_st * params)
{
int result, i;
size_t size[DSA_PRIVATE_PARAMS], total;
- opaque *p_data, *q_data, *g_data, *x_data, *y_data;
- opaque *all_data = NULL, *p;
- opaque null = '\0';
+ uint8_t *p_data, *q_data, *g_data, *x_data, *y_data;
+ uint8_t *all_data = NULL, *p;
+ uint8_t null = '\0';
/* Read all the sizes */
total = 0;
diff --git a/lib/x509/mpi.c b/lib/x509/mpi.c
index 127b9f1e84..3b6ccf56e5 100644
--- a/lib/x509/mpi.c
+++ b/lib/x509/mpi.c
@@ -34,7 +34,7 @@
*/
int
-_gnutls_x509_read_der_int (opaque * der, int dersize, bigint_t * out)
+_gnutls_x509_read_der_int (uint8_t * der, int dersize, bigint_t * out)
{
int result;
ASN1_TYPE spk = ASN1_TYPE_EMPTY;
@@ -246,7 +246,7 @@ int
_gnutls_x509_read_uint (ASN1_TYPE node, const char *value, unsigned int *ret)
{
int len, result;
- opaque *tmpstr;
+ uint8_t *tmpstr;
len = 0;
result = asn1_read_value (node, value, NULL, &len);
@@ -297,7 +297,7 @@ _gnutls_x509_read_uint (ASN1_TYPE node, const char *value, unsigned int *ret)
int
_gnutls_x509_write_uint32 (ASN1_TYPE node, const char *value, uint32_t num)
{
- opaque tmpstr[4];
+ uint8_t tmpstr[4];
int result;
_gnutls_write_uint32 (num, tmpstr);
diff --git a/lib/x509/output.c b/lib/x509/output.c
index bacb98455a..98d3ea8ff2 100644
--- a/lib/x509/output.c
+++ b/lib/x509/output.c
@@ -1369,7 +1369,7 @@ static void
print_keyid (gnutls_buffer_st * str, gnutls_x509_crt_t cert)
{
int err;
- char buffer[32];
+ unsigned char buffer[32];
size_t size = sizeof(buffer);
const char* name;
char* p;
@@ -1604,6 +1604,7 @@ gnutls_x509_crt_print (gnutls_x509_crt_t cert,
gnutls_datum_t * out)
{
gnutls_buffer_st str;
+ int ret;
if (format == GNUTLS_CRT_PRINT_FULL
|| format == GNUTLS_CRT_PRINT_UNSIGNED_FULL)
@@ -1619,8 +1620,11 @@ gnutls_x509_crt_print (gnutls_x509_crt_t cert,
print_other (&str, cert, format == GNUTLS_CRT_PRINT_UNSIGNED_FULL);
_gnutls_buffer_append_data (&str, "\0", 1);
- out->data = str.data;
- out->size = strlen (str.data);
+
+ ret = _gnutls_buffer_to_datum( &str, out);
+ if (out->size > 0) out->size--;
+
+ return ret;
}
else if (format == GNUTLS_CRT_PRINT_ONELINE)
{
@@ -1629,16 +1633,17 @@ gnutls_x509_crt_print (gnutls_x509_crt_t cert,
print_oneline (&str, cert);
_gnutls_buffer_append_data (&str, "\0", 1);
- out->data = str.data;
- out->size = strlen (str.data);
+
+ ret = _gnutls_buffer_to_datum( &str, out);
+ if (out->size > 0) out->size--;
+
+ return ret;
}
else
{
gnutls_assert ();
return GNUTLS_E_INVALID_REQUEST;
}
-
- return 0;
}
#ifdef ENABLE_PKI
@@ -1857,7 +1862,7 @@ print_crl (gnutls_buffer_st * str, gnutls_x509_crl_t crl, int notsigned)
for (j = 0; j < num; j++)
{
- char serial[128];
+ unsigned char serial[128];
size_t serial_size = sizeof (serial);
int err;
time_t tim;
@@ -1960,6 +1965,7 @@ gnutls_x509_crl_print (gnutls_x509_crl_t crl,
gnutls_datum_t * out)
{
gnutls_buffer_st str;
+ int ret;
_gnutls_buffer_init (&str);
@@ -1969,10 +1975,11 @@ gnutls_x509_crl_print (gnutls_x509_crl_t crl,
print_crl (&str, crl, format == GNUTLS_CRT_PRINT_UNSIGNED_FULL);
_gnutls_buffer_append_data (&str, "\0", 1);
- out->data = str.data;
- out->size = strlen (str.data);
-
- return 0;
+
+ ret = _gnutls_buffer_to_datum( &str, out);
+ if (out->size > 0) out->size--;
+
+ return ret;
}
static void
@@ -2220,7 +2227,7 @@ print_crq_other (gnutls_buffer_st * str, gnutls_x509_crq_t crq)
{
int err;
size_t size = 0;
- char *buffer = NULL;
+ unsigned char *buffer = NULL;
err = gnutls_x509_crq_get_key_id (crq, 0, buffer, &size);
if (err != GNUTLS_E_SHORT_MEMORY_BUFFER)
@@ -2274,6 +2281,7 @@ gnutls_x509_crq_print (gnutls_x509_crq_t crq,
gnutls_datum_t * out)
{
gnutls_buffer_st str;
+ int ret;
_gnutls_buffer_init (&str);
@@ -2287,10 +2295,11 @@ gnutls_x509_crq_print (gnutls_x509_crq_t crq,
print_crq_other (&str, crq);
_gnutls_buffer_append_data (&str, "\0", 1);
- out->data = str.data;
- out->size = strlen (str.data);
- return 0;
+ ret = _gnutls_buffer_to_datum( &str, out);
+ if (out->size > 0) out->size--;
+
+ return ret;
}
#endif /* ENABLE_PKI */
diff --git a/lib/x509/pbkdf2-sha1.c b/lib/x509/pbkdf2-sha1.c
index e773bac59e..517214d69c 100644
--- a/lib/x509/pbkdf2-sha1.c
+++ b/lib/x509/pbkdf2-sha1.c
@@ -54,8 +54,8 @@
int
_gnutls_pbkdf2_sha1 (const char *P, size_t Plen,
- const char *S, size_t Slen,
- unsigned int c, char *DK, size_t dkLen)
+ const unsigned char *S, size_t Slen,
+ unsigned int c, unsigned char *DK, size_t dkLen)
{
unsigned int hLen = 20;
char U[20];
diff --git a/lib/x509/pbkdf2-sha1.h b/lib/x509/pbkdf2-sha1.h
index b5dbdfbe8c..3273c00344 100644
--- a/lib/x509/pbkdf2-sha1.h
+++ b/lib/x509/pbkdf2-sha1.h
@@ -1,3 +1,3 @@
int _gnutls_pbkdf2_sha1 (const char *P, size_t Plen,
- const char *S, size_t Slen,
- unsigned int c, char *DK, size_t dkLen);
+ const unsigned char *S, size_t Slen,
+ unsigned int c, unsigned char *DK, size_t dkLen);
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index 8db0c0723a..afd0fcc0c1 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -210,7 +210,7 @@ gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
result = _gnutls_fbase64_decode (PEM_PKCS12, data->data, data->size,
&out);
@@ -507,7 +507,7 @@ _pkcs12_decode_safe_contents (const gnutls_datum_t * content,
continue;
}
bag->element[i].friendly_name =
- ucs2_to_ascii (attr_val.data, attr_val.size);
+ ucs2_to_ascii ((char*)attr_val.data, attr_val.size);
}
else
{
@@ -863,12 +863,12 @@ cleanup:
int
gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass)
{
- opaque salt[8], key[20];
+ uint8_t salt[8], key[20];
int result;
const int iter = 1;
digest_hd_st td1;
gnutls_datum_t tmp = { NULL, 0 };
- opaque sha_mac[20];
+ uint8_t sha_mac[20];
if (pkcs12 == NULL)
{
@@ -996,7 +996,7 @@ cleanup:
int
gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass)
{
- opaque key[20];
+ uint8_t key[20];
int result;
unsigned int iter;
int len;
@@ -1004,8 +1004,8 @@ gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass)
gnutls_datum_t tmp = { NULL, 0 }, salt =
{
NULL, 0};
- opaque sha_mac[20];
- opaque sha_mac_orig[20];
+ uint8_t sha_mac[20];
+ uint8_t sha_mac_orig[20];
if (pkcs12 == NULL)
{
@@ -1153,7 +1153,7 @@ write_attributes (gnutls_pkcs12_bag_t bag, int elem,
if (bag->element[elem].friendly_name != NULL)
{
- opaque *name;
+ uint8_t *name;
int size, i;
const char *p;
diff --git a/lib/x509/pkcs12_encr.c b/lib/x509/pkcs12_encr.c
index 3c9f441b06..c2331b192e 100644
--- a/lib/x509/pkcs12_encr.c
+++ b/lib/x509/pkcs12_encr.c
@@ -34,12 +34,11 @@
static int
_pkcs12_check_pass (const char *pass, size_t plen)
{
- const unsigned char *p = pass;
unsigned int i;
for (i = 0; i < plen; i++)
{
- if (isascii (p[i]))
+ if (isascii (pass[i]))
continue;
return GNUTLS_E_INVALID_PASSWORD;
}
@@ -53,10 +52,10 @@ _pkcs12_check_pass (const char *pass, size_t plen)
* 1 for encryption key
*/
int
-_gnutls_pkcs12_string_to_key (unsigned int id, const opaque * salt,
+_gnutls_pkcs12_string_to_key (unsigned int id, const uint8_t * salt,
unsigned int salt_size, unsigned int iter,
const char *pw, unsigned int req_keylen,
- opaque * keybuf)
+ uint8_t * keybuf)
{
int rc;
unsigned int i, j;
@@ -64,10 +63,10 @@ _gnutls_pkcs12_string_to_key (unsigned int id, const opaque * salt,
bigint_t num_b1 = NULL, num_ij = NULL;
bigint_t mpi512 = NULL;
unsigned int pwlen;
- opaque hash[20], buf_b[64], buf_i[128], *p;
+ uint8_t hash[20], buf_b[64], buf_i[128], *p;
size_t cur_keylen;
size_t n, m;
- const opaque buf_512[] = /* 2^64 */
+ const uint8_t buf_512[] = /* 2^64 */
{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c
index 4c016d2e11..3f54e24304 100644
--- a/lib/x509/pkcs7.c
+++ b/lib/x509/pkcs7.c
@@ -47,7 +47,7 @@ _decode_pkcs7_signed_data (ASN1_TYPE pkcs7, ASN1_TYPE * sdata,
{
char oid[MAX_OID_SIZE];
ASN1_TYPE c2;
- opaque *tmp = NULL;
+ uint8_t *tmp = NULL;
int tmp_size, len, result;
len = sizeof (oid) - 1;
@@ -218,7 +218,7 @@ gnutls_pkcs7_import (gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
result = _gnutls_fbase64_decode (PEM_PKCS7, data->data, data->size,
&out);
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 420ddfce14..c22d8a4dc1 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -89,7 +89,8 @@ gnutls_x509_privkey_deinit (gnutls_x509_privkey_t key)
int
gnutls_x509_privkey_cpy (gnutls_x509_privkey_t dst, gnutls_x509_privkey_t src)
{
- int i, ret;
+ unsigned int i;
+ int ret;
if (!src || !dst)
return GNUTLS_E_INVALID_REQUEST;
@@ -449,7 +450,7 @@ gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
/* Try the first header */
result =
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 1fa6b81bd8..3bafb390cf 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -55,7 +55,7 @@ static int _decode_pkcs8_ecc_key (ASN1_TYPE pkcs8_asn, gnutls_x509_privkey_t pke
struct pbkdf2_params
{
- opaque salt[32];
+ uint8_t salt[32];
int salt_size;
unsigned int iter_count;
unsigned int key_size;
@@ -64,7 +64,7 @@ struct pbkdf2_params
struct pbe_enc_params
{
gnutls_cipher_algorithm_t cipher;
- opaque iv[MAX_CIPHER_BLOCK_SIZE];
+ uint8_t iv[MAX_CIPHER_BLOCK_SIZE];
int iv_size;
};
@@ -133,7 +133,7 @@ inline static int
_encode_privkey (gnutls_x509_privkey_t pkey, gnutls_datum_t * raw)
{
size_t size = 0;
- opaque *data = NULL;
+ uint8_t *data = NULL;
int ret;
ASN1_TYPE spk = ASN1_TYPE_EMPTY;
@@ -219,7 +219,7 @@ encode_to_private_key_info (gnutls_x509_privkey_t pkey,
gnutls_datum_t * der, ASN1_TYPE * pkey_info)
{
int result, len;
- opaque null = 0;
+ uint8_t null = 0;
const char *oid;
gnutls_datum_t algo_params = { NULL, 0 };
gnutls_datum_t algo_privkey = { NULL, 0 };
@@ -669,7 +669,7 @@ gnutls_x509_privkey_export_pkcs8 (gnutls_x509_privkey_t key,
*/
static int
read_pkcs_schema_params (schema_id * schema, const char *password,
- const opaque * data, int data_size,
+ const uint8_t * data, int data_size,
struct pbkdf2_params *kdf_params,
struct pbe_enc_params *enc_params)
{
@@ -705,7 +705,7 @@ read_pkcs_schema_params (schema_id * schema, const char *password,
goto error;
}
- tmp.data = (opaque *) data;
+ tmp.data = (uint8_t *) data;
tmp.size = data_size;
result = read_pbkdf2_params (pbes2_asn, &tmp, kdf_params);
@@ -1078,7 +1078,7 @@ decode_private_key_info (const gnutls_datum_t * der,
gnutls_x509_privkey_t pkey)
{
int result, len;
- opaque oid[64];
+ char oid[64];
ASN1_TYPE pkcs8_asn = ASN1_TYPE_EMPTY;
@@ -1200,7 +1200,7 @@ gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
/* Try the first header
*/
@@ -1591,7 +1591,7 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn,
{
int result;
int data_size;
- opaque *data = NULL, *key = NULL;
+ uint8_t *data = NULL, *key = NULL;
gnutls_datum_t dkey, d_iv;
cipher_hd_st ch;
int ch_init = 0;
@@ -1673,7 +1673,7 @@ decrypt_data (schema_id schema, ASN1_TYPE pkcs8_asn,
dkey.data = key;
dkey.size = key_size;
- d_iv.data = (opaque *) enc_params->iv;
+ d_iv.data = (uint8_t *) enc_params->iv;
d_iv.size = enc_params->iv_size;
result = _gnutls_cipher_init (&ch, enc_params->cipher, &dkey, &d_iv, 0);
@@ -1723,7 +1723,7 @@ write_pbkdf2_params (ASN1_TYPE pbes2_asn,
{
int result;
ASN1_TYPE pbkdf2_asn = ASN1_TYPE_EMPTY;
- opaque tmp[64];
+ uint8_t tmp[64];
/* Write the key derivation algorithm
*/
@@ -2129,11 +2129,11 @@ encrypt_data (const gnutls_datum_t * plain,
{
int result;
int data_size;
- opaque *data = NULL;
+ uint8_t *data = NULL;
gnutls_datum_t d_iv;
cipher_hd_st ch;
int ch_init = 0;
- opaque pad, pad_size;
+ uint8_t pad, pad_size;
pad_size = gnutls_cipher_get_block_size (enc_params->cipher);
@@ -2161,7 +2161,7 @@ encrypt_data (const gnutls_datum_t * plain,
data_size = plain->size + pad;
- d_iv.data = (opaque *) enc_params->iv;
+ d_iv.data = (uint8_t *) enc_params->iv;
d_iv.size = enc_params->iv_size;
result = _gnutls_cipher_init (&ch, enc_params->cipher, key, &d_iv, 1);
diff --git a/lib/x509/sign.c b/lib/x509/sign.c
index afb4e65e1c..c651894491 100644
--- a/lib/x509/sign.c
+++ b/lib/x509/sign.c
@@ -48,7 +48,7 @@ _gnutls_x509_get_tbs (ASN1_TYPE cert, const char *tbs_name,
gnutls_datum_t * tbs)
{
int result;
- opaque *buf;
+ uint8_t *buf;
int buf_size;
buf_size = 0;
diff --git a/lib/x509/verify-high.c b/lib/x509/verify-high.c
index 5818be5ab7..993e45134b 100644
--- a/lib/x509/verify-high.c
+++ b/lib/x509/verify-high.c
@@ -53,7 +53,7 @@ struct node_st {
};
struct gnutls_x509_trust_list_st {
- int size;
+ unsigned int size;
struct node_st *node;
};
@@ -111,7 +111,7 @@ void
gnutls_x509_trust_list_deinit(gnutls_x509_trust_list_t list,
unsigned int all)
{
- int i, j;
+ unsigned int i, j;
if (!list)
return;
@@ -343,9 +343,10 @@ gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list,
*/
static int shorten_clist(gnutls_x509_trust_list_t list,
gnutls_x509_crt_t * certificate_list,
- int clist_size)
+ unsigned int clist_size)
{
- int i, ret;
+ int ret;
+ unsigned int j, i;
uint32_t hash;
gnutls_datum_t dn;
@@ -372,8 +373,6 @@ static int shorten_clist(gnutls_x509_trust_list_t list,
* self-signed E but already removed above), and we trust B, remove
* B, C and D. */
for (i = 1; i < clist_size; i++) {
- int j;
-
ret = gnutls_x509_crt_get_raw_issuer_dn(certificate_list[i], &dn);
if (ret < 0) {
gnutls_assert();
@@ -421,7 +420,8 @@ int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t list,
unsigned int flags)
{
gnutls_datum_t dn;
- int ret, i;
+ int ret;
+ unsigned int i;
uint32_t hash;
ret = gnutls_x509_crt_get_raw_issuer_dn(cert, &dn);
@@ -474,7 +474,8 @@ gnutls_x509_trust_list_verify_crt(gnutls_x509_trust_list_t list,
gnutls_verify_output_function func)
{
gnutls_datum_t dn;
- int ret, i;
+ int ret;
+ unsigned int i;
uint32_t hash;
if (cert_list == NULL || cert_list_size < 1)
@@ -574,7 +575,8 @@ gnutls_x509_trust_list_verify_named_crt(gnutls_x509_trust_list_t list,
gnutls_verify_output_function func)
{
gnutls_datum_t dn;
- int ret, i;
+ int ret;
+ unsigned int i;
uint32_t hash;
ret = gnutls_x509_crt_get_raw_issuer_dn(cert, &dn);
@@ -626,7 +628,8 @@ _gnutls_trustlist_inlist (gnutls_x509_trust_list_t list,
gnutls_x509_crt_t cert)
{
gnutls_datum_t dn;
- int ret, i;
+ int ret;
+ unsigned int i;
uint32_t hash;
ret = gnutls_x509_crt_get_raw_dn (cert, &dn);
diff --git a/lib/x509/verify.c b/lib/x509/verify.c
index 81ce2b6c51..f80506f718 100644
--- a/lib/x509/verify.c
+++ b/lib/x509/verify.c
@@ -52,7 +52,7 @@ check_if_same_cert (gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2)
{
NULL, 0};
int result;
- opaque serial1[128], serial2[128];
+ uint8_t serial1[128], serial2[128];
size_t serial1_size, serial2_size;
serial1_size = sizeof (serial1);
@@ -682,9 +682,9 @@ _gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash,
gnutls_pk_algorithm_t pk,
gnutls_pk_params_st * issuer_params)
{
- opaque digest[MAX_HASH_SIZE];
+ uint8_t digest[MAX_HASH_SIZE];
gnutls_datum_t decrypted;
- int digest_size;
+ unsigned int digest_size;
int ret;
switch (pk)
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index af45c86dcd..5fd2476cc0 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -83,7 +83,7 @@ _gnutls_x509_crt_cpy (gnutls_x509_crt_t dest, gnutls_x509_crt_t src)
{
int ret;
size_t der_size=0;
- opaque *der;
+ uint8_t *der;
gnutls_datum_t tmp;
ret = gnutls_x509_crt_export (src, GNUTLS_X509_FMT_DER, NULL, &der_size);
@@ -178,7 +178,7 @@ gnutls_x509_crt_import (gnutls_x509_crt_t cert,
*/
if (format == GNUTLS_X509_FMT_PEM)
{
- opaque *out;
+ uint8_t *out;
/* Try the first header */
result =
@@ -551,7 +551,7 @@ gnutls_x509_crt_get_signature (gnutls_x509_crt_t cert,
int
gnutls_x509_crt_get_version (gnutls_x509_crt_t cert)
{
- opaque version[8];
+ uint8_t version[8];
int len, result;
if (cert == NULL)
@@ -628,7 +628,7 @@ gnutls_x509_crt_get_expiration_time (gnutls_x509_crt_t cert)
* This function will return the X.509 certificate's serial number.
* This is obtained by the X509 Certificate serialNumber field. Serial
* is not always a 32 or 64bit number. Some CAs use large serial
- * numbers, thus it may be wise to handle it as something opaque.
+ * numbers, thus it may be wise to handle it as something uint8_t.
*
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
* negative error value.
@@ -903,7 +903,7 @@ _gnutls_parse_general_name (ASN1_TYPE src, const char *src_name,
int len;
char nptr[ASN1_MAX_NAME_SIZE];
int result;
- opaque choice_type[128];
+ char choice_type[128];
gnutls_x509_subject_alt_name_t type;
seq++; /* 0->1, 1->2 etc */
@@ -960,7 +960,7 @@ _gnutls_parse_general_name (ASN1_TYPE src, const char *src_name,
if (othername_oid)
{
- if (len > strlen (XMPP_OID) && strcmp (name, XMPP_OID) == 0)
+ if ((unsigned)len > strlen (XMPP_OID) && strcmp (name, XMPP_OID) == 0)
type = GNUTLS_SAN_OTHERNAME_XMPP;
}
else
@@ -981,7 +981,7 @@ _gnutls_parse_general_name (ASN1_TYPE src, const char *src_name,
return _gnutls_asn2err (result);
}
- if (len > strlen (XMPP_OID) && strcmp (oid, XMPP_OID) == 0)
+ if ((unsigned)len > strlen (XMPP_OID) && strcmp (oid, XMPP_OID) == 0)
{
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
size_t orig_name_size = *name_size;
@@ -1013,7 +1013,7 @@ _gnutls_parse_general_name (ASN1_TYPE src, const char *src_name,
}
asn1_delete_structure (&c2);
- if (len + 1 > orig_name_size)
+ if ((unsigned)len + 1 > orig_name_size)
{
gnutls_assert ();
*name_size = len + 1;
@@ -1065,7 +1065,7 @@ _gnutls_parse_general_name (ASN1_TYPE src, const char *src_name,
if (is_type_printable (type))
{
- if (len + 1 > orig_name_size)
+ if ((unsigned)len + 1 > orig_name_size)
{
gnutls_assert ();
(*name_size)++;
@@ -1954,9 +1954,9 @@ get_dn (gnutls_x509_crt_t cert, const char *whom, gnutls_x509_dn_t * dn)
/**
* gnutls_x509_crt_get_subject:
* @cert: should contain a #gnutls_x509_crt_t structure
- * @dn: output variable with pointer to opaque DN.
+ * @dn: output variable with pointer to uint8_t DN.
*
- * Return the Certificate's Subject DN as an opaque data type. You
+ * Return the Certificate's Subject DN as an uint8_t data type. You
* may use gnutls_x509_dn_get_rdn_ava() to decode the DN.
*
* Note that @dn should be treated as constant. Because points
@@ -1974,9 +1974,9 @@ gnutls_x509_crt_get_subject (gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn)
/**
* gnutls_x509_crt_get_issuer:
* @cert: should contain a #gnutls_x509_crt_t structure
- * @dn: output variable with pointer to opaque DN
+ * @dn: output variable with pointer to uint8_t DN
*
- * Return the Certificate's Issuer DN as an opaque data type. You may
+ * Return the Certificate's Issuer DN as an uint8_t data type. You may
* use gnutls_x509_dn_get_rdn_ava() to decode the DN.
*
* Note that @dn should be treated as constant. Because points
@@ -1993,7 +1993,7 @@ gnutls_x509_crt_get_issuer (gnutls_x509_crt_t cert, gnutls_x509_dn_t * dn)
/**
* gnutls_x509_dn_get_rdn_ava:
- * @dn: input variable with opaque DN pointer
+ * @dn: input variable with uint8_t DN pointer
* @irdn: index of RDN
* @iava: index of AVA.
* @ava: Pointer to structure which will hold output information.
@@ -2109,7 +2109,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert,
gnutls_digest_algorithm_t algo,
void *buf, size_t * buf_size)
{
- opaque *cert_buf;
+ uint8_t *cert_buf;
int cert_buf_size;
int result;
gnutls_datum_t tmp;
@@ -2190,7 +2190,7 @@ _gnutls_get_key_id (gnutls_pk_algorithm_t pk, gnutls_pk_params_st * params,
int ret = 0;
gnutls_datum_t der = { NULL, 0 };
const gnutls_digest_algorithm_t hash = GNUTLS_DIG_SHA1;
- int digest_len = _gnutls_hash_get_algo_len(hash);
+ unsigned int digest_len = _gnutls_hash_get_algo_len(hash);
if (output_data == NULL || *output_data_size < digest_len)
{
@@ -2286,8 +2286,8 @@ _gnutls_x509_crt_check_revocation (gnutls_x509_crt_t cert,
int crl_list_length,
gnutls_verify_output_function func)
{
- opaque serial[128];
- opaque cert_serial[128];
+ uint8_t serial[128];
+ uint8_t cert_serial[128];
size_t serial_size, cert_serial_size;
int ncerts, ret, i, j;
gnutls_datum_t dn1, dn2;
@@ -3355,7 +3355,7 @@ _gnutls_parse_aia (ASN1_TYPE src,
gnutls_assert ();
return _gnutls_asn2err (result);
}
- if (len != strlen (oid) + 1 || memcmp (tmpoid, oid, len) != 0)
+ if ((unsigned)len != strlen (oid) + 1 || memcmp (tmpoid, oid, len) != 0)
return GNUTLS_E_UNKNOWN_ALGORITHM;
}
/* fall through */
@@ -3479,7 +3479,7 @@ gnutls_x509_crt_get_authority_info_access (gnutls_x509_crt_t crt,
unsigned int seq,
int what,
gnutls_datum_t * data,
- int *critical)
+ unsigned int *critical)
{
int ret;
gnutls_datum_t aia;
diff --git a/lib/x509/x509_int.h b/lib/x509/x509_int.h
index 55fdaac72d..0dd3cb5b17 100644
--- a/lib/x509/x509_int.h
+++ b/lib/x509/x509_int.h
@@ -164,7 +164,7 @@ ASN1_TYPE _gnutls_privkey_decode_ecc_key (const gnutls_datum_t *
gnutls_x509_privkey_t pkey);
int
-_gnutls_x509_read_ecc_params (opaque * der, int dersize, gnutls_pk_params_st * params);
+_gnutls_x509_read_ecc_params (uint8_t * der, int dersize, gnutls_pk_params_st * params);
int _gnutls_asn1_encode_privkey (gnutls_pk_algorithm_t pk, ASN1_TYPE * c2, gnutls_pk_params_st * params);
@@ -191,10 +191,10 @@ int _gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert,
int indx, void *ret,
size_t * ret_size);
int _gnutls_x509_ext_extract_keyUsage (uint16_t * keyUsage,
- opaque * extnValue, int extnValueLen);
+ uint8_t * extnValue, int extnValueLen);
int _gnutls_x509_ext_extract_basicConstraints (unsigned int *CA,
int *pathLenConstraint,
- opaque * extnValue,
+ uint8_t * extnValue,
int extnValueLen);
int _gnutls_x509_crt_set_extension (gnutls_x509_crt_t cert,
const char *extension_id,
@@ -202,11 +202,11 @@ int _gnutls_x509_crt_set_extension (gnutls_x509_crt_t cert,
unsigned int critical);
int
-_gnutls_x509_ext_extract_number (opaque * number,
+_gnutls_x509_ext_extract_number (uint8_t * number,
size_t * nr_size,
- opaque * extnValue, int extnValueLen);
+ uint8_t * extnValue, int extnValueLen);
int
-_gnutls_x509_ext_gen_number (const opaque * nuber, size_t nr_size,
+_gnutls_x509_ext_gen_number (const uint8_t * nuber, size_t nr_size,
gnutls_datum_t * der_ext);
@@ -231,7 +231,7 @@ int _gnutls_x509_ext_extract_proxyCertInfo (int *pathLenConstraint,
char **policyLanguage,
char **policy,
size_t * sizeof_policy,
- opaque * extnValue,
+ uint8_t * extnValue,
int extnValueLen);
int _gnutls_x509_ext_gen_proxyCertInfo (int pathLenConstraint,
const char *policyLanguage,
@@ -246,10 +246,10 @@ int _gnutls_x509_crq_get_mpis (gnutls_x509_crq_t cert,
int _gnutls_x509_crt_get_mpis (gnutls_x509_crt_t cert,
gnutls_pk_params_st * params);
-int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t, opaque * der, int dersize,
+int _gnutls_x509_read_pubkey_params (gnutls_pk_algorithm_t, uint8_t * der, int dersize,
gnutls_pk_params_st * params);
-int _gnutls_x509_read_pubkey (gnutls_pk_algorithm_t, opaque * der, int dersize,
+int _gnutls_x509_read_pubkey (gnutls_pk_algorithm_t, uint8_t * der, int dersize,
gnutls_pk_params_st * params);
int _gnutls_x509_write_ecc_params (gnutls_pk_params_st * params,
@@ -267,7 +267,7 @@ int _gnutls_x509_write_pubkey (gnutls_pk_algorithm_t, gnutls_pk_params_st * para
int _gnutls_x509_read_uint (ASN1_TYPE node, const char *value,
unsigned int *ret);
-int _gnutls_x509_read_der_int (opaque * der, int dersize, bigint_t * out);
+int _gnutls_x509_read_der_int (uint8_t * der, int dersize, bigint_t * out);
int _gnutls_x509_read_int (ASN1_TYPE node, const char *value,
bigint_t * ret_mpi);
@@ -321,10 +321,10 @@ typedef struct gnutls_pkcs12_bag_int
#define KEY_ID_OID "1.2.840.113549.1.9.21"
int
-_gnutls_pkcs12_string_to_key (unsigned int id, const opaque * salt,
+_gnutls_pkcs12_string_to_key (unsigned int id, const uint8_t * salt,
unsigned int salt_size, unsigned int iter,
const char *pw, unsigned int req_keylen,
- opaque * keybuf);
+ uint8_t * keybuf);
int _gnutls_pkcs7_decrypt_data (const gnutls_datum_t * data,
const char *password, gnutls_datum_t * dec);
diff --git a/lib/x509/x509_write.c b/lib/x509/x509_write.c
index 507879bd3b..a70e246f88 100644
--- a/lib/x509/x509_write.c
+++ b/lib/x509/x509_write.c
@@ -318,7 +318,7 @@ gnutls_x509_crt_set_crq_extensions (gnutls_x509_crt_t crt,
int result;
char oid[MAX_OID_SIZE];
size_t oid_size;
- opaque *extensions;
+ uint8_t *extensions;
size_t extensions_size;
unsigned int critical;
gnutls_datum_t ext;
@@ -678,7 +678,7 @@ finish:
* and negative error codes indicate that the pathLenConstraints field should
* not be present.
* @policyLanguage: OID describing the language of @policy.
- * @policy: opaque byte array with policy language, can be %NULL
+ * @policy: uint8_t byte array with policy language, can be %NULL
* @sizeof_policy: size of @policy.
*
* This function will set the proxyCertInfo extension.
@@ -864,7 +864,7 @@ gnutls_x509_crt_set_expiration_time (gnutls_x509_crt_t cert, time_t exp_time)
* This function will set the X.509 certificate's serial number.
* Serial is not always a 32 or 64bit number. Some CAs use large
* serial numbers, thus it may be wise to handle it as something
- * opaque.
+ * uint8_t.
*
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
* negative error value.
diff --git a/lib/x509_b64.c b/lib/x509_b64.c
index 78918c365e..53dc1cce51 100644
--- a/lib/x509_b64.c
+++ b/lib/x509_b64.c
@@ -105,7 +105,7 @@ encode (char *result, const uint8_t * data, int left)
*/
#define TOASCII(c) (c < 127 ? asciitable[c] : 0xff)
inline static int
-decode (uint8_t * result, const opaque * data)
+decode (uint8_t * result, const uint8_t * data)
{
uint8_t a1, a2;
int ret = 3;
@@ -151,14 +151,14 @@ decode (uint8_t * result, const opaque * data)
*/
int
_gnutls_fbase64_encode (const char *msg, const uint8_t * data,
- int data_size, uint8_t ** result)
+ size_t data_size, uint8_t ** result)
{
int ret, tmp;
unsigned int i, j;
char tmpres[4];
uint8_t *ptr;
- uint8_t top[80];
- uint8_t bottom[80];
+ char top[80];
+ char bottom[80];
int pos, bytes, top_len, bottom_len;
if (msg == NULL || strlen(msg) > 50)
@@ -270,7 +270,7 @@ int
gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * data,
char *result, size_t * result_size)
{
- opaque *ret;
+ uint8_t *ret;
int size;
size = _gnutls_fbase64_encode (msg, data->data, data->size, &ret);
@@ -314,7 +314,7 @@ gnutls_pem_base64_encode_alloc (const char *msg,
const gnutls_datum_t * data,
gnutls_datum_t * result)
{
- opaque *ret;
+ uint8_t *ret;
int size;
if (result == NULL)
@@ -392,7 +392,7 @@ cpydata (const uint8_t * data, int data_size, uint8_t ** result)
*/
#define ENDSTR "-----"
int
-_gnutls_fbase64_decode (const char *header, const opaque * data,
+_gnutls_fbase64_decode (const char *header, const uint8_t * data,
size_t data_size, uint8_t ** result)
{
int ret;
@@ -505,7 +505,7 @@ gnutls_pem_base64_decode (const char *header,
const gnutls_datum_t * b64_data,
unsigned char *result, size_t * result_size)
{
- opaque *ret;
+ uint8_t *ret;
int size;
size =
@@ -551,7 +551,7 @@ gnutls_pem_base64_decode_alloc (const char *header,
const gnutls_datum_t * b64_data,
gnutls_datum_t * result)
{
- opaque *ret;
+ uint8_t *ret;
int size;
if (result == NULL)
diff --git a/lib/x509_b64.h b/lib/x509_b64.h
index 8ed0b0259a..e2835ed4b5 100644
--- a/lib/x509_b64.h
+++ b/lib/x509_b64.h
@@ -21,7 +21,7 @@
*/
int _gnutls_fbase64_encode (const char *msg, const uint8_t * data,
- int data_size, uint8_t ** result);
+ size_t data_size, uint8_t ** result);
int _gnutls_fbase64_decode (const char *header, const uint8_t * data,
size_t data_size, uint8_t ** result);
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);
diff --git a/tests/anonself.c b/tests/anonself.c
index d9b33300b9..4b6061db48 100644
--- a/tests/anonself.c
+++ b/tests/anonself.c
@@ -183,7 +183,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -197,7 +197,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/certificate_set_x509_crl.c b/tests/certificate_set_x509_crl.c
index ffa92f1ccf..4ea93812a1 100644
--- a/tests/certificate_set_x509_crl.c
+++ b/tests/certificate_set_x509_crl.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
@@ -53,7 +54,7 @@ main (void)
{
int rc;
gnutls_certificate_credentials_t crt;
- gnutls_datum_t crldatum = { crl, strlen (crl) };
+ gnutls_datum_t crldatum = { (uint8_t*)crl, strlen (crl) };
gnutls_x509_crl_t crl;
rc = gnutls_global_init ();
diff --git a/tests/chainverify.c b/tests/chainverify.c
index 2343aa27ca..572f6c0717 100644
--- a/tests/chainverify.c
+++ b/tests/chainverify.c
@@ -716,8 +716,8 @@ static struct
const char *name;
const char **chain;
const char **ca;
- int verify_flags;
- int expected_verify_result;
+ unsigned int verify_flags;
+ unsigned int expected_verify_result;
} chains[] =
{
{ "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2],
@@ -839,7 +839,7 @@ doit (void)
error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d,%d]: %s",
(int) i, (int) j, gnutls_strerror (ret));
- tmp.data = (char *) chains[i].chain[j];
+ tmp.data = (unsigned char *) chains[i].chain[j];
tmp.size = strlen (chains[i].chain[j]);
ret = gnutls_x509_crt_import (certs[j], &tmp, GNUTLS_X509_FMT_PEM);
@@ -863,7 +863,7 @@ doit (void)
error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s",
gnutls_strerror (ret));
- tmp.data = (char *) *chains[i].ca;
+ tmp.data = (unsigned char *) *chains[i].ca;
tmp.size = strlen (*chains[i].ca);
ret = gnutls_x509_crt_import (ca, &tmp, GNUTLS_X509_FMT_PEM);
diff --git a/tests/cve-2008-4989.c b/tests/cve-2008-4989.c
index 511d498b16..570c00ee28 100644
--- a/tests/cve-2008-4989.c
+++ b/tests/cve-2008-4989.c
@@ -168,7 +168,7 @@ main (int argc, char *argv[])
error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d]: %s", (int) i,
gnutls_strerror (ret));
- tmp.data = (char *) pem_certs[i];
+ tmp.data = (unsigned char *) pem_certs[i];
tmp.size = strlen (pem_certs[i]);
ret = gnutls_x509_crt_import (certs[i], &tmp, GNUTLS_X509_FMT_PEM);
@@ -182,7 +182,7 @@ main (int argc, char *argv[])
error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s",
gnutls_strerror (ret));
- tmp.data = (char *) pem_ca;
+ tmp.data = (unsigned char *) pem_ca;
tmp.size = strlen (pem_ca);
ret = gnutls_x509_crt_import (ca, &tmp, GNUTLS_X509_FMT_PEM);
@@ -214,7 +214,7 @@ main (int argc, char *argv[])
error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s",
gnutls_strerror (ret));
- tmp.data = (char *) pem_self_cert;
+ tmp.data = (unsigned char *) pem_self_cert;
tmp.size = strlen (pem_self_cert);
ret = gnutls_x509_crt_import (self_cert, &tmp, GNUTLS_X509_FMT_PEM);
diff --git a/tests/cve-2009-1415.c b/tests/cve-2009-1415.c
index 912453dd68..80105bce84 100644
--- a/tests/cve-2009-1415.c
+++ b/tests/cve-2009-1415.c
@@ -71,7 +71,7 @@ static char dsa_cert[] =
"QcDzQ8REwidsfh9uKAluk1c/KQ==\n" "-----END CERTIFICATE-----\n";
const gnutls_datum_t dsa_cert_dat = {
- dsa_cert, sizeof (dsa_cert)
+ (void*)dsa_cert, sizeof (dsa_cert)
};
int
@@ -79,8 +79,8 @@ main (void)
{
gnutls_x509_crt_t crt;
gnutls_pubkey_t pubkey;
- gnutls_datum_t data = { (char *) "foo", 3 };
- gnutls_datum_t sig = { (char *) "bar", 3 };
+ gnutls_datum_t data = { (void *) "foo", 3 };
+ gnutls_datum_t sig = { (void *) "bar", 3 };
int ret;
gnutls_global_init ();
diff --git a/tests/dhepskself.c b/tests/dhepskself.c
index cd6fa71f3f..979424a34e 100644
--- a/tests/dhepskself.c
+++ b/tests/dhepskself.c
@@ -63,7 +63,7 @@ client (void)
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_psk_client_credentials_t pskcred;
- const gnutls_datum_t key = { (char *) "DEADBEEF", 8 };
+ const gnutls_datum_t key = { (void *) "DEADBEEF", 8 };
gnutls_global_init ();
@@ -176,7 +176,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -204,7 +204,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/dn.c b/tests/dn.c
index 9f62e4c6fb..36c89b2e7a 100644
--- a/tests/dn.c
+++ b/tests/dn.c
@@ -90,7 +90,7 @@ void
doit (void)
{
int ret;
- gnutls_datum_t derCert = { pem, sizeof (pem) };
+ gnutls_datum_t derCert = { (unsigned char*)pem, sizeof (pem) };
gnutls_x509_crt_t cert;
gnutls_x509_dn_t xdn;
diff --git a/tests/dn2.c b/tests/dn2.c
index 1d2cda0632..a1ae8f2a36 100644
--- a/tests/dn2.c
+++ b/tests/dn2.c
@@ -69,7 +69,7 @@ static const char *info =
void
doit (void)
{
- gnutls_datum_t der = { pem, sizeof (pem) };
+ gnutls_datum_t der = { (void*)pem, sizeof (pem) };
gnutls_x509_crt_t cert;
gnutls_datum_t out;
int ret;
@@ -90,7 +90,8 @@ doit (void)
if (ret < 0)
fail ("x509_crt_print %d\n", ret);
- if (out.size != strlen (info) || strcmp (out.data, info) != 0)
+ if (out.size != strlen (info) ||
+ strcmp ((char*)out.data, info) != 0)
fail ("comparison fail (%d/%d)\nexpect: %s\n got: %.*s\n",
out.size, (int) strlen (info), info, out.size, out.data);
diff --git a/tests/gc.c b/tests/gc.c
index 23d2c4c333..1c7a92251a 100644
--- a/tests/gc.c
+++ b/tests/gc.c
@@ -36,7 +36,7 @@
void
doit (void)
{
- char digest[20];
+ unsigned char digest[20];
int err;
/* XXX: We need this to fix secure memory. */
@@ -82,7 +82,7 @@ doit (void)
}
}
- err = _gnutls_pbkdf2_sha1 ("password", 8, "salt", 4, 4711, digest, 16);
+ err = _gnutls_pbkdf2_sha1 ("password", 8, (unsigned char*)"salt", 4, 4711, digest, 16);
if (err < 0)
fail ("_gnutls_pkcs5_pbkdf2_sha1() failed: %d\n", err);
else
diff --git a/tests/hostname-check.c b/tests/hostname-check.c
index 916f52a760..ba0c8e45b9 100644
--- a/tests/hostname-check.c
+++ b/tests/hostname-check.c
@@ -658,7 +658,7 @@ doit (void)
if (debug)
success ("Testing pem1...\n");
- data.data = pem1;
+ data.data = (unsigned char*)pem1;
data.size = strlen (pem1);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -671,7 +671,7 @@ doit (void)
if (debug)
success ("Testing pem2...\n");
- data.data = pem2;
+ data.data = (unsigned char*)pem2;
data.size = strlen (pem2);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -692,7 +692,7 @@ doit (void)
if (debug)
success ("Testing pem3...\n");
- data.data = pem3;
+ data.data = (unsigned char*)pem3;
data.size = strlen (pem3);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -713,7 +713,7 @@ doit (void)
if (debug)
success ("Testing pem4...\n");
- data.data = pem4;
+ data.data = (unsigned char*)pem4;
data.size = strlen (pem4);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -738,7 +738,7 @@ doit (void)
if (debug)
success ("Testing pem6...\n");
- data.data = pem6;
+ data.data = (unsigned char*)pem6;
data.size = strlen (pem6);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -755,7 +755,7 @@ doit (void)
if (debug)
success ("Testing pem7...\n");
- data.data = pem7;
+ data.data = (unsigned char*)pem7;
data.size = strlen (pem7);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -780,7 +780,7 @@ doit (void)
if (debug)
success ("Testing pem8...\n");
- data.data = pem8;
+ data.data = (unsigned char*)pem8;
data.size = strlen (pem8);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -805,7 +805,7 @@ doit (void)
if (debug)
success ("Testing pem9...\n");
- data.data = pem9;
+ data.data = (unsigned char*)pem9;
data.size = strlen (pem9);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -822,7 +822,7 @@ doit (void)
if (debug)
success ("Testing pem10...\n");
- data.data = pem10;
+ data.data = (unsigned char*)pem10;
data.size = strlen (pem10);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -835,7 +835,7 @@ doit (void)
if (debug)
success ("Testing pem_too_many...\n");
- data.data = pem_too_many;
+ data.data = (unsigned char*)pem_too_many;
data.size = strlen (pem_too_many);
ret = gnutls_x509_crt_import (x509, &data, GNUTLS_X509_FMT_PEM);
@@ -849,7 +849,7 @@ doit (void)
#ifdef ENABLE_OPENPGP
if (debug)
success ("Testing pem11...\n");
- data.data = pem11;
+ data.data = (unsigned char*)pem11;
data.size = strlen (pem11);
ret = gnutls_openpgp_crt_import (pgp, &data, GNUTLS_OPENPGP_FMT_BASE64);
diff --git a/tests/infoaccess.c b/tests/infoaccess.c
index 7273c15b7b..073e54f21d 100644
--- a/tests/infoaccess.c
+++ b/tests/infoaccess.c
@@ -69,7 +69,7 @@ static char cert_with_aia_data[] =
"-----END CERTIFICATE-----\n";
const gnutls_datum_t cert_with_aia = {
- cert_with_aia_data, sizeof (cert_with_aia_data)
+ (void*)cert_with_aia_data, sizeof (cert_with_aia_data)
};
void
@@ -78,7 +78,7 @@ doit (void)
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t data;
- int critical;
+ unsigned int critical;
ret = gnutls_global_init ();
if (ret < 0)
diff --git a/tests/mini-deflate.c b/tests/mini-deflate.c
index f11a590ce2..a850357767 100644
--- a/tests/mini-deflate.c
+++ b/tests/mini-deflate.c
@@ -49,7 +49,7 @@ doit (void)
{
/* Server stuff. */
gnutls_anon_server_credentials_t s_anoncred;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (unsigned char*) pkcs3, strlen (pkcs3) };
static gnutls_dh_params_t dh_params;
gnutls_session_t server;
int sret = GNUTLS_E_AGAIN;
diff --git a/tests/mini-eagain-dtls.c b/tests/mini-eagain-dtls.c
index 850b595c11..5295f1e98c 100644
--- a/tests/mini-eagain-dtls.c
+++ b/tests/mini-eagain-dtls.c
@@ -50,7 +50,7 @@ doit (void)
{
/* 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/tests/mini-eagain.c b/tests/mini-eagain.c
index 0f6a5efa9d..67e5ad8e79 100644
--- a/tests/mini-eagain.c
+++ b/tests/mini-eagain.c
@@ -51,7 +51,7 @@ doit (void)
{
/* Server stuff. */
gnutls_anon_server_credentials_t s_anoncred;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (unsigned char *) pkcs3, strlen (pkcs3) };
static gnutls_dh_params_t dh_params;
gnutls_session_t server;
int sret, cret;
diff --git a/tests/mini.c b/tests/mini.c
index f79a0e0091..069f7ceb10 100644
--- a/tests/mini.c
+++ b/tests/mini.c
@@ -47,7 +47,7 @@ doit (void)
{
/* Server stuff. */
gnutls_anon_server_credentials_t s_anoncred;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (unsigned char *) pkcs3, strlen (pkcs3) };
static gnutls_dh_params_t dh_params;
gnutls_session_t server;
int sret = GNUTLS_E_AGAIN;
diff --git a/tests/moredn.c b/tests/moredn.c
index 832a564c6c..d7bff37a9a 100644
--- a/tests/moredn.c
+++ b/tests/moredn.c
@@ -51,7 +51,7 @@ static const char cert_pem[] =
"jpfc/3X7sLUsMvumcDE01ls/cG5mIatmiyEU9qI3jbgUf82z23ON/acwJf875D3/\n"
"U7jyOsBJ44SEQITbin2yUeJMIm1tievvdNXBDfW95AM507ShzP12sfiJkJfjjdhy\n"
"dc8Siq5JojruiMizAf0pA7in\n" "-----END CERTIFICATE-----\n";
-static const gnutls_datum_t cert_datum = { (char *) cert_pem,
+static const gnutls_datum_t cert_datum = { (unsigned char *) cert_pem,
sizeof (cert_pem)
};
diff --git a/tests/nul-in-x509-names.c b/tests/nul-in-x509-names.c
index 11e12e1d1b..4361b1dbf0 100644
--- a/tests/nul-in-x509-names.c
+++ b/tests/nul-in-x509-names.c
@@ -59,7 +59,7 @@ static char badguy_nul_cn_data[] =
"CQ==\n" "-----END CERTIFICATE-----\n";
const gnutls_datum_t badguy_nul_cn = {
- badguy_nul_cn_data, sizeof (badguy_nul_cn_data)
+ (void*)badguy_nul_cn_data, sizeof (badguy_nul_cn_data)
};
static char badguy_nul_san_data[] =
@@ -87,7 +87,7 @@ static char badguy_nul_san_data[] =
"-----END CERTIFICATE-----\n";
const gnutls_datum_t badguy_nul_san = {
- badguy_nul_san_data, sizeof (badguy_nul_san_data)
+ (void*)badguy_nul_san_data, sizeof (badguy_nul_san_data)
};
void
diff --git a/tests/openpgp-auth.c b/tests/openpgp-auth.c
index b72a880751..e71bee8a31 100644
--- a/tests/openpgp-auth.c
+++ b/tests/openpgp-auth.c
@@ -177,7 +177,7 @@ doit ()
ssize_t received;
pid_t done;
int status;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
if (debug)
printf ("server process %i (child %i)\n", getpid (), child);
diff --git a/tests/openpgp-auth2.c b/tests/openpgp-auth2.c
index ef88dd7b80..e884ca8115 100644
--- a/tests/openpgp-auth2.c
+++ b/tests/openpgp-auth2.c
@@ -168,7 +168,7 @@ doit ()
ssize_t received;
pid_t done;
int status;
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void*) pkcs3, strlen (pkcs3) };
if (debug)
printf ("server process %i (child %i)\n", getpid (), child);
diff --git a/tests/openpgpself.c b/tests/openpgpself.c
index 53e1757414..00f738ccd8 100644
--- a/tests/openpgpself.c
+++ b/tests/openpgpself.c
@@ -30,9 +30,9 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/socket.h>
#if !defined(_WIN32)
#include <netinet/in.h>
-#include <sys/socket.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#endif
@@ -287,7 +287,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -301,7 +301,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/parse_ca.c b/tests/parse_ca.c
index 5477d2b554..fb6de97fc3 100644
--- a/tests/parse_ca.c
+++ b/tests/parse_ca.c
@@ -60,7 +60,7 @@ doit (void)
{
int rc;
gnutls_certificate_credentials_t cred;
- gnutls_datum_t ca = { castr, sizeof (castr) };
+ gnutls_datum_t ca = { (unsigned char*)castr, sizeof (castr) };
gnutls_global_init ();
diff --git a/tests/pkcs12_encode.c b/tests/pkcs12_encode.c
index 4bc6532c0c..981f9ba97c 100644
--- a/tests/pkcs12_encode.c
+++ b/tests/pkcs12_encode.c
@@ -48,7 +48,7 @@ static char client_pem[] =
"jpfc/3X7sLUsMvumcDE01ls/cG5mIatmiyEU9qI3jbgUf82z23ON/acwJf875D3/\n"
"U7jyOsBJ44SEQITbin2yUeJMIm1tievvdNXBDfW95AM507ShzP12sfiJkJfjjdhy\n"
"dc8Siq5JojruiMizAf0pA7in\n" "-----END CERTIFICATE-----\n";
-const gnutls_datum_t client_dat = { client_pem, sizeof (client_pem) };
+const gnutls_datum_t client_dat = { (void*)client_pem, sizeof (client_pem) };
static char ca_pem[] =
"-----BEGIN CERTIFICATE-----\n"
@@ -63,7 +63,7 @@ static char ca_pem[] =
"njuu7kHq5peUgYn8Jd9zNzExBOEp1VOipGsf6G66oQAhDFp2o8zkz7ZH71zR4HEW\n"
"KoX6n5Emn6DvcEH/9pAhnGxNHJAoS7czTKv/JDZJhkqHxyrE1fuLsg5Qv25DTw7+\n"
"PfqUpIhz5Bbm7J4=\n" "-----END CERTIFICATE-----\n";
-const gnutls_datum_t ca_dat = { ca_pem, sizeof (ca_pem) };
+const gnutls_datum_t ca_dat = { (void*)ca_pem, sizeof (ca_pem) };
static void
tls_log_func (int level, const char *str)
@@ -78,7 +78,7 @@ doit (void)
gnutls_x509_crt_t client;
gnutls_x509_crt_t ca;
gnutls_pkcs12_bag_t bag;
- char key_id_buf[20];
+ unsigned char key_id_buf[20];
gnutls_datum_t key_id;
int ret, indx;
char outbuf[10240];
diff --git a/tests/pkcs12_s2k.c b/tests/pkcs12_s2k.c
index cc394d8a1d..e7efc04cd8 100644
--- a/tests/pkcs12_s2k.c
+++ b/tests/pkcs12_s2k.c
@@ -37,7 +37,7 @@ tls_log_func (int level, const char *str)
fprintf (stderr, "|<%d>| %s", level, str);
}
-static const char *salt[3] = { "salt1", "ltsa22", "balt33" };
+static const unsigned char *salt[3] = { (void*)"salt1", (void*)"ltsa22", (void*)"balt33" };
static const char *pw[3] = { "secret1", "verysecret2", "veryverysecret3" };
static const char *values[] = {
@@ -71,47 +71,48 @@ static struct
{
int id;
const char *password;
- const char *salt;
+ const unsigned char *salt;
size_t iter;
size_t keylen;
const char *key;
} tv[] =
{
{
- 1, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 24,
+ 1, "smeg", (void*)"\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 24,
"8aaae6297b6cb04642ab5b077851284eb7128f1a2a7fbca3"},
{
- 2, "smeg", "\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 8, "79993dfe048d3b76"},
+ 2, "smeg", (void*)"\x0A\x58\xCF\x64\x53\x0D\x82\x3F", 1, 8, "79993dfe048d3b76"},
{
- 1, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 24,
+ 1, "smeg", (void*)"\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 24,
"f3a95fec48d7711e985cfe67908c5ab79fa3d7c5caa5d966"},
{
- 2, "smeg", "\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 8, "c0a38d64a79bea1d"},
+ 2, "smeg", (void*)"\x64\x2B\x99\xAB\x44\xFB\x4B\x1F", 1, 8, "c0a38d64a79bea1d"},
{
- 3, "smeg", "\x3D\x83\xC0\xE4\x54\x6A\xC1\x40", 1, 20,
+ 3, "smeg", (void*)"\x3D\x83\xC0\xE4\x54\x6A\xC1\x40", 1, 20,
"8d967d88f6caa9d714800ab3d48051d63f73a312"},
{
- 1, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 24,
+ 1, "queeg", (void*)"\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 24,
"ed2034e36328830ff09df1e1a07dd357185dac0d4f9eb3d4"},
{
- 2, "queeg", "\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 8,
+ 2, "queeg", (void*)"\x05\xDE\xC9\x59\xAC\xFF\x72\xF7", 1000, 8,
"11dedad7758d4860"},
{
- 1, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 24,
+ 1, "queeg", (void*)"\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 24,
"483dd6e919d7de2e8e648ba8f862f3fbfbdc2bcb2c02957f"},
{
- 2, "queeg", "\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 8,
+ 2, "queeg", (void*)"\x16\x82\xC0\xFC\x5B\x3F\x7E\xC5", 1000, 8,
"9d461d1b00355c50"},
{
- 3, "queeg", "\x26\x32\x16\xFC\xC2\xFA\xB3\x1C", 1000, 20,
+ 3, "queeg", (void*)"\x26\x32\x16\xFC\xC2\xFA\xB3\x1C", 1000, 20,
"5ec4c7a80df652294c3925b6489a7ab857c83476"}
};
void
doit (void)
{
- int rc, i, j, x;
- char key[32];
+ int rc;
+ unsigned int i, j, x;
+ unsigned char key[32];
char tmp[1024];
gnutls_global_init ();
@@ -126,7 +127,7 @@ doit (void)
for (j = 0; j < 3; j++)
{
rc =
- _gnutls_pkcs12_string_to_key (i, salt[j], strlen (salt[j]),
+ _gnutls_pkcs12_string_to_key (i, salt[j], strlen ((char*)salt[j]),
j + i + 15, pw[j], sizeof (key),
key);
if (rc < 0)
diff --git a/tests/pkcs12_s2k_pem.c b/tests/pkcs12_s2k_pem.c
index 12208fdcd8..6dbc9fa205 100644
--- a/tests/pkcs12_s2k_pem.c
+++ b/tests/pkcs12_s2k_pem.c
@@ -275,8 +275,8 @@ main (void)
if (ret < 0)
return 1;
- tmp.data = (char *) keys[i].pkcs12key;
- tmp.size = strlen (tmp.data);
+ tmp.data = (unsigned char *) keys[i].pkcs12key;
+ tmp.size = strlen ((char*)tmp.data);
ret = gnutls_x509_privkey_import_pkcs8 (key, &tmp,
GNUTLS_X509_FMT_PEM,
diff --git a/tests/pskself.c b/tests/pskself.c
index ebacd94948..356cf3f4b8 100644
--- a/tests/pskself.c
+++ b/tests/pskself.c
@@ -31,8 +31,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#if !defined(_WIN32)
#include <sys/socket.h>
+#if !defined(_WIN32)
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -58,7 +58,7 @@ client (void)
char buffer[MAX_BUF + 1];
gnutls_psk_client_credentials_t pskcred;
/* Need to enable anonymous KX specifically. */
- const gnutls_datum_t key = { (char *) "DEADBEEF", 8 };
+ const gnutls_datum_t key = { (void *) "DEADBEEF", 8 };
gnutls_global_init ();
@@ -182,7 +182,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/resume.c b/tests/resume.c
index 9add84d6b1..6214f7fbd2 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -31,8 +31,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#if !defined(_WIN32)
#include <sys/socket.h>
+#if !defined(_WIN32)
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -271,7 +271,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -285,7 +285,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/rsa-encrypt-decrypt.c b/tests/rsa-encrypt-decrypt.c
index 4460ebdff0..376736f0da 100644
--- a/tests/rsa-encrypt-decrypt.c
+++ b/tests/rsa-encrypt-decrypt.c
@@ -86,11 +86,11 @@ static char pem1_key[] =
"-----END RSA PRIVATE KEY-----\n";
const gnutls_datum_t cert_dat[] = {
- {pem1_cert, sizeof (pem1_cert)}
+ {(void*)pem1_cert, sizeof (pem1_cert)}
};
const gnutls_datum_t key_dat[] = {
- {pem1_key, sizeof (pem1_key)}
+ {(void*)pem1_key, sizeof (pem1_key)}
};
void
diff --git a/tests/slow/cipher-test.c b/tests/slow/cipher-test.c
index a41aac0dd8..c39d2d83bc 100644
--- a/tests/slow/cipher-test.c
+++ b/tests/slow/cipher-test.c
@@ -21,9 +21,9 @@ struct aes_gcm_vectors_st
{
const uint8_t *key;
const uint8_t *auth;
- int auth_size;
+ unsigned int auth_size;
const uint8_t *plaintext;
- int plaintext_size;
+ unsigned int plaintext_size;
const uint8_t *iv;
const uint8_t *ciphertext;
const uint8_t *tag;
@@ -31,42 +31,42 @@ struct aes_gcm_vectors_st
struct aes_gcm_vectors_st aes_gcm_vectors[] = {
{
- .key =
+ .key = (void*)
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
.auth = NULL,
.auth_size = 0,
.plaintext = NULL,
.plaintext_size = 0,
.ciphertext = NULL,
- .iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
- .tag =
+ .iv = (void*)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ .tag = (void*)
"\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57\xa4\xe7\x45\x5a"},
{
- .key =
+ .key = (void*)
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
.auth = NULL,
.auth_size = 0,
- .plaintext =
+ .plaintext = (void*)
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
.plaintext_size = 16,
- .ciphertext =
+ .ciphertext = (void*)
"\x03\x88\xda\xce\x60\xb6\xa3\x92\xf3\x28\xc2\xb9\x71\xb2\xfe\x78",
- .iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
- .tag =
+ .iv = (void*)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
+ .tag = (void*)
"\xab\x6e\x47\xd4\x2c\xec\x13\xbd\xf5\x3a\x67\xb2\x12\x57\xbd\xdf"},
{
- .key =
+ .key = (void*)
"\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
- .auth =
+ .auth = (void*)
"\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef\xab\xad\xda\xd2",
.auth_size = 20,
- .plaintext =
+ .plaintext = (void*)
"\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
.plaintext_size = 60,
- .ciphertext =
+ .ciphertext = (void*)
"\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91",
- .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
- .tag =
+ .iv = (void*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
+ .tag = (void*)
"\x5b\xc9\x4f\xbc\x32\x21\xa5\xdb\x94\xfa\xe9\x5a\xe7\x12\x1a\x47"}
};
@@ -120,7 +120,8 @@ static int
test_aes (void)
{
gnutls_cipher_hd_t hd;
- int ret, i, j;
+ int ret;
+ unsigned int i, j;
uint8_t _iv[16];
uint8_t tmp[128];
gnutls_datum_t key, iv;
@@ -341,11 +342,11 @@ struct hash_vectors_st
const char *name;
int algorithm;
const uint8_t *key; /* if hmac */
- int key_size;
+ unsigned int key_size;
const uint8_t *plaintext;
- int plaintext_size;
+ unsigned int plaintext_size;
const uint8_t *output;
- int output_size;
+ unsigned int output_size;
} hash_vectors[] =
{
{
@@ -480,7 +481,8 @@ static int
test_hash (void)
{
uint8_t data[HASH_DATA_SIZE];
- int i, j, ret;
+ unsigned int i, j;
+ int ret;
size_t data_size;
fprintf (stdout, "Tests on Hashes\n");
diff --git a/tests/utils.c b/tests/utils.c
index d5625f99e0..490c1e2f3a 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -90,9 +90,10 @@ escapeprint (const char *str, size_t len)
}
void
-hexprint (const char *str, size_t len)
+hexprint (const void *_str, size_t len)
{
size_t i;
+ const char* str = _str;
printf ("\t;; ");
for (i = 0; i < len; i++)
@@ -107,9 +108,10 @@ hexprint (const char *str, size_t len)
}
void
-binprint (const char *str, size_t len)
+binprint (const void *_str, size_t len)
{
size_t i;
+ const char* str = _str;
printf ("\t;; ");
for (i = 0; i < len; i++)
diff --git a/tests/utils.h b/tests/utils.h
index cd588ba6a6..269ac8a2f1 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -46,8 +46,8 @@ extern void success (const char *format, ...)
__attribute__ ((format (printf, 1, 2)));
extern void escapeprint (const char *str, size_t len);
-extern void hexprint (const char *str, size_t len);
-extern void binprint (const char *str, size_t len);
+extern void hexprint (const void *str, size_t len);
+extern void binprint (const void *str, size_t len);
/* This must be implemented elsewhere. */
extern void doit (void);
diff --git a/tests/x509_altname.c b/tests/x509_altname.c
index 00d7cd2797..9238397d43 100644
--- a/tests/x509_altname.c
+++ b/tests/x509_altname.c
@@ -65,7 +65,7 @@ void
doit (void)
{
int ret;
- gnutls_datum_t derCert = { pem, sizeof (pem) };
+ gnutls_datum_t derCert = { (void*)pem, sizeof (pem) };
gnutls_x509_crt_t cert;
size_t data_len = MAX_DATA_SIZE;
char data[MAX_DATA_SIZE];
diff --git a/tests/x509cert.c b/tests/x509cert.c
index aa21be7a53..e753c0798f 100644
--- a/tests/x509cert.c
+++ b/tests/x509cert.c
@@ -159,7 +159,8 @@ void
doit (void)
{
gnutls_certificate_credentials_t x509_cred;
- int ret, i;
+ int ret;
+ unsigned int i;
gnutls_x509_crt_t issuer;
gnutls_x509_crt_t list[LIST_SIZE];
char dn[128];
diff --git a/tests/x509dn.c b/tests/x509dn.c
index 388d44c6f9..d6b6d99280 100644
--- a/tests/x509dn.c
+++ b/tests/x509dn.c
@@ -30,11 +30,11 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#if !defined(_WIN32)
-#include <netinet/in.h>
#include <sys/socket.h>
-#include <sys/wait.h>
-#include <arpa/inet.h>
+#if !defined(_WIN32)
+# include <netinet/in.h>
+# include <sys/wait.h>
+# include <arpa/inet.h>
#endif
#include <unistd.h>
#include <gnutls/gnutls.h>
@@ -151,7 +151,7 @@ cert_callback (gnutls_session_t session,
success ("client: got RDN 0.\n");
if (val.value.size == strlen (EXPECT_RDN0)
- && strncmp (val.value.data, EXPECT_RDN0, val.value.size) == 0)
+ && strncmp ((char*)val.value.data, EXPECT_RDN0, val.value.size) == 0)
{
if (debug)
success ("client: RND 0 correct.\n");
@@ -321,7 +321,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -335,7 +335,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/x509self.c b/tests/x509self.c
index a2f63876d6..551411584d 100644
--- a/tests/x509self.c
+++ b/tests/x509self.c
@@ -30,11 +30,11 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+# include <sys/socket.h>
#if !defined(_WIN32)
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <arpa/inet.h>
+# include <netinet/in.h>
+# include <sys/wait.h>
+# include <arpa/inet.h>
#endif
#include <unistd.h>
#include <gnutls/gnutls.h>
@@ -283,7 +283,7 @@ static gnutls_dh_params_t dh_params;
static int
generate_dh_params (void)
{
- const gnutls_datum_t p3 = { (char *) pkcs3, strlen (pkcs3) };
+ const gnutls_datum_t p3 = { (void *) pkcs3, strlen (pkcs3) };
/* Generate Diffie-Hellman parameters - for use with DHE
* kx algorithms. These should be discarded and regenerated
* once a day, once a week or once a month. Depending on the
@@ -297,7 +297,7 @@ int err, listen_sd, i;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
-int client_len;
+socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
diff --git a/tests/x509sign-verify.c b/tests/x509sign-verify.c
index 134c7c226c..9ac6b5d466 100644
--- a/tests/x509sign-verify.c
+++ b/tests/x509sign-verify.c
@@ -128,15 +128,15 @@ static char pem2_key[] =
"AoNBXjeBjgCGMei2m8E=\n" "-----END DSA PRIVATE KEY-----\n";
const gnutls_datum_t cert_dat[] = {
- {pem1_cert, sizeof (pem1_cert)}
+ {(void*)pem1_cert, sizeof (pem1_cert)}
,
- {pem2_cert, sizeof (pem2_cert)}
+ {(void*)pem2_cert, sizeof (pem2_cert)}
};
const gnutls_datum_t key_dat[] = {
- {pem1_key, sizeof (pem1_key)}
+ {(void*)pem1_key, sizeof (pem1_key)}
,
- {pem2_key, sizeof (pem2_key)}
+ {(void*)pem2_key, sizeof (pem2_key)}
};
void