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 security and crypto jars, always build the jar, but for closed, install the prebuilt
  55 # signed version instead of the newly built jar. Unsigned jars are treated as intermediate
  56 # targets and explicitly added to the JARS list. For open, signing is not needed. See
  57 # SignJars.gmk for more information.
  58 #
  59 # The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
  60 # variable is set to no if these jars can't be built to skip that step of the build.
  61 # Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
  62 # other way to get the jars than to build them.
  63 
  64 SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
  65 SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunpkcs11.jar
  66 
  67 $(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR,,\
  68         SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
  69         SUFFIXES:=.class,\
  70         INCLUDES:=sun/security/pkcs11,\
  71         JAR:=$(SUNPKCS11_JAR_UNSIGNED), \
  72         MANIFEST:=$(JCE_MANIFEST), \
  73         SKIP_METAINF := true))
  74 
  75 $(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
  76 
  77 ifndef OPENJDK
  78     SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
  79     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_SRC)
  80         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
  81         $(install-file)
  82 else
  83     $(SUNPKCS11_JAR_DST) : $(SUNPKCS11_JAR_UNSIGNED)
  84         $(install-file)
  85 endif
  86 
  87 JARS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
  88 
  89 ##########################################################################################
  90 
  91 SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
  92 SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunec.jar
  93 
  94 $(eval $(call SetupArchive,BUILD_SUNEC_JAR,,\
  95                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
  96                 SUFFIXES:=.class,\
  97                 INCLUDES:=sun/security/ec,\
  98                 JAR:=$(SUNEC_JAR_UNSIGNED), \
  99                 MANIFEST:=$(JCE_MANIFEST), \
 100                 SKIP_METAINF := true))
 101 
 102 $(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
 103 
 104 ifndef OPENJDK
 105     SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
 106     $(SUNEC_JAR_DST) : $(SUNEC_JAR_SRC)
 107         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
 108         $(install-file)
 109 else
 110     $(SUNEC_JAR_DST) : $(SUNEC_JAR_UNSIGNED)
 111         $(install-file)
 112 endif
 113 
 114 JARS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
 115 
 116 ##########################################################################################
 117 
 118 SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
 119 SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunjce_provider.jar
 120 
 121 ifneq ($(BUILD_CRYPTO),no)
 122   $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR,,\
 123                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 124                 SUFFIXES:=.class,\
 125                 INCLUDES:= com/sun/crypto/provider,\
 126                 JAR:=$(SUNJCE_PROVIDER_JAR_UNSIGNED), \
 127                 MANIFEST:=$(JCE_MANIFEST), \
 128                 SKIP_METAINF := true))
 129 
 130   $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
 131 
 132   JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
 133 endif
 134 
 135 ifndef OPENJDK
 136     SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
 137     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_SRC)
 138         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
 139         $(install-file)
 140 else
 141     $(SUNJCE_PROVIDER_JAR_DST) : $(SUNJCE_PROVIDER_JAR_UNSIGNED)
 142         $(install-file)
 143 endif
 144 
 145 JARS += $(SUNJCE_PROVIDER_JAR_DST)
 146 
 147 ##########################################################################################
 148 
 149 JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
 150 JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/jce.jar
 151 
 152 ifneq ($(BUILD_CRYPTO),no)
 153   $(eval $(call SetupArchive,BUILD_JCE_JAR,,\
 154                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 155                 SUFFIXES:=.class,\
 156                 INCLUDES:= javax/crypto sun/security/internal,\
 157                 JAR:=$(JCE_JAR_UNSIGNED), \
 158                 MANIFEST:=$(JCE_MANIFEST), \
 159                 SKIP_METAINF := true))
 160 
 161   $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
 162 
 163   JARS +=  $(JCE_JAR_UNSIGNED)
 164 endif
 165 
 166 ifndef OPENJDK
 167     JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
 168     $(JCE_JAR_DST) : $(JCE_JAR_SRC)
 169         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
 170         $(install-file)
 171 else
 172     $(JCE_JAR_DST) : $(JCE_JAR_UNSIGNED)
 173         $(install-file)
 174 endif
 175 
 176 JARS += $(JCE_JAR_DST)
 177 
 178 ##########################################################################################
 179 
 180 US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
 181 US_EXPORT_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/US_export_policy.jar
 182 
 183 ifneq ($(BUILD_CRYPTO),no)
 184   #
 185   # TODO fix so that SetupArchive does not write files into SRCS
 186   #   then we don't need this extra copying
 187   #
 188   # NOTE:  We currently do not place restrictions on our limited export
 189   # policy.  This was not a typo.
 190   #
 191   US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
 192   US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp
 193 
 194   $(US_EXPORT_POLICY_JAR_TMP)/% : $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
 195         $(install-file)
 196 
 197   US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
 198 
 199   $(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR,$(US_EXPORT_POLICY_JAR_DEPS),\
 200                 SRCS:=$(US_EXPORT_POLICY_JAR_TMP), \
 201                 SUFFIXES:= .policy,\
 202                 JAR:=$(US_EXPORT_POLICY_JAR_UNSIGNED), \
 203                 EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
 204                 SKIP_METAINF := true))
 205 
 206   JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
 207 endif
 208 
 209 ifndef OPENJDK
 210     $(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
 211         $(ECHO) $(LOG_INFO) Copying $(@F)
 212         $(install-file)
 213 else
 214     $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
 215         $(install-file)
 216 endif
 217 
 218 JARS += $(US_EXPORT_POLICY_JAR_DST)
 219 
 220 ##########################################################################################
 221 
 222 LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
 223 LOCAL_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/local_policy.jar
 224 
 225 ifneq ($(BUILD_CRYPTO),no)
 226   #
 227   # TODO fix so that SetupArchive does not write files into SRCS
 228   #   then we don't need this extra copying
 229   #
 230   LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp
 231 
 232   ifeq ($(UNLIMITED_CRYPTO), true)
 233     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
 234     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
 235     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
 236   else
 237     LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
 238     LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
 239                              $(LOCAL_POLICY_JAR_TMP)/default_local.policy
 240     LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
 241   endif
 242 
 243   $(LOCAL_POLICY_JAR_TMP)/% : $(LOCAL_POLICY_JAR_SRC_DIR)/%
 244         $(install-file)
 245 
 246   $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR,$(LOCAL_POLICY_JAR_DEPS),\
 247                 SRCS:=$(LOCAL_POLICY_JAR_TMP),\
 248                 SUFFIXES:= .policy,\
 249                 JAR:=$(LOCAL_POLICY_JAR_UNSIGNED), \
 250                 EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
 251                 SKIP_METAINF := true))
 252 
 253   JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
 254 endif
 255 
 256 ifndef OPENJDK
 257     $(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
 258         $(ECHO) $(LOG_INFO) Copying $(@F)
 259         $(install-file)
 260 else
 261     $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
 262         $(install-file)
 263 endif
 264 
 265 JARS += $(LOCAL_POLICY_JAR_DST)
 266 
 267 ##########################################################################################
 268 
 269 ifeq ($(OPENJDK_TARGET_OS),windows)
 270 
 271 SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
 272 SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunmscapi.jar
 273 
 274 $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR,,\
 275                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 276                 SUFFIXES:=.class,\
 277                 INCLUDES:= sun/security/mscapi,\
 278                 JAR:=$(SUNMSCAPI_JAR_UNSIGNED), \
 279                 MANIFEST:=$(JCE_MANIFEST), \
 280                 SKIP_METAINF:=true))
 281 
 282 $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
 283 
 284 ifndef OPENJDK
 285     SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
 286     $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_SRC)
 287         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
 288         $(install-file)
 289 else
 290     $(SUNMSCAPI_JAR_DST) : $(SUNMSCAPI_JAR_UNSIGNED)
 291         $(install-file)
 292 endif
 293 
 294 JARS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
 295 
 296 endif
 297 
 298 ##########################################################################################
 299 
 300 ifeq ($(OPENJDK_TARGET_OS),solaris)
 301 ifndef OPENJDK
 302 
 303 UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
 304 UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/ucrypto.jar
 305 UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
 306 
 307 $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR,,\
 308                 SRCS:=$(JDK_OUTPUTDIR)/classes_security, \
 309                 SUFFIXES:=.class,\
 310                 INCLUDES:=com/oracle/security/ucrypto,\
 311                 JAR:=$(UCRYPTO_JAR_UNSIGNED), \
 312                 MANIFEST:=$(JCE_MANIFEST), \
 313                 SKIP_METAINF:=true))
 314 
 315 $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
 316 
 317 $(UCRYPTO_JAR_DST) : $(UCRYPTO_JAR_SRC)
 318         @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
 319         $(install-file)
 320 
 321 JARS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
 322 
 323 endif
 324 endif
 325 
 326 all: $(JARS)