Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 342D78793 for ; Fri, 9 Sep 2011 11:58:42 +0000 (UTC) Received: (qmail 17841 invoked by uid 500); 9 Sep 2011 11:58:36 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 17457 invoked by uid 500); 9 Sep 2011 11:58:19 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 17413 invoked by uid 99); 9 Sep 2011 11:58:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 11:58:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 11:58:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6F3D6238897A for ; Fri, 9 Sep 2011 11:57:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1167121 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/ssl/ native/ native/modules/openssl/ test/org/apache/commons/runtime/ Date: Fri, 09 Sep 2011 11:57:51 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110909115752.6F3D6238897A@eris.apache.org> Author: mturk Date: Fri Sep 9 11:57:51 2011 New Revision: 1167121 URL: http://svn.apache.org/viewvc?rev=1167121&view=rev Log: Use SSL prefix for all ssl classes Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSL.java - copied, changed from r1166616, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Library.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java (with props) commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLEngine.java - copied, changed from r1167009, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Engine.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMethod.java - copied, changed from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMethod.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMode.java - copied, changed from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMode.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLRandom.java - copied, changed from r1167100, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Random.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLShutdownType.java - copied, changed from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ShutdownType.java commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c (with props) Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Engine.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Library.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMethod.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMode.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Random.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ShutdownType.java commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in commons/sandbox/runtime/trunk/src/main/native/modules/openssl/init.c commons/sandbox/runtime/trunk/src/main/native/modules/openssl/rand.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestOpenSSL.java Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSL.java (from r1166616, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Library.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSL.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSL.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Library.java&r1=1166616&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Library.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSL.java Fri Sep 9 11:57:51 2011 @@ -25,12 +25,12 @@ import java.io.File; /** * OpenSSL library */ -public final class Library +public final class SSL { private static boolean inited = false; private static Object lock; - private Library() + private SSL() { // No instance } Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java?rev=1167121&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java (added) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java Fri Sep 9 11:57:51 2011 @@ -0,0 +1,46 @@ +/* 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. + */ + +package org.apache.commons.runtime.ssl; + +import org.apache.commons.runtime.InvalidArgumentException; +import org.apache.commons.runtime.Status; +import org.apache.commons.runtime.SystemException; + +import java.io.File; +import java.nio.ByteBuffer; + +/** + * Contains the context structure for global default values for + * multiple SSL connections and certificate verification information. + */ +public final class SSLContext extends NativePointer +{ + + // Hide NativePointer + private final long pointer = 0L; + + private static native long new0(); + /** + * Creates a new object instance. + */ + public SSLContext() + { + super.pointer = new0(); + } + +} + Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLContext.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLEngine.java (from r1167009, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Engine.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLEngine.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLEngine.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Engine.java&r1=1167009&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Engine.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLEngine.java Fri Sep 9 11:57:51 2011 @@ -25,17 +25,17 @@ import java.io.File; /** * OpenSSL Engine */ -public final class Engine extends NativePointer +public final class SSLEngine extends NativePointer { - private static Object lock; - private static Engine global; + private static Object lock; + private static SSLEngine global; - private Engine() + private SSLEngine() { // No instance } - private Engine(long pointer) + private SSLEngine(long pointer) { super.pointer = pointer; } @@ -58,7 +58,7 @@ public final class Engine extends Native synchronized(lock) { if (global == null) { // Create global Engine instance. - global = new Engine(init0(name)); + global = new SSLEngine(init0(name)); } } } @@ -70,7 +70,7 @@ public final class Engine extends Native } } - public Engine(String name) + public SSLEngine(String name) throws SystemException { super.pointer = init0(name); Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMethod.java (from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMethod.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMethod.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMethod.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMethod.java&r1=1166589&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMethod.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMethod.java Fri Sep 9 11:57:51 2011 @@ -19,7 +19,7 @@ package org.apache.commons.runtime.ssl; /** * Represents the SSL protocol method. */ -public enum ProtocolMethod +public enum SSLProtocolMethod { /** * Unset mode. @@ -47,7 +47,7 @@ public enum ProtocolMethod DTLSv1( 5); private int value; - private ProtocolMethod(int v) + private SSLProtocolMethod(int v) { value = v; } @@ -57,9 +57,9 @@ public enum ProtocolMethod return value; } - public static ProtocolMethod valueOf(int value) + public static SSLProtocolMethod valueOf(int value) { - for (ProtocolMethod e : values()) { + for (SSLProtocolMethod e : values()) { if (e.value == value) return e; } Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMode.java (from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMode.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMode.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMode.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMode.java&r1=1166589&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ProtocolMode.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLProtocolMode.java Fri Sep 9 11:57:51 2011 @@ -19,7 +19,7 @@ package org.apache.commons.runtime.ssl; /** * Represents the SSL protocol mode. */ -public enum ProtocolMode +public enum SSLProtocolMode { /** @@ -36,7 +36,7 @@ public enum ProtocolMode COMBINED( 2); private int value; - private ProtocolMode(int v) + private SSLProtocolMode(int v) { value = v; } @@ -46,9 +46,9 @@ public enum ProtocolMode return value; } - public static ProtocolMode valueOf(int value) + public static SSLProtocolMode valueOf(int value) { - for (ProtocolMode e : values()) { + for (SSLProtocolMode e : values()) { if (e.value == value) return e; } Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLRandom.java (from r1167100, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Random.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLRandom.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLRandom.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Random.java&r1=1167100&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/Random.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLRandom.java Fri Sep 9 11:57:51 2011 @@ -26,7 +26,7 @@ import java.nio.ByteBuffer; /** * Random number gererator */ -public final class Random +public final class SSLRandom { private byte buf[]; @@ -36,7 +36,7 @@ public final class Random /** * Creates a new random number generator. */ - public Random() + public SSLRandom() { buf = new byte[1024]; pos = 0; @@ -163,7 +163,7 @@ public final class Random } } - public boolean setEngine(Engine e) + public boolean setEngine(SSLEngine e) { // TODO: Throw error if fails return seteng0(((NativePointer)e).pointer); Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLShutdownType.java (from r1166589, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ShutdownType.java) URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLShutdownType.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLShutdownType.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ShutdownType.java&r1=1166589&r2=1167121&rev=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/ShutdownType.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ssl/SSLShutdownType.java Fri Sep 9 11:57:51 2011 @@ -19,7 +19,7 @@ package org.apache.commons.runtime.ssl; /** * Represents the SSL endpoint's shutdown type. */ -public enum ShutdownType +public enum SSLShutdownType { /** * Unset shutdown type. @@ -39,7 +39,7 @@ public enum ShutdownType ACCURATE( 3); private int value; - private ShutdownType(int v) + private SSLShutdownType(int v) { value = v; } @@ -49,9 +49,9 @@ public enum ShutdownType return value; } - public static ShutdownType valueOf(int value) + public static SSLShutdownType valueOf(int value) { - for (ShutdownType e : values()) { + for (SSLShutdownType e : values()) { if (e.value == value) return e; } Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in?rev=1167121&r1=1167120&r2=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in Fri Sep 9 11:57:51 2011 @@ -153,6 +153,7 @@ SSLSOURCES=\ $(TOPDIR)/modules/openssl/init.c \ $(TOPDIR)/modules/openssl/password.c \ $(TOPDIR)/modules/openssl/rand.c \ + $(TOPDIR)/modules/openssl/sslctx.c \ $(TOPDIR)/modules/openssl/util.c CXXSOURCES= Modified: commons/sandbox/runtime/trunk/src/main/native/modules/openssl/init.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/modules/openssl/init.c?rev=1167121&r1=1167120&r2=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/modules/openssl/init.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/modules/openssl/init.c Fri Sep 9 11:57:51 2011 @@ -177,7 +177,7 @@ static void ssl_dynlock_destroy(struct C static int ssl_initialized = 0; -ACR_SSL_EXPORT(jint, Library, init0)(JNI_STDARGS) +ACR_SSL_EXPORT(jint, SSL, init0)(JNI_STDARGS) { int i, rc = 0; @@ -230,7 +230,7 @@ ACR_SSL_EXPORT(jint, Library, init0)(JNI return 0; } -ACR_SSL_EXPORT(jboolean, Library, hasFipsMode)(JNI_STDARGS) +ACR_SSL_EXPORT(jboolean, SSL, hasFipsMode)(JNI_STDARGS) { #if defined(OPENSSL_FIPS) return JNI_TRUE; @@ -239,7 +239,7 @@ ACR_SSL_EXPORT(jboolean, Library, hasFip #endif } -ACR_SSL_EXPORT(void, Library, fipsmode0)(JNI_STDARGS, jboolean on) +ACR_SSL_EXPORT(void, SSL, fipsmode0)(JNI_STDARGS, jboolean on) { #if defined(OPENSSL_FIPS) if(FIPS_mode_set(on ? 1 : 0) == 0) { @@ -254,7 +254,7 @@ ACR_SSL_EXPORT(void, Library, fipsmode0) #endif } -ACR_SSL_EXPORT(jlong, Engine, init0)(JNI_STDARGS, jstring name) +ACR_SSL_EXPORT(jlong, SSLEngine, init0)(JNI_STDARGS, jstring name) { jlong ep = 0; int rc = 0; @@ -286,7 +286,7 @@ ACR_SSL_EXPORT(jlong, Engine, init0)(JNI return ep; } -ACR_SSL_EXPORT(void, Engine, free0)(JNI_STDARGS, jlong ep) +ACR_SSL_EXPORT(void, SSLEngine, free0)(JNI_STDARGS, jlong ep) { #ifndef OPENSSL_NO_ENGINE ENGINE *ee = J2P(ep, ENGINE *); Modified: commons/sandbox/runtime/trunk/src/main/native/modules/openssl/rand.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/modules/openssl/rand.c?rev=1167121&r1=1167120&r2=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/modules/openssl/rand.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/modules/openssl/rand.c Fri Sep 9 11:57:51 2011 @@ -103,7 +103,7 @@ int ssl_rand_seed(const char *file) return RAND_status(); } -ACR_SSL_EXPORT(jboolean, Random, seed0)(JNI_STDARGS, jstring file) +ACR_SSL_EXPORT(jboolean, SSLRandom, seed0)(JNI_STDARGS, jstring file) { int rc = 0; /* Initialize PRNG @@ -116,13 +116,13 @@ ACR_SSL_EXPORT(jboolean, Random, seed0)( return rc == 0 ? JNI_FALSE : JNI_TRUE; } -ACR_SSL_EXPORT(jboolean, Random, seed1)(JNI_STDARGS) +ACR_SSL_EXPORT(jboolean, SSLRandom, seed1)(JNI_STDARGS) { return ssl_rand_seed(0) == 0 ? JNI_FALSE : JNI_TRUE; } -ACR_SSL_EXPORT(jboolean, Random, seed2)(JNI_STDARGS, jbyteArray ba, - jint off, jint len) +ACR_SSL_EXPORT(jboolean, SSLRandom, seed2)(JNI_STDARGS, jbyteArray ba, + jint off, jint len) { jboolean rv = JNI_FALSE; jbyte *sb = (*env)->GetPrimitiveArrayCritical(env, ba, 0); @@ -136,7 +136,7 @@ ACR_SSL_EXPORT(jboolean, Random, seed2)( return rv; } -ACR_SSL_EXPORT(jstring, Random, getdef0)(JNI_STDARGS) +ACR_SSL_EXPORT(jstring, SSLRandom, getdef0)(JNI_STDARGS) { char buffer[PATH_MAX]; if (ssl_global_rand_file[0] != '\0') @@ -147,15 +147,15 @@ ACR_SSL_EXPORT(jstring, Random, getdef0) return 0; } -ACR_SSL_EXPORT(void, Random, setdef0)(JNI_STDARGS, jstring path) +ACR_SSL_EXPORT(void, SSLRandom, setdef0)(JNI_STDARGS, jstring path) { WITH_CSTR(path) { strlcpy(ssl_global_rand_file, J2S(path), PATH_MAX); } DONE_WITH_STR(path); } -ACR_SSL_EXPORT(jint, Random, bytes0)(JNI_STDARGS, jbyteArray ba, - jint off, jint len) +ACR_SSL_EXPORT(jint, SSLRandom, bytes0)(JNI_STDARGS, jbyteArray ba, + jint off, jint len) { jboolean rv = JNI_FALSE; unsigned char *sb = (*env)->GetPrimitiveArrayCritical(env, ba, 0); @@ -168,8 +168,8 @@ ACR_SSL_EXPORT(jint, Random, bytes0)(JNI return rv; } -ACR_SSL_EXPORT(jint, Random, bytes1)(JNI_STDARGS, jobject bb, - jint off, jint len) +ACR_SSL_EXPORT(jint, SSLRandom, bytes1)(JNI_STDARGS, jobject bb, + jint off, jint len) { unsigned char *sb = (*env)->GetDirectBufferAddress(env, bb); @@ -179,7 +179,7 @@ ACR_SSL_EXPORT(jint, Random, bytes1)(JNI return JNI_FALSE; } -ACR_SSL_EXPORT(jboolean, Random, seteng0)(JNI_STDARGS, jlong ep) +ACR_SSL_EXPORT(jboolean, SSLRandom, seteng0)(JNI_STDARGS, jlong ep) { jboolean rv = JNI_FALSE; #ifndef OPENSSL_NO_ENGINE Added: commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c?rev=1167121&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c Fri Sep 9 11:57:51 2011 @@ -0,0 +1,39 @@ +/* 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. + */ + +#include "acr/clazz.h" +#include "acr/error.h" +#include "acr/misc.h" +#include "acr/string.h" +#include "acr/port.h" +#include "acr/ssl.h" +#include "arch_sync.h" + +#if !HAVE_OPENSSL +#error "Cannot compile this file without HAVE_OPENSSL defined" +#endif + + +ACR_SSL_EXPORT(jlong, SSLContext, new0)(JNI_STDARGS) +{ + acr_ssl_ctxt_t *ctx; + + ctx = ACR_TALLOC(acr_ssl_ctxt_t); + if (ctx == 0) + return 0; + return P2J(ctx); +} + Propchange: commons/sandbox/runtime/trunk/src/main/native/modules/openssl/sslctx.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestOpenSSL.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestOpenSSL.java?rev=1167121&r1=1167120&r2=1167121&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestOpenSSL.java (original) +++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestOpenSSL.java Fri Sep 9 11:57:51 2011 @@ -53,15 +53,15 @@ public class TestOpenSSL extends Assert if (Native.HAS_OPENSSL) { assertTrue(Native.ldopenssl()); } - Library.initialize(); - assertTrue(Library.initialized()); + SSL.initialize(); + assertTrue(SSL.initialized()); } @Test(groups = { "openssl" }) public void sslInit() { - assertTrue(Library.initialized()); - assertTrue(Random.seed()); + assertTrue(SSL.initialized()); + assertTrue(SSLRandom.seed()); } @Test(groups = { "openssl" }) @@ -81,7 +81,7 @@ public class TestOpenSSL extends Assert throws Exception { byte[] b = new byte[1024]; - Random r = new Random(); + SSLRandom r = new SSLRandom(); r.nextBytes(b); r.nextByte(); r.nextBytes(b); @@ -93,7 +93,7 @@ public class TestOpenSSL extends Assert public void randomBuffer() throws Exception { - Random r = new Random(); + SSLRandom r = new SSLRandom(); r.nextByte(); ByteBuffer db = ByteBuffer.allocateDirect(1964); r.nextBytes(db);