diff options
Diffstat (limited to 'src/libstrongswan')
24 files changed, 92 insertions, 117 deletions
diff --git a/src/libstrongswan/crypto/certinfo.h b/src/libstrongswan/crypto/certinfo.h index 6561462a7..b391cbc53 100644 --- a/src/libstrongswan/crypto/certinfo.h +++ b/src/libstrongswan/crypto/certinfo.h @@ -23,26 +23,30 @@ #ifndef CERTINFO_H_ #define CERTINFO_H_ +typedef enum cert_status_t cert_status_t; +typedef enum crl_reason_t crl_reason_t; +typedef struct certinfo_t certinfo_t; + #include <types.h> #include <definitions.h> /** * RFC 2560 OCSP - certificate status */ -typedef enum { +enum cert_status_t { CERT_GOOD = 0, CERT_REVOKED = 1, CERT_UNKNOWN = 2, CERT_UNDEFINED = 3, CERT_UNTRUSTED = 4 /* private use */ -} cert_status_t; +}; extern enum_name_t *cert_status_names; /** * RFC 2459 CRL reason codes */ -typedef enum { +enum crl_reason_t { REASON_UNSPECIFIED = 0, REASON_KEY_COMPROMISE = 1, REASON_CA_COMPROMISE = 2, @@ -51,16 +55,13 @@ typedef enum { REASON_CESSATION_OF_OPERATON = 5, REASON_CERTIFICATE_HOLD = 6, REASON_REMOVE_FROM_CRL = 8 -} crl_reason_t; +}; extern enum_name_t *crl_reason_names; -typedef struct certinfo_t certinfo_t; - /** * @brief X.509 certificate status information - * - * + * * @ingroup transforms */ struct certinfo_t { diff --git a/src/libstrongswan/crypto/crl.h b/src/libstrongswan/crypto/crl.h index 8848e4e47..ff4ccd860 100755 --- a/src/libstrongswan/crypto/crl.h +++ b/src/libstrongswan/crypto/crl.h @@ -23,6 +23,8 @@ #ifndef CRL_H_ #define CRL_H_ +typedef struct crl_t crl_t; + #include <types.h> #include <definitions.h> #include <crypto/rsa/rsa_public_key.h> @@ -37,8 +39,6 @@ */ #define CRL_PRINTF_SPEC 'U' -typedef struct crl_t crl_t; - /** * @brief X.509 certificate revocation list * diff --git a/src/libstrongswan/crypto/crypters/aes_cbc_crypter.h b/src/libstrongswan/crypto/crypters/aes_cbc_crypter.h index 509ee5f74..5da248b8c 100644 --- a/src/libstrongswan/crypto/crypters/aes_cbc_crypter.h +++ b/src/libstrongswan/crypto/crypters/aes_cbc_crypter.h @@ -25,17 +25,16 @@ #ifndef AES_CBC_CRYPTER_H_ #define AES_CBC_CRYPTER_H_ -#include <crypto/crypters/crypter.h> - - typedef struct aes_cbc_crypter_t aes_cbc_crypter_t; +#include <crypto/crypters/crypter.h> + /** * @brief Class implementing the AES symmetric encryption algorithm. - * + * * @b Constructors: * - aes_cbc_crypter_create() - * + * * @ingroup crypters */ struct aes_cbc_crypter_t { diff --git a/src/libstrongswan/crypto/crypters/crypter.h b/src/libstrongswan/crypto/crypters/crypter.h index cb7f9b139..411dfeda6 100644 --- a/src/libstrongswan/crypto/crypters/crypter.h +++ b/src/libstrongswan/crypto/crypters/crypter.h @@ -24,18 +24,19 @@ #ifndef CRYPTER_H_ #define CRYPTER_H_ -#include <types.h> - typedef enum encryption_algorithm_t encryption_algorithm_t; +typedef struct crypter_t crypter_t; + +#include <types.h> /** * @brief Encryption algorithm, as in IKEv2 RFC 3.3.2. - * + * * Currently only the following algorithms are implemented: * - ENCR_AES_CBC * - ENCR_DES * - ENCR_3DES - * + * * @ingroup crypters */ enum encryption_algorithm_t { @@ -62,15 +63,12 @@ enum encryption_algorithm_t { */ extern enum_name_t *encryption_algorithm_names; - -typedef struct crypter_t crypter_t; - /** * @brief Generic interface for symmetric encryption algorithms. - * + * * @b Constructors: * - crypter_create() - * + * * @ingroup crypters */ struct crypter_t { diff --git a/src/libstrongswan/crypto/crypters/des_crypter.h b/src/libstrongswan/crypto/crypters/des_crypter.h index 90e158028..0c87b0a9c 100644 --- a/src/libstrongswan/crypto/crypters/des_crypter.h +++ b/src/libstrongswan/crypto/crypters/des_crypter.h @@ -23,10 +23,10 @@ #ifndef DES_CRYPTER_H_ #define DES_CRYPTER_H_ -#include <crypto/crypters/crypter.h> +typedef struct des_crypter_t des_crypter_t; +#include <crypto/crypters/crypter.h> -typedef struct des_crypter_t des_crypter_t; /** * @brief Class implementing the DES and 3DES encryption algorithms. diff --git a/src/libstrongswan/crypto/diffie_hellman.h b/src/libstrongswan/crypto/diffie_hellman.h index 4659c7fee..65921a530 100644 --- a/src/libstrongswan/crypto/diffie_hellman.h +++ b/src/libstrongswan/crypto/diffie_hellman.h @@ -24,18 +24,18 @@ #ifndef DIFFIE_HELLMAN_H_ #define DIFFIE_HELLMAN_H_ -#include <types.h> - - typedef enum diffie_hellman_group_t diffie_hellman_group_t; +typedef struct diffie_hellman_t diffie_hellman_t; -/** +#include <types.h> + +/** * @brief Diffie-Hellman group. - * + * * The modulus (or group) to use for a Diffie-Hellman calculation. - * + * * See IKEv2 RFC 3.3.2 and RFC 3526. - * + * * @ingroup transforms */ enum diffie_hellman_group_t { @@ -55,9 +55,6 @@ enum diffie_hellman_group_t { */ extern enum_name_t *diffie_hellman_group_names; - -typedef struct diffie_hellman_t diffie_hellman_t; - /** * @brief Implementation of the widely used Diffie-Hellman algorithm. * diff --git a/src/libstrongswan/crypto/hashers/hasher.h b/src/libstrongswan/crypto/hashers/hasher.h index ed3defb05..3c6192f01 100644 --- a/src/libstrongswan/crypto/hashers/hasher.h +++ b/src/libstrongswan/crypto/hashers/hasher.h @@ -24,15 +24,14 @@ #ifndef HASHER_H_ #define HASHER_H_ +typedef enum hash_algorithm_t hash_algorithm_t; +typedef struct hasher_t hasher_t; #include <types.h> - -typedef enum hash_algorithm_t hash_algorithm_t; - /** * @brief Algorithms to use for hashing. - * + * * Currently only the following algorithms are implemented: * - HASH_MD5 * - HASH_SHA1 @@ -70,8 +69,6 @@ enum hash_algorithm_t { extern enum_name_t *hash_algorithm_names; -typedef struct hasher_t hasher_t; - /** * @brief Generic interface for all hash functions. * diff --git a/src/libstrongswan/crypto/hashers/md5_hasher.h b/src/libstrongswan/crypto/hashers/md5_hasher.h index 8447a7202..715f11663 100644 --- a/src/libstrongswan/crypto/hashers/md5_hasher.h +++ b/src/libstrongswan/crypto/hashers/md5_hasher.h @@ -24,21 +24,20 @@ #ifndef MD5_HASHER_H_ #define MD5_HASHER_H_ -#include <crypto/hashers/hasher.h> - - typedef struct md5_hasher_t md5_hasher_t; +#include <crypto/hashers/hasher.h> + /** * @brief Implementation of hasher_t interface using the * MD5 algorithm. - * + * * @b Constructors: * - hasher_create() using HASH_MD5 as algorithm * - md5_hasher_create() - * + * * @see hasher_t - * + * * @ingroup hashers */ struct md5_hasher_t { diff --git a/src/libstrongswan/crypto/hashers/sha1_hasher.h b/src/libstrongswan/crypto/hashers/sha1_hasher.h index d200a23e2..380fa9845 100644 --- a/src/libstrongswan/crypto/hashers/sha1_hasher.h +++ b/src/libstrongswan/crypto/hashers/sha1_hasher.h @@ -24,11 +24,10 @@ #ifndef SHA1_HASHER_H_ #define SHA1_HASHER_H_ -#include <crypto/hashers/hasher.h> - - typedef struct sha1_hasher_t sha1_hasher_t; +#include <crypto/hashers/hasher.h> + /** * @brief Implementation of hasher_t interface using the * SHA1 algorithm. diff --git a/src/libstrongswan/crypto/hashers/sha2_hasher.h b/src/libstrongswan/crypto/hashers/sha2_hasher.h index d5a8a7030..91e82fedb 100644 --- a/src/libstrongswan/crypto/hashers/sha2_hasher.h +++ b/src/libstrongswan/crypto/hashers/sha2_hasher.h @@ -23,21 +23,20 @@ #ifndef SHA2_HASHER_H_ #define SHA2_HASHER_H_ -#include <crypto/hashers/hasher.h> - - typedef struct sha2_hasher_t sha2_hasher_t; +#include <crypto/hashers/hasher.h> + /** * @brief Implementation of hasher_t interface using the SHA2 algorithms. - * + * * SHA2 is an other name for the SHA-256, SHA-384 and SHA-512 variants of * the SHA hash algorithm. - * + * * @b Constructors: * - hasher_create() using HASH_SHA256, HASH_SHA384 or HASH_SHA512 as algorithm * - sha2_hasher_create() - * + * * @see hasher_t * * @ingroup hashers diff --git a/src/libstrongswan/crypto/hmac.h b/src/libstrongswan/crypto/hmac.h index cddd862c0..0f9ac7071 100644 --- a/src/libstrongswan/crypto/hmac.h +++ b/src/libstrongswan/crypto/hmac.h @@ -23,27 +23,26 @@ #ifndef HMAC_H_ #define HMAC_H_ +typedef struct hmac_t hmac_t; + #include <crypto/hashers/hasher.h> #include <definitions.h> - -typedef struct hmac_t hmac_t; - /** * @brief Message authentication using hash functions. - * + * * This class implements the message authenticaion algorithm * described in RFC2104. It uses a hash function, wich must * be implemented as a hasher_t class. - * + * * See http://www.faqs.org/rfcs/rfc2104.html for RFC. * @see * - hasher_t * - prf_hmac_t - * + * * @b Constructors: * - hmac_create() - * + * * @ingroup transforms */ struct hmac_t { diff --git a/src/libstrongswan/crypto/prf_plus.h b/src/libstrongswan/crypto/prf_plus.h index 430162a9a..90f9ce2eb 100644 --- a/src/libstrongswan/crypto/prf_plus.h +++ b/src/libstrongswan/crypto/prf_plus.h @@ -24,12 +24,10 @@ #ifndef PRF_PLUS_H_ #define PRF_PLUS_H_ +typedef struct prf_plus_t prf_plus_t; #include <crypto/prfs/prf.h> - -typedef struct prf_plus_t prf_plus_t; - /** * @brief Implementation of the prf+ function described in IKEv2 RFC. * diff --git a/src/libstrongswan/crypto/prfs/hmac_prf.h b/src/libstrongswan/crypto/prfs/hmac_prf.h index 17b28acbf..ecd61960c 100644 --- a/src/libstrongswan/crypto/prfs/hmac_prf.h +++ b/src/libstrongswan/crypto/prfs/hmac_prf.h @@ -24,12 +24,12 @@ #ifndef PRF_HMAC_H_ #define PRF_HMAC_H_ +typedef struct hmac_prf_t hmac_prf_t; + #include <types.h> #include <crypto/prfs/prf.h> #include <crypto/hashers/hasher.h> -typedef struct hmac_prf_t hmac_prf_t; - /** * @brief Implementation of prf_t interface using the * HMAC algorithm. diff --git a/src/libstrongswan/crypto/prfs/prf.h b/src/libstrongswan/crypto/prfs/prf.h index 0a0e0fa5c..b95cc451a 100644 --- a/src/libstrongswan/crypto/prfs/prf.h +++ b/src/libstrongswan/crypto/prfs/prf.h @@ -24,9 +24,10 @@ #ifndef PRF_H_ #define PRF_H_ -#include <types.h> - typedef enum pseudo_random_function_t pseudo_random_function_t; +typedef struct prf_t prf_t; + +#include <types.h> /** * @brief Pseudo random function, as in IKEv2 RFC 3.3.2. @@ -52,9 +53,6 @@ enum pseudo_random_function_t { */ extern enum_name_t *pseudo_random_function_names; - -typedef struct prf_t prf_t; - /** * @brief Generic interface for pseudo-random-functions. * diff --git a/src/libstrongswan/crypto/rsa/rsa_private_key.h b/src/libstrongswan/crypto/rsa/rsa_private_key.h index da5cb4359..2263d2f31 100644 --- a/src/libstrongswan/crypto/rsa/rsa_private_key.h +++ b/src/libstrongswan/crypto/rsa/rsa_private_key.h @@ -24,26 +24,25 @@ #ifndef RSA_PRIVATE_KEY_H_ #define RSA_PRIVATE_KEY_H_ +typedef struct rsa_private_key_t rsa_private_key_t; + #include <types.h> #include <definitions.h> #include <crypto/rsa/rsa_public_key.h> #include <crypto/hashers/hasher.h> - -typedef struct rsa_private_key_t rsa_private_key_t; - /** * @brief RSA private key with associated functions. - * + * * Currently only supports signing using EMSA encoding. - * + * * @b Constructors: * - rsa_private_key_create() * - rsa_private_key_create_from_chunk() * - rsa_private_key_create_from_file() * * @see rsa_public_key_t - * + * * @todo Implement get_key(), save_key(), get_public_key() * * @ingroup rsa diff --git a/src/libstrongswan/crypto/rsa/rsa_public_key.h b/src/libstrongswan/crypto/rsa/rsa_public_key.h index 033995ec7..b56df28b2 100644 --- a/src/libstrongswan/crypto/rsa/rsa_public_key.h +++ b/src/libstrongswan/crypto/rsa/rsa_public_key.h @@ -24,14 +24,13 @@ #ifndef RSA_PUBLIC_KEY_H_ #define RSA_PUBLIC_KEY_H_ +typedef struct rsa_public_key_t rsa_public_key_t; + #include <gmp.h> #include <types.h> #include <definitions.h> - -typedef struct rsa_public_key_t rsa_public_key_t; - /** * @brief RSA public key with associated functions. * diff --git a/src/libstrongswan/crypto/signers/hmac_signer.h b/src/libstrongswan/crypto/signers/hmac_signer.h index 057d61fab..5b9549086 100644 --- a/src/libstrongswan/crypto/signers/hmac_signer.h +++ b/src/libstrongswan/crypto/signers/hmac_signer.h @@ -24,11 +24,11 @@ #ifndef HMAC_SIGNER_H_ #define HMAC_SIGNER_H_ +typedef struct hmac_signer_t hmac_signer_t; + #include <crypto/signers/signer.h> #include <crypto/hashers/hasher.h> -typedef struct hmac_signer_t hmac_signer_t; - /** * @brief Implementation of signer_t interface using the * HMAC algorithm in combination with either MD5 or SHA1. diff --git a/src/libstrongswan/crypto/signers/signer.h b/src/libstrongswan/crypto/signers/signer.h index b7c7af55d..a9a80a5e0 100644 --- a/src/libstrongswan/crypto/signers/signer.h +++ b/src/libstrongswan/crypto/signers/signer.h @@ -24,11 +24,12 @@ #ifndef SIGNER_H_ #define SIGNER_H_ +typedef enum integrity_algorithm_t integrity_algorithm_t; +typedef struct signer_t signer_t; + #include <types.h> #include <definitions.h> -typedef enum integrity_algorithm_t integrity_algorithm_t; - /** * @brief Integrity algorithm, as in IKEv2 RFC 3.3.2. * @@ -54,18 +55,15 @@ enum integrity_algorithm_t { */ extern enum_name_t *integrity_algorithm_names; - -typedef struct signer_t signer_t; - /** * @brief Generig interface for a symmetric signature algorithm. - * + * * @b Constructors: * - signer_create() * - hmac_signer_create() - * + * * @todo Implement more integrity algorithms - * + * * @ingroup signers */ struct signer_t { diff --git a/src/libstrongswan/crypto/x509.h b/src/libstrongswan/crypto/x509.h index 5d0b2c905..346590ed4 100755 --- a/src/libstrongswan/crypto/x509.h +++ b/src/libstrongswan/crypto/x509.h @@ -23,6 +23,8 @@ #ifndef X509_H_ #define X509_H_ +typedef struct x509_t x509_t; + #include <types.h> #include <definitions.h> #include <crypto/rsa/rsa_public_key.h> @@ -37,8 +39,6 @@ */ #define X509_PRINTF_SPEC 'Q' -typedef struct x509_t x509_t; - /** * @brief X.509 certificate. * diff --git a/src/libstrongswan/utils/host.h b/src/libstrongswan/utils/host.h index 38bdc809a..74b75ee97 100644 --- a/src/libstrongswan/utils/host.h +++ b/src/libstrongswan/utils/host.h @@ -25,6 +25,9 @@ #ifndef HOST_H_ #define HOST_H_ +typedef enum host_diff_t host_diff_t; +typedef struct host_t host_t; + #include <stdlib.h> #include <stdio.h> #include <sys/types.h> @@ -35,7 +38,6 @@ #include <types.h> - /** * printf() specifier to print a host. * The specifier option '#' does include the port number, e.g.: @@ -43,8 +45,6 @@ */ #define HOST_PRINTF_SPEC 'H' -typedef enum host_diff_t host_diff_t; - /** * Differences between two hosts. They differ in * address, port, or both. @@ -55,8 +55,6 @@ enum host_diff_t { HOST_DIFF_PORT = 2, }; -typedef struct host_t host_t; - /** * @brief Representates a Host * diff --git a/src/libstrongswan/utils/identification.h b/src/libstrongswan/utils/identification.h index 0d2bc794e..8d8b59935 100644 --- a/src/libstrongswan/utils/identification.h +++ b/src/libstrongswan/utils/identification.h @@ -25,7 +25,10 @@ #ifndef IDENTIFICATION_H_ #define IDENTIFICATION_H_ -#include "types.h" +typedef enum id_type_t id_type_t; +typedef struct identification_t identification_t; + +#include <types.h> #define MAX_WILDCARDS 14 /** @@ -33,8 +36,6 @@ */ #define IDENTIFICATION_PRINTF_SPEC 'D' -typedef enum id_type_t id_type_t; - /** * @brief ID Types in a ID payload. * @@ -120,8 +121,6 @@ enum id_type_t { */ extern enum_name_t *id_type_names; -typedef struct identification_t identification_t; - /** * @brief Generic identification, such as used in ID payload. * diff --git a/src/libstrongswan/utils/iterator.h b/src/libstrongswan/utils/iterator.h index 668fbb764..51a8d6061 100644 --- a/src/libstrongswan/utils/iterator.h +++ b/src/libstrongswan/utils/iterator.h @@ -28,18 +28,18 @@ typedef struct iterator_t iterator_t; /** * @brief Iterator interface, allows iteration over collections. - * + * * iterator_t defines an interface for iterating over collections. * It allows searching, deleting, updating and inserting. - * + * * Thanks to JMP for iterator lessons :-) - * + * * @b Constructors: * - via linked_list_t.create_iterator, or * - any other class which supports the iterator_t interface - * + * * @see linked_list_t - * + * * @ingroup utils */ struct iterator_t { diff --git a/src/libstrongswan/utils/linked_list.h b/src/libstrongswan/utils/linked_list.h index 63c7eb6e3..6a97d4445 100644 --- a/src/libstrongswan/utils/linked_list.h +++ b/src/libstrongswan/utils/linked_list.h @@ -24,19 +24,18 @@ #ifndef LINKED_LIST_H_ #define LINKED_LIST_H_ +typedef struct linked_list_t linked_list_t; + #include <pthread.h> #include <types.h> #include <utils/iterator.h> - -typedef struct linked_list_t linked_list_t; - /** * @brief Class implementing a double linked list. * * General purpose linked list. This list is not synchronized. - * + * * @b Costructors: * - linked_list_create() * diff --git a/src/libstrongswan/utils/randomizer.h b/src/libstrongswan/utils/randomizer.h index 2387cd5fd..d797633af 100644 --- a/src/libstrongswan/utils/randomizer.h +++ b/src/libstrongswan/utils/randomizer.h @@ -24,8 +24,9 @@ #ifndef RANDOMIZER_H_ #define RANDOMIZER_H_ -#include <types.h> +typedef struct randomizer_t randomizer_t; +#include <types.h> #ifndef DEV_RANDOM /** @@ -41,8 +42,6 @@ # define DEV_URANDOM "/dev/urandom" #endif -typedef struct randomizer_t randomizer_t; - /** * @brief Class used to get random and pseudo random values. * |