1 #
   2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 default: all
  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 include JavaCompilation.gmk
  31 include Setup.gmk
  32 
  33 # The jars created in this file are required for the exploded jdk image to function and
  34 # cannot wait to be built in the images target.
  35 
  36 ##########################################################################################
  37 # Create manifest for security jars
  38 #
  39 # Include these extra attributes for now, should probably take out.
  40 #
  41 MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
  42 JCE_MANIFEST := $(JDK_OUTPUTDIR)/lib/_the.security.manifest.mf
  43 $(JCE_MANIFEST): $(MAINMANIFEST)
  44         $(MKDIR) -p $(@D)
  45         $(RM) $@ $@.tmp
  46         $(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#"       \
  47                -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
  48                $(MAINMANIFEST) >> $@.tmp
  49         $(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
  50         $(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
  51         $(MV) $@.tmp $@
  52 
  53 ##########################################################################################
  54 # For all security jars, always build the jar, but for closed, install the prebuilt signed
  55 # version instead of the newly built jar. Unsigned jars are treated as intermediate targets
  56 # and explicitly added to the JARS list. For open, signing is not needed. See SignJars.gmk
  57 # for more information.
  58 
  59 SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
  60 SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunpkcs11.jar
  61 
  62 $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,,\
  63         SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
  64         SUFFIXES:=.class,\
  65         INCLUDES:=sun/security/pkcs11,\
  66         JAR:=$(SUNPKCS11_JAR_UNSIGNED), \
  67         MANIFEST:=$(JCE_MANIFEST), \
  68         SKIP_METAINF := true))
  69 
  70 $(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
  71 
  72 ifndef OPENJDK
  73     SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
  74     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
  75         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
  76         $(install-file)
  77 else
  78     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_UNSIGNED)
  79         $(install-file)
  80 endif
  81 
  82 JARS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
  83 
  84 ##########################################################################################
  85 
  86 SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
  87 SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunec.jar
  88 
  89 $(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
  90                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
  91                 SUFFIXES:=.class,\
  92                 INCLUDES:=sun/security/ec,\
  93                 JAR:=$(SUNEC_JAR_UNSIGNED), \
  94                 MANIFEST:=$(JCE_MANIFEST), \
  95                 SKIP_METAINF := true))
  96 
  97 $(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
  98 
  99 ifndef OPENJDK
 100     SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
 101     $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 102         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
 103         $(install-file)
 104 else
 105     $(SUNEC_JAR_DST) : $(SUNEC_JAR_UNSIGNED)
 106         $(install-file)
 107 endif
 108 
 109 JARS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
 110 
 111 ##########################################################################################
 112 
 113 SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
 114 SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunjce_provider.jar
 115 
 116 $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
 117                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 118                 SUFFIXES:=.class,\
 119                 INCLUDES:= com/sun/crypto/provider,\
 120                 JAR:=$(SUNJCE_PROVIDER_JAR_UNSIGNED), \
 121                 MANIFEST:=$(JCE_MANIFEST), \
 122                 SKIP_METAINF := true))
 123 
 124 $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
 125 
 126 ifndef OPENJDK
 127     SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
 128     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
 129         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
 130         $(install-file)
 131 else
 132     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_UNSIGNED)
 133         $(install-file)
 134 endif
 135 
 136 JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED) $(SUNJCE_PROVIDER_JAR_DST)
 137 
 138 ##########################################################################################
 139 
 140 JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
 141 JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/jce.jar
 142 
 143 $(eval $(call SetupArchive,BUILD_JCE_JAR,,\
 144                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 145                 SUFFIXES:=.class,\
 146                 INCLUDES:= javax/crypto sun/security/internal,\
 147                 JAR:=$(JCE_JAR_UNSIGNED), \
 148                 MANIFEST:=$(JCE_MANIFEST), \
 149                 SKIP_METAINF := true))
 150 
 151 $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
 152 
 153 ifndef OPENJDK
 154     JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
 155     $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 156         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
 157         $(install-file)
 158 else
 159     $(JCE_JAR_DST) : $(JCE_JAR_UNSIGNED)
 160         $(install-file)
 161 endif
 162 
 163 JARS +=  $(JCE_JAR_UNSIGNED) $(JCE_JAR_DST)
 164 
 165 ##########################################################################################
 166 
 167 US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
 168 US_EXPORT_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/US_export_policy.jar
 169 
 170 #
 171 # TODO fix so that SetupArchive does not write files into SRCS
 172 #   then we don't need this extra copying
 173 #
 174 # NOTE:  We currently do not place restrictions on our limited export
 175 # policy.  This was not a typo.
 176 #
 177 US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
 178 US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp
 179 
 180 $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
 181         $(install-file)
 182 
 183 US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
 184 
 185 $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
 186                 SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
 187                 SUFFIXES:= .policy,\
 188                 JAR:=$(US_EXPORT_POLICY_JAR_UNSIGNED), \
 189                 EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
 190                 SKIP_METAINF := true))
 191 
 192 ifndef OPENJDK
 193     $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
 194         $(ECHO) $(LOG_INFO) Copying $(@F)
 195         $(install-file)
 196 else
 197     $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
 198         $(install-file)
 199 endif
 200 
 201 JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED) $(US_EXPORT_POLICY_JAR_DST)
 202 
 203 ##########################################################################################
 204 
 205 LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
 206 LOCAL_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/local_policy.jar
 207 
 208 #
 209 # TODO fix so that SetupArchive does not write files into SRCS
 210 #   then we don't need this extra copying
 211 #
 212 LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp
 213 
 214 ifeq ($(UNLIMITED_CRYPTO), true)
 215     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
 216     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
 217     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
 218 else
 219     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
 220     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
 221                              $(LOCAL_POLICY_JAR_TMP)/default_local.policy
 222     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
 223 endif
 224 
 225 $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
 226         $(install-file)
 227 
 228 $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
 229                 SRCS:=$(LOCAL_POLICY_JAR_TMP),\
 230                 SUFFIXES:= .policy,\
 231                 JAR:=$(LOCAL_POLICY_JAR_UNSIGNED), \
 232                 EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
 233                 SKIP_METAINF := true))
 234 
 235 ifndef OPENJDK
 236     $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
 237         $(ECHO) $(LOG_INFO) Copying $(@F)
 238         $(install-file)
 239 else
 240     $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
 241         $(install-file)
 242 endif
 243 
 244 JARS += $(LOCAL_POLICY_JAR_UNSIGNED) $(LOCAL_POLICY_JAR_DST)
 245 
 246 ##########################################################################################
 247 
 248 ifeq ($(OPENJDK_TARGET_OS),windows)
 249 
 250 SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
 251 SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunmscapi.jar
 252 
 253 $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR,,\
 254                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 255                 SUFFIXES:=.class,\
 256                 INCLUDES:= sun/security/mscapi,\
 257                 JAR:=$(SUNMSCAPI_JAR_UNSIGNED), \
 258                 MANIFEST:=$(JCE_MANIFEST), \
 259                 SKIP_METAINF:=true))
 260 
 261 $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
 262 
 263 ifndef OPENJDK
 264     SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
 265     $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
 266         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
 267         $(install-file)
 268 else
 269     $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_UNSIGNED)
 270         $(install-file)
 271 endif
 272 
 273 JARS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
 274 
 275 endif
 276 
 277 ##########################################################################################
 278 
 279 ifeq ($(OPENJDK_TARGET_OS),solaris)
 280 ifndef OPENJDK
 281 
 282 UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
 283 UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/ucrypto.jar
 284 UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
 285 
 286 $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR,,\
 287                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 288                 SUFFIXES:=.class,\
 289                 INCLUDES:=com/oracle/security/ucrypto,\
 290                 JAR:=$(UCRYPTO_JAR_UNSIGNED), \
 291                 MANIFEST:=$(JCE_MANIFEST), \
 292                 SKIP_METAINF:=true))
 293 
 294 $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
 295 
 296 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 297         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
 298         $(install-file)
 299 
 300 JARS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
 301 
 302 endif
 303 endif
 304 
 305 all: $(JARS)