diff options
author | Adriaan de Jong <dejong@fox-it.com> | 2011-06-23 17:39:42 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-10-19 22:13:25 +0200 |
commit | 485c5f76a15e7f9950a3ee3126dbf50f66f9ef82 (patch) | |
tree | 23209c35da7ddf067803027582190ecec1b6d8c7 /crypto.h | |
parent | 670f9dd91aed7ac435b79c0e28e49fa7c256642c (diff) | |
download | openvpn-485c5f76a15e7f9950a3ee3126dbf50f66f9ef82.tar.gz openvpn-485c5f76a15e7f9950a3ee3126dbf50f66f9ef82.tar.xz openvpn-485c5f76a15e7f9950a3ee3126dbf50f66f9ef82.zip |
Refactored cipher functions
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'crypto.h')
-rw-r--r-- | crypto.h | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -182,6 +182,17 @@ struct key /**< %Key material for HMAC operations. */ }; + +/** + * Container for one set of OpenSSL cipher and/or HMAC contexts. + * @ingroup control_processor + */ +struct key_ctx +{ + cipher_ctx_t *cipher; /**< Generic cipher %context. */ + hmac_ctx_t *hmac; /**< Generic HMAC %context. */ +}; + #define KEY_DIRECTION_BIDIRECTIONAL 0 /* same keys for both directions */ #define KEY_DIRECTION_NORMAL 1 /* encrypt with keys[0], decrypt with keys[1] */ #define KEY_DIRECTION_INVERSE 2 /* encrypt with keys[1], decrypt with keys[0] */ @@ -224,16 +235,6 @@ struct key_direction_state }; /** - * Container for one set of OpenSSL cipher and/or HMAC contexts. - * @ingroup control_processor - */ -struct key_ctx -{ - EVP_CIPHER_CTX *cipher; /**< OpenSSL cipher %context. */ - HMAC_CTX *hmac; /**< OpenSSL HMAC %context. */ -}; - -/** * Container for two sets of OpenSSL cipher and/or HMAC contexts for both * sending and receiving directions. * @ingroup control_processor @@ -313,9 +314,6 @@ void init_key_type (struct key_type *kt, const char *ciphername, bool ciphername_defined, const char *authname, bool authname_defined, int keysize, bool cfb_ofb_allowed, bool warn); -/* enc parameter in init_key_ctx */ -#define DO_ENCRYPT 1 -#define DO_DECRYPT 0 /* * Key context functions */ @@ -325,6 +323,7 @@ void init_key_ctx (struct key_ctx *ctx, struct key *key, const char *prefix); void free_key_ctx (struct key_ctx *ctx); + void free_key_ctx_bi (struct key_ctx_bi *ctx); @@ -401,7 +400,6 @@ bool openvpn_decrypt (struct buffer *buf, struct buffer work, /** @} name Functions for performing security operations on data channel packets */ - void crypto_adjust_frame_parameters(struct frame *frame, const struct key_type* kt, bool cipher_defined, |