summaryrefslogtreecommitdiff
path: root/lib/includes
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-05-31 13:49:13 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-05-31 13:56:03 +0200
commit248e282fd4900db081c958e72021f307b1c9edba (patch)
tree66683de7f1f7e90b417f414ccb6caf264f15f243 /lib/includes
parent05a70fa35d94c48ab9621f651f6f10c67931c4b1 (diff)
downloadgnutls-248e282fd4900db081c958e72021f307b1c9edba.tar.gz
several sign-related API changes
This replaces the usage of "int" in functions which could only have accepted an "unsigned" value. Also functions which return unsigned values are explicitly tagged as such. The ABI remains the same with these changes. This allows easier catching of sign/unsigned related errors from the calling applications.
Diffstat (limited to 'lib/includes')
-rw-r--r--lib/includes/gnutls/crypto.h10
-rw-r--r--lib/includes/gnutls/pkcs12.h12
-rw-r--r--lib/includes/gnutls/pkcs7.h8
-rw-r--r--lib/includes/gnutls/x509.h78
4 files changed, 54 insertions, 54 deletions
diff --git a/lib/includes/gnutls/crypto.h b/lib/includes/gnutls/crypto.h
index af0cc32913..3abc77e658 100644
--- a/lib/includes/gnutls/crypto.h
+++ b/lib/includes/gnutls/crypto.h
@@ -56,9 +56,9 @@ int gnutls_cipher_add_auth(gnutls_cipher_hd_t handle,
const void *text, size_t text_size);
void gnutls_cipher_deinit(gnutls_cipher_hd_t handle);
-int gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
-int gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
-int gnutls_cipher_get_tag_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
+unsigned gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
+unsigned gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
+unsigned gnutls_cipher_get_tag_size(gnutls_cipher_algorithm_t algorithm) __GNUTLS_CONST__;
/* AEAD API
*/
@@ -98,7 +98,7 @@ void gnutls_hmac_set_nonce(gnutls_hmac_hd_t handle,
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);
void gnutls_hmac_deinit(gnutls_hmac_hd_t handle, void *digest);
-int gnutls_hmac_get_len(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__;
+unsigned gnutls_hmac_get_len(gnutls_mac_algorithm_t algorithm) __GNUTLS_CONST__;
int gnutls_hmac_fast(gnutls_mac_algorithm_t algorithm,
const void *key, size_t keylen,
const void *text, size_t textlen, void *digest);
@@ -108,7 +108,7 @@ int gnutls_hash_init(gnutls_hash_hd_t * dig,
int gnutls_hash(gnutls_hash_hd_t handle, const void *text, size_t textlen);
void gnutls_hash_output(gnutls_hash_hd_t handle, void *digest);
void gnutls_hash_deinit(gnutls_hash_hd_t handle, void *digest);
-int gnutls_hash_get_len(gnutls_digest_algorithm_t algorithm) __GNUTLS_CONST__;
+unsigned gnutls_hash_get_len(gnutls_digest_algorithm_t algorithm) __GNUTLS_CONST__;
int gnutls_hash_fast(gnutls_digest_algorithm_t algorithm,
const void *text, size_t textlen, void *digest);
diff --git a/lib/includes/gnutls/pkcs12.h b/lib/includes/gnutls/pkcs12.h
index 1442b33bd9..b75efa61c1 100644
--- a/lib/includes/gnutls/pkcs12.h
+++ b/lib/includes/gnutls/pkcs12.h
@@ -110,8 +110,8 @@ typedef enum gnutls_pkcs12_bag_type_t {
} gnutls_pkcs12_bag_type_t;
gnutls_pkcs12_bag_type_t
-gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, int indx);
-int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, int indx,
+gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, unsigned indx);
+int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, unsigned indx,
gnutls_datum_t * data);
int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag,
gnutls_pkcs12_bag_type_t type,
@@ -130,15 +130,15 @@ int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t * bag);
void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag_t bag);
-int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, int indx,
+int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, unsigned indx,
gnutls_datum_t * id);
-int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, int indx,
+int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, unsigned indx,
const gnutls_datum_t * id);
int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag,
- int indx, char **name);
+ unsigned indx, char **name);
int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag,
- int indx, const char *name);
+ unsigned indx, const char *name);
/* *INDENT-OFF* */
#ifdef __cplusplus
diff --git a/lib/includes/gnutls/pkcs7.h b/lib/includes/gnutls/pkcs7.h
index e640a50da5..6d998bc458 100644
--- a/lib/includes/gnutls/pkcs7.h
+++ b/lib/includes/gnutls/pkcs7.h
@@ -58,7 +58,7 @@ int gnutls_pkcs7_get_signature_count(gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_get_embedded_data(gnutls_pkcs7_t pkcs7, unsigned idx, gnutls_datum_t *data);
int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7);
-int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, int indx,
+int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, unsigned indx,
void *certificate, size_t * certificate_size);
int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7_t pkcs7,
@@ -67,7 +67,7 @@ int gnutls_pkcs7_set_crt(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt);
int gnutls_pkcs7_delete_crt(gnutls_pkcs7_t pkcs7, int indx);
int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7_t pkcs7,
- int indx, void *crl, size_t * crl_size);
+ unsigned indx, void *crl, size_t * crl_size);
int gnutls_pkcs7_get_crl_count(gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7_t pkcs7,
@@ -130,10 +130,10 @@ int gnutls_pkcs7_sign(gnutls_pkcs7_t pkcs7,
int
gnutls_pkcs7_get_crt_raw2(gnutls_pkcs7_t pkcs7,
- int indx, gnutls_datum_t *cert);
+ unsigned indx, gnutls_datum_t *cert);
int
gnutls_pkcs7_get_crl_raw2(gnutls_pkcs7_t pkcs7,
- int indx, gnutls_datum_t *crl);
+ unsigned indx, gnutls_datum_t *crl);
int gnutls_pkcs7_print(gnutls_pkcs7_t pkcs7,
gnutls_certificate_print_formats_t format,
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index 045645e4b3..5217942abd 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -170,19 +170,19 @@ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert,
int gnutls_x509_crt_get_issuer_dn2(gnutls_x509_crt_t cert,
gnutls_datum_t * dn);
int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * oid_size);
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
unsigned int raw_flag,
void *buf, size_t * buf_size);
int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf,
size_t * buf_size);
int gnutls_x509_crt_get_dn2(gnutls_x509_crt_t cert, gnutls_datum_t * dn);
-int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, int indx,
+int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, unsigned indx,
void *oid, size_t * oid_size);
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
unsigned int raw_flag, void *buf,
size_t * buf_size);
int gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert,
@@ -495,7 +495,7 @@ typedef struct gnutls_x509_policy_st {
void gnutls_x509_policy_release(struct gnutls_x509_policy_st
*policy);
-int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, int indx, struct gnutls_x509_policy_st
+int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, unsigned indx, struct gnutls_x509_policy_st
*policy, unsigned int *critical);
int gnutls_x509_crt_set_policy(gnutls_x509_crt_t crt, const struct gnutls_x509_policy_st
*policy, unsigned int critical);
@@ -507,10 +507,10 @@ const char *gnutls_x509_dn_oid_name(const char *oid, unsigned int flags);
/* Read extensions by OID. */
int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * oid_size);
int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
void *buf,
size_t * buf_size,
unsigned int *critical);
@@ -518,17 +518,17 @@ int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert,
int gnutls_x509_crq_get_signature_algorithm(gnutls_x509_crq_t crq);
int
gnutls_x509_crq_get_extension_by_oid2(gnutls_x509_crq_t crq,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
gnutls_datum_t *output,
unsigned int *critical);
/* Read extensions by sequence number. */
int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * oid_size,
unsigned int *critical);
int gnutls_x509_crt_get_extension_data(gnutls_x509_crt_t cert,
- int indx, void *data,
+ unsigned indx, void *data,
size_t * sizeof_data);
int
gnutls_x509_crt_get_extension_data2(gnutls_x509_crt_t cert,
@@ -653,10 +653,10 @@ int gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert,
int gnutls_x509_rdn_get(const gnutls_datum_t * idn,
char *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_oid(const gnutls_datum_t * idn,
- int indx, void *buf, size_t * sizeof_buf);
+ unsigned indx, void *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t * idn,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
unsigned int raw_flag, void *buf,
size_t * sizeof_buf);
@@ -716,10 +716,10 @@ int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl,
int gnutls_x509_crl_get_issuer_dn2(gnutls_x509_crl_t crl,
gnutls_datum_t * dn);
int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
unsigned int raw_flag,
void *buf, size_t * sizeof_buf);
-int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, int indx,
+int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, unsigned indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl);
@@ -733,7 +733,7 @@ time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl_t crl);
time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl);
-int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, int indx,
+int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, unsigned indx,
unsigned char *serial,
size_t * serial_size, time_t * t);
@@ -749,7 +749,7 @@ void gnutls_x509_crl_iter_deinit(gnutls_x509_crl_iter_t);
#define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count
#define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial
-int gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl,
+unsigned gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer);
int gnutls_x509_crl_list_import2(gnutls_x509_crl_t ** crls,
@@ -798,16 +798,16 @@ int gnutls_x509_crl_get_number(gnutls_x509_crl_t crl, void *ret,
size_t * ret_size, unsigned int *critical);
int gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * sizeof_oid);
int gnutls_x509_crl_get_extension_info(gnutls_x509_crl_t crl,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl,
- int indx, void *data,
+ unsigned indx, void *data,
size_t * sizeof_data);
int
gnutls_x509_crl_get_extension_data2(gnutls_x509_crl_t crl,
@@ -927,24 +927,24 @@ typedef enum gnutls_certificate_verification_profiles_t {
((((unsigned)x)>>24)&0xff)
-int gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert,
+unsigned gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer);
int gnutls_x509_crt_list_verify(const gnutls_x509_crt_t *
- cert_list, int cert_list_length,
+ cert_list, unsigned cert_list_length,
const gnutls_x509_crt_t * CA_list,
- int CA_list_length,
+ unsigned CA_list_length,
const gnutls_x509_crl_t * CRL_list,
- int CRL_list_length,
+ unsigned CRL_list_length,
unsigned int flags, unsigned int *verify);
int gnutls_x509_crt_verify(gnutls_x509_crt_t cert,
const gnutls_x509_crt_t * CA_list,
- int CA_list_length, unsigned int flags,
+ unsigned CA_list_length, unsigned int flags,
unsigned int *verify);
int gnutls_x509_crl_verify(gnutls_x509_crl_t crl,
const gnutls_x509_crt_t * CA_list,
- int CA_list_length, unsigned int flags,
+ unsigned CA_list_length, unsigned int flags,
unsigned int *verify);
int
@@ -956,14 +956,14 @@ gnutls_x509_crt_verify_data2(gnutls_x509_crt_t crt,
int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert,
const gnutls_x509_crl_t *
- crl_list, int crl_list_length);
+ crl_list, unsigned crl_list_length);
int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert,
gnutls_digest_algorithm_t algo,
void *buf, size_t * buf_size);
int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * oid_size,
unsigned int *critical);
int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert,
@@ -1211,10 +1211,10 @@ int gnutls_x509_crq_get_private_key_usage_period(gnutls_x509_crq_t
int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *buf,
size_t * sizeof_buf);
int gnutls_x509_crq_get_dn2(gnutls_x509_crq_t crq, gnutls_datum_t * dn);
-int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, int indx,
+int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, unsigned indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
unsigned int raw_flag, void *buf,
size_t * sizeof_buf);
int gnutls_x509_crq_set_dn(gnutls_x509_crq_t crq, const char *dn,
@@ -1240,7 +1240,7 @@ int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq,
const char *oid,
void *buf, size_t sizeof_buf);
int gnutls_x509_crq_get_attribute_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
void *buf, size_t * sizeof_buf);
int gnutls_x509_crq_export(gnutls_x509_crq_t crq,
@@ -1283,26 +1283,26 @@ int gnutls_x509_crq_set_key_purpose_oid(gnutls_x509_crq_t crq,
const void *oid,
unsigned int critical);
int gnutls_x509_crq_get_key_purpose_oid(gnutls_x509_crq_t crq,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crq_get_extension_data(gnutls_x509_crq_t crq,
- int indx, void *data,
+ unsigned indx, void *data,
size_t * sizeof_data);
int
gnutls_x509_crq_get_extension_data2(gnutls_x509_crq_t crq,
unsigned indx,
gnutls_datum_t * data);
int gnutls_x509_crq_get_extension_info(gnutls_x509_crq_t crq,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crq_get_attribute_data(gnutls_x509_crq_t crq,
- int indx, void *data,
+ unsigned indx, void *data,
size_t * sizeof_data);
int gnutls_x509_crq_get_attribute_info(gnutls_x509_crq_t crq,
- int indx, void *oid,
+ unsigned indx, void *oid,
size_t * sizeof_oid);
int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq_t crq,
unsigned int *bits);
@@ -1337,7 +1337,7 @@ int gnutls_x509_crq_get_subject_alt_othername_oid(gnutls_x509_crq_t
size_t * ret_size);
int gnutls_x509_crq_get_extension_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
void *buf,
size_t * sizeof_buf,
unsigned int *critical);
@@ -1349,7 +1349,7 @@ int gnutls_x509_crq_set_tlsfeatures(gnutls_x509_crq_t crq,
int
gnutls_x509_crt_get_extension_by_oid2(gnutls_x509_crt_t cert,
- const char *oid, int indx,
+ const char *oid, unsigned indx,
gnutls_datum_t *output,
unsigned int *critical);
@@ -1392,7 +1392,7 @@ gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list,
int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t
list,
const gnutls_x509_crt_t *
- clist, int clist_size);
+ clist, unsigned clist_size);
int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t
list,
@@ -1404,7 +1404,7 @@ int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t
int
gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list,
const gnutls_x509_crl_t *
- crl_list, int crl_size,
+ crl_list, unsigned crl_size,
unsigned int flags,
unsigned int verification_flags);