diff --git a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile index db2f6e1bd3..04ebf66a92 100644 --- a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile +++ b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile @@ -1,12 +1,22 @@ include ../common.mak -CFLAGS = -Os -Wall $(EXTRACFLAGS) -fPIC -CFLAGS += -I$(SRCBASE)/include -I$(TOP)/$(OPENSSLDIR)/include $(if $(TCONFIG_BCMARM),-I$(TOP)/openvpn/include,-I$(TOP)/openvpn-2.5/include) -LDFLAGS = -L$(TOP)/nvram$(BCMEX) -lnvram -L$(TOP)/$(OPENSSLDIR) $(if $(TCONFIG_BCMARM),-L$(TOP)/openvpn,-L$(TOP)/openvpn-2.5) - +CFLAGS = -Os -Wall $(EXTRACFLAGS) -fPIC -Wsign-compare +CFLAGS += -I$(SRCBASE)/include $(if $(TCONFIG_BCMARM),-I$(TOP)/openvpn/include,-I$(TOP)/openvpn-2.5/include) +LDFLAGS = -L$(TOP)/nvram$(BCMEX) $(if $(TCONFIG_BCMARM),-L$(TOP)/openvpn,-L$(TOP)/openvpn-2.5) +LIBS = -lnvram + +ifeq ($(TCONFIG_WOLFSSL),y) + CFLAGS += -DUSE_WOLFSSL -I$(TOP)/wolfssl/staged/usr/include -I$(TOP)/wolfssl/staged/usr/include/wolfssl -I$(TOP)/wolfssl + LDFLAGS += -L$(TOP)/wolfssl/staged/usr/lib + LIBS += -lwolfssl +else + CFLAGS += -DUSE_OPENSSL -I$(TOP)/$(OPENSSLDIR)/include + LDFLAGS += -L$(TOP)/$(OPENSSLDIR) + LIBS += -lssl -lcrypto +endif ifeq ($(TCONFIG_BCMARM),y) -LIBS += -lgcc_s + LIBS += -lgcc_s endif OBJS = openvpn_plugin_auth_nvram.o @@ -14,8 +24,8 @@ OBJS = openvpn_plugin_auth_nvram.o all: openvpn_plugin_auth_nvram.so openvpn_plugin_auth_nvram.so: $(OBJS) - @echo " [openvpn_plugin_auth_nvram] CC -o $@" - @$(CC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LDFLAGS) + @echo " [openvpn_plugin_auth_nvram.so] CC -o $@" + @$(CC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(SIZECHECK) $(CPTMP) @@ -29,7 +39,7 @@ clean: rm -f openvpn_plugin_auth_nvram.so .*.depend *.o %.o: %.c .%.depend - @echo " [openvpn_plugin_auth_nvram] CC $@" + @echo " [openvpn_plugin_auth_nvram.o] CC $@" @$(CC) $(CFLAGS) -c $< .depend: $(OBJS:%.o=%.c) diff --git a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/openvpn_plugin_auth_nvram.c b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/openvpn_plugin_auth_nvram.c index 2f3c242363..0d74cc0ac8 100644 --- a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/openvpn_plugin_auth_nvram.c +++ b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/openvpn_plugin_auth_nvram.c @@ -1,8 +1,37 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Fixes/updates (C) 2018 - 2024 pedro + * + */ + + #include #include #include -#include #include +#ifdef USE_WOLFSSL + #include + #include + #include + #include + #include +#endif +#include #define NVRAM_KEY_MAX_LEN 32 @@ -19,7 +48,7 @@ static const char *get_env(const char *key, const char *env[]) return (NULL); for (i = 0; env[i]; i++) { - int keylen = strlen(key); + unsigned int keylen = strlen(key); if (keylen > strlen(env[i])) continue;