mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
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:
parent
71cc6f510a
commit
33abd28183
7 changed files with 85 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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, \
|
||||
|
|
63
jdk/make/lib/SecurityLibraries.gmk
Normal file
63
jdk/make/lib/SecurityLibraries.gmk
Normal 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
|
|
@ -106,7 +106,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
|||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
System.loadLibrary("osxsecurity");
|
||||
return null;
|
||||
}
|
||||
});
|
|
@ -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<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 {
|
||||
if (isLoading) {
|
||||
// because this method is synchronized, this can only
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue