aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/openvpn/crypto_backend.h4
-rw-r--r--src/openvpn/crypto_mbedtls.c4
-rw-r--r--src/openvpn/crypto_mbedtls.h2
-rw-r--r--src/openvpn/crypto_openssl.c2
-rw-r--r--src/openvpn/crypto_openssl.h2
5 files changed, 9 insertions, 5 deletions
diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h
index 8d37e64..c454c64 100644
--- a/src/openvpn/crypto_backend.h
+++ b/src/openvpn/crypto_backend.h
@@ -336,10 +336,10 @@ void cipher_ctx_free(cipher_ctx_t *ctx);
* @param key Buffer containing the key to use
* @param ciphername Ciphername of the cipher to use
* @param enc Whether to encrypt or decrypt (either
- * \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT).
+ * \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT).
*/
void cipher_ctx_init(cipher_ctx_t *ctx, const uint8_t *key,
- const char *cipername, int enc);
+ const char *cipername, crypto_operation_t enc);
/**
* Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index 1a39752..c230292 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -566,7 +566,7 @@ cipher_ctx_free(mbedtls_cipher_context_t *ctx)
void
cipher_ctx_init(mbedtls_cipher_context_t *ctx, const uint8_t *key,
- const char *ciphername, const mbedtls_operation_t operation)
+ const char *ciphername, crypto_operation_t enc)
{
ASSERT(NULL != ciphername && NULL != ctx);
CLEAR(*ctx);
@@ -580,7 +580,7 @@ cipher_ctx_init(mbedtls_cipher_context_t *ctx, const uint8_t *key,
msg(M_FATAL, "mbed TLS cipher context init #1");
}
- if (!mbed_ok(mbedtls_cipher_setkey(ctx, key, (int)key_bitlen, operation)))
+ if (!mbed_ok(mbedtls_cipher_setkey(ctx, key, (int)key_bitlen, enc)))
{
msg(M_FATAL, "mbed TLS cipher set key");
}
diff --git a/src/openvpn/crypto_mbedtls.h b/src/openvpn/crypto_mbedtls.h
index 46f76e2..48d1e20 100644
--- a/src/openvpn/crypto_mbedtls.h
+++ b/src/openvpn/crypto_mbedtls.h
@@ -63,6 +63,8 @@ typedef void provider_t;
/** Cipher is in GCM mode */
#define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM
+typedef mbedtls_operation_t crypto_operation_t;
+
/** Cipher should encrypt */
#define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 50683b6..bfc5e37 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -840,7 +840,7 @@ cipher_ctx_free(EVP_CIPHER_CTX *ctx)
void
cipher_ctx_init(EVP_CIPHER_CTX *ctx, const uint8_t *key,
- const char *ciphername, int enc)
+ const char *ciphername, crypto_operation_t enc)
{
ASSERT(NULL != ciphername && NULL != ctx);
evp_cipher_type *kt = cipher_get(ciphername);
diff --git a/src/openvpn/crypto_openssl.h b/src/openvpn/crypto_openssl.h
index c0e95b4..4cd988a 100644
--- a/src/openvpn/crypto_openssl.h
+++ b/src/openvpn/crypto_openssl.h
@@ -85,6 +85,8 @@ typedef EVP_MD evp_md_type;
/** Cipher is in GCM mode */
#define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE
+typedef int crypto_operation_t;
+
/** Cipher should encrypt */
#define OPENVPN_OP_ENCRYPT 1