openvpn_plugin_auth_nvram: add wolfssl support

arm-master
pedro 1 year ago
parent b0297eee19
commit be34ca11b1

@ -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)

@ -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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openvpn-plugin.h>
#include <bcmnvram.h>
#ifdef USE_WOLFSSL
#include <config.h>
#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
#include <wolfssl/error-ssl.h>
#endif
#include <openvpn-plugin.h>
#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;

Loading…
Cancel
Save