summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-04-02 20:17:23 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-04-02 20:21:52 +0200
commit0eb8f2922a50ac941010ec266b1d9cf5db8c8580 (patch)
tree2a0e41786347295ac9fb80e3ecfee01a859f67be
parentcb098c250be7e0454a227d7f21e84bc605b42f74 (diff)
downloadgnutls-0eb8f2922a50ac941010ec266b1d9cf5db8c8580.tar.gz
several type changes to please clang
-rw-r--r--lib/accelerated/x86/hmac-padlock.c6
-rw-r--r--lib/algorithms.h3
-rw-r--r--lib/algorithms/kx.c2
-rw-r--r--lib/algorithms/mac.c20
-rw-r--r--lib/crypto-api.c2
-rw-r--r--lib/gnutls_cipher_int.c2
-rw-r--r--lib/gnutls_constate.c2
-rw-r--r--lib/gnutls_hash_int.c12
-rw-r--r--lib/gnutls_hash_int.h4
-rw-r--r--lib/gnutls_pk.c2
-rw-r--r--lib/gnutls_pubkey.c5
-rw-r--r--lib/gnutls_sig.c6
-rw-r--r--lib/gnutls_sig.h2
-rw-r--r--lib/includes/gnutls/crypto.h2
-rw-r--r--lib/opencdk/armor.c10
-rw-r--r--lib/opencdk/misc.c2
-rw-r--r--lib/opencdk/new-packet.c2
-rw-r--r--lib/x509/ocsp.c4
-rw-r--r--lib/x509/verify.c2
-rw-r--r--lib/x509/x509.c2
-rw-r--r--lib/x509/x509_int.h2
21 files changed, 44 insertions, 50 deletions
diff --git a/lib/accelerated/x86/hmac-padlock.c b/lib/accelerated/x86/hmac-padlock.c
index ec68771fd1..b762952563 100644
--- a/lib/accelerated/x86/hmac-padlock.c
+++ b/lib/accelerated/x86/hmac-padlock.c
@@ -304,7 +304,7 @@ wrap_padlock_hmac_fast (gnutls_mac_algorithm_t algo,
if (key_size > SHA1_DATA_SIZE)
{
- wrap_padlock_hash_fast (algo, key, key_size, hkey);
+ wrap_padlock_hash_fast ((gnutls_digest_algorithm_t)algo, key, key_size, hkey);
key = hkey;
key_size = digest_size;
}
@@ -318,7 +318,7 @@ wrap_padlock_hmac_fast (gnutls_mac_algorithm_t algo,
memcpy (&pad[SHA1_DATA_SIZE], text, text_size);
- wrap_padlock_hash_fast (algo, pad, text_size + SHA1_DATA_SIZE,
+ wrap_padlock_hash_fast ((gnutls_digest_algorithm_t)algo, pad, text_size + SHA1_DATA_SIZE,
&pad2[SHA1_DATA_SIZE]);
gnutls_free (pad);
@@ -326,7 +326,7 @@ wrap_padlock_hmac_fast (gnutls_mac_algorithm_t algo,
memset (pad2, OPAD, SHA1_DATA_SIZE);
memxor (pad2, key, key_size);
- wrap_padlock_hash_fast (algo, pad2, digest_size + SHA1_DATA_SIZE,
+ wrap_padlock_hash_fast ((gnutls_digest_algorithm_t)algo, pad2, digest_size + SHA1_DATA_SIZE,
digest);
}
diff --git a/lib/algorithms.h b/lib/algorithms.h
index 41fb34eefc..e2600c605a 100644
--- a/lib/algorithms.h
+++ b/lib/algorithms.h
@@ -50,11 +50,10 @@ int _gnutls_version_has_explicit_iv (gnutls_protocol_t version);
/* Functions for MACs. */
int _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm);
-gnutls_mac_algorithm_t _gnutls_x509_oid2mac_algorithm (const char *oid);
+gnutls_digest_algorithm_t _gnutls_x509_oid_to_digest (const char *oid);
const char *_gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t mac);
/* Functions for digests. */
-gnutls_digest_algorithm_t _gnutls_x509_oid2digest_algorithm (const char *oid);
const char *_gnutls_x509_digest_to_oid (gnutls_digest_algorithm_t algorithm);
const char *_gnutls_digest_get_name (gnutls_digest_algorithm_t algorithm);
diff --git a/lib/algorithms/kx.c b/lib/algorithms/kx.c
index 7a47781c0c..23811744d1 100644
--- a/lib/algorithms/kx.c
+++ b/lib/algorithms/kx.c
@@ -181,7 +181,7 @@ gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm)
gnutls_kx_algorithm_t
gnutls_kx_get_id (const char *name)
{
- gnutls_cipher_algorithm_t ret = GNUTLS_KX_UNKNOWN;
+ gnutls_kx_algorithm_t ret = GNUTLS_KX_UNKNOWN;
GNUTLS_KX_LOOP (
if (strcasecmp (p->name, name) == 0)
diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c
index 0813df2010..ad7d57c582 100644
--- a/lib/algorithms/mac.c
+++ b/lib/algorithms/mac.c
@@ -179,18 +179,20 @@ _gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t algorithm)
return ret;
}
-gnutls_mac_algorithm_t
-_gnutls_x509_oid2mac_algorithm (const char *oid)
+gnutls_digest_algorithm_t
+_gnutls_x509_oid_to_digest (const char *oid)
{
- gnutls_mac_algorithm_t ret = 0;
+ gnutls_digest_algorithm_t ret = 0;
GNUTLS_HASH_LOOP (if (p->oid && strcmp (oid, p->oid) == 0)
{
- ret = p->id; break;}
+ ret = (gnutls_digest_algorithm_t)p->id;
+ break;
+ }
);
if (ret == 0)
- return GNUTLS_MAC_UNKNOWN;
+ return GNUTLS_DIG_UNKNOWN;
return ret;
}
@@ -200,16 +202,10 @@ _gnutls_x509_digest_to_oid (gnutls_digest_algorithm_t algorithm)
return _gnutls_x509_mac_to_oid ((gnutls_mac_algorithm_t) algorithm);
}
-gnutls_digest_algorithm_t
-_gnutls_x509_oid2digest_algorithm (const char *oid)
-{
- return (gnutls_digest_algorithm_t) _gnutls_x509_oid2mac_algorithm (oid);
-}
-
const char *
_gnutls_digest_get_name (gnutls_digest_algorithm_t algorithm)
{
- return gnutls_mac_get_name ((gnutls_digest_algorithm_t) algorithm);
+ return gnutls_mac_get_name ((gnutls_mac_algorithm_t) algorithm);
}
int
diff --git a/lib/crypto-api.c b/lib/crypto-api.c
index 2beb329e69..3bf2efefbf 100644
--- a/lib/crypto-api.c
+++ b/lib/crypto-api.c
@@ -288,7 +288,7 @@ api_cipher_hd_st * h = handle;
**/
int
gnutls_hmac_init (gnutls_hmac_hd_t * dig,
- gnutls_digest_algorithm_t algorithm,
+ gnutls_mac_algorithm_t algorithm,
const void *key, size_t keylen)
{
*dig = gnutls_malloc (sizeof (digest_hd_st));
diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index 94f7b13424..cbb6a401ae 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -166,7 +166,7 @@ int ret;
goto cleanup;
}
- handle->tag_size = _gnutls_hash_get_algo_len(mac);
+ handle->tag_size = _gnutls_hmac_get_algo_len(mac);
}
else if (_gnutls_cipher_is_aead(&handle->cipher))
handle->tag_size = _gnutls_cipher_tag_len(&handle->cipher);
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index 84e6fe3682..5ef0c74f53 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -429,7 +429,7 @@ _gnutls_epoch_set_keys (gnutls_session_t session, uint16_t epoch)
IV_size = _gnutls_cipher_get_iv_size (cipher_algo);
key_size = gnutls_cipher_get_key_size (cipher_algo);
export_flag = _gnutls_cipher_get_export_flag (cipher_algo);
- hash_size = _gnutls_hash_get_algo_len (mac_algo);
+ hash_size = _gnutls_hmac_get_algo_len (mac_algo);
ret = _gnutls_set_keys
(session, params, hash_size, IV_size, key_size, export_flag);
diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c
index 543369e546..740e13b086 100644
--- a/lib/gnutls_hash_int.c
+++ b/lib/gnutls_hash_int.c
@@ -208,7 +208,7 @@ _gnutls_hmac_init (digest_hd_st * dig, gnutls_mac_algorithm_t algorithm,
int result;
const gnutls_crypto_mac_st *cc = NULL;
- dig->algorithm = algorithm;
+ dig->algorithm = (gnutls_digest_algorithm_t)algorithm;
dig->key = key;
dig->keysize = keylen;
@@ -276,13 +276,13 @@ _gnutls_hmac_deinit (digest_hd_st * handle, void *digest)
}
inline static int
-get_padsize (gnutls_mac_algorithm_t algorithm)
+get_padsize (gnutls_digest_algorithm_t algorithm)
{
switch (algorithm)
{
- case GNUTLS_MAC_MD5:
+ case GNUTLS_DIG_MD5:
return 48;
- case GNUTLS_MAC_SHA1:
+ case GNUTLS_DIG_SHA1:
return 40;
default:
return 0;
@@ -299,7 +299,7 @@ _gnutls_mac_init_ssl3 (digest_hd_st * ret, gnutls_mac_algorithm_t algorithm,
uint8_t ipad[48];
int padsize, result;
- padsize = get_padsize (algorithm);
+ padsize = get_padsize ((gnutls_digest_algorithm_t)algorithm);
if (padsize == 0)
{
gnutls_assert ();
@@ -308,7 +308,7 @@ _gnutls_mac_init_ssl3 (digest_hd_st * ret, gnutls_mac_algorithm_t algorithm,
memset (ipad, 0x36, padsize);
- result = _gnutls_hash_init (ret, algorithm);
+ result = _gnutls_hash_init (ret, (gnutls_digest_algorithm_t)algorithm);
if (result < 0)
{
gnutls_assert ();
diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h
index 565d6a612a..5c55490e01 100644
--- a/lib/gnutls_hash_int.h
+++ b/lib/gnutls_hash_int.h
@@ -43,7 +43,7 @@ typedef void (*deinit_func) (void *handle);
typedef struct
{
- gnutls_mac_algorithm_t algorithm;
+ gnutls_digest_algorithm_t algorithm;
const void *key;
int keysize;
@@ -60,7 +60,7 @@ 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);
size_t _gnutls_hash_get_algo_len (gnutls_digest_algorithm_t algorithm);
-#define _gnutls_hmac_get_algo_len _gnutls_hash_get_algo_len
+#define _gnutls_hmac_get_algo_len(x) _gnutls_hash_get_algo_len((gnutls_digest_algorithm_t)x)
int _gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void *key,
int keylen, const void *text, size_t textlen,
void *digest);
diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c
index ef544c1321..738f1accf2 100644
--- a/lib/gnutls_pk.c
+++ b/lib/gnutls_pk.c
@@ -502,7 +502,7 @@ _gnutls_pk_get_hash_algorithm (gnutls_pk_algorithm_t pk,
*mand = 0;
}
- return _gnutls_x509_verify_algorithm ((gnutls_mac_algorithm_t *) dig,
+ return _gnutls_x509_verify_algorithm (dig,
NULL, pk, params);
}
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index d66a531a83..32cdb720b9 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -1465,8 +1465,7 @@ gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key,
return GNUTLS_E_INVALID_REQUEST;
}
- return _gnutls_x509_verify_algorithm ((gnutls_mac_algorithm_t *)
- hash, signature,
+ return _gnutls_x509_verify_algorithm (hash, signature,
key->pk_algorithm,
&key->params);
@@ -1541,7 +1540,7 @@ _pkcs1_rsa_verify_sig (const gnutls_datum_t * text,
const gnutls_datum_t * signature,
gnutls_pk_params_st * params)
{
- gnutls_mac_algorithm_t hash = GNUTLS_MAC_UNKNOWN;
+ gnutls_digest_algorithm_t hash = GNUTLS_DIG_UNKNOWN;
int ret;
uint8_t digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE], *cmp;
unsigned int digest_size;
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index a5e85bd529..66fde1bba3 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -596,7 +596,7 @@ _gnutls_handshake_sign_crt_vrfy12 (gnutls_session_t session,
_gnutls_debug_log ("sign handshake cert vrfy: picked %s with %s\n",
gnutls_sign_algorithm_get_name (sign_algo),
- gnutls_mac_get_name (hash_algo));
+ gnutls_mac_get_name ((gnutls_mac_algorithm_t)hash_algo));
ret = _gnutls_hash_fast (hash_algo, session->internals.handshake_hash_buffer.data,
session->internals.handshake_hash_buffer.length,
@@ -794,7 +794,7 @@ pk_prepare_hash (gnutls_pk_algorithm_t pk,
*/
int
decode_ber_digest_info (const gnutls_datum_t * info,
- gnutls_mac_algorithm_t * hash,
+ gnutls_digest_algorithm_t * hash,
uint8_t * digest, unsigned int *digest_size)
{
ASN1_TYPE dinfo = ASN1_TYPE_EMPTY;
@@ -827,7 +827,7 @@ decode_ber_digest_info (const gnutls_datum_t * info,
return _gnutls_asn2err (result);
}
- *hash = _gnutls_x509_oid2mac_algorithm (str);
+ *hash = _gnutls_x509_oid_to_digest (str);
if (*hash == GNUTLS_MAC_UNKNOWN)
{
diff --git a/lib/gnutls_sig.h b/lib/gnutls_sig.h
index 187ab8368c..cd4981d945 100644
--- a/lib/gnutls_sig.h
+++ b/lib/gnutls_sig.h
@@ -66,7 +66,7 @@ _gnutls_privkey_sign_hash (gnutls_privkey_t key,
int
decode_ber_digest_info (const gnutls_datum_t * info,
- gnutls_mac_algorithm_t * hash,
+ gnutls_digest_algorithm_t * hash,
uint8_t * digest, unsigned int *digest_size);
#endif
diff --git a/lib/includes/gnutls/crypto.h b/lib/includes/gnutls/crypto.h
index abc6813cbf..c8d5755e4e 100644
--- a/lib/includes/gnutls/crypto.h
+++ b/lib/includes/gnutls/crypto.h
@@ -58,7 +58,7 @@ extern "C"
typedef struct hmac_hd_st *gnutls_hmac_hd_t;
int gnutls_hmac_init (gnutls_hmac_hd_t * dig,
- gnutls_digest_algorithm_t algorithm, const void *key,
+ gnutls_mac_algorithm_t algorithm, const void *key,
size_t keylen);
int gnutls_hmac (gnutls_hmac_hd_t handle, const void *text, size_t textlen);
void gnutls_hmac_output (gnutls_hmac_hd_t handle, void *digest);
diff --git a/lib/opencdk/armor.c b/lib/opencdk/armor.c
index e007522a6a..fbfab152e7 100644
--- a/lib/opencdk/armor.c
+++ b/lib/opencdk/armor.c
@@ -132,7 +132,7 @@ compress_get_algo (cdk_stream_t inp, int *r_zipalgo)
&& (nread = _cdk_stream_gets (inp, buf, DIM (buf) - 1)) > 0)
{
plain_size = sizeof(plain);
- base64_decode (buf, nread, plain, &plain_size);
+ base64_decode (buf, nread, (char*)plain, &plain_size);
if (!(*plain & 0x80))
break;
pkttype = *plain & 0x40 ? (*plain & 0x3f) : ((*plain >> 2) & 0xf);
@@ -264,7 +264,7 @@ armor_encode (void *data, FILE * in, FILE * out)
return CDK_File_Error;
}
afx->crc = update_crc (afx->crc, (byte *) raw, nread);
- base64_encode ((byte *) raw, nread, buf, DIM (buf) - 1);
+ base64_encode (raw, nread, buf, DIM (buf) - 1);
fprintf (out, "%s%s", buf, lf);
}
@@ -395,14 +395,14 @@ armor_decode (void *data, FILE * in, FILE * out)
{ /* CRC */
memset (crcbuf, 0, sizeof (crcbuf));
crcbuf_size = sizeof(crcbuf);
- base64_decode (buf + 1, len-1, crcbuf, &crcbuf_size);
+ base64_decode (buf + 1, len-1, (char*)crcbuf, &crcbuf_size);
crc2 = (crcbuf[0] << 16) | (crcbuf[1] << 8) | crcbuf[2];
break; /* stop here */
}
else
{
raw_size = sizeof(raw);
- nread = base64_decode (buf, len, raw, &raw_size);
+ nread = base64_decode (buf, len, (char*)raw, &raw_size);
if (nread == 0)
break;
afx->crc = update_crc (afx->crc, raw, raw_size);
@@ -490,7 +490,7 @@ cdk_armor_encode_buffer (const byte * inbuf, size_t inlen,
size_t * nwritten, int type)
{
const char *head, *tail, *le;
- byte tempbuf[48];
+ char tempbuf[48];
char tempout[128];
size_t pos, off, len, rest;
diff --git a/lib/opencdk/misc.c b/lib/opencdk/misc.c
index 0cda7219f2..ec6ad08765 100644
--- a/lib/opencdk/misc.c
+++ b/lib/opencdk/misc.c
@@ -116,7 +116,7 @@ _cdk_memistr (const char *buf, size_t buflen, const char *sub)
{
if (c_toupper (*t) == c_toupper (*s))
{
- for (buf = t++, buflen = n--, s++;
+ for (buf = (char*)t++, buflen = n--, s++;
n && c_toupper (*t) == c_toupper ((byte) * s); t++, s++, n--)
;
if (!*s)
diff --git a/lib/opencdk/new-packet.c b/lib/opencdk/new-packet.c
index b46267c088..9453476be6 100644
--- a/lib/opencdk/new-packet.c
+++ b/lib/opencdk/new-packet.c
@@ -626,7 +626,7 @@ cdk_subpkt_new (size_t size)
s = cdk_calloc (1, sizeof *s + size + 2);
if (!s)
return NULL;
- s->d = (char *) s + sizeof (*s);
+ s->d = (byte*)s + sizeof (*s);
return s;
}
diff --git a/lib/x509/ocsp.c b/lib/x509/ocsp.c
index 9855352a48..0857e33acf 100644
--- a/lib/x509/ocsp.c
+++ b/lib/x509/ocsp.c
@@ -492,7 +492,7 @@ gnutls_ocsp_req_get_cert_id (gnutls_ocsp_req_t req,
return ret;
}
- ret = _gnutls_x509_oid2digest_algorithm ((char*)sa.data);
+ ret = _gnutls_x509_oid_to_digest ((char*)sa.data);
_gnutls_free_datum (&sa);
if (ret < 0)
{
@@ -1354,7 +1354,7 @@ gnutls_ocsp_resp_get_single (gnutls_ocsp_resp_t resp,
return ret;
}
- ret = _gnutls_x509_oid2digest_algorithm ((char*)sa.data);
+ ret = _gnutls_x509_oid_to_digest ((char*)sa.data);
_gnutls_free_datum (&sa);
if (ret < 0)
{
diff --git a/lib/x509/verify.c b/lib/x509/verify.c
index 1c34269c18..4a133d451e 100644
--- a/lib/x509/verify.c
+++ b/lib/x509/verify.c
@@ -677,7 +677,7 @@ _gnutls_x509_verify_certificate (const gnutls_x509_crt_t * certificate_list,
* the given parameters.
*/
int
-_gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash,
+_gnutls_x509_verify_algorithm (gnutls_digest_algorithm_t * hash,
const gnutls_datum_t * signature,
gnutls_pk_algorithm_t pk,
gnutls_pk_params_st * issuer_params)
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index b9cf50cd5f..d0de3cb97f 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -2582,7 +2582,7 @@ gnutls_x509_crt_get_verify_algorithm (gnutls_x509_crt_t crt,
return ret;
}
- ret = _gnutls_x509_verify_algorithm ((gnutls_mac_algorithm_t *) hash,
+ ret = _gnutls_x509_verify_algorithm (hash,
signature,
gnutls_x509_crt_get_pk_algorithm (crt,
NULL),
diff --git a/lib/x509/x509_int.h b/lib/x509/x509_int.h
index 0dd3cb5b17..19c2c1238b 100644
--- a/lib/x509/x509_int.h
+++ b/lib/x509/x509_int.h
@@ -141,7 +141,7 @@ int gnutls_x509_crt_is_issuer (gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer);
int
-_gnutls_x509_verify_algorithm (gnutls_mac_algorithm_t * hash,
+_gnutls_x509_verify_algorithm (gnutls_digest_algorithm_t * hash,
const gnutls_datum_t * signature,
gnutls_pk_algorithm_t pk,
gnutls_pk_params_st * issuer_params);