From 20ee3b5a4f110f53a73746e18fc0eb0cbbb7845c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 2 Nov 2013 04:32:18 +0100 Subject: Implement the first step towards a more flexible way to support crypto methods --- src/types.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/types.h') diff --git a/src/types.h b/src/types.h index a2b7d38..894b2af 100644 --- a/src/types.h +++ b/src/types.h @@ -36,6 +36,7 @@ #include #include +#include #define UNUSED __attribute__((unused)) @@ -113,6 +114,7 @@ typedef struct fastd_context fastd_context_t; typedef struct fastd_protocol fastd_protocol_t; typedef struct fastd_method fastd_method_t; +typedef struct fastd_cipher fastd_cipher_t; typedef struct fastd_handshake fastd_handshake_t; @@ -121,14 +123,17 @@ typedef struct fastd_string_stack fastd_string_stack_t; typedef struct fastd_resolve_return fastd_resolve_return_t; -#ifdef USE_CRYPTO_AES128CTR -typedef struct fastd_crypto_aes128ctr fastd_crypto_aes128ctr_t; -#endif #ifdef USE_CRYPTO_GHASH typedef struct fastd_crypto_ghash fastd_crypto_ghash_t; #endif +typedef union fastd_block128 { + uint8_t b[16]; + uint64_t qw[2]; +} __attribute__((aligned(16))) fastd_block128_t; + + /* May be defined by the protocol/method/crypto implementations however they like */ typedef struct fastd_protocol_config fastd_protocol_config_t; typedef struct fastd_protocol_state fastd_protocol_state_t; @@ -137,10 +142,8 @@ typedef struct fastd_protocol_peer_state fastd_protocol_peer_state_t; typedef struct fastd_method_session_state fastd_method_session_state_t; -#ifdef USE_CRYPTO_AES128CTR -typedef struct fastd_crypto_aes128ctr_context fastd_crypto_aes128ctr_context_t; -typedef struct fastd_crypto_aes128ctr_state fastd_crypto_aes128ctr_state_t; -#endif +typedef struct fastd_cipher_context fastd_cipher_context_t; +typedef struct fastd_cipher_state fastd_cipher_state_t; #ifdef USE_CRYPTO_GHASH typedef struct fastd_crypto_ghash_context fastd_crypto_ghash_context_t; -- cgit v1.2.3