8086002: Move apple.security.AppleProvider to a proper module

Move Apple provider to java.base module with "libosxsecurity" native library.

Reviewed-by: mchung
This commit is contained in:
Valerie Peng 2015-08-18 21:16:27 +00:00
parent 71cc6f510a
commit 33abd28183
7 changed files with 85 additions and 2 deletions

View file

@ -32,3 +32,4 @@ $(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.base/*/native \
include CoreLibraries.gmk include CoreLibraries.gmk
include NetworkingLibraries.gmk include NetworkingLibraries.gmk
include NioLibraries.gmk include NioLibraries.gmk
include SecurityLibraries.gmk

View file

@ -80,7 +80,6 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework ApplicationServices \ -framework ApplicationServices \
-framework JavaNativeFoundation \ -framework JavaNativeFoundation \
-framework JavaRuntimeSupport \ -framework JavaRuntimeSupport \
-framework Security \
-framework SystemConfiguration \ -framework SystemConfiguration \
$(LDFLAGS_JDKLIB_SUFFIX), \ $(LDFLAGS_JDKLIB_SUFFIX), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \

View file

@ -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

View file

@ -106,7 +106,7 @@ public final class KeychainStore extends KeyStoreSpi {
AccessController.doPrivileged( AccessController.doPrivileged(
new PrivilegedAction<Void>() { new PrivilegedAction<Void>() {
public Void run() { public Void run() {
System.loadLibrary("osx"); System.loadLibrary("osxsecurity");
return null; return null;
} }
}); });

View file

@ -178,6 +178,26 @@ final class ProviderConfig {
p = new com.sun.crypto.provider.SunJCE(); p = new com.sun.crypto.provider.SunJCE();
} else if (provName.equals("SunJSSE") || provName.equals("com.sun.net.ssl.internal.ssl.Provider")) { } else if (provName.equals("SunJSSE") || provName.equals("com.sun.net.ssl.internal.ssl.Provider")) {
p = new 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<Provider>() {
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 { } else {
if (isLoading) { if (isLoading) {
// because this method is synchronized, this can only // because this method is synchronized, this can only