All of lore.kernel.org
 help / color / mirror / Atom feed
* [Openvpn-devel] [PATCH] Some crypto_openssl.c cleanup for release/2.3
@ 2014-05-25 22:08 Steffan Karger
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 1/2] Remove function without effect (cipher_ok() always returned true) Steffan Karger
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 2/2] Remove unneeded wrapper functions in crypto_openssl.c Steffan Karger
  0 siblings, 2 replies; 5+ messages in thread
From: Steffan Karger @ 2014-05-25 22:08 UTC (permalink / raw)
  To: openvpn-devel

Hi,

These are 1/3 and 2/3 of the crypto_openssl.c cleanup patches, but rebased and
fixed for the release/2.3 branch.

-Steffan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Openvpn-devel] [PATCH 1/2] Remove function without effect (cipher_ok() always returned true).
  2014-05-25 22:08 [Openvpn-devel] [PATCH] Some crypto_openssl.c cleanup for release/2.3 Steffan Karger
@ 2014-05-25 22:08 ` Steffan Karger
  2014-05-26 17:56   ` [Openvpn-devel] [PATCH applied] " Gert Doering
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 2/2] Remove unneeded wrapper functions in crypto_openssl.c Steffan Karger
  1 sibling, 1 reply; 5+ messages in thread
From: Steffan Karger @ 2014-05-25 22:08 UTC (permalink / raw)
  To: openvpn-devel

Signed-off-by: Steffan Karger <steffan@...1856...>
---
 src/openvpn/crypto_openssl.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 1501bc8..6671a42 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -96,12 +96,6 @@ EVP_CipherUpdate_ov (EVP_CIPHER_CTX *ctx, uint8_t *out, int *outl, uint8_t *in,
   return EVP_CipherUpdate (ctx, out, outl, in, inl);
 }
 
-static inline bool
-cipher_ok (const char* name)
-{
-  return true;
-}
-
 #ifndef EVP_CIPHER_name
 #define EVP_CIPHER_name(e)		OBJ_nid2sn(EVP_CIPHER_nid(e))
 #endif
@@ -312,7 +306,7 @@ show_available_ciphers ()
   for (nid = 0; nid < 10000; ++nid)	/* is there a better way to get the size of the nid list? */
     {
       const EVP_CIPHER *cipher = EVP_get_cipherbynid (nid);
-      if (cipher && cipher_ok (OBJ_nid2sn (nid)))
+      if (cipher)
 	{
 	  const unsigned int mode = EVP_CIPHER_mode (cipher);
 	  if (mode == EVP_CIPH_CBC_MODE
@@ -491,7 +485,7 @@ cipher_kt_get (const char *ciphername)
 
   cipher = EVP_get_cipherbyname (ciphername);
 
-  if ((NULL == cipher) || !cipher_ok (OBJ_nid2sn (EVP_CIPHER_nid (cipher))))
+  if (NULL == cipher)
     msg (M_SSLERR, "Cipher algorithm '%s' not found", ciphername);
 
   if (EVP_CIPHER_key_length (cipher) > MAX_CIPHER_KEY_LENGTH)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Openvpn-devel] [PATCH 2/2] Remove unneeded wrapper functions in crypto_openssl.c
  2014-05-25 22:08 [Openvpn-devel] [PATCH] Some crypto_openssl.c cleanup for release/2.3 Steffan Karger
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 1/2] Remove function without effect (cipher_ok() always returned true) Steffan Karger
@ 2014-05-25 22:08 ` Steffan Karger
  2014-05-26 17:56   ` [Openvpn-devel] [PATCH applied] " Gert Doering
  1 sibling, 1 reply; 5+ messages in thread
From: Steffan Karger @ 2014-05-25 22:08 UTC (permalink / raw)
  To: openvpn-devel

Both EVPCipherInit_ov() and EVPCipherUpdate_ov() wrapped OpenSSL functions
without any changes, so lets just use the functions directly.

Signed-off-by: Steffan Karger <steffan@...1856...>
---
 src/openvpn/crypto_openssl.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 6671a42..8171499 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -84,18 +84,6 @@
 
 #endif
 
-static inline int
-EVP_CipherInit_ov (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, uint8_t *key, uint8_t *iv, int enc)
-{
-  return EVP_CipherInit (ctx, type, key, iv, enc);
-}
-
-static inline int
-EVP_CipherUpdate_ov (EVP_CIPHER_CTX *ctx, uint8_t *out, int *outl, uint8_t *in, int inl)
-{
-  return EVP_CipherUpdate (ctx, out, outl, in, inl);
-}
-
 #ifndef EVP_CIPHER_name
 #define EVP_CIPHER_name(e)		OBJ_nid2sn(EVP_CIPHER_nid(e))
 #endif
@@ -546,13 +534,13 @@ cipher_ctx_init (EVP_CIPHER_CTX *ctx, uint8_t *key, int key_len,
   CLEAR (*ctx);
 
   EVP_CIPHER_CTX_init (ctx);
-  if (!EVP_CipherInit_ov (ctx, kt, NULL, NULL, enc))
+  if (!EVP_CipherInit (ctx, kt, NULL, NULL, enc))
     msg (M_SSLERR, "EVP cipher init #1");
 #ifdef HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH
   if (!EVP_CIPHER_CTX_set_key_length (ctx, key_len))
     msg (M_SSLERR, "EVP set key size");
 #endif
-  if (!EVP_CipherInit_ov (ctx, NULL, key, NULL, enc))
+  if (!EVP_CipherInit (ctx, NULL, key, NULL, enc))
     msg (M_SSLERR, "EVP cipher init #2");
 
   /* make sure we used a big enough key */
@@ -586,14 +574,14 @@ cipher_ctx_mode (const EVP_CIPHER_CTX *ctx)
 int
 cipher_ctx_reset (EVP_CIPHER_CTX *ctx, uint8_t *iv_buf)
 {
-  return EVP_CipherInit_ov (ctx, NULL, NULL, iv_buf, -1);
+  return EVP_CipherInit (ctx, NULL, NULL, iv_buf, -1);
 }
 
 int
 cipher_ctx_update (EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len,
     uint8_t *src, int src_len)
 {
-  return EVP_CipherUpdate_ov (ctx, dst, dst_len, src, src_len);
+  return EVP_CipherUpdate (ctx, dst, dst_len, src, src_len);
 }
 
 int
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Openvpn-devel] [PATCH applied] Re: Remove function without effect (cipher_ok() always returned true).
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 1/2] Remove function without effect (cipher_ok() always returned true) Steffan Karger
@ 2014-05-26 17:56   ` Gert Doering
  0 siblings, 0 replies; 5+ messages in thread
From: Gert Doering @ 2014-05-26 17:56 UTC (permalink / raw)
  To: Steffan Karger <steffan@; +Cc: openvpn-devel

Your patch has been applied to the release/2.3 branch.

commit ad4da1ac27cf9308852cac4b3a591a40fa579bc3
Author: Steffan Karger
Date:   Mon May 26 00:08:32 2014 +0200

     Remove function without effect (cipher_ok() always returned true).

     Signed-off-by: Steffan Karger <steffan@...1856...>
     Acked-by: Gert Doering <gert@...1296...>
     Message-Id: <1401055713-9891-2-git-send-email-steffan@...1856...>
     Signed-off-by: Gert Doering <gert@...1296...>


--
kind regards,

Gert Doering



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Openvpn-devel] [PATCH applied] Re: Remove unneeded wrapper functions in crypto_openssl.c
  2014-05-25 22:08 ` [Openvpn-devel] [PATCH 2/2] Remove unneeded wrapper functions in crypto_openssl.c Steffan Karger
@ 2014-05-26 17:56   ` Gert Doering
  0 siblings, 0 replies; 5+ messages in thread
From: Gert Doering @ 2014-05-26 17:56 UTC (permalink / raw)
  To: Steffan Karger <steffan@; +Cc: openvpn-devel

Your patch has been applied to the release/2.3 branch.

commit c570c1923c4b81871a115f0c07bb2aa04e85fd69
Author: Steffan Karger
Date:   Mon May 26 00:08:33 2014 +0200

     Remove unneeded wrapper functions in crypto_openssl.c

     Signed-off-by: Steffan Karger <steffan@...1856...>
     Acked-by: Gert Doering <gert@...1296...>
     Message-Id: <1401055713-9891-3-git-send-email-steffan@...1856...>
     Signed-off-by: Gert Doering <gert@...1296...>


--
kind regards,

Gert Doering



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-26 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-25 22:08 [Openvpn-devel] [PATCH] Some crypto_openssl.c cleanup for release/2.3 Steffan Karger
2014-05-25 22:08 ` [Openvpn-devel] [PATCH 1/2] Remove function without effect (cipher_ok() always returned true) Steffan Karger
2014-05-26 17:56   ` [Openvpn-devel] [PATCH applied] " Gert Doering
2014-05-25 22:08 ` [Openvpn-devel] [PATCH 2/2] Remove unneeded wrapper functions in crypto_openssl.c Steffan Karger
2014-05-26 17:56   ` [Openvpn-devel] [PATCH applied] " Gert Doering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.