$!-----------------------------------------------------------------'f$verify(0) $! SSL_DETECT.COM $! $! Copyright (C) 1996-2021 Mark G.Daniel. $! $! Licensed under the Apache License, Version 2.0 (the "License"); $! you may not use this file except in compliance with the License. $! You may obtain a copy of the License at $! $! http://www.apache.org/licenses/LICENSE-2.0 $! $! Unless required by applicable law or agreed to in writing, software $! distributed under the License is distributed on an "AS IS" BASIS, $! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. $! See the License for the specific language governing permissions and $! limitations under the License. $! $! Checks for and determines which OpenSSL toolkit will be built against. $! $! none (non-SSL build) $! VMS port OpenSSL toolkit $! VMS SSL toolkit product (HP) $! VMS SSL1 toolkit product (HP) $! WASD OpenSSL package $! $! If an SSL toolkit and build is selected then one of these global symbols $! is used to convey this to other procedures including [SRC]BUILD_ALL.COM $! $! DEMO_SSL ................ used by DEMO.COM to initiate an SSL demo $! BUILD_HTTPD_SSL ......... build using an SSL toolkit $! BUILD_HTTPD_OPEN_SSL .... build using the OpenSSL toolkit $! BUILD_HTTPD_OSSL ........ build using the (v1.1.0) OpenSSL toolkit $! BUILD_HTTPD_VMS_SSL ..... NO LONGER SUPPORTED - build using the VMS SSL $! BUILD_HTTPD_VMS_SSL1 .... build using the VMS SSL1 product $! BUILD_HTTPD_WASD_SSL .... build using the WASD SSL package $! BUILD_HTTPD_SSL_ROOT .... provides SSL_FINISH.COM with the WASD SSL root $! $! 19-JAN-2020 MGD VSI SSL111 $! 18-SEP-2018 MGD detect OpenSSL v1.1 in WASD package $! 03-AUG-2017 MGD bugfix; BUILD_HTTPD_SSL $! 13-AUG-2016 MGD OpenSSL 1.1.0 (new VMS build environment) $! HP SSL (OpenSSL v0.9.8n based) no longer supported $! remove (specific) support for Polarhome OpenSSL kit $! 24-APR-2016 MGD HPE SSL1 $! 06-DEC-2014 MGD remove support for JFP's OpenSSL package $! 28-APR-2012 MGD Polarhome OpenSSL (http://www.polarhome.com/openssl/) $! 07-NOV-2009 MGD WASD v10 logical naming schema $! 22-SEP-2006 MGD upper-case result from f$search() for SSL directory $! 19-JUN-2005 MGD Jean-François Piéronne's OpenSSL package $! 07-DEC-2002 MGD initial (completely reworked for v8.1) $!----------------------------------------------------------------------------- $! $ if f$trnlnm("INSTALL$DBUG") .nes. "" then set verify $! $ ss$_abort = 44 $ ss$_bugcheck = 676 $ say = "write sys$command" $ on controly then exit ss$_abort $ if f$environment("depth") .le. 1 then say "" $! $ dgs = "delete/symbol/global" $ if f$type(DEMO_SSL) .nes. "" then dgs DEMO_SSL $ if f$type(BUILD_HTTPD_OPEN_SSL) .nes. "" then dgs BUILD_HTTPD_OPEN_SSL $ if f$type(BUILD_HTTPD_OPEN_SSL1) .nes. "" then dgs BUILD_HTTPD_OPEN_SSL1 $ if f$type(BUILD_HTTPD_SSL) .nes. "" then dgs BUILD_HTTPD_SSL $ if f$type(BUILD_HTTPD_SSL_ROOT) .nes. "" then dgs BUILD_HTTPD_SSL_ROOT $ if f$type(BUILD_HTTPD_VMS_SSL1) .nes. "" then dgs BUILD_HTTPD_VMS_SSL1 $ if f$type(BUILD_HTTPD_VMS_SSL111) .nes. "" then dgs BUILD_HTTPD_VMS_SSL111 $ if f$type(BUILD_HTTPD_WASD_SSL) .nes. "" then dgs BUILD_HTTPD_WASD_SSL $! $ OSSLroot = f$trnlnm("OSSL$INSTROOT") $ OSSLdir = "" $ if f$search("OSSL$INSTROOT:[000000]LIB.DIR") .nes. "" $ then $! (OpenSSL v1.1.0 kit) $ OSSLdir = f$trnlnm("OSSL$INSTROOT") $ endif $! $ openSSLdir = f$trnlnm("SSLROOT") $ if f$locate("OPENSSL",openSSLdir) .lt. f$length(openSSLdir) $ then $ if f$search("SSLROOT:[000000]OPENSSL.CNF") .nes. "" $ then $ endif $ endif $! $ openSSLdir = f$trnlnm("SSLROOT") $ if f$locate("OPENSSL",openSSLdir) .lt. f$length(openSSLdir) $ then $ if f$search("SSLROOT:[000000]OPENSSL.CNF") .nes. "" $ then $ endif $ endif $! $!(SSL toolkit for OpenVMS - from the logical or look for it's directory) $!(NO LONGER SUPPORTED but we need to account for it) $ vmsSSLroot = f$trnlnm("SSL$ROOT") $ if vmsSSLroot $ then vmsSSLdir = f$search("SSL$ROOT:[000000]*.DIR"); $ else vmsSSLdir = f$search("SYS$COMMON:[000000]SSL.DIR") $ endif $! $!(SSL1 toolkit for OpenVMS - from the logical or look for it's directory) $ vmsSSL1root = f$trnlnm("SSL1$ROOT") $ if vmsSSL1root $ then vmsSSL1dir = f$search("SSL1$ROOT:[000000]*.DIR") $ else vmsSSL1dir = f$search("SYS$COMMON:[000000]SSL1.DIR") $ endif $! $!(SSL111 toolkit for OpenVMS - from the logical or look for it's directory) $ vmsSSL111root = f$trnlnm("SSL111$ROOT") $ if vmsSSL111root $ then vmsSSL111dir = f$search("SSL111$ROOT:[000000]*.DIR") $ else vmsSSL111dir = f$search("SYS$COMMON:[000000]SSL111.DIR") $ endif $! $!(WASD's OpenSSL package) $ wasdSSLdir = "" $!(search for latest version in default WASD location) $ wasdSSLdirLoop: $ tmpDir = f$edit(f$search("WASD_ROOT:[SRC]OPENSSL-*_*_*.DIR"),"UPCASE") $ if tmpDir .eqs. "" then goto end_wasdSSLdirLoop $ sslDirPos = f$locate("]OPENSSL",tmpDir) $ wasdSSLdir = f$extract(0,sslDirPos,tmpDir) + "." + - f$extract(sslDirPos+1,999,tmpDir) - ".DIR;1" + "]" $ tmpVersion = f$extract(8,999,f$parse(tmpDir,,,"name")) $ wasdVersion = "v" + f$extract(0,f$locate("_",tmpVersion),tmpVersion) + "." $ tmpVersion = f$extract(f$locate("_",tmpVersion)+1,999,tmpVersion) $ wasdVersion = wasdVersion + - f$extract(0,f$locate(tmpVersion,"_"),tmpVersion) + "." $ tmpVersion = f$extract(f$locate("_",tmpVersion)+1,999,tmpVersion) $ wasdVersion = wasdVersion + tmpVersion $ goto wasdSSLdirLoop $ end_wasdSSLdirLoop: $! $ if OSSLdir .eqs. "" .and. openSSLdir .eqs. "" .and. - vmsSSLdir .eqs. "" .and. wasdSSLdir .eqs. "" .and. - vmsSSL111dir .eqs. "" $ then $ type sys$input ************************************** * NO SSL TOOLKIT COULD BE LOCATED! * ************************************** None of the following SSL toolkits could be located. o OpenSSL (prior to v1.1.0) toolkit o OpenSSL (v1.1.0 or later) toolkit o VMS SSL1 product (HP) o VMS SSL111 product (VSI) o WASD OpenSSL package $ if p1 .eqs. "SSL" $ then $ type sys$input As an "SSL" build was specifically requested this cannot continue. $ exit ss$_abort $ else $ type sys$input A non-SSL version of the server will be built. $ read sys$command response /prompt="Press RETURN to continue: " $ say "" $ exit $ endif $ endif $! $ if p1 .eqs. "SSL" $ then $! (an SSL build as specifically requested, if there's only one toolkit) $! $ if vmsSSLdir .eqs. "" .and. openSSLdir .nes. "" .and. - vmsSSL1dir .eqs. "" .and. wasdSSLdir .eqs. "" $ then $! (only the OpenSSL toolkit was found) $ say "The OpenSSL toolkit will be used." $ say "" $ BUILD_HTTPD_OPEN_SSL == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if vmsSSLdir .nes. "" .and. openSSLdir .eqs. "" .and. - vmsSSL1dir .eqs. "" .and. wasdSSLdir .eqs. "" .and. - vmsSSL111dir .eqs. "" $ then $! (only the VMS SSL product was found) $ say "The VMS SSL product is no longer supported." $ say "" $ exit $ endif $! $ if vmsSSLdir .eqs. "" .and. openSSLdir .eqs. "" .and. - vmsSSL1dir .nes. "" .and. wasdSSLdir .eqs. "" .and. - vmsSSL111dir .eqs. "" $ then $! (only the VMS SSL1 product was found) $ say "The VMS SSL1 product will be used." $ say "" $ BUILD_HTTPD_VMS_SSL1 == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if vmsSSLdir .eqs. "" .and. openSSLdir .eqs. "" .and. - vmsSSL1dir .eqs. "" .and. wasdSSLdir .nes. "" .and. - vmsSSL111dir .eqs. "" $ then $! (only the WASD OpenSSL package was found) $ say "The WASD OpenSSL ''wasdVersion' package will be used." $ say "" $ BUILD_HTTPD_WASD_SSL == 1 $ DEMO_SSL == 1 $! (this symbol will be used by SSL_FINISH.COM to build the OpenSSL apps) $ BUILD_HTTPD_SSL_ROOT == wasdSSLdir $ exit $ endif $! $ if vmsSSLdir .eqs. "" .and. openSSLdir .eqs. "" .and. - vmsSSL1dir .eqs. "" .and. wasdSSLdir .eqs. "" .and. - vmsSSL111dir .nes. "" $ then $! (only the VMS SSL111 product was found) $ say "The VMS SSL111 product will be used." $ say "" $ BUILD_HTTPD_VMS_SSL111 == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ type sys$input ************************************ * MULTIPLE SSL TOOLKITS DETECTED * ************************************ Multiple supported Secure Sockets Layer (SSL) toolkits have been detected. $! $ else $! $ type sys$input ************************** * SSL TOOLKIT DETECTED * ************************** A supported Secure Sockets Layer (SSL) toolkit has been detected. $! $ endif $! $ type sys$input Those with item numbers are available for building, 'x's are not available. 0. do not build an SSL version $ count = 0 $ defaultResponse = 1 $! $ if openSSLdir .nes. "" $ then $ count = count + 1 $ toolkit'count' = openSSLdir $ say " ''count'. OpenSSL (prior to v1.1.0) toolkit" $ else $ say " x. OpenSSL (prior to v1.1.0) toolkit" $ endif $! $ if OSSLdir .nes. "" $ then $ count = count + 1 $ toolkit'count' = OSSLdir $ say " ''count'. OpenSSL (v1.1.0 or later) toolkit OBJECT link" $ count = count + 1 $ toolkit'count' = OSSLdir + "SHR" $ say " ''count'. OpenSSL (v1.1.0 or later) toolkit SHAREABLE IMAGE link" $ else $ say " x. OpenSSL (v1.1.0 or later) toolkit" $ endif $! $ if vmsSSL1dir .nes. "" $ then $ count = count + 1 $ toolkit'count' = vmsSSL1dir $ defaultResponse = count $ say " ''count'. OpenVMS SSL1 product (HP)" $ else $ say " x. OpenVMS SSL1 product (HP)" $ endif $! $ if vmsSSL111dir .nes. "" $ then $ count = count + 1 $ toolkit'count' = vmsSSL111dir $ defaultResponse = count $ say " ''count'. OpenVMS SSL111 product (VSI)" $ else $ say " x. OpenVMS SSL111 product (VSI)" $ endif $! $ if wasdSSLdir .nes. "" $ then $ count = count + 1 $ toolkit'count' = wasdSSLdir $ say " ''count'. WASD OpenSSL ''wasdVersion' package" $ else $ say " x. WASD OpenSSL package" $ endif $! $ if vmsSSLdir .nes. "" - then say " x. OpenVMS SSL product (HP) no longer supported" $! $ toolkitLoop: $ response = "" $ say "" $ read sys$command response /prompt="Select item number [''defaultResponse']: " $ say "" $ if response .eqs. "" then response = defaultResponse $ number = f$integer(response) $ if number .lt. 0 .or. number .gt. count $ then $ say "RESPONSE ERROR! (enter a single digit 0 to ''count')" $ goto toolkitLoop $ endif $ toolkitLoopEnd: $! $ if number .eq. 0 $ then $ say "A non-SSL version of the server will be built." $ say "" $ exit $ endif $! $ if toolkit'number' .eqs. openSSLdir $ then $ say "The OpenSSL (prior to v1.1.0) toolkit has been selected." $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_OPEN_SSL == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if toolkit'number' .eqs. OSSLdir $ then $ say "The OpenSSL (v1.1.0 or later) OBJECT link has been selected." $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_OSSL == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if toolkit'number' .eqs. (OSSLdir + "SHR") $ then $ say "The OpenSSL (v1.1.0 or later) SHAREABLE IMAGE has been selected." $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_OSSLSHR == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if toolkit'number' .eqs. vmsSSL1dir $ then $ type sys$input The VMS SSL1 product has been selected. $ product show product ssl1 $ type sys$input NOTE: As WASD installs it's server image with required privileges the OpenVMS SSL shareable images also be installed (but without extended privileges). Using this product requires the v8.1 or later startup procedures. $ read sys$command response /prompt="Press RETURN to continue: " $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_VMS_SSL1 == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if toolkit'number' .eqs. vmsSSL111dir $ then $ type sys$input The VMS SSL111 product has been selected. $ product show product ssl111 $ read sys$command response /prompt="Press RETURN to continue: " $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_VMS_SSL111 == 1 $ DEMO_SSL == 1 $ exit $ endif $! $ if toolkit'number' .eqs. wasdSSLdir $ then $ say "The WASD OpenSSL ''wasdVersion' package has been selected." $ say "" $ BUILD_HTTPD_SSL == 1 $ BUILD_HTTPD_WASD_SSL == 1 $ DEMO_SSL == 1 $! (this symbol will be used by SSL_FINISH.COM to build the OpenSSL apps) $ BUILD_HTTPD_SSL_ROOT == wasdSSLdir $ exit $ endif $! $ exit ss$_bugcheck $!-----------------------------------------------------------------------------