commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r773187 - in /commons/sandbox/runtime/trunk: ./ src/main/native/ src/main/native/include/ src/main/native/modules/network/ssl/ src/main/native/shared/ src/test/org/apache/commons/runtime/
Date Sat, 09 May 2009 09:40:46 GMT
Author: mturk
Date: Sat May  9 09:40:46 2009
New Revision: 773187

URL: http://svn.apache.org/viewvc?rev=773187&view=rev
Log:
Add ssl module library stub

Added:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h   (with props)
    commons/sandbox/runtime/trunk/src/main/native/shared/modules.c   (with props)
Modified:
    commons/sandbox/runtime/trunk/build.xml
    commons/sandbox/runtime/trunk/src/main/native/Makefile.in
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java

Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Sat May  9 09:40:46 2009
@@ -43,7 +43,7 @@
     <property name="commons-logging.jar" value="${commons-logging.home}/commons-logging-1.1.1.jar"/>
     <property name="runtime.natives.path" value="${basedir}/src/main/native"/>
     <property name="runtime.libname" value="libacr"/>
-    <property name="runtime.library.path" value="${runtime.natives.path}/.libs"/>
+    <property name="runtime.library.path" value="${runtime.natives.path}"/>
     <property name="runtime.attributes.base" value="org/apache/commons/runtime"/>
 
     <property name="compile.source" value="1.5"/>

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Sat May  9 09:40:46 2009
@@ -29,9 +29,11 @@
 BITS=@bits@
 CC=@cc@
 SO=@so@
+LIB=@lib@
 OBJ=@obj@
 EXE=@exe@
 AR=@ar@
+ARFLAGS=@arflags@
 RANLIB=@ranlib@
 PREFIX=@prefix@
 LIBDIR=@libdir@
@@ -44,13 +46,15 @@
 LDFLAGS=@ldflags@
 SHFLAGS=@shflags@
 INCLUDES=@includes@
+SSLFLAGS=@sslflags@
 
 DESTDIR=$(PREFIX)
 SONAME=lib$(NAME)$(SO)
+STATICLIB=lib$(NAME)$(LIB)
 SHAREDLIB=lib$(NAME)$(SO)
+SSLMODLIB=lib$(NAME)ssl$(SO)
 
 SRCDIR=$(TOPDIR)
-BLDDIR=$(TOPDIR)/.libs
 PWDDIR=$(PWD)
 
 ARCH_DIRS=\
@@ -72,6 +76,7 @@
 	$(SRCDIR)/shared/error.$(OBJ) \
 	$(SRCDIR)/shared/fco.$(OBJ) \
 	$(SRCDIR)/shared/memory.$(OBJ) \
+	$(SRCDIR)/shared/modules.$(OBJ) \
 	$(SRCDIR)/shared/native.$(OBJ) \
 	$(SRCDIR)/shared/pointer.$(OBJ) \
 	$(SRCDIR)/shared/string.$(OBJ) \
@@ -137,7 +142,7 @@
 	$(SRCDIR)/test/testcase.$(OBJ)
 
 
-all: setup $(SHAREDLIB)
+all: $(STATICLIB) $(SHAREDLIB) @modules@
 
 .c.$(OBJ):
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
@@ -145,23 +150,28 @@
 .cpp.$(OBJ):
 	$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
 
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) $(OPENSSL_OBJS) @testobjs@
-	$(CC) $(SHFLAGS) $(LDFLAGS) -o $(BLDDIR)/$@ $(COMMON_OBJS) $(@platform@_OBJS) $(OPENSSL_OBJS)
@testobjs@
+$(STATICLIB): $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+	$(AR) $(ARFLAGS) $@ $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+	-@$(RANLIB) $@
 
-setup:
-	@mkdir -p $(BLDDIR)
+$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@ $(STATICLIB)
+	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+
+$(SSLMODLIB): $(SHAREDLIB) $(OPENSSL_OBJS)
+	$(CC) $(SHFLAGS) $(LDFLAGS) $(SSLFLAGS) -L. -l$(NAME) -o $@ $(OPENSSL_OBJS)
 
 clean:
 	for i in $(SRCDIR) $(ARCH_DIRS) ; do rm -f $$i/*.$(OBJ) ; done
-	rm -f $(BLDDIR)/*
+	rm -f *$(SO)
+	rm -f *$(LIB)
 
 distclean: clean
 	rm -f $(TOPDIR)/Makefile
 	rm -f $(INCDIR)/ccconfig.h
-	rm -rf $(BLDDIR)
 
 install: all
 	@mkdir -p $(DESTDIR)/include
 	@mkdir -p $(DESTDIR)/$(LIBDIR)
-	cp -f $(INCDIR)/* $(DESTDIR)/include/
-	cp -f $(BLDDIR)/$(SHAREDLIB) $(DESTDIR)/lib/
+	cp -rf $(INCDIR)/* $(DESTDIR)/include/
+	cp -f *$(LIB) $(DESTDIR)/lib/
+	cp -f *$(SO) $(DESTDIR)/lib/

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Sat May  9 09:40:46 2009
@@ -48,15 +48,18 @@
 MT=mt.exe
 
 DESTDIR=$(PREFIX)
-SONAME=$(NAME)$(SO)
+LIBSO=$(NAME)$(SO)
+SSLSO=$(NAME)ssl$(SO)
 LIBNAME=lib$(NAME)
-SHAREDLIB=$(LIBNAME)$(SO)
+SSLNAME=lib$(NAME)ssl
 
 SRCDIR=$(TOPDIR)
 INCDIR=$(TOPDIR)/include
-BLDDIR=$(TOPDIR)\.libs
 PWDDIR=$(PWD)
 
+SHAREDLIB=$(LIBNAME)$(SO)
+SSLMODLIB=$(SSLNAME)(SO)
+
 COMMON_OBJS=\
 	$(SRCDIR)/shared/buildmark.$(OBJ) \
 	$(SRCDIR)/shared/clazz.$(OBJ) \
@@ -65,6 +68,7 @@
 	$(SRCDIR)/shared/error.$(OBJ) \
 	$(SRCDIR)/shared/fco.$(OBJ) \
 	$(SRCDIR)/shared/memory.$(OBJ) \
+	$(SRCDIR)/shared/modules.$(OBJ) \
 	$(SRCDIR)/shared/native.$(OBJ) \
 	$(SRCDIR)/shared/pointer.$(OBJ) \
 	$(SRCDIR)/shared/string.$(OBJ) \
@@ -89,25 +93,28 @@
 TEST_OBJS= \
 	$(SRCDIR)/test/testcase.$(OBJ)
 
-all: setup $(SHAREDLIB)
+all: setup $(SHAREDLIB) $(SSLMODLIB)
 
 .c.$(OBJ):
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -Fo$@ -Fd$(BLDDIR)\$(LIBNAME)-src $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -Fo$@ -Fd$(LIBNAME)-src $<
 
 .cpp.$(OBJ):
-	$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -Fo$@ -Fd$(BLDDIR)\$(LIBNAME)-src
$<
+	$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -Fo$@ -Fd$(LIBNAME)-src $<
 
 .rc.res:
 	$(RC) /l 0x409 /d "NDEBUG" /i "$(SRCDIR)\include" /fo $@ $<
 
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) $(OPENSSL_OBJS) @testobjs@
-	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(COMMON_OBJS) $(WINDOWS_OBJS) $(OPENSSL_OBJS)
@testobjs@ /pdb:$(BLDDIR)\$(LIBNAME).pdb /out:$(BLDDIR)\$@
-	IF EXIST $(BLDDIR)\$(SHAREDLIB).manifest \
-		mt -nologo -manifest  $(BLDDIR)\$(SHAREDLIB).manifest -outputresource:$(BLDDIR)\$(SHAREDLIB);2
-	@copy /Y $(BLDDIR)\$(SHAREDLIB) $(BLDDIR)\$(SONAME)
-
-setup:
-	@if not exist "$(BLDDIR)\$(NULL)" mkdir "$(BLDDIR)"
+$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(COMMON_OBJS) $(WINDOWS_OBJS) @testobjs@
/pdb:$(LIBNAME).pdb /out:$@
+	IF EXIST $@.manifest \
+		mt -nologo -manifest $@.manifest -outputresource:$@;2
+	@copy /Y $@ $(LIBSO)
+
+$(SSLMODLIB): $(SHAREDLIB) $(OPENSSL_OBJS)
+	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(OPENSSL_OBJS) libpath:"." $(LIBNAME).lib
/pdb:$(SSLNAME).pdb /out:$@
+	IF EXIST $(SSLMODLIB).manifest \
+		mt -nologo -manifest $@.manifest -outputresource:$@;2
+	@copy /Y $@ $(SSLSO)
 
 clean:
 	-@del /Q $(SRCDIR)\shared\*.$(OBJ) 2>NUL
@@ -115,12 +122,14 @@
 	-@del /Q $(SRCDIR)\os\win32\*.$(OBJ) 2>NUL
 	-@del /Q $(SRCDIR)\os\win32\*.res 2>NUL
 	-@del /Q $(SRCDIR)\modules\network\ssl\*.$(OBJ) 2>NUL
-	-@del /Q $(BLDDIR)\*  2>NUL
+	-@del /Q *.dll  2>NUL
+	-@del /Q *.lib  2>NUL
+	-@del /Q *.pdb  2>NUL
+	-@del /Q *.exp  2>NUL
 
 distclean: clean
 	-@del /Q $(TOPDIR)\Makefile 2>NUL
 	-@del /Q $(SRCDIR)\include\ccconfig.h 2>NUL
-	@if exist "$(BLDDIR)\$(NULL)" rd /s /q $(BLDDIR)
 
 install: all
 	@if not exist "$(DESTDIR)\include\$(NULL)" mkdir "$(DESTDIR)\include"

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Sat May  9 09:40:46 2009
@@ -44,6 +44,7 @@
 cc="${CC:=gcc}"
 cxx="${CXX:=g++}"
 ar="${AR:=ar}"
+arflags="${SRFLAGS:=ru}"
 ranlib="${RANLIB:=ranlib}"
 topdir="${TOPDIR:=.}"
 cpp="${CPP:=$cc -E}"
@@ -54,8 +55,11 @@
 shflags="$SHFLAGS"
 rcflags="$RCFLAGS"
 includes="-I$topdir/include"
+ssldflags=""
+modules=""
 bige="0"
 so=".so"
+lib=".a"
 exe=""
 obj="o"
 bits=""
@@ -187,7 +191,7 @@
         if [ ".$e" = . ]; then
             eval "$1=\"$2\""
         else
-            for v in $2
+            for v in "$2"
             do
                 do_adds=true
                 for i in $e
@@ -275,7 +279,7 @@
         varadds cppopts "-DLINUX=2 -D_GNU_SOURCE"
         varadds ccflags "-fPIC -O3 -Wall -g"
         varadds ldflags "-lrt -lpthread -ldl"
-        varadds shflags "-shared -fPIC -Wl,-soname -Wl,lib$name$so"
+        varadds shflags '-shared -fPIC -Wl,-soname -Wl,\$@'
         if [ ".$java_pinc" = . ]; then java_pinc=linux; fi
         ;;
     darwin-gcc )
@@ -284,7 +288,7 @@
         varadds ccflags "-fPIC -O3 -g"
         varadds ldflags "-lpthread -ldl"
         if $has_jni ; then so=".jnilib"; else so=".dynlib"; fi
-        varadds shflags "-dynamiclib -flat_namespace -undefined suppress -fPIC -Wl,-dylib_install_name
-Wl,lib$name$so"
+        varadds shflags '-dynamiclib -flat_namespace -undefined suppress -fPIC -Wl,-dylib_install_name
-Wl,\$@'
         ;;
     solaris-cc )
         r="`uname -r | sed 's/5.//'`"
@@ -293,16 +297,16 @@
         else
             varadds ccflags "-fast"
         fi
-        varadds ccflags "-xstrconst -xdepend -O -Xa -KPIC"
         varadds cppopts "-D_POSIX_PTHREAD_SEMANTICS -DSOLARIS2=$r"
+        varadds ccflags "-xstrconst -xdepend -O -Xa -KPIC"
         varadds ldflags "-lrt -lthread -lsocket -lnsl -ldl"
         varadds shflags "-G -KPIC -dy"
         if [ ".$java_pinc" = . ]; then java_pinc=solaris; fi
         ;;
     hpux-cc    )
         r="`uname -r | sed 's/[A-Z].[0-9]*.//'`"
-        varadds ccflags "-Ae +O2 -z +Z"
         varadds cppopts "-D_HPUX_SOURCE -DHPUX11=$r"
+        varadds ccflags "-Ae +O2 -z +Z"
         varadds ldflags "-lrt -lpthread -ldld"
         varadds shflags "+Z -b"
         if [ ".$mach" = ".parisc" ]; then so=".sl"; fi
@@ -363,7 +367,7 @@
 
 if $has_test; then
     varadds cppopts  "-DACR_ENABLE_TEST"
-    testobjs=' $(TEST_OBJS)'
+    testobjs='$(TEST_OBJS)'
 else
     testobjs=""
 fi
@@ -384,16 +388,17 @@
     fi
     if $is_unix; then
         if [ -n "$openssl_lib" ]; then
-            varadds shflags "-L$openssl_lib"
+            varadds sslflags "-L$openssl_lib"
         fi
-        varadds ldflags "-lssl -lcrypto"
+        varadds sslflags "-lssl -lcrypto"
     else
         if [ -n "$openssl_lib" ]; then
-            varadds shflags "/libpath:\"openssl_lib\""
+            varadds sslflags "/libpath:\"openssl_lib\""
         fi
-        varadds ldflags "libeay32.lib ssleay32.lib"
+        varadds sslflags "libeay32.lib ssleay32.lib"
     fi
     have_openssl=1
+    modules="\$(SSLMODLIB)"
 else
     have_openssl=0
 fi
@@ -660,14 +665,13 @@
     -e "s;=@cpp@;=$cpp;g" \
     -e "s;=@cxx@;=$cxx;g" \
     -e "s;=@so@;=$so;g" \
+    -e "s;=@lib@;=$lib;g" \
     -e "s;=@obj@;=$obj;g" \
     -e "s;=@exe@;=$exe;g" \
     -e "s;=@ar@;=$ar;g" \
     -e "s;=@host@;=$host;g" \
     -e "s;=@mach@;=$mach;g" \
     -e "s;=@bits@;=$bits;g" \
-    -e "s;@platform@;$platform;g" \
-    -e "s;@testobjs@;$testobjs;g" \
     -e "s;=@ranlib@;=$ranlib;g" \
     -e "s;=@prefix@;=$prefix;g" \
     -e "s;=@libdir@;=$libdir;g" \
@@ -677,9 +681,14 @@
     -e "s;=@cxxopts@;=$cxxopts;g" \
     -e "s;=@ldflags@;=$ldflags;g" \
     -e "s;=@shflags@;=$shflags;g" \
+    -e "s;=@arflags@;=$arflags;g" \
+    -e "s;=@sslflags@;=$sslflags;g" \
     -e "s;=@rcflags@;=$rcflags;g" \
     -e "s;=@includes@;=$includes;g" \
     -e "s;=@name@;=$name;g" \
+    -e "s;@platform@;$platform;g" \
+    -e "s;@testobjs@;$testobjs;g" \
+    -e "s;@modules@;$modules;g" \
     Makefile$nmake.in > Makefile$nmake
 
 echo ""

Added: commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h?rev=773187&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h (added)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h Sat May  9 09:40:46
2009
@@ -0,0 +1,208 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * @author Mladen Turk
+ */
+
+#ifndef ACR_OPENSSL_H
+#define ACR_OPENSSL_H
+
+/* Exclude unused OpenSSL features
+ * even if the OpenSSL supports them
+ */
+#ifndef OPENSSL_NO_IDEA
+#define OPENSSL_NO_IDEA
+#endif
+#ifndef OPENSSL_NO_KRB5
+#define OPENSSL_NO_KRB5
+#endif
+#ifndef OPENSSL_NO_MDC2
+#define OPENSSL_NO_MDC2
+#endif
+#ifndef OPENSSL_NO_RC5
+#define OPENSSL_NO_RC5
+#endif
+
+/* OpenSSL headers */
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+#include <openssl/crypto.h>
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <openssl/x509v3.h>
+#include <openssl/md5.h>
+/* Avoid tripping over an engine build installed globally and detected
+ * when the user points at an explicit non-engine flavor of OpenSSL
+ */
+#ifndef OPENSSL_NO_ENGINE
+#include <openssl/engine.h>
+#endif
+
+#ifndef RAND_MAX
+#include <limits.h>
+#define RAND_MAX INT_MAX
+#endif
+
+#define SSL_ALGO_UNKNOWN (0)
+#define SSL_ALGO_RSA     (1<<0)
+#define SSL_ALGO_DSA     (1<<1)
+#define SSL_ALGO_ALL     (SSL_ALGO_RSA|SSL_ALGO_DSA)
+
+#define SSL_AIDX_RSA     (0)
+#define SSL_AIDX_DSA     (1)
+#define SSL_AIDX_MAX     (2)
+
+/*
+ * Define IDs for the temporary RSA keys and DH params
+ */
+
+#define SSL_TMP_KEY_RSA_512     (0)
+#define SSL_TMP_KEY_RSA_1024    (1)
+#define SSL_TMP_KEY_RSA_2048    (2)
+#define SSL_TMP_KEY_RSA_4096    (3)
+#define SSL_TMP_KEY_DH_512      (4)
+#define SSL_TMP_KEY_DH_1024     (5)
+#define SSL_TMP_KEY_DH_2048     (6)
+#define SSL_TMP_KEY_DH_4096     (7)
+#define SSL_TMP_KEY_MAX         (8)
+
+#define SSL_CRT_FORMAT_UNDEF    (0)
+#define SSL_CRT_FORMAT_ASN1     (1)
+#define SSL_CRT_FORMAT_TEXT     (2)
+#define SSL_CRT_FORMAT_PEM      (3)
+#define SSL_CRT_FORMAT_NETSCAPE (4)
+#define SSL_CRT_FORMAT_PKCS12   (5)
+#define SSL_CRT_FORMAT_SMIME    (6)
+#define SSL_CRT_FORMAT_ENGINE   (7)
+/* XXX this stupid macro helps us to avoid
+ * adding yet another param to load_*key()
+ */
+#define SSL_KEY_FORMAT_IISSGC   (8)
+
+/*
+ * Define the SSL options
+ */
+#define SSL_OPT_NONE            (0)
+#define SSL_OPT_RELSET          (1<<0)
+#define SSL_OPT_STDENVVARS      (1<<1)
+#define SSL_OPT_EXPORTCERTDATA  (1<<3)
+#define SSL_OPT_FAKEBASICAUTH   (1<<4)
+#define SSL_OPT_STRICTREQUIRE   (1<<5)
+#define SSL_OPT_OPTRENEGOTIATE  (1<<6)
+#define SSL_OPT_ALL             (SSL_OPT_STDENVVARS|SSL_OPT_EXPORTCERTDATA|SSL_OPT_FAKEBASICAUTH|SSL_OPT_STRICTREQUIRE|SSL_OPT_OPTRENEGOTIATE)
+
+/*
+ * Define the SSL Protocol options
+ */
+#define SSL_PROTOCOL_NONE       (0)
+#define SSL_PROTOCOL_SSLV2      (1<<0)
+#define SSL_PROTOCOL_SSLV3      (1<<1)
+#define SSL_PROTOCOL_TLSV1      (1<<2)
+#define SSL_PROTOCOL_ALL        (SSL_PROTOCOL_SSLV2|SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1)
+
+#define SSL_MODE_CLIENT         (0)
+#define SSL_MODE_SERVER         (1)
+#define SSL_MODE_COMBINED       (2)
+
+#define SSL_BIO_FLAG_RDONLY     (1<<0)
+#define SSL_BIO_FLAG_CALLBACK   (1<<1)
+#define SSL_DEFAULT_CACHE_SIZE  (256)
+#define SSL_DEFAULT_VHOST_NAME  ("_default_:443")
+#define SSL_MAX_STR_LEN         (2048)
+#define SSL_MAX_PASSWORD_LEN    (256)
+
+#define SSL_CVERIFY_UNSET           (-1)
+#define SSL_CVERIFY_NONE            (0)
+#define SSL_CVERIFY_OPTIONAL        (1)
+#define SSL_CVERIFY_REQUIRE         (2)
+#define SSL_CVERIFY_OPTIONAL_NO_CA  (3)
+#define SSL_VERIFY_PEER_STRICT      (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
+
+#define SSL_SHUTDOWN_TYPE_UNSET     (0)
+#define SSL_SHUTDOWN_TYPE_STANDARD  (1)
+#define SSL_SHUTDOWN_TYPE_UNCLEAN   (2)
+#define SSL_SHUTDOWN_TYPE_ACCURATE  (3)
+
+#define SSL_TO_APR_ERROR(X)         (ACR_OS_START_USERERR + 1000 + X)
+
+#define SSL_INFO_SESSION_ID                 (0x0001)
+#define SSL_INFO_CIPHER                     (0x0002)
+#define SSL_INFO_CIPHER_USEKEYSIZE          (0x0003)
+#define SSL_INFO_CIPHER_ALGKEYSIZE          (0x0004)
+#define SSL_INFO_CIPHER_VERSION             (0x0005)
+#define SSL_INFO_CIPHER_DESCRIPTION         (0x0006)
+#define SSL_INFO_PROTOCOL                   (0x0007)
+
+#define SSL_INFO_CLIENT_S_DN                (0x0010)
+#define SSL_INFO_CLIENT_I_DN                (0x0020)
+#define SSL_INFO_SERVER_S_DN                (0x0040)
+#define SSL_INFO_SERVER_I_DN                (0x0080)
+
+#define SSL_INFO_DN_COUNTRYNAME             (0x0001)
+#define SSL_INFO_DN_STATEORPROVINCENAME     (0x0002)
+#define SSL_INFO_DN_LOCALITYNAME            (0x0003)
+#define SSL_INFO_DN_ORGANIZATIONNAME        (0x0004)
+#define SSL_INFO_DN_ORGANIZATIONALUNITNAME  (0x0005)
+#define SSL_INFO_DN_COMMONNAME              (0x0006)
+#define SSL_INFO_DN_TITLE                   (0x0007)
+#define SSL_INFO_DN_INITIALS                (0x0008)
+#define SSL_INFO_DN_GIVENNAME               (0x0009)
+#define SSL_INFO_DN_SURNAME                 (0x000A)
+#define SSL_INFO_DN_DESCRIPTION             (0x000B)
+#define SSL_INFO_DN_UNIQUEIDENTIFIER        (0x000C)
+#define SSL_INFO_DN_EMAILADDRESS            (0x000D)
+
+#define SSL_INFO_CLIENT_MASK                (0x0100)
+
+#define SSL_INFO_CLIENT_M_VERSION           (0x0101)
+#define SSL_INFO_CLIENT_M_SERIAL            (0x0102)
+#define SSL_INFO_CLIENT_V_START             (0x0103)
+#define SSL_INFO_CLIENT_V_END               (0x0104)
+#define SSL_INFO_CLIENT_A_SIG               (0x0105)
+#define SSL_INFO_CLIENT_A_KEY               (0x0106)
+#define SSL_INFO_CLIENT_CERT                (0x0107)
+#define SSL_INFO_CLIENT_V_REMAIN            (0x0108)
+
+#define SSL_INFO_SERVER_MASK                (0x0200)
+
+#define SSL_INFO_SERVER_M_VERSION           (0x0201)
+#define SSL_INFO_SERVER_M_SERIAL            (0x0202)
+#define SSL_INFO_SERVER_V_START             (0x0203)
+#define SSL_INFO_SERVER_V_END               (0x0204)
+#define SSL_INFO_SERVER_A_SIG               (0x0205)
+#define SSL_INFO_SERVER_A_KEY               (0x0206)
+#define SSL_INFO_SERVER_CERT                (0x0207)
+#define SSL_INFO_CLIENT_CERT_CHAIN          (0x0400)
+
+#define SSL_VERIFY_ERROR_IS_OPTIONAL(errnum) \
+   ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
+    || (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) \
+    || (errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) \
+    || (errnum == X509_V_ERR_CERT_UNTRUSTED) \
+    || (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE))
+
+
+
+#define SSL_DEFAULT_PASS_PROMPT "Some of your private key files are encrypted for security
reasons.\n"  \
+                                "In order to read them you have to provide the pass phrases.\n"
        \
+                                "Enter password :"
+
+
+#endif /* ACR_OPENSSL */

Propchange: commons/sandbox/runtime/trunk/src/main/native/include/acr_openssl.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/modules/network/ssl/openssl.c Sat May  9
09:40:46 2009
@@ -22,8 +22,34 @@
 #include "acr_types.h"
 #include "acr_clazz.h"
 #include "acr_vm.h"
+#include "acr_openssl.h"
 
-ACR_NET_EXPORT_DECLARE(jboolean, OpenSSL, has0)(ACR_JNISTDARGS)
+#ifdef ACR_ENABLE_TEST
+/* OpenSSL TestPrivate methods
+ */
+ACR_JNI_EXPORT_DECLARE(jstring, TestPrivate, test100)(ACR_JNISTDARGS, jstring s)
 {
-    return V2Z(HAVE_OPENSSL);
+    jstring rs = NULL;
+
+    WITH_CSTR(s) {
+        rs = ACR_NewJavaStringA(_E, J2S(s));
+    } END_WITH_CSTR(s);
+
+    return rs;
+
 }
+
+#endif /* ACR_ENABLE_TEST */
+
+ACR_JNI_EXPORT_DECLARE(jint, OpenSSL, version0)(ACR_JNISTDARGS)
+{
+    UNREFERENCED_STDARGS;
+    return OPENSSL_VERSION_NUMBER;
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OpenSSL, version1)(ACR_JNISTDARGS)
+{
+    UNREFERENCED_O;
+    return CSTR_TO_JSTRING(OPENSSL_VERSION_TEXT);
+}
+

Added: commons/sandbox/runtime/trunk/src/main/native/shared/modules.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/modules.c?rev=773187&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/modules.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/modules.c Sat May  9 09:40:46 2009
@@ -0,0 +1,31 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * @author Mladen Turk
+ */
+
+#include "acr.h"
+#include "acr_private.h"
+#include "acr_error.h"
+#include "acr_clazz.h"
+#include "acr_vm.h"
+
+ACR_NET_EXPORT_DECLARE(jboolean, OpenSSL, has0)(ACR_JNISTDARGS)
+{
+    return V2Z(HAVE_OPENSSL);
+}

Propchange: commons/sandbox/runtime/trunk/src/main/native/shared/modules.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java?rev=773187&r1=773186&r2=773187&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Sat
May  9 09:40:46 2009
@@ -77,11 +77,14 @@
     private static native String test028(int d);
     private static native File   test029(int d);
 
+    private static native String test100(String s);
+
 
     protected void setUp()
         throws Exception
     {
         System.loadLibrary("acr");
+        System.loadLibrary("acrssl");
         for (int i = 0; i < longStrSize; i++) {
             longChar[i] = (char)('A' + (i % 20));
         }
@@ -561,4 +564,11 @@
         assertEquals("Name", "foo", f.getName());
     }
 
+    public void testModuleSSL()
+        throws Throwable
+    {
+        String s = test100("OpenSSL");
+        assertEquals("Name", "OpenSSL", s);
+    }
+
 }



Mime
View raw message