diff --git a/jdk/make/lib/Lib-java.base.gmk b/jdk/make/lib/Lib-java.base.gmk index ef5f64aea09..c5949d57138 100644 --- a/jdk/make/lib/Lib-java.base.gmk +++ b/jdk/make/lib/Lib-java.base.gmk @@ -32,3 +32,4 @@ $(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.base/*/native \ include CoreLibraries.gmk include NetworkingLibraries.gmk include NioLibraries.gmk +include SecurityLibraries.gmk diff --git a/jdk/make/lib/Lib-jdk.deploy.osx.gmk b/jdk/make/lib/Lib-jdk.deploy.osx.gmk index 51c56355b5b..7ed6f9eb0a8 100644 --- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk +++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk @@ -80,7 +80,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) -framework ApplicationServices \ -framework JavaNativeFoundation \ -framework JavaRuntimeSupport \ - -framework Security \ -framework SystemConfiguration \ $(LDFLAGS_JDKLIB_SUFFIX), \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \ diff --git a/jdk/make/lib/SecurityLibraries.gmk b/jdk/make/lib/SecurityLibraries.gmk new file mode 100644 index 00000000000..9778137ae1f --- /dev/null +++ b/jdk/make/lib/SecurityLibraries.gmk @@ -0,0 +1,63 @@ +# +# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code 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 +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +include LibCommon.gmk + +ifeq ($(OPENJDK_TARGET_OS), macosx) + + ################################################################################ + + LIBOSXSECURITY_DIRS := $(JDK_TOPDIR)/src/java.base/macosx/native/libosxsecurity + LIBOSXSECURITY_CFLAGS := -I$(LIBOSXSECURITY_DIRS) \ + $(LIBJAVA_HEADER_FLAGS) \ + -I$(SUPPORT_OUTPUTDIR)/headers/java.base \ + + $(eval $(call SetupNativeCompilation,BUILD_LIBOSXSECURITY, \ + LIBRARY := osxsecurity, \ + OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ + SRC := $(LIBOSXSECURITY_DIRS), \ + OPTIMIZATION := LOW, \ + CFLAGS := $(CFLAGS_JDKLIB) \ + $(LIBOSXSECURITY_CFLAGS), \ + DISABLED_WARNINGS_clang := deprecated-declarations, \ + LDFLAGS := $(LDFLAGS_JDKLIB) \ + -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \ + $(call SET_SHARED_LIBRARY_ORIGIN), \ + LDFLAGS_SUFFIX_macosx := \ + -fobjc-link-runtime \ + -framework JavaNativeFoundation \ + -framework CoreServices \ + -framework Security \ + $(LDFLAGS_JDKLIB_SUFFIX), \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxsecurity, \ + DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) + + $(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA) + + TARGETS += $(BUILD_LIBOSXSECURITY) + + ################################################################################ + +endif diff --git a/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/AppleProvider.java b/jdk/src/java.base/macosx/classes/apple/security/AppleProvider.java similarity index 100% rename from jdk/src/jdk.deploy.osx/macosx/classes/apple/security/AppleProvider.java rename to jdk/src/java.base/macosx/classes/apple/security/AppleProvider.java diff --git a/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java b/jdk/src/java.base/macosx/classes/apple/security/KeychainStore.java similarity index 99% rename from jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java rename to jdk/src/java.base/macosx/classes/apple/security/KeychainStore.java index 36f146b9ba7..42b312196cd 100644 --- a/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java +++ b/jdk/src/java.base/macosx/classes/apple/security/KeychainStore.java @@ -106,7 +106,7 @@ public final class KeychainStore extends KeyStoreSpi { AccessController.doPrivileged( new PrivilegedAction() { public Void run() { - System.loadLibrary("osx"); + System.loadLibrary("osxsecurity"); return null; } }); diff --git a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m b/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m similarity index 100% rename from jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m rename to jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m diff --git a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java index f0ed2fb19bb..ea542fe213c 100644 --- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java +++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java @@ -178,6 +178,26 @@ final class ProviderConfig { p = new com.sun.crypto.provider.SunJCE(); } else if (provName.equals("SunJSSE") || provName.equals("com.sun.net.ssl.internal.ssl.Provider")) { p = new com.sun.net.ssl.internal.ssl.Provider(); + } else if (provName.equals("Apple") || provName.equals("apple.security.AppleProvider")) { + // need to use reflection since this class only exists on MacOsx + p = AccessController.doPrivileged(new PrivilegedAction() { + public Provider run() { + try { + Class c = Class.forName("apple.security.AppleProvider"); + if (Provider.class.isAssignableFrom(c)) { + return (Provider) c.newInstance(); + } else { + return null; + } + } catch (Exception ex) { + if (debug != null) { + debug.println("Error loading provider Apple"); + ex.printStackTrace(); + } + return null; + } + } + }); } else { if (isLoading) { // because this method is synchronized, this can only