From: Nikos Mavrogiannopoulos Date: Tue, 7 Oct 2003 22:42:15 +0000 (+0000) Subject: Corrected some of the return types. Several other minor corrections. X-Git-Tag: gnutls_0_9_90~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41bcc7660913cafeca9a768be60cd79f0f7b649e;p=thirdparty%2Fgnutls.git Corrected some of the return types. Several other minor corrections. --- diff --git a/includes/gnutls/x509.h b/includes/gnutls/x509.h index 3ad5275b5a..d17047d3db 100644 --- a/includes/gnutls/x509.h +++ b/includes/gnutls/x509.h @@ -52,31 +52,31 @@ void gnutls_x509_crt_deinit(gnutls_x509_crt cert); int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_x509_crt_export( gnutls_x509_crt cert, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, - int *sizeof_buf); + size_t *sizeof_buf); int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, - const char* oid, int indx, char *buf, int *sizeof_buf); + const char* oid, int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, - int *sizeof_buf); + size_t *sizeof_buf); int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, - const char* oid, int indx, char *buf, int *sizeof_buf); + const char* oid, int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crt_check_hostname(gnutls_x509_crt cert, const char *hostname); int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt cert); int gnutls_x509_crt_get_version(gnutls_x509_crt cert); int gnutls_x509_crt_get_key_id( gnutls_x509_crt crt, unsigned int flags, - unsigned char* output_data, int* output_data_size); + unsigned char* output_data, size_t* output_data_size); time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt cert); time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert); -int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size); +int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, size_t* result_size); int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, int* bits); int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, - int seq, char *ret, int *ret_size, int* critical); + int seq, char *ret, size_t *ret_size, int* critical); int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, int* critical); int gnutls_x509_crt_get_key_usage( gnutls_x509_crt cert, unsigned int* key_usage, @@ -96,7 +96,7 @@ int gnutls_x509_crt_get_key_usage( gnutls_x509_crt cert, unsigned int* key_usage int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, const char* oid, int indx, - unsigned char* buf, int * sizeof_buf, int * critical); + unsigned char* buf, size_t * sizeof_buf, int * critical); int gnutls_x509_crt_to_xml(gnutls_x509_crt cert, gnutls_datum* res, int detail); @@ -107,10 +107,10 @@ int gnutls_x509_crt_to_xml(gnutls_x509_crt cert, gnutls_datum* res, int detail); /* RDN handling */ int gnutls_x509_rdn_get(const gnutls_datum * idn, - char *buf, unsigned int *sizeof_buf); + char *buf, size_t *sizeof_buf); int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char* oid, - int indx, char *buf, unsigned int *sizeof_buf); + int indx, char *buf, size_t *sizeof_buf); /* CRL handling functions */ @@ -122,12 +122,12 @@ void gnutls_x509_crl_deinit(gnutls_x509_crl crl); int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_x509_crl_export( gnutls_x509_crl crl, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_x509_crl_get_issuer_dn(const gnutls_x509_crl crl, - char *buf, int *sizeof_buf); + char *buf, size_t *sizeof_buf); int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl, - const char* oid, int indx, char *buf, int *sizeof_buf); + const char* oid, int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl crl); int gnutls_x509_crl_get_version(gnutls_x509_crl crl); @@ -137,7 +137,7 @@ time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl); int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl); int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, unsigned char* serial, - int* serial_size, time_t* time); + size_t* serial_size, time_t* time); int gnutls_x509_crl_check_issuer( gnutls_x509_crl crl, gnutls_x509_crt issuer); @@ -155,15 +155,15 @@ int gnutls_pkcs7_get_certificate_count( gnutls_pkcs7 pkcs7); int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_pkcs7_export( gnutls_pkcs7 pkcs7, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, int indx, - unsigned char* certificate, int* certificate_size); + unsigned char* certificate, size_t* certificate_size); int gnutls_pkcs7_set_certificate(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7, - int indx, unsigned char* crl, int* crl_size); + int indx, unsigned char* crl, size_t* crl_size); int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7); int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, const gnutls_datum* crt); @@ -204,7 +204,7 @@ int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert, gnutls_digest_algorithm algo, char *buf, - int *sizeof_buf); + size_t *sizeof_buf); /* Private key handling */ @@ -232,16 +232,16 @@ int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey privkey, const gnutls_datum *u); int gnutls_x509_privkey_get_pk_algorithm( gnutls_x509_privkey key); int gnutls_x509_privkey_get_key_id( gnutls_x509_privkey key, unsigned int flags, - unsigned char* output_data, int* output_data_size); + unsigned char* output_data, size_t* output_data_size); int gnutls_x509_privkey_generate( gnutls_x509_privkey key, gnutls_pk_algorithm algo, int bits, unsigned int flags); int gnutls_x509_privkey_export( gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_x509_privkey_export_pkcs8( gnutls_x509_privkey key, gnutls_x509_crt_fmt format, const char* password, unsigned int flags, - unsigned char* output_data, int* output_data_size); + unsigned char* output_data, size_t* output_data_size); int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key, gnutls_datum * m, gnutls_datum *e, gnutls_datum *d, gnutls_datum *p, gnutls_datum* q, @@ -257,9 +257,9 @@ void gnutls_x509_crq_deinit(gnutls_x509_crq crq); int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, - int *sizeof_buf); + size_t *sizeof_buf); int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid, - int indx, char *buf, int *sizeof_buf); + int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq crq, const char* oid, const char *name, int sizeof_name); int gnutls_x509_crq_set_version(gnutls_x509_crq crq, int version); @@ -268,10 +268,10 @@ int gnutls_x509_crq_sign(gnutls_x509_crq crq, gnutls_x509_privkey key); int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq crq, const char* pass); int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq, - const char* pass, int* sizeof_pass); + const char* pass, size_t* sizeof_pass); int gnutls_x509_crq_export( gnutls_x509_crq crq, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 148449991c..e56eb26896 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -26,7 +26,7 @@ # include #endif -extern void (*_gnutls_log_func)( int, const char*); +extern LOG_FUNC _gnutls_log_func; #define ERROR_ENTRY(desc, name, fatal) \ { desc, #name, name, fatal} diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index 92bc69fa40..0af34fa73d 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -25,7 +25,6 @@ #include #include "x509/rc2.h" -typedef void (*LOG_FUNC)( int, const char*); #define gnutls_log_func LOG_FUNC /* created by asn1c */ diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 0f7ab3f3bc..8028fb654d 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -205,6 +205,7 @@ typedef enum gnutls_pk_algorithm { GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA, /* STATE (stop) */ +typedef void (*LOG_FUNC)( int, const char*); /* Pull & Push functions defines: */ diff --git a/lib/x509/common.c b/lib/x509/common.c index 5aab61a833..665283a44c 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -519,7 +519,7 @@ gnutls_x509_subject_alt_name _gnutls_x509_san_find_type( char* str_type) { */ int _gnutls_x509_export_int( ASN1_TYPE asn1_data, gnutls_x509_crt_fmt format, char* pem_header, - int tmp_buf_size, unsigned char* output_data, int* output_data_size) + int tmp_buf_size, unsigned char* output_data, size_t* output_data_size) { int result; if (tmp_buf_size == 0) tmp_buf_size = 16*1024; diff --git a/lib/x509/common.h b/lib/x509/common.h index fa3e00c5e7..c197f7bdef 100644 --- a/lib/x509/common.h +++ b/lib/x509/common.h @@ -48,7 +48,7 @@ int _gnutls_x509_der_encode( ASN1_TYPE src, const char* src_name, int _gnutls_x509_export_int( ASN1_TYPE asn1_data, gnutls_x509_crt_fmt format, char* pem_header, - int tmp_buf_size, unsigned char* output_data, int* output_data_size); + int tmp_buf_size, unsigned char* output_data, size_t* output_data_size); int _gnutls_x509_read_value( ASN1_TYPE c, const char* root, gnutls_datum *ret, int str); int _gnutls_x509_write_value( ASN1_TYPE c, const char* root, const gnutls_datum* data, int str); diff --git a/lib/x509/crl.c b/lib/x509/crl.c index 615a99004e..031055d37a 100644 --- a/lib/x509/crl.c +++ b/lib/x509/crl.c @@ -245,7 +245,7 @@ int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, * **/ int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf, - int *sizeof_buf) + size_t *sizeof_buf) { if (sizeof_buf == 0 || crl == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -280,7 +280,7 @@ int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf, **/ int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl, const char *oid, int indx, - char *buf, int *sizeof_buf) + char *buf, size_t *sizeof_buf) { if (sizeof_buf == 0 || crl == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -411,7 +411,7 @@ int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl) **/ int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, unsigned char *serial, - int *serial_size, time_t * time) + size_t *serial_size, time_t * time) { int result; @@ -525,7 +525,7 @@ int _gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl crl, * **/ int gnutls_x509_crl_export( gnutls_x509_crl crl, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size) + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size) { return _gnutls_x509_export_int( crl->crl, format, PEM_CRL, *output_data_size, output_data, output_data_size); diff --git a/lib/x509/crq.c b/lib/x509/crq.c index 9a4a03edc1..06e91859a6 100644 --- a/lib/x509/crq.c +++ b/lib/x509/crq.c @@ -166,7 +166,7 @@ int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, * **/ int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, - int *sizeof_buf) + size_t *sizeof_buf) { if (sizeof_buf == 0 || crq == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -199,7 +199,7 @@ int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, * **/ int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid, - int indx, char *buf, int *sizeof_buf) + int indx, char *buf, size_t *sizeof_buf) { if (sizeof_buf == 0 || crq == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -222,7 +222,7 @@ int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid, static int parse_attribute(ASN1_TYPE asn1_struct, const char *attr_name, const char *given_oid, int indx, - char *buf, int *sizeof_buf) + char *buf, size_t *sizeof_buf) { int k1, result; char tmpbuffer1[64]; @@ -363,7 +363,7 @@ static int parse_attribute(ASN1_TYPE asn1_struct, * **/ int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq, - char* pass, int* sizeof_pass) + char* pass, size_t* sizeof_pass) { return parse_attribute( crq->crq, "certificationRequestInfo.attributes", "1.2.840.113549.1.9.7", 0, pass, sizeof_pass); @@ -623,7 +623,7 @@ gnutls_datum signature; * **/ int gnutls_x509_crq_export( gnutls_x509_crq crq, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size) + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size) { return _gnutls_x509_export_int( crq->crq, format, PEM_CRQ, *output_data_size, output_data, output_data_size); diff --git a/lib/x509/crq.h b/lib/x509/crq.h index 58a14cf70e..b0da695497 100644 --- a/lib/x509/crq.h +++ b/lib/x509/crq.h @@ -8,7 +8,7 @@ typedef struct gnutls_x509_crq_int { typedef struct gnutls_x509_crq_int *gnutls_x509_crq; int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, char *buf, int *sizeof_buf); + int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crq_init(gnutls_x509_crq * crq); void gnutls_x509_crq_deinit(gnutls_x509_crq crq); diff --git a/lib/x509/dn.c b/lib/x509/dn.c index 964eec7ff3..35f6146363 100644 --- a/lib/x509/dn.c +++ b/lib/x509/dn.c @@ -713,7 +713,7 @@ int _gnutls_x509_set_dn_oid(ASN1_TYPE asn1_struct, * **/ int gnutls_x509_rdn_get(const gnutls_datum * idn, - char *buf, unsigned int *sizeof_buf) + char *buf, size_t *sizeof_buf) { int result; ASN1_TYPE dn = ASN1_TYPE_EMPTY; @@ -767,7 +767,7 @@ int gnutls_x509_rdn_get(const gnutls_datum * idn, * **/ int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char* oid, int indx, - char *buf, unsigned int *sizeof_buf) + char *buf, size_t *sizeof_buf) { int result; ASN1_TYPE dn = ASN1_TYPE_EMPTY; diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index 9f9ad12cfb..92cedf09a5 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -242,7 +242,7 @@ int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, * **/ int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, - int indx, unsigned char* certificate, int* certificate_size) + int indx, unsigned char* certificate, size_t* certificate_size) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, len; @@ -380,7 +380,7 @@ int gnutls_pkcs7_get_certificate_count(gnutls_pkcs7 pkcs7) * **/ int gnutls_pkcs7_export( gnutls_pkcs7 pkcs7, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size) + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size) { return _gnutls_x509_export_int( pkcs7->pkcs7, format, PEM_PKCS7, *output_data_size, output_data, output_data_size); @@ -609,7 +609,7 @@ int gnutls_pkcs7_delete_certificate(gnutls_pkcs7 pkcs7, int indx) * **/ int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7, - int indx, unsigned char* crl, int* crl_size) + int indx, unsigned char* crl, size_t* crl_size) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; diff --git a/lib/x509/pkcs7.h b/lib/x509/pkcs7.h index 2099cae8b8..dfabee49cd 100644 --- a/lib/x509/pkcs7.h +++ b/lib/x509/pkcs7.h @@ -10,5 +10,5 @@ void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7); int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, - int indx, unsigned char* certificate, int* certificate_size); + int indx, unsigned char* certificate, size_t* certificate_size); int gnutls_pkcs7_get_certificate_count(gnutls_pkcs7 pkcs7); diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index cdc2c755bf..e99b1bd1cd 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -467,7 +467,7 @@ int gnutls_x509_privkey_get_pk_algorithm( gnutls_x509_privkey key) * **/ int gnutls_x509_privkey_export( gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size) + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size) { char * msg; @@ -1075,7 +1075,7 @@ opaque algo = GNUTLS_PK_DSA; * **/ int gnutls_x509_privkey_get_key_id( gnutls_x509_privkey key, unsigned int flags, - unsigned char* output_data, int* output_data_size) + unsigned char* output_data, size_t* output_data_size) { if (key->pk_algorithm == GNUTLS_PK_RSA) diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c index 45bd6567b7..c2c2e9cd32 100644 --- a/lib/x509/privkey_pkcs8.c +++ b/lib/x509/privkey_pkcs8.c @@ -398,7 +398,7 @@ int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey key, const char *password, unsigned int flags, unsigned char *output_data, - int *output_data_size) + size_t *output_data_size) { ASN1_TYPE pkcs8_asn, pkey_info; int ret; diff --git a/lib/x509/x509.c b/lib/x509/x509.c index f7fbe07ff9..aa008662d8 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -300,7 +300,7 @@ int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, * **/ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, - int *sizeof_buf) + size_t *sizeof_buf) { if (sizeof_buf == 0 || cert == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -333,7 +333,7 @@ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, * **/ int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, char *buf, int *sizeof_buf) + int indx, char *buf, size_t *sizeof_buf) { if (sizeof_buf == 0 || cert == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -362,7 +362,7 @@ int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid, * **/ int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, - int *sizeof_buf) + size_t *sizeof_buf) { if (sizeof_buf == 0 || cert == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -395,7 +395,7 @@ int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, * **/ int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, char *buf, int *sizeof_buf) + int indx, char *buf, size_t *sizeof_buf) { if (sizeof_buf == 0 || cert == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -493,7 +493,8 @@ time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert) * Returns a negative value in case of an error, and 0 on success. * **/ -int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size) +int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, + size_t* result_size) { int ret; @@ -642,7 +643,7 @@ int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, int* bits) * **/ int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, - int seq, char *ret, int *ret_size, int *critical) + int seq, char *ret, size_t *ret_size, int *critical) { int result; gnutls_datum dnsname; @@ -847,7 +848,7 @@ int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, unsigned int *key_usage, * **/ int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, unsigned char* buf, int * sizeof_buf, int * critical) + int indx, unsigned char* buf, size_t * sizeof_buf, int * critical) { int result; gnutls_datum output; @@ -979,7 +980,7 @@ int _gnutls_x509_crt_get_raw_dn( gnutls_x509_crt cert, **/ int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert, gnutls_digest_algorithm algo, char *buf, - int *sizeof_buf) + size_t *sizeof_buf) { opaque *cert_buf; int cert_buf_size; @@ -1037,7 +1038,7 @@ gnutls_datum tmp; * **/ int gnutls_x509_crt_export( gnutls_x509_crt cert, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size) + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size) { return _gnutls_x509_export_int( cert->cert, format, "CERTIFICATE", *output_data_size, output_data, output_data_size); @@ -1064,7 +1065,7 @@ int gnutls_x509_crt_export( gnutls_x509_crt cert, * **/ int gnutls_x509_crt_get_key_id( gnutls_x509_crt crt, unsigned int flags, - unsigned char* output_data, int* output_data_size) + unsigned char* output_data, size_t* output_data_size) { GNUTLS_MPI params[MAX_PUBLIC_PARAMS_SIZE]; int params_size = MAX_PUBLIC_PARAMS_SIZE; diff --git a/lib/x509/x509.h b/lib/x509/x509.h index 49e469ed58..1b13b83523 100644 --- a/lib/x509/x509.h +++ b/lib/x509/x509.h @@ -66,11 +66,11 @@ typedef struct gnutls_x509_crl_int *gnutls_x509_crl; typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey; int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, char *buf, int *sizeof_buf); + int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, - int seq, char *ret, int *ret_size, int* critical); + int seq, char *ret, size_t *ret_size, int* critical); int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid, - int indx, char *buf, int *sizeof_buf); + int indx, char *buf, size_t *sizeof_buf); int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, int* critical); int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, int* bits); @@ -80,7 +80,7 @@ int _gnutls_x509_crt_get_raw_issuer_dn( gnutls_x509_crt cert, int _gnutls_x509_crt_get_raw_dn( gnutls_x509_crt cert, gnutls_const_datum* start); -int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size); +int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, size_t* result_size); int _gnutls_x509_compare_raw_dn(const gnutls_const_datum * dn1, const gnutls_const_datum * dn2); @@ -94,21 +94,21 @@ int _gnutls_x509_crl_get_raw_issuer_dn( gnutls_x509_crl crl, int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl); int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, unsigned char *serial, - int *serial_size, time_t * time); + size_t *serial_size, time_t * time); void gnutls_x509_crl_deinit(gnutls_x509_crl crl); int gnutls_x509_crl_init(gnutls_x509_crl * crl); int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_x509_crl_export( gnutls_x509_crl crl, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_x509_crt_init(gnutls_x509_crt * cert); void gnutls_x509_crt_deinit(gnutls_x509_crt cert); int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, gnutls_x509_crt_fmt format); int gnutls_x509_crt_export( gnutls_x509_crt cert, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, unsigned int *key_usage, int *critical); @@ -132,7 +132,7 @@ int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key, gnutls_datum *d, gnutls_datum *p, gnutls_datum* q, gnutls_datum* u); int gnutls_x509_privkey_export( gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size); + gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size); #endif diff --git a/lib/x509_b64.c b/lib/x509_b64.c index 5881bf0bdb..fb3d829622 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -27,8 +27,9 @@ #include #include -static const uint8 b64table[64] = +static const uint8 b64table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + static const uint8 asciitable[128] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, diff --git a/libextra/auth_srp_sb64.c b/libextra/auth_srp_sb64.c index 58e47c794d..4f6986033f 100644 --- a/libextra/auth_srp_sb64.c +++ b/libextra/auth_srp_sb64.c @@ -27,7 +27,7 @@ /* this a modified base64 for srp !!! * It seems that everybody makes an own base64 conversion. */ -static const uint8 b64table[64] = +static const uint8 b64table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./"; static const uint8 asciitable[128] = {