From 0d096961b7a60b57947e3568a7d9ff78459c436a Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Thu, 2 Aug 2018 16:18:41 +0200 Subject: [PATCH 1/2] Interop_OpenVPN: remove lists of supported encryption and hash algorithms They are not required as OvsGetCipher() checks if the cipher is available and fallbacks to the default one in case it's not. --- src/Cedar/Interop_OpenVPN.c | 4 ++-- src/Cedar/Interop_OpenVPN.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Cedar/Interop_OpenVPN.c b/src/Cedar/Interop_OpenVPN.c index 9ebc1c33..284dfa9c 100644 --- a/src/Cedar/Interop_OpenVPN.c +++ b/src/Cedar/Interop_OpenVPN.c @@ -953,7 +953,7 @@ CIPHER *OvsGetCipher(char *name) { CIPHER *c = NULL; - if (IsEmptyStr(name) == false && IsStrInStrTokenList(OPENVPN_CIPHER_LIST, name, NULL, false)) + if (IsEmptyStr(name) == false) { c = NewCipher(name); } @@ -971,7 +971,7 @@ MD *OvsGetMd(char *name) { MD *m = NULL; - if (IsEmptyStr(name) == false && IsStrInStrTokenList(OPENVPN_MD_LIST, name, NULL, false)) + if (IsEmptyStr(name) == false) { m = NewMd(name); } diff --git a/src/Cedar/Interop_OpenVPN.h b/src/Cedar/Interop_OpenVPN.h index c31d3d24..6fdb007c 100644 --- a/src/Cedar/Interop_OpenVPN.h +++ b/src/Cedar/Interop_OpenVPN.h @@ -151,12 +151,6 @@ #define OPENVPN_IPC_POSTFIX_L2 "OPENVPN_L2" #define OPENVPN_IPC_POSTFIX_L3 "OPENVPN_L3" -// List of supported encryption algorithms -#define OPENVPN_CIPHER_LIST "[NULL-CIPHER] NULL AES-128-CBC AES-192-CBC AES-256-CBC BF-CBC CAST-CBC CAST5-CBC DES-CBC DES-EDE-CBC DES-EDE3-CBC DESX-CBC RC2-40-CBC RC2-64-CBC RC2-CBC CAMELLIA-128-CBC CAMELLIA-192-CBC CAMELLIA-256-CBC" - -// List of the supported hash algorithm -#define OPENVPN_MD_LIST "SHA SHA1 SHA256 SHA384 SHA512 MD5 MD4 RMD160" - // MTU #define OPENVPN_MTU_LINK 1514 // Ethernet MTU #define OPENVPN_MTU_TUN 1500 // Tun MTU From 517fed85a14a598dca2d0543395cd8e82438debe Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Thu, 2 Aug 2018 18:14:57 +0200 Subject: [PATCH 2/2] Str: remove unused IsStrInStrTokenList() function --- src/Mayaqua/Str.c | 39 --------------------------------------- src/Mayaqua/Str.h | 1 - 2 files changed, 40 deletions(-) diff --git a/src/Mayaqua/Str.c b/src/Mayaqua/Str.c index 5d386755..b863f9d3 100644 --- a/src/Mayaqua/Str.c +++ b/src/Mayaqua/Str.c @@ -579,45 +579,6 @@ bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensiti return ret; } -// Confirm whether the specified string is in the token list -bool IsStrInStrTokenList(char *str_list, char *str, char *split_chars, bool case_sensitive) -{ - TOKEN_LIST *t; - bool ret = false; - UINT i; - // Validate arguments - if (str_list == NULL || str == NULL) - { - return false; - } - - t = ParseTokenWithoutNullStr(str_list, split_chars); - - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - if ((case_sensitive == false) && (StrCmpi(t->Token[i], str) == 0)) - { - ret = true; - } - if ((case_sensitive) && (StrCmp(t->Token[i], str) == 0)) - { - ret = true; - } - - if (ret) - { - break; - } - } - - FreeToken(t); - } - - return ret; -} - // Cut out the token from string (Ignore blanks between delimiters) TOKEN_LIST *ParseTokenWithoutNullStr(char *str, char *split_chars) { diff --git a/src/Mayaqua/Str.h b/src/Mayaqua/Str.h index 92da8dc8..2eec8e04 100644 --- a/src/Mayaqua/Str.h +++ b/src/Mayaqua/Str.h @@ -244,7 +244,6 @@ void ToHex64(char *str, UINT64 value); UINT HexToInt(char *str); UINT64 HexToInt64(char *str); UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive); -bool IsStrInStrTokenList(char *str_list, char *str, char *split_chars, bool case_sensitive); void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str); LIST *StrToIntList(char *str, bool sorted); void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str);