aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/lib')
-rw-r--r--src/charon/lib/asn1/asn1.c2
-rwxr-xr-xsrc/charon/lib/asn1/pem.c8
-rwxr-xr-xsrc/charon/lib/asn1/pem.h4
-rw-r--r--src/charon/lib/asn1/ttodata.c142
-rw-r--r--src/charon/lib/crypto/hashers/md5_hasher.c2
-rw-r--r--src/charon/lib/crypto/hashers/md5_hasher.h2
-rw-r--r--src/charon/lib/crypto/hashers/sha1_hasher.c2
-rw-r--r--src/charon/lib/crypto/hashers/sha1_hasher.h2
-rw-r--r--src/charon/lib/crypto/rsa/rsa_private_key.c4
-rw-r--r--src/charon/lib/crypto/rsa/rsa_public_key.c4
-rwxr-xr-xsrc/charon/lib/crypto/x509.c6
-rw-r--r--src/charon/lib/library.c4
-rw-r--r--src/charon/lib/utils/host.c2
-rw-r--r--src/charon/lib/utils/identification.c4
-rw-r--r--src/charon/lib/utils/linked_list.h2
-rw-r--r--src/charon/lib/utils/logger_manager.h4
-rw-r--r--src/charon/lib/utils/randomizer.h2
17 files changed, 100 insertions, 96 deletions
diff --git a/src/charon/lib/asn1/asn1.c b/src/charon/lib/asn1/asn1.c
index e894999fb..662f7fc1a 100644
--- a/src/charon/lib/asn1/asn1.c
+++ b/src/charon/lib/asn1/asn1.c
@@ -90,7 +90,7 @@ static logger_t *logger = NULL;
/**
* initializes the ASN.1 logger
*/
-static void asn1_init_logger()
+static void asn1_init_logger(void)
{
if (logger == NULL)
logger = logger_manager->get_logger(logger_manager, ASN1);
diff --git a/src/charon/lib/asn1/pem.c b/src/charon/lib/asn1/pem.c
index d3a6986eb..eca7e8d19 100755
--- a/src/charon/lib/asn1/pem.c
+++ b/src/charon/lib/asn1/pem.c
@@ -34,7 +34,7 @@ static logger_t *logger = NULL;
/**
* initializes the PEM logger
*/
-static void pem_init_logger()
+static void pem_init_logger(void)
{
if (logger == NULL)
logger = logger_manager->get_logger(logger_manager, ASN1);
@@ -89,7 +89,7 @@ static bool find_boundary(const char* tag, chunk_t *line)
/*
* decrypts a DES-EDE-CBC encrypted data block
*/
-static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, const char *passphrase)
+static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, char *passphrase)
{
hasher_t *hasher;
crypter_t *crypter;
@@ -144,7 +144,7 @@ static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, const char *passphrase)
* RFC 1421 Privacy Enhancement for Electronic Mail, February 1993
* RFC 934 Message Encapsulation, January 1985
*/
-err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp)
+err_t pem_to_bin(chunk_t *blob, char *passphrase, bool *pgp)
{
typedef enum {
PEM_PRE = 0,
@@ -285,7 +285,7 @@ err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp)
/* load a coded key or certificate file with autodetection
* of binary DER or base64 PEM ASN.1 formats and armored PGP format
*/
-bool pem_asn1_load_file(const char *filename, const char *passphrase,
+bool pem_asn1_load_file(const char *filename, char *passphrase,
const char *type, chunk_t *blob, bool *pgp)
{
err_t ugh = NULL;
diff --git a/src/charon/lib/asn1/pem.h b/src/charon/lib/asn1/pem.h
index 30621fa24..9edb3dc20 100755
--- a/src/charon/lib/asn1/pem.h
+++ b/src/charon/lib/asn1/pem.h
@@ -19,9 +19,9 @@
#include <types.h>
-err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp);
+err_t pem_to_bin(chunk_t *blob, char *passphrase, bool *pgp);
-bool pem_asn1_load_file(const char *filename, const char *passphrase,
+bool pem_asn1_load_file(const char *filename, char *passphrase,
const char *type, chunk_t *blob, bool *pgp);
#endif /*PEM_H_*/
diff --git a/src/charon/lib/asn1/ttodata.c b/src/charon/lib/asn1/ttodata.c
index 5e8149955..8114b12c5 100644
--- a/src/charon/lib/asn1/ttodata.c
+++ b/src/charon/lib/asn1/ttodata.c
@@ -33,22 +33,23 @@ static const char *badch(const char *, int, char *, size_t);
#define BADCH3 (-7) /* invalid character 3 */
#define BADOFF(code) (BADCH0-(code))
-/*
- - ttodatav - convert text to data, with verbose error reports
+/**
+ * @brief convert text to data, with verbose error reports
+ *
* If some of this looks slightly odd, it's because it has changed
* repeatedly (from the original atodata()) without a major rewrite.
+ *
+ * @param src
+ * @param srclen 0 means apply strlen()
+ * @param base 0 means figure it out
+ * @param dst need not be valid if dstlen is 0
+ * @param dstlen
+ * @param lenp where to record length (NULL is nowhere)
+ * @param errp error buffer
+ * @param flags
+ * @return NULL on success, else literal or errp
*/
-const char * /* NULL on success, else literal or errp */
-ttodatav(src, srclen, base, dst, dstlen, lenp, errp, errlen, flags)
-const char *src;
-size_t srclen; /* 0 means apply strlen() */
-int base; /* 0 means figure it out */
-char *dst; /* need not be valid if dstlen is 0 */
-size_t dstlen;
-size_t *lenp; /* where to record length (NULL is nowhere) */
-char *errp; /* error buffer */
-size_t errlen;
-unsigned int flags;
+const char *ttodatav(const char *src, size_t srclen, int base, char *dst, size_t dstlen, size_t *lenp, char *errp, size_t errlen, unsigned int flags)
{
size_t ingroup; /* number of input bytes converted at once */
char buf[4]; /* output from conversion */
@@ -166,32 +167,35 @@ unsigned int flags;
return NULL;
}
-/*
- - ttodata - convert text to data
+/**
+ * @brief ttodata - convert text to data
+ *
+ * @param src
+ * @param srclen 0 means apply strlen()
+ * @param base 0 means figure it out
+ * @param dst need not be valid if dstlen is 0
+ * @param dstlen
+ * @param lenp where to record length (NULL is nowhere)
+ * @return NULL on success, else literal
*/
-const char * /* NULL on success, else literal */
-ttodata(src, srclen, base, dst, dstlen, lenp)
-const char *src;
-size_t srclen; /* 0 means apply strlen() */
-int base; /* 0 means figure it out */
-char *dst; /* need not be valid if dstlen is 0 */
-size_t dstlen;
-size_t *lenp; /* where to record length (NULL is nowhere) */
+const char *ttodata(const char *src, size_t srclen, int base, char *dst, size_t dstlen, size_t *lenp)
{
return ttodatav(src, srclen, base, dst, dstlen, lenp, (char *)NULL,
(size_t)0, TTODATAV_SPACECOUNTS);
}
-/*
- - atodata - convert ASCII to data
+/**
+ * @brief atodata - convert ASCII to data
+ *
* backward-compatibility interface
+ *
+ * @param src
+ * @param srclen
+ * @param dst
+ * @param dstlen
+ * @return 0 for failure, true length for success
*/
-size_t /* 0 for failure, true length for success */
-atodata(src, srclen, dst, dstlen)
-const char *src;
-size_t srclen;
-char *dst;
-size_t dstlen;
+size_t atodata(const char *src, size_t srclen, char *dst, size_t dstlen)
{
size_t len;
const char *err;
@@ -202,29 +206,25 @@ size_t dstlen;
return len;
}
-/*
- - atobytes - convert ASCII to data bytes
+/**
+ * @brief atobytes - convert ASCII to data bytes
+ *
* another backward-compatibility interface
*/
-const char *
-atobytes(src, srclen, dst, dstlen, lenp)
-const char *src;
-size_t srclen;
-char *dst;
-size_t dstlen;
-size_t *lenp;
+const char *atobytes(const char *src, size_t srclen, char *dst, size_t dstlen, size_t *lenp)
{
return ttodata(src, srclen, 0, dst, dstlen, lenp);
}
-/*
- - unhex - convert two ASCII hex digits to byte
+/**
+ * @brief unhex - convert two ASCII hex digits to byte
+ *
+ * @param src known to be full length
+ * @param dstnumber of result bytes, or error code
+ * @param dstlen not large enough is a failure
+ * @return
*/
-static int /* number of result bytes, or error code */
-unhex(src, dst, dstlen)
-const char *src; /* known to be full length */
-char *dst;
-size_t dstlen; /* not large enough is a failure */
+static int unhex(const char *src, char *dst, size_t dstlen)
{
char *p;
unsigned byte;
@@ -252,16 +252,18 @@ size_t dstlen; /* not large enough is a failure */
return 1;
}
-/*
- - unb64 - convert four ASCII base64 digits to three bytes
+/**
+ * @brief unb64 - convert four ASCII base64 digits to three bytes
+ *
* Note that a base64 digit group is padded out with '=' if it represents
* less than three bytes: one byte is dd==, two is ddd=, three is dddd.
+ *
+ * @param src known to be full length
+ * @param dst
+ * @param dstlen
+ * @return number of result bytes, or error code
*/
-static int /* number of result bytes, or error code */
-unb64(src, dst, dstlen)
-const char *src; /* known to be full length */
-char *dst;
-size_t dstlen;
+static int unb64(const char *src, char *dst, size_t dstlen)
{
char *p;
unsigned byte1;
@@ -316,14 +318,15 @@ size_t dstlen;
return 3;
}
-/*
- - untext - convert one ASCII character to byte
+/**
+ * @brief untext - convert one ASCII character to byte
+ *
+ * @param src known to be full length
+ * @param dst
+ * @param dstlen not large enough is a failure
+ * @return number of result bytes, or error code
*/
-static int /* number of result bytes, or error code */
-untext(src, dst, dstlen)
-const char *src; /* known to be full length */
-char *dst;
-size_t dstlen; /* not large enough is a failure */
+static int untext(const char *src, char *dst, size_t dstlen)
{
if (dstlen < 1)
return SHORT;
@@ -332,18 +335,19 @@ size_t dstlen; /* not large enough is a failure */
return 1;
}
-/*
- - badch - produce a nice complaint about an unknown character
+/**
+ * @brief badch - produce a nice complaint about an unknown character
*
* If the compiler complains that the array bigenough[] has a negative
* size, that means the TTODATAV_BUF constant has been set too small.
+ *
+ * @param src
+ * @param errcode
+ * @param errp might be NULL
+ * @param errlen
+ * @return literal or errp
*/
-static const char * /* literal or errp */
-badch(src, errcode, errp, errlen)
-const char *src;
-int errcode;
-char *errp; /* might be NULL */
-size_t errlen;
+static const char *badch(const char *src, int errcode, char *errp, size_t errlen)
{
static const char pre[] = "unknown character (`";
static const char suf[] = "') in input";
diff --git a/src/charon/lib/crypto/hashers/md5_hasher.c b/src/charon/lib/crypto/hashers/md5_hasher.c
index bd3ab0c62..b0bc2f638 100644
--- a/src/charon/lib/crypto/hashers/md5_hasher.c
+++ b/src/charon/lib/crypto/hashers/md5_hasher.c
@@ -377,7 +377,7 @@ static void destroy(private_md5_hasher_t *this)
/*
* Described in header.
*/
-md5_hasher_t *md5_hasher_create()
+md5_hasher_t *md5_hasher_create(void)
{
private_md5_hasher_t *this = malloc_thing(private_md5_hasher_t);
diff --git a/src/charon/lib/crypto/hashers/md5_hasher.h b/src/charon/lib/crypto/hashers/md5_hasher.h
index 1e6d95d19..3ee721bce 100644
--- a/src/charon/lib/crypto/hashers/md5_hasher.h
+++ b/src/charon/lib/crypto/hashers/md5_hasher.h
@@ -55,6 +55,6 @@ struct md5_hasher_t {
*
* @ingroup hashers
*/
-md5_hasher_t *md5_hasher_create();
+md5_hasher_t *md5_hasher_create(void);
#endif /*MD5_HASHER_H_*/
diff --git a/src/charon/lib/crypto/hashers/sha1_hasher.c b/src/charon/lib/crypto/hashers/sha1_hasher.c
index 2b82ef4ba..0dda019d0 100644
--- a/src/charon/lib/crypto/hashers/sha1_hasher.c
+++ b/src/charon/lib/crypto/hashers/sha1_hasher.c
@@ -252,7 +252,7 @@ static void destroy(private_sha1_hasher_t *this)
/*
* Described in header.
*/
-sha1_hasher_t *sha1_hasher_create()
+sha1_hasher_t *sha1_hasher_create(void)
{
private_sha1_hasher_t *this = malloc_thing(private_sha1_hasher_t);
diff --git a/src/charon/lib/crypto/hashers/sha1_hasher.h b/src/charon/lib/crypto/hashers/sha1_hasher.h
index 5124ea1a8..d6d896a97 100644
--- a/src/charon/lib/crypto/hashers/sha1_hasher.h
+++ b/src/charon/lib/crypto/hashers/sha1_hasher.h
@@ -55,6 +55,6 @@ struct sha1_hasher_t {
*
* @ingroup hashers
*/
-sha1_hasher_t *sha1_hasher_create();
+sha1_hasher_t *sha1_hasher_create(void);
#endif /*SHA1_HASHER_H_*/
diff --git a/src/charon/lib/crypto/rsa/rsa_private_key.c b/src/charon/lib/crypto/rsa/rsa_private_key.c
index 86a38cbfe..f8798bbfd 100644
--- a/src/charon/lib/crypto/rsa/rsa_private_key.c
+++ b/src/charon/lib/crypto/rsa/rsa_private_key.c
@@ -170,7 +170,7 @@ static const asn1Object_t privkey_objects[] = {
#define PRIV_KEY_COEFF 9
#define PRIV_KEY_ROOF 16
-static private_rsa_private_key_t *rsa_private_key_create_empty();
+static private_rsa_private_key_t *rsa_private_key_create_empty(void);
/**
* Implementation of private_rsa_private_key_t.compute_prime.
@@ -546,7 +546,7 @@ static void destroy(private_rsa_private_key_t *this)
/**
* Internal generic constructor
*/
-static private_rsa_private_key_t *rsa_private_key_create_empty()
+static private_rsa_private_key_t *rsa_private_key_create_empty(void)
{
private_rsa_private_key_t *this = malloc_thing(private_rsa_private_key_t);
diff --git a/src/charon/lib/crypto/rsa/rsa_public_key.c b/src/charon/lib/crypto/rsa/rsa_public_key.c
index 6601b6cda..74d9b4db9 100644
--- a/src/charon/lib/crypto/rsa/rsa_public_key.c
+++ b/src/charon/lib/crypto/rsa/rsa_public_key.c
@@ -150,7 +150,7 @@ struct rsa_public_key_info_t {
chunk_t public_key;
};
-private_rsa_public_key_t *rsa_public_key_create_empty();
+private_rsa_public_key_t *rsa_public_key_create_empty(void);
/**
* Implementation of private_rsa_public_key_t.rsaep and private_rsa_public_key_t.rsavp1
@@ -364,7 +364,7 @@ static void destroy(private_rsa_public_key_t *this)
/**
* Generic private constructor
*/
-private_rsa_public_key_t *rsa_public_key_create_empty()
+private_rsa_public_key_t *rsa_public_key_create_empty(void)
{
private_rsa_public_key_t *this = malloc_thing(private_rsa_public_key_t);
diff --git a/src/charon/lib/crypto/x509.c b/src/charon/lib/crypto/x509.c
index 91f9f191e..6a9afcea5 100755
--- a/src/charon/lib/crypto/x509.c
+++ b/src/charon/lib/crypto/x509.c
@@ -874,9 +874,9 @@ x509_t *x509_create_from_chunk(chunk_t chunk)
this->public_key = NULL;
this->subject = NULL;
this->issuer = NULL;
- this->subjectAltNames = linked_list_create(this->subjectAltNames);
- this->issuerAltNames = linked_list_create(this->issuerAltNames);
- this->crlDistributionPoints = linked_list_create(this->crlDistributionPoints);
+ this->subjectAltNames = linked_list_create();
+ this->issuerAltNames = linked_list_create();
+ this->crlDistributionPoints = linked_list_create();
/* we do not use a per-instance logger right now, since its not always accessible */
logger = logger_manager->get_logger(logger_manager, ASN1);
diff --git a/src/charon/lib/library.c b/src/charon/lib/library.c
index fa9c732bf..6c4d15761 100644
--- a/src/charon/lib/library.c
+++ b/src/charon/lib/library.c
@@ -26,7 +26,7 @@
/**
* Called whenever the library is linked from a process
*/
-void __attribute__ ((constructor)) library_init()
+void __attribute__ ((constructor)) library_init(void)
{
logger_manager_init();
leak_detective_init();
@@ -35,7 +35,7 @@ void __attribute__ ((constructor)) library_init()
/**
* Called whenever the library is unlinked from a process
*/
-void __attribute__ ((destructor)) library_cleanup()
+void __attribute__ ((destructor)) library_cleanup(void)
{
leak_detective_cleanup();
logger_manager_cleanup();
diff --git a/src/charon/lib/utils/host.c b/src/charon/lib/utils/host.c
index 020ed27f3..b85dc07a5 100644
--- a/src/charon/lib/utils/host.c
+++ b/src/charon/lib/utils/host.c
@@ -261,7 +261,7 @@ static void destroy(private_host_t *this)
/**
* Creates an empty host_t object
*/
-static private_host_t *host_create_empty()
+static private_host_t *host_create_empty(void)
{
private_host_t *this = malloc_thing(private_host_t);
diff --git a/src/charon/lib/utils/identification.c b/src/charon/lib/utils/identification.c
index 33f3d92cd..9c17ac54c 100644
--- a/src/charon/lib/utils/identification.c
+++ b/src/charon/lib/utils/identification.c
@@ -248,7 +248,7 @@ struct private_identification_t {
id_type_t type;
};
-static private_identification_t *identification_create();
+static private_identification_t *identification_create(void);
/**
@@ -952,7 +952,7 @@ static void destroy(private_identification_t *this)
/**
* Generic constructor used for the other constructors.
*/
-static private_identification_t *identification_create()
+static private_identification_t *identification_create(void)
{
private_identification_t *this = malloc_thing(private_identification_t);
diff --git a/src/charon/lib/utils/linked_list.h b/src/charon/lib/utils/linked_list.h
index 8647f064d..f0070eda2 100644
--- a/src/charon/lib/utils/linked_list.h
+++ b/src/charon/lib/utils/linked_list.h
@@ -197,7 +197,7 @@ struct linked_list_t {
*
* @ingroup utils
*/
-linked_list_t *linked_list_create();
+linked_list_t *linked_list_create(void);
#endif /*LINKED_LIST_H_*/
diff --git a/src/charon/lib/utils/logger_manager.h b/src/charon/lib/utils/logger_manager.h
index a3ff5a37e..f6210c490 100644
--- a/src/charon/lib/utils/logger_manager.h
+++ b/src/charon/lib/utils/logger_manager.h
@@ -149,12 +149,12 @@ extern logger_manager_t *logger_manager;
* Initialize the logger manager with all its logger.
* Has to be called before logger_manager is accessed.
*/
-void logger_manager_init();
+void logger_manager_init(void);
/**
* Free any resources hold by the logger manager. Do
* not access logger_manager after this call.
*/
-void logger_manager_cleanup();
+void logger_manager_cleanup(void);
#endif /*LOGGER_MANAGER_H_*/
diff --git a/src/charon/lib/utils/randomizer.h b/src/charon/lib/utils/randomizer.h
index 55519550e..993f71d12 100644
--- a/src/charon/lib/utils/randomizer.h
+++ b/src/charon/lib/utils/randomizer.h
@@ -105,6 +105,6 @@ struct randomizer_t {
*
* @ingroup utils
*/
-randomizer_t *randomizer_create();
+randomizer_t *randomizer_create(void);
#endif /*RANDOMIZER_H_*/