moved typedefs to beginning of files to solve some include problems
splitted authenticator to have a separate implementation for each auth_method_t using va_copy to clone va_lists, should fix proplems on AMD64 some other cleanups
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#ifndef DES_CRYPTER_H_
|
||||
#define DES_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.
|
||||
*
|
||||
|
||||
@@ -24,18 +24,18 @@
|
||||
#ifndef DIFFIE_HELLMAN_H_
|
||||
#define DIFFIE_HELLMAN_H_
|
||||
|
||||
typedef enum diffie_hellman_group_t diffie_hellman_group_t;
|
||||
typedef struct diffie_hellman_t diffie_hellman_t;
|
||||
|
||||
#include <types.h>
|
||||
|
||||
|
||||
typedef enum diffie_hellman_group_t diffie_hellman_group_t;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user