harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r986617 - in /harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse: shared/sslEngine.c shared/sslParameters.c shared/sslSession.c shared/sslSocket.c unix/makefile
Date Wed, 18 Aug 2010 10:10:55 GMT
Author: odeakin
Date: Wed Aug 18 10:10:55 2010
New Revision: 986617

URL: http://svn.apache.org/viewvc?rev=986617&view=rev
Log:
Apply patch for HARMONY-6627 ([classlib][x-net] Creating a JSSE provider based on OpenSSL),
with additional modification to new file sslEngine.c to use jlong2addr/addr2jlong.

Modified:
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslEngine.c
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslParameters.c
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSession.c
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSocket.c
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/unix/makefile

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslEngine.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslEngine.c?rev=986617&r1=986616&r2=986617&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslEngine.c
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslEngine.c
Wed Aug 18 10:10:55 2010
@@ -27,6 +27,6 @@
 
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLEngineImpl_initImpl
   (JNIEnv *env, jclass clazz, jlong context) {
-    return (jlong)SSL_new((SSL_CTX*)context);
+    return addr2jlong(SSL_new(jlong2addr(SSL_CTX, context)));
 }
 

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslParameters.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslParameters.c?rev=986617&r1=986616&r2=986617&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslParameters.c
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslParameters.c
Wed Aug 18 10:10:55 2010
@@ -75,7 +75,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
     jint i;
     X509_STORE *certStore;
     X509 *x509cert;
-    unsigned char *temp;
+    const unsigned char *temp;
     int ret;
     RAND_METHOD *randMethod;
     JavaVM *jvm;
@@ -104,7 +104,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_
             (*env)->GetByteArrayRegion(env, cert, 0, byteSize, certBuffer);
 
             // Copy certBuffer as the d2i_X509 will increment it
-            temp = (unsigned char*)certBuffer;
+            temp = (const unsigned char*)certBuffer;
 
             // Create an X509 from the ASN1 encoded certificate
             x509cert = d2i_X509(NULL, &temp, (int)byteSize);
@@ -158,14 +158,14 @@ JNIEXPORT jlong JNICALL Java_org_apache_
     randMethod = getRandMethod(jvm);
     RAND_set_rand_method(randMethod);
     
-    return (jlong)context;
+    return addr2jlong(context);
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLParameters_setEnabledProtocolsImpl
   (JNIEnv *env, jclass clazz, jlong context, jlong jssl, jint flags) 
 {
-    SSL_CTX *ctx = (SSL_CTX*)context;
-    SSL *ssl = (SSL*)jssl;
+    SSL_CTX *ctx = jlong2addr(SSL_CTX, context);
+    SSL *ssl = jlong2addr(SSL, jssl);
     long options = 0;
     long mask = SSL_OP_NO_TLSv1 | SSL_OP_NO_SSLv3 | SSL_OP_NO_SSLv2;
 
@@ -193,8 +193,8 @@ JNIEXPORT void JNICALL Java_org_apache_h
 JNIEXPORT void JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLParameters_setClientAuthImpl
   (JNIEnv *env, jclass clazz, jlong context, jlong jssl, jshort flag)
 {
-    SSL_CTX *ctx = (SSL_CTX*)context;
-    SSL *ssl = (SSL*)jssl;
+    SSL_CTX *ctx = jlong2addr(SSL_CTX, context);
+    SSL *ssl = jlong2addr(SSL, jssl);
     int mode = 0;
 
     switch (flag) {
@@ -252,8 +252,8 @@ JNIEXPORT void JNICALL Java_org_apache_h
     }
 
     // Set the new cipher list in the context and SSL, if specified
-    SSL_CTX_set_cipher_list((SSL_CTX*)context, cipherList);
+    SSL_CTX_set_cipher_list(jlong2addr(SSL_CTX, context), cipherList);
     if (jssl) {
-        SSL_set_cipher_list((SSL*)jssl, cipherList);
+        SSL_set_cipher_list(jlong2addr(SSL, jssl), cipherList);
     }
 }

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSession.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSession.c?rev=986617&r1=986616&r2=986617&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSession.c
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSession.c
Wed Aug 18 10:10:55 2010
@@ -26,7 +26,7 @@
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSessionImpl_initialiseSession
   (JNIEnv *env, jobject object, jlong jssl)
 {
-    SSL *ssl = (SSL*)jssl;
+    SSL *ssl = jlong2addr(SSL, jssl);
 
-    return (jlong)SSL_get_session(ssl);
+    return addr2jlong(SSL_get_session(ssl));
 }

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSocket.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSocket.c?rev=986617&r1=986616&r2=986617&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSocket.c
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/shared/sslSocket.c
Wed Aug 18 10:10:55 2010
@@ -60,13 +60,13 @@ jlong getFD(JNIEnv * env, jobject fd) {
 
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSocketImpl_initImpl
   (JNIEnv *env, jclass clazz, jlong context) {
-    return (jlong)SSL_new((SSL_CTX*)context);
+    return addr2jlong(SSL_new(jlong2addr(SSL_CTX, context)));
 }
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSocketImpl_sslAcceptImpl
   (JNIEnv *env, jclass clazz, jlong jssl, jobject fd) {
     jlong socket = getFD(env, fd);
-    SSL *ssl = (SSL*)jssl;
+    SSL *ssl = jlong2addr(SSL, jssl);
     BIO *bio;
     int ret;
  
@@ -89,7 +89,7 @@ JNIEXPORT void JNICALL Java_org_apache_h
 JNIEXPORT void JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSocketImpl_sslConnectImpl
   (JNIEnv *env, jclass clazz, jlong jssl, jobject fd) {
     jlong socket = getFD(env, fd);
-    SSL *ssl = (SSL*)jssl;
+    SSL *ssl = jlong2addr(SSL, jssl);
     BIO *bio;
     int ret;
 
@@ -111,10 +111,9 @@ JNIEXPORT void JNICALL Java_org_apache_h
 
 JNIEXPORT void JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSocketImpl_writeAppDataImpl
   (JNIEnv *env, jclass clazz, jlong jssl, jbyteArray data, jint offset, jint len) {
-    SSL *ssl = (SSL*)jssl;
+    SSL *ssl = jlong2addr(SSL, jssl);
     int ret;
 
-    jint byteSize = (*env)->GetArrayLength(env, data);
     jbyte *buffer = (jbyte*) malloc(len * sizeof(jbyte*)); 
     (*env)->GetByteArrayRegion(env, data, offset, len, buffer);
 
@@ -131,7 +130,7 @@ JNIEXPORT void JNICALL Java_org_apache_h
 
 JNIEXPORT jbyte JNICALL Java_org_apache_harmony_xnet_provider_jsse_SSLSocketImpl_needAppDataImpl
   (JNIEnv *env, jclass clazz, jlong jssl) {
-    SSL *ssl = (SSL*)jssl;
+    SSL *ssl = jlong2addr(SSL, jssl);
     int ret;
     jbyte data;
 

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/unix/makefile?rev=986617&r1=986616&r2=986617&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/unix/makefile
(original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/native/jsse/unix/makefile
Wed Aug 18 10:10:55 2010
@@ -21,6 +21,8 @@ include $(HY_HDK)/build/make/defines.mk
 
 OPENSSL_DIST = ../../openssl/# path to OpenSSL
 
+INCLUDES += -I$(OPENSSL_DIST)include
+
 ifneq ($(HY_OS),zos)
 ifneq ($(HY_OS),aix)
 CFLAGS += -Wall
@@ -32,7 +34,7 @@ BUILDFILES = \
 	$(SHAREDSUB)sslSession.o $(SHAREDSUB)sslEngine.o $(SHAREDSUB)jsse_rand.o
 
 MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX) \
-	$(OPENSSL_DIST)out32/libeay32$(HY_LINKLIB_SUFFIX) $(OPENSSL_DIST)out32/ssleay32$(HY_LINKLIB_SUFFIX)
+	$(OPENSSL_DIST)libcrypto.a $(OPENSSL_DIST)libssl.a
 
 OSLIBS += -lm
 



Mime
View raw message