From 0d7829638607013939064896b1432067d5302dbc Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 9 Nov 2008 16:11:46 +0000 Subject: [PATCH] * luci/contrib: add axtls package --- contrib/axtls/Makefile | 61 ++++++++++ contrib/axtls/files/axtls-config | 116 ++++++++++++++++++ contrib/axtls/files/axtls-config.h | 117 +++++++++++++++++++ contrib/axtls/patches/001-ld-fix.patch | 12 ++ contrib/axtls/patches/002-httpd-fix.patch | 12 ++ contrib/axtls/patches/003-content-type.patch | 37 ++++++ 6 files changed, 355 insertions(+) create mode 100644 contrib/axtls/Makefile create mode 100644 contrib/axtls/files/axtls-config create mode 100644 contrib/axtls/files/axtls-config.h create mode 100644 contrib/axtls/patches/001-ld-fix.patch create mode 100644 contrib/axtls/patches/002-httpd-fix.patch create mode 100644 contrib/axtls/patches/003-content-type.patch diff --git a/contrib/axtls/Makefile b/contrib/axtls/Makefile new file mode 100644 index 000000000..459a15cc8 --- /dev/null +++ b/contrib/axtls/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=axtls +PKG_VERSION:=1.2.0 +PKG_RELEASE:=1 + +PKG_BUILD_DIR=$(BUILD_DIR)/axTLS +PKG_SOURCE:=axTLS-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/axtls +PKG_MD5SUM:=af805c76c0da1dbfc0c5e6b8dbd6706a + +include $(INCLUDE_DIR)/package.mk + +# set to 1 to enable debugging +DEBUG= + +define Package/libaxtls + SECTION:=libs + CATEGORY:=Libraries + TITLE:=axTLS embedded SSL library +endef + +define Package/axhttpd + SECTION:=net + CATEGORY:=Networking + DEPENDS:=+libaxtls + TITLE:=axTLS embedded http/https server +endef + +define Build/Configure + $(INSTALL_DIR) $(PKG_BUILD_DIR)/config + $(CP) ./files/axtls-config $(PKG_BUILD_DIR)/config/.config + $(CP) ./files/axtls-config.h $(PKG_BUILD_DIR)/config/config.h +endef + +TARGET_CFLAGS += $(FPIC) + +#define Build/Compile +# $(MAKE) -C $(PKG_BUILD_DIR) +#endef + +define Package/libaxtls/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/_stage/libaxtls.so* $(1)/usr/lib/ +endef + +define Package/axhttpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/_stage/axhttpd $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,libaxtls)) +$(eval $(call BuildPackage,axhttpd)) diff --git a/contrib/axtls/files/axtls-config b/contrib/axtls/files/axtls-config new file mode 100644 index 000000000..f32264e5a --- /dev/null +++ b/contrib/axtls/files/axtls-config @@ -0,0 +1,116 @@ +# +# Automatically generated make config: don't edit +# +HAVE_DOT_CONFIG=y +CONFIG_PLATFORM_LINUX=y +# CONFIG_PLATFORM_CYGWIN is not set +# CONFIG_PLATFORM_WIN32 is not set + +# +# General Configuration +# +PREFIX="/usr/local" +# CONFIG_DEBUG is not set +# CONFIG_STRIP_UNWANTED_SECTIONS is not set +# CONFIG_VISUAL_STUDIO_7_0 is not set +# CONFIG_VISUAL_STUDIO_8_0 is not set +CONFIG_VISUAL_STUDIO_7_0_BASE="" +CONFIG_VISUAL_STUDIO_8_0_BASE="" +CONFIG_EXTRA_CFLAGS_OPTIONS="-fPIC" +CONFIG_EXTRA_LDFLAGS_OPTIONS="-lc -lm" + +# +# SSL Library +# +# CONFIG_SSL_SERVER_ONLY is not set +# CONFIG_SSL_CERT_VERIFICATION is not set +# CONFIG_SSL_ENABLE_CLIENT is not set +# CONFIG_SSL_FULL_MODE is not set +CONFIG_SSL_SKELETON_MODE=y +# CONFIG_SSL_PROT_LOW is not set +# CONFIG_SSL_PROT_MEDIUM is not set +# CONFIG_SSL_PROT_HIGH is not set +# CONFIG_SSL_USE_DEFAULT_KEY is not set +CONFIG_SSL_PRIVATE_KEY_LOCATION="" +CONFIG_SSL_PRIVATE_KEY_PASSWORD="" +CONFIG_SSL_X509_CERT_LOCATION="" +# CONFIG_SSL_GENERATE_X509_CERT is not set +CONFIG_SSL_X509_COMMON_NAME="" +CONFIG_SSL_X509_ORGANIZATION_NAME="" +CONFIG_SSL_X509_ORGANIZATION_UNIT_NAME="" +CONFIG_SSL_ENABLE_V23_HANDSHAKE=y +# CONFIG_SSL_HAS_PEM is not set +# CONFIG_SSL_USE_PKCS12 is not set +CONFIG_SSL_EXPIRY_TIME=0 +CONFIG_X509_MAX_CA_CERTS=0 +CONFIG_SSL_MAX_CERTS=2 +# CONFIG_SSL_CTX_MUTEXING is not set +CONFIG_USE_DEV_URANDOM=y +# CONFIG_WIN32_USE_CRYPTO_LIB is not set +# CONFIG_OPENSSL_COMPATIBLE is not set +# CONFIG_PERFORMANCE_TESTING is not set +# CONFIG_SSL_TEST is not set +CONFIG_AXHTTPD=y + +# +# Axhttpd Configuration +# +# CONFIG_HTTP_STATIC_BUILD is not set +CONFIG_HTTP_PORT=80 +CONFIG_HTTP_HTTPS_PORT=443 +CONFIG_HTTP_SESSION_CACHE_SIZE=5 +CONFIG_HTTP_WEBROOT="/www" +CONFIG_HTTP_TIMEOUT=300 + +# +# CGI +# +CONFIG_HTTP_HAS_CGI=y +CONFIG_HTTP_CGI_EXTENSIONS="luci" +# CONFIG_HTTP_ENABLE_LUA is not set +CONFIG_HTTP_LUA_PREFIX="" +CONFIG_HTTP_LUA_CGI_LAUNCHER="" +# CONFIG_HTTP_BUILD_LUA is not set +CONFIG_HTTP_DIRECTORIES=y +# CONFIG_HTTP_HAS_AUTHORIZATION is not set +# CONFIG_HTTP_HAS_IPV6 is not set +# CONFIG_HTTP_ENABLE_DIFFERENT_USER is not set +CONFIG_HTTP_USER="" +# CONFIG_HTTP_VERBOSE is not set +CONFIG_HTTP_IS_DAEMON=y + +# +# Language Bindings +# +# CONFIG_BINDINGS is not set +# CONFIG_CSHARP_BINDINGS is not set +# CONFIG_VBNET_BINDINGS is not set +CONFIG_DOT_NET_FRAMEWORK_BASE="" +# CONFIG_JAVA_BINDINGS is not set +CONFIG_JAVA_HOME="" +# CONFIG_PERL_BINDINGS is not set +CONFIG_PERL_CORE="" +CONFIG_PERL_LIB="" +# CONFIG_LUA_BINDINGS is not set +CONFIG_LUA_CORE="" + +# +# Samples +# +# CONFIG_SAMPLES is not set +# CONFIG_C_SAMPLES is not set +# CONFIG_CSHARP_SAMPLES is not set +# CONFIG_VBNET_SAMPLES is not set +# CONFIG_JAVA_SAMPLES is not set +# CONFIG_PERL_SAMPLES is not set +# CONFIG_LUA_SAMPLES is not set +# CONFIG_BIGINT_CLASSICAL is not set +# CONFIG_BIGINT_MONTGOMERY is not set +# CONFIG_BIGINT_BARRETT is not set +# CONFIG_BIGINT_CRT is not set +# CONFIG_BIGINT_KARATSUBA is not set +MUL_KARATSUBA_THRESH=0 +SQU_KARATSUBA_THRESH=0 +# CONFIG_BIGINT_SLIDING_WINDOW is not set +# CONFIG_BIGINT_SQUARE is not set +# CONFIG_BIGINT_CHECK_ON is not set diff --git a/contrib/axtls/files/axtls-config.h b/contrib/axtls/files/axtls-config.h new file mode 100644 index 000000000..45cf8b675 --- /dev/null +++ b/contrib/axtls/files/axtls-config.h @@ -0,0 +1,117 @@ +/* + * Automatically generated header file: don't edit + */ + +#define HAVE_DOT_CONFIG 1 +#define CONFIG_PLATFORM_LINUX 1 +#undef CONFIG_PLATFORM_CYGWIN +#undef CONFIG_PLATFORM_WIN32 + +/* + * General Configuration + */ +#define PREFIX "/usr/local" +#undef CONFIG_DEBUG +#undef CONFIG_STRIP_UNWANTED_SECTIONS +#undef CONFIG_VISUAL_STUDIO_7_0 +#undef CONFIG_VISUAL_STUDIO_8_0 +#define CONFIG_VISUAL_STUDIO_7_0_BASE "" +#define CONFIG_VISUAL_STUDIO_8_0_BASE "" +#define CONFIG_EXTRA_CFLAGS_OPTIONS "-fPIC" +#define CONFIG_EXTRA_LDFLAGS_OPTIONS "-lc -lm" + +/* + * SSL Library + */ +#undef CONFIG_SSL_SERVER_ONLY +#undef CONFIG_SSL_CERT_VERIFICATION +#undef CONFIG_SSL_ENABLE_CLIENT +#undef CONFIG_SSL_FULL_MODE +#define CONFIG_SSL_SKELETON_MODE 1 +#undef CONFIG_SSL_PROT_LOW +#undef CONFIG_SSL_PROT_MEDIUM +#undef CONFIG_SSL_PROT_HIGH +#undef CONFIG_SSL_USE_DEFAULT_KEY +#define CONFIG_SSL_PRIVATE_KEY_LOCATION "" +#define CONFIG_SSL_PRIVATE_KEY_PASSWORD "" +#define CONFIG_SSL_X509_CERT_LOCATION "" +#undef CONFIG_SSL_GENERATE_X509_CERT +#define CONFIG_SSL_X509_COMMON_NAME "" +#define CONFIG_SSL_X509_ORGANIZATION_NAME "" +#define CONFIG_SSL_X509_ORGANIZATION_UNIT_NAME "" +#define CONFIG_SSL_ENABLE_V23_HANDSHAKE 1 +#undef CONFIG_SSL_HAS_PEM +#undef CONFIG_SSL_USE_PKCS12 +#define CONFIG_SSL_EXPIRY_TIME +#define CONFIG_X509_MAX_CA_CERTS +#define CONFIG_SSL_MAX_CERTS 2 +#undef CONFIG_SSL_CTX_MUTEXING +#define CONFIG_USE_DEV_URANDOM 1 +#undef CONFIG_WIN32_USE_CRYPTO_LIB +#undef CONFIG_OPENSSL_COMPATIBLE +#undef CONFIG_PERFORMANCE_TESTING +#undef CONFIG_SSL_TEST +#define CONFIG_AXHTTPD 1 + +/* + * Axhttpd Configuration + */ +#undef CONFIG_HTTP_STATIC_BUILD +#define CONFIG_HTTP_PORT 80 +#define CONFIG_HTTP_HTTPS_PORT 443 +#define CONFIG_HTTP_SESSION_CACHE_SIZE 5 +#define CONFIG_HTTP_WEBROOT "/www" +#define CONFIG_HTTP_TIMEOUT 300 + +/* + * CGI + */ +#define CONFIG_HTTP_HAS_CGI 1 +#define CONFIG_HTTP_CGI_EXTENSIONS "luci" +#undef CONFIG_HTTP_ENABLE_LUA +#define CONFIG_HTTP_LUA_PREFIX "" +#define CONFIG_HTTP_LUA_CGI_LAUNCHER "" +#undef CONFIG_HTTP_BUILD_LUA +#define CONFIG_HTTP_DIRECTORIES 1 +#undef CONFIG_HTTP_HAS_AUTHORIZATION +#undef CONFIG_HTTP_HAS_IPV6 +#undef CONFIG_HTTP_ENABLE_DIFFERENT_USER +#define CONFIG_HTTP_USER "" +#undef CONFIG_HTTP_VERBOSE +#define CONFIG_HTTP_IS_DAEMON 1 + +/* + * Language Bindings + */ +#undef CONFIG_BINDINGS +#undef CONFIG_CSHARP_BINDINGS +#undef CONFIG_VBNET_BINDINGS +#define CONFIG_DOT_NET_FRAMEWORK_BASE "" +#undef CONFIG_JAVA_BINDINGS +#define CONFIG_JAVA_HOME "" +#undef CONFIG_PERL_BINDINGS +#define CONFIG_PERL_CORE "" +#define CONFIG_PERL_LIB "" +#undef CONFIG_LUA_BINDINGS +#define CONFIG_LUA_CORE "" + +/* + * Samples + */ +#undef CONFIG_SAMPLES +#undef CONFIG_C_SAMPLES +#undef CONFIG_CSHARP_SAMPLES +#undef CONFIG_VBNET_SAMPLES +#undef CONFIG_JAVA_SAMPLES +#undef CONFIG_PERL_SAMPLES +#undef CONFIG_LUA_SAMPLES +#undef CONFIG_BIGINT_CLASSICAL +#undef CONFIG_BIGINT_MONTGOMERY +#undef CONFIG_BIGINT_BARRETT +#undef CONFIG_BIGINT_CRT +#undef CONFIG_BIGINT_KARATSUBA +#define MUL_KARATSUBA_THRESH +#define SQU_KARATSUBA_THRESH +#undef CONFIG_BIGINT_SLIDING_WINDOW +#undef CONFIG_BIGINT_SQUARE +#undef CONFIG_BIGINT_CHECK_ON diff --git a/contrib/axtls/patches/001-ld-fix.patch b/contrib/axtls/patches/001-ld-fix.patch new file mode 100644 index 000000000..245600705 --- /dev/null +++ b/contrib/axtls/patches/001-ld-fix.patch @@ -0,0 +1,12 @@ +diff -urb axTLS.orig/ssl/Makefile axTLS/ssl/Makefile +--- axTLS.orig/ssl/Makefile 2008-11-09 00:58:43.000000000 +0000 ++++ axTLS/ssl/Makefile 2008-11-09 00:58:57.000000000 +0000 +@@ -96,7 +96,7 @@ + + $(TARGET2) : $(OBJ) + ifndef CONFIG_PLATFORM_CYGWIN +- $(LD) $(LDFLAGS) $(LDSHARED) -Wl,-soname,$(LIBMAJOR) -o $(AXTLS_HOME)/$(STAGE)/$(LIBMINOR) $(CRYPTO_OBJ) $(OBJ) ++ $(LD) $(LDFLAGS) $(LDSHARED) -o $(AXTLS_HOME)/$(STAGE)/$(LIBMINOR) $(CRYPTO_OBJ) $(OBJ) + cd $(AXTLS_HOME)/$(STAGE); ln -sf $(LIBMINOR) $(LIBMAJOR); ln -sf $(LIBMAJOR) $(BASETARGET); cd - + else + $(LD) $(LDFLAGS) $(LDSHARED) -o $(AXTLS_HOME)/$(STAGE)/cygaxtls.dll \ diff --git a/contrib/axtls/patches/002-httpd-fix.patch b/contrib/axtls/patches/002-httpd-fix.patch new file mode 100644 index 000000000..e6fd152d8 --- /dev/null +++ b/contrib/axtls/patches/002-httpd-fix.patch @@ -0,0 +1,12 @@ +diff -urb axTLS.orig/httpd/Makefile axTLS/httpd/Makefile +--- axTLS.orig/httpd/Makefile 2008-11-09 00:58:44.000000000 +0000 ++++ axTLS/httpd/Makefile 2008-11-09 01:29:55.000000000 +0000 +@@ -95,7 +95,7 @@ + ifndef CONFIG_PLATFORM_WIN32 + + $(TARGET): $(OBJ) $(AXTLS_HOME)/$(STAGE)/libaxtls.a +- $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) ++ $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) + ifdef CONFIG_STRIP_UNWANTED_SECTIONS + strip --remove-section=.comment $(TARGET) + endif diff --git a/contrib/axtls/patches/003-content-type.patch b/contrib/axtls/patches/003-content-type.patch new file mode 100644 index 000000000..476890cf1 --- /dev/null +++ b/contrib/axtls/patches/003-content-type.patch @@ -0,0 +1,37 @@ +diff -urb axTLS.orig/httpd/axhttp.h axTLS/httpd/axhttp.h +--- axTLS.orig/httpd/axhttp.h 2008-11-09 00:58:44.000000000 +0000 ++++ axTLS/httpd/axhttp.h 2008-11-09 02:33:44.000000000 +0000 +@@ -91,6 +91,7 @@ + uint8_t is_lua; + #endif + int content_length; ++ char content_type[MAXREQUESTLENGTH]; + char remote_addr[MAXREQUESTLENGTH]; + char uri_request[MAXREQUESTLENGTH]; + char uri_path_info[MAXREQUESTLENGTH]; +diff -urb axTLS.orig/httpd/proc.c axTLS/httpd/proc.c +--- axTLS.orig/httpd/proc.c 2008-11-09 00:58:44.000000000 +0000 ++++ axTLS/httpd/proc.c 2008-11-09 02:43:32.000000000 +0000 +@@ -129,6 +129,10 @@ + + my_strncpy(cn->server_name, value, MAXREQUESTLENGTH); + } ++ else if (strcmp(buf, "Content-Type:") == 0 ) ++ { ++ my_strncpy(cn->content_type, value, MAXREQUESTLENGTH); ++ } + else if (strcmp(buf, "Connection:") == 0 && strcmp(value, "close") == 0) + { + cn->close_when_done = 1; +@@ -673,8 +677,9 @@ + type = "POST"; + sprintf(cgienv[cgi_index++], + "CONTENT_LENGTH=%d", cn->content_length); +- strcpy(cgienv[cgi_index++], /* hard-code? */ +- "CONTENT_TYPE=application/x-www-form-urlencoded"); ++ snprintf(cgienv[cgi_index++], MAXREQUESTLENGTH, ++ "CONTENT_TYPE=%s", cn->content_type); ++ + break; + } + -- 2.25.1