diff options
Diffstat (limited to 'src/libstrongswan/crypto')
21 files changed, 28 insertions, 104 deletions
diff --git a/src/libstrongswan/crypto/certinfo.c b/src/libstrongswan/crypto/certinfo.c index 20a695753..baebe3fc0 100644 --- a/src/libstrongswan/crypto/certinfo.c +++ b/src/libstrongswan/crypto/certinfo.c @@ -22,8 +22,7 @@ #include <time.h> -#include <types.h> -#include <definitions.h> +#include <library.h> #include "certinfo.h" diff --git a/src/libstrongswan/crypto/certinfo.h b/src/libstrongswan/crypto/certinfo.h index b391cbc53..8d60e3933 100644 --- a/src/libstrongswan/crypto/certinfo.h +++ b/src/libstrongswan/crypto/certinfo.h @@ -27,8 +27,7 @@ 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> +#include <library.h> /** * RFC 2560 OCSP - certificate status diff --git a/src/libstrongswan/crypto/crl.c b/src/libstrongswan/crypto/crl.c index e6a1c35a2..b79c474ee 100755 --- a/src/libstrongswan/crypto/crl.c +++ b/src/libstrongswan/crypto/crl.c @@ -25,9 +25,8 @@ #include <string.h> #include <printf.h> -#include <types.h> #include <library.h> -#include <definitions.h> +#include <debug.h> #include <asn1/oid.h> #include <asn1/asn1.h> #include <asn1/pem.h> @@ -219,7 +218,7 @@ bool parse_x509crl(chunk_t blob, u_int level0, private_crl_t *crl) asn1_ctx_t ctx; bool critical; chunk_t extnID; - chunk_t userCertificate = CHUNK_INITIALIZER; + chunk_t userCertificate = chunk_empty; revokedCert_t *revokedCert = NULL; chunk_t object; u_int level; @@ -474,33 +473,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (info->alt) - { - if (n > 1) - { - argtypes[0] = PA_POINTER; - argtypes[1] = PA_INT; - } - return 2; - } - - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(CRL_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_CRL, print, arginfo_ptr_alt_ptr_int); } /* @@ -512,11 +489,11 @@ crl_t *crl_create_from_chunk(chunk_t chunk) /* initialize */ this->crlDistributionPoints = linked_list_create(); - this->tbsCertList = CHUNK_INITIALIZER; + this->tbsCertList = chunk_empty; this->issuer = NULL; this->revokedCertificates = linked_list_create(); - this->authKeyID = CHUNK_INITIALIZER; - this->authKeySerialNumber = CHUNK_INITIALIZER; + this->authKeyID = chunk_empty; + this->authKeySerialNumber = chunk_empty; /* public functions */ this->public.get_issuer = (identification_t* (*) (const crl_t*))get_issuer; @@ -543,7 +520,7 @@ crl_t *crl_create_from_chunk(chunk_t chunk) crl_t *crl_create_from_file(const char *filename) { bool pgp = FALSE; - chunk_t chunk = CHUNK_INITIALIZER; + chunk_t chunk = chunk_empty; crl_t *crl = NULL; if (!pem_asn1_load_file(filename, NULL, "crl", &chunk, &pgp)) diff --git a/src/libstrongswan/crypto/crl.h b/src/libstrongswan/crypto/crl.h index ff4ccd860..216cafad0 100755 --- a/src/libstrongswan/crypto/crl.h +++ b/src/libstrongswan/crypto/crl.h @@ -25,21 +25,13 @@ typedef struct crl_t crl_t; -#include <types.h> -#include <definitions.h> +#include <library.h> #include <crypto/rsa/rsa_public_key.h> #include <crypto/certinfo.h> #include <utils/identification.h> #include <utils/iterator.h> /** - * printf specifier for printing crls. When using the - * #-modifier, an additional bool argument defines if dates - * are printed in UTC. - */ -#define CRL_PRINTF_SPEC 'U' - -/** * @brief X.509 certificate revocation list * * @b Constructors: diff --git a/src/libstrongswan/crypto/crypters/crypter.h b/src/libstrongswan/crypto/crypters/crypter.h index 411dfeda6..46d94ce93 100644 --- a/src/libstrongswan/crypto/crypters/crypter.h +++ b/src/libstrongswan/crypto/crypters/crypter.h @@ -27,7 +27,7 @@ typedef enum encryption_algorithm_t encryption_algorithm_t; typedef struct crypter_t crypter_t; -#include <types.h> +#include <library.h> /** * @brief Encryption algorithm, as in IKEv2 RFC 3.3.2. diff --git a/src/libstrongswan/crypto/diffie_hellman.h b/src/libstrongswan/crypto/diffie_hellman.h index 65921a530..29a2ab45b 100644 --- a/src/libstrongswan/crypto/diffie_hellman.h +++ b/src/libstrongswan/crypto/diffie_hellman.h @@ -27,7 +27,7 @@ typedef enum diffie_hellman_group_t diffie_hellman_group_t; typedef struct diffie_hellman_t diffie_hellman_t; -#include <types.h> +#include <library.h> /** * @brief Diffie-Hellman group. diff --git a/src/libstrongswan/crypto/hashers/hasher.h b/src/libstrongswan/crypto/hashers/hasher.h index 3c6192f01..a1b5f5805 100644 --- a/src/libstrongswan/crypto/hashers/hasher.h +++ b/src/libstrongswan/crypto/hashers/hasher.h @@ -27,7 +27,7 @@ typedef enum hash_algorithm_t hash_algorithm_t; typedef struct hasher_t hasher_t; -#include <types.h> +#include <library.h> /** * @brief Algorithms to use for hashing. diff --git a/src/libstrongswan/crypto/hashers/md5_hasher.c b/src/libstrongswan/crypto/hashers/md5_hasher.c index 5cf4643b8..fa61cac5b 100644 --- a/src/libstrongswan/crypto/hashers/md5_hasher.c +++ b/src/libstrongswan/crypto/hashers/md5_hasher.c @@ -30,8 +30,6 @@ #include "md5_hasher.h" -#include <definitions.h> - /* Constants for MD5Transform routine. */ #define S11 7 diff --git a/src/libstrongswan/crypto/hashers/sha1_hasher.c b/src/libstrongswan/crypto/hashers/sha1_hasher.c index 33eec5969..cca336694 100644 --- a/src/libstrongswan/crypto/hashers/sha1_hasher.c +++ b/src/libstrongswan/crypto/hashers/sha1_hasher.c @@ -28,8 +28,6 @@ #include "sha1_hasher.h" -#include <definitions.h> - /* * ugly macro stuff */ diff --git a/src/libstrongswan/crypto/hashers/sha2_hasher.c b/src/libstrongswan/crypto/hashers/sha2_hasher.c index 2c59438c0..f6fd0404e 100644 --- a/src/libstrongswan/crypto/hashers/sha2_hasher.c +++ b/src/libstrongswan/crypto/hashers/sha2_hasher.c @@ -27,8 +27,6 @@ #include "sha2_hasher.h" -#include <definitions.h> - typedef struct private_sha512_hasher_t private_sha512_hasher_t; diff --git a/src/libstrongswan/crypto/hmac.h b/src/libstrongswan/crypto/hmac.h index 0f9ac7071..d320bc5aa 100644 --- a/src/libstrongswan/crypto/hmac.h +++ b/src/libstrongswan/crypto/hmac.h @@ -26,7 +26,6 @@ typedef struct hmac_t hmac_t; #include <crypto/hashers/hasher.h> -#include <definitions.h> /** * @brief Message authentication using hash functions. diff --git a/src/libstrongswan/crypto/prf_plus.c b/src/libstrongswan/crypto/prf_plus.c index 761a8a7bc..6bd444b1f 100644 --- a/src/libstrongswan/crypto/prf_plus.c +++ b/src/libstrongswan/crypto/prf_plus.c @@ -25,8 +25,6 @@ #include "prf_plus.h" -#include <definitions.h> - typedef struct private_prf_plus_t private_prf_plus_t; /** diff --git a/src/libstrongswan/crypto/prfs/hmac_prf.h b/src/libstrongswan/crypto/prfs/hmac_prf.h index ecd61960c..9b06ee3a2 100644 --- a/src/libstrongswan/crypto/prfs/hmac_prf.h +++ b/src/libstrongswan/crypto/prfs/hmac_prf.h @@ -26,7 +26,7 @@ typedef struct hmac_prf_t hmac_prf_t; -#include <types.h> +#include <library.h> #include <crypto/prfs/prf.h> #include <crypto/hashers/hasher.h> diff --git a/src/libstrongswan/crypto/prfs/prf.h b/src/libstrongswan/crypto/prfs/prf.h index b95cc451a..897cf906b 100644 --- a/src/libstrongswan/crypto/prfs/prf.h +++ b/src/libstrongswan/crypto/prfs/prf.h @@ -27,7 +27,7 @@ typedef enum pseudo_random_function_t pseudo_random_function_t; typedef struct prf_t prf_t; -#include <types.h> +#include <library.h> /** * @brief Pseudo random function, as in IKEv2 RFC 3.3.2. diff --git a/src/libstrongswan/crypto/rsa/rsa_private_key.c b/src/libstrongswan/crypto/rsa/rsa_private_key.c index 8dfced51d..5b1647965 100644 --- a/src/libstrongswan/crypto/rsa/rsa_private_key.c +++ b/src/libstrongswan/crypto/rsa/rsa_private_key.c @@ -762,7 +762,7 @@ rsa_private_key_t *rsa_private_key_create_from_chunk(chunk_t blob) rsa_private_key_t *rsa_private_key_create_from_file(char *filename, chunk_t *passphrase) { bool pgp = FALSE; - chunk_t chunk = CHUNK_INITIALIZER; + chunk_t chunk = chunk_empty; rsa_private_key_t *key = NULL; if (!pem_asn1_load_file(filename, passphrase, "private key", &chunk, &pgp)) diff --git a/src/libstrongswan/crypto/rsa/rsa_private_key.h b/src/libstrongswan/crypto/rsa/rsa_private_key.h index 2263d2f31..9ec07704e 100644 --- a/src/libstrongswan/crypto/rsa/rsa_private_key.h +++ b/src/libstrongswan/crypto/rsa/rsa_private_key.h @@ -26,8 +26,7 @@ typedef struct rsa_private_key_t rsa_private_key_t; -#include <types.h> -#include <definitions.h> +#include <library.h> #include <crypto/rsa/rsa_public_key.h> #include <crypto/hashers/hasher.h> diff --git a/src/libstrongswan/crypto/rsa/rsa_public_key.c b/src/libstrongswan/crypto/rsa/rsa_public_key.c index f42ff0611..38899670f 100644 --- a/src/libstrongswan/crypto/rsa/rsa_public_key.c +++ b/src/libstrongswan/crypto/rsa/rsa_public_key.c @@ -485,7 +485,7 @@ rsa_public_key_t *rsa_public_key_create_from_chunk(chunk_t blob) rsa_public_key_t *rsa_public_key_create_from_file(char *filename) { bool pgp = FALSE; - chunk_t chunk = CHUNK_INITIALIZER; + chunk_t chunk = chunk_empty; rsa_public_key_t *pubkey = NULL; if (!pem_asn1_load_file(filename, NULL, "public key", &chunk, &pgp)) diff --git a/src/libstrongswan/crypto/rsa/rsa_public_key.h b/src/libstrongswan/crypto/rsa/rsa_public_key.h index b56df28b2..1ee54dcc3 100644 --- a/src/libstrongswan/crypto/rsa/rsa_public_key.h +++ b/src/libstrongswan/crypto/rsa/rsa_public_key.h @@ -28,8 +28,7 @@ typedef struct rsa_public_key_t rsa_public_key_t; #include <gmp.h> -#include <types.h> -#include <definitions.h> +#include <library.h> /** * @brief RSA public key with associated functions. diff --git a/src/libstrongswan/crypto/signers/signer.h b/src/libstrongswan/crypto/signers/signer.h index a9a80a5e0..57f7d8fe6 100644 --- a/src/libstrongswan/crypto/signers/signer.h +++ b/src/libstrongswan/crypto/signers/signer.h @@ -27,8 +27,7 @@ typedef enum integrity_algorithm_t integrity_algorithm_t; typedef struct signer_t signer_t; -#include <types.h> -#include <definitions.h> +#include <library.h> /** * @brief Integrity algorithm, as in IKEv2 RFC 3.3.2. diff --git a/src/libstrongswan/crypto/x509.c b/src/libstrongswan/crypto/x509.c index 43fe589fa..8ed79ebd9 100755 --- a/src/libstrongswan/crypto/x509.c +++ b/src/libstrongswan/crypto/x509.c @@ -28,9 +28,8 @@ #include "x509.h" -#include <types.h> #include <library.h> -#include <definitions.h> +#include <debug.h> #include <asn1/oid.h> #include <asn1/asn1.h> #include <asn1/pem.h> @@ -1162,33 +1161,11 @@ static int print(FILE *stream, const struct printf_info *info, } /** - * arginfo handler in printf() - */ -static int print_arginfo(const struct printf_info *info, size_t n, int *argtypes) -{ - if (info->alt) - { - if (n > 1) - { - argtypes[0] = PA_POINTER; - argtypes[1] = PA_INT; - } - return 2; - } - - if (n > 0) - { - argtypes[0] = PA_POINTER; - } - return 1; -} - -/** * register printf() handlers */ static void __attribute__ ((constructor))print_register() { - register_printf_function(X509_PRINTF_SPEC, print, print_arginfo); + register_printf_function(PRINTF_X509, print, arginfo_ptr_alt_ptr_int); } /** @@ -1215,15 +1192,15 @@ x509_t *x509_create_from_chunk(chunk_t chunk) private_x509_t *this = malloc_thing(private_x509_t); /* initialize */ - this->subjectPublicKey = CHUNK_INITIALIZER; + this->subjectPublicKey = chunk_empty; this->public_key = NULL; this->subject = NULL; this->issuer = NULL; this->subjectAltNames = linked_list_create(); this->crlDistributionPoints = linked_list_create(); - this->subjectKeyID = CHUNK_INITIALIZER; - this->authKeyID = CHUNK_INITIALIZER; - this->authKeySerialNumber = CHUNK_INITIALIZER; + this->subjectKeyID = chunk_empty; + this->authKeyID = chunk_empty; + this->authKeySerialNumber = chunk_empty; /* public functions */ this->public.equals = (bool (*) (const x509_t*,const x509_t*))equals; @@ -1270,7 +1247,7 @@ x509_t *x509_create_from_chunk(chunk_t chunk) x509_t *x509_create_from_file(const char *filename, const char *label) { bool pgp = FALSE; - chunk_t chunk = CHUNK_INITIALIZER; + chunk_t chunk = chunk_empty; x509_t *cert = NULL; if (!pem_asn1_load_file(filename, NULL, label, &chunk, &pgp)) diff --git a/src/libstrongswan/crypto/x509.h b/src/libstrongswan/crypto/x509.h index 346590ed4..f17d086bd 100755 --- a/src/libstrongswan/crypto/x509.h +++ b/src/libstrongswan/crypto/x509.h @@ -25,21 +25,13 @@ typedef struct x509_t x509_t; -#include <types.h> -#include <definitions.h> +#include <library.h> #include <crypto/rsa/rsa_public_key.h> #include <crypto/certinfo.h> #include <utils/identification.h> #include <utils/iterator.h> /** - * printf specifier for printing certificates. When using the - * #-modifier, an additional bool argument defines if dates - * are printed in UTC. - */ -#define X509_PRINTF_SPEC 'Q' - -/** * @brief X.509 certificate. * * @b Constructors: |