README revision 4368
363N/A#
363N/A# CDDL HEADER START
363N/A#
363N/A# The contents of this file are subject to the terms of the
363N/A# Common Development and Distribution License (the "License").
363N/A# You may not use this file except in compliance with the License.
363N/A#
363N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
363N/A# or http://www.opensolaris.org/os/licensing.
363N/A# See the License for the specific language governing permissions
363N/A# and limitations under the License.
363N/A#
363N/A# When distributing Covered Code, include this CDDL HEADER in each
363N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
363N/A# If applicable, add the following below this CDDL HEADER, with the
363N/A# fields enclosed by brackets "[]" replaced with your own identifying
363N/A# information: Portions Copyright [yyyy] [name of copyright owner]
363N/A#
363N/A# CDDL HEADER END
363N/A#
4368N/A# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
363N/A#
363N/A
1610N/A
363N/ABuild Layout
363N/A---
363N/A
2221N/AOpenSSL build is run four times. Once for regular dynamic 1.0.1 non-fips, once
2221N/Afor static 1.0.1 bits to link with standalone wanboot binary, once for 1.0.1
2221N/Afips-140, and once for 1.0.1 FIPS-140 canister (in the openssl-fips component)
2221N/Aneeded to build 1.0.1 FIPS-140 certified libraries. All builds apart from
777N/Astatic libraries for wanboot are done for 32 and 64 bits. So, in total, OpenSSL
3387N/Ais built seven times. OpenSSL for wanboot is only built on sparc.
363N/A
797N/ASee also comments in all the Makefiles for more information.
363N/A
1610N/AOpenSSL Version
1610N/A---
1610N/A
2377N/AFor non-FIPS build, we currently deliver OpenSSL 1.0.1 with some updates
1610N/Afrom OpenSSL 1.0.2 to make T4 instructions embedded in the OpenSSL
1610N/Aupstream code. As of April 2013, 1.0.2 is not yet released, and therefore,
1610N/Awe have decided to patch the code.
1610N/AThe following files/code are copied in from 1.0.2.
1610N/Aadded:
1826N/A components/openssl/openssl-1.0.1/inline-t4/aest4-sparcv9.pl
1826N/A components/openssl/openssl-1.0.1/inline-t4/dest4-sparcv9.pl
1610N/A components/openssl/openssl-1.0.1/inline-t4/md5-sparcv9.pl
1610N/A components/openssl/openssl-1.0.1/inline-t4/sparc_arch.h
1826N/A components/openssl/openssl-1.0.1/inline-t4/sparct4-mont.pl
1826N/A components/openssl/openssl-1.0.1/inline-t4/sparcv9_modes.pl
1826N/A components/openssl/openssl-1.0.1/inline-t4/sparcv9-gf2m.pl
1826N/A components/openssl/openssl-1.0.1/inline-t4/vis3-mont.pl
1610N/A components/openssl/openssl-1.0.1/patches/openssl-t4-inline.sparc-patch
1610N/A
1610N/A
363N/AThe non-fips Build.
363N/A---
363N/A
4368N/AThe non-fips build is the 'default' build of OpenSSL and includes the regular
363N/Abinaries, libraries, man pages, and header files.
363N/A
2783N/A
363N/AThe fips Build
363N/A---
363N/A
2377N/AWe are now shipping FIPS-140 certified OpenSSL 1.0.1 with S12 and S11.2.
2377N/AThe admin may choose to activate 'openssl-fips' implementation using 'pkg mediator'.
797N/A
797N/AThe wanboot Build
797N/A----
797N/A
797N/AThere are some significant differences when building OpenSSL for wanboot.
797N/A
797N/ASome additional Configuration options are needed:
797N/A-DNO_CHMOD chmod not available in stand-alone environment
797N/A-DBOOT guard for wanboot specific patches
797N/A-DOPENSSL_NO_DTLS1 to avoid dtls1_min_mtu() - DTLS not used anyway
797N/A
797N/AList of object files for wanboot-openssl.o
797N/A----
797N/A
797N/AAt this moment, object files for wanboot-openssl.o need to be listed explicitly.
797N/AThis is cumbersome and relatively tedious with respect to upgrading to higher
797N/Aversion of openssl.
797N/A
797N/AIn future, it would be nice, if this could be performed automatically by the
797N/Alinker. The required interface for wanboot is already defined in a mapfile and
797N/Alinker option '-zdiscard-unused=sections,files' is already used to discard
797N/Aunused code.
797N/ABut sadly, at this moment when the linker is given all the object files, it
797N/Acorrectly discards some unused files, but references to undefined symbols from
797N/Athe discarded files don't get discarded along. Later, these undefined references
797N/Acause wanboot linking failure.
797N/A
797N/AIn order to determine which openssl object files are required for wanboot,
797N/Afirst build static standalone openssl bits in Userland. As a site effect,
797N/Astatic libraries libssl.a and libcrypto.a are created in build/sparcv9-wanboot.
797N/A
2377N/A $ cd $USERLAND/components/openssl/openssl-1.0.1 ; gmake build
797N/A
797N/ANext, collect some information from linking wanboot static libraries in ON.
797N/AThis can be done by the following hack.
797N/A
797N/A $ cd $ON/usr/src/psm/stand/boot/sparcv9/sun4
797N/A $ touch wanboot.o
797N/A $ LD_OPTIONS="-Dfiles,symbols,output=ld.dbg \
2377N/A -L$USERLAND/components/openssl/openssl-1.0.1/build/sparcv9-wanboot " \
797N/A WAN_OPENSSL=" -lwanboot -lssl -lcrypto" dmake all
797N/A
797N/AThe following sort of information ends up in ld.dbg (note that the debugging
797N/Aoutput from the link-editor is not considered a 'stable interface' and may
797N/Achange in the future):
797N/A
2377N/A debug: file=/builds/tkuthan/ul-wanboot-rebuilt/components/openssl/openssl-1.0.1/build/sparcv9-wanboot/libcrypto.a(sparcv9cap.o) [ ET_REL ]
797N/A debug:
2377N/A debug: symbol table processing; file=/builds/tkuthan/ul-wanboot-rebuilt/components/openssl/openssl-1.0.1/build/sparcv9-wanboot/libcrypto.a(sparcv9cap.o) [ ET_REL ]
797N/A debug: symbol[1]=sparcv9cap.c
797N/A ....
797N/A
797N/ANow run the following script in Userland:
797N/A
797N/A #!/bin/bash
797N/A
797N/A # set to workspace paths:
797N/A USERLAND=/builds/tkuthan/ul-wanboot-rebuilt
797N/A ON=/builds/tkuthan/on11u1-wanboot-rti
797N/A
2377N/A BUILD=$USERLAND/components/openssl/openssl-1.0.1/build/sparcv9-wanboot
797N/A LD_DBG=$ON/usr/src/psm/stand/boot/sparcv9/sun4/ld.dbg
797N/A
797N/A for i in `find $BUILD/crypto $BUILD/ssl -name '*.o'`
797N/A do
797N/A f=`basename $i`
797N/A if grep -q "^debug: file.*\<$f\>" $LD_DBG
797N/A then
797N/A echo $i | sed "s#$BUILD/##"
797N/A fi
797N/A done
797N/A
797N/Ato get the list of required object files.
797N/A
797N/AAdditionally, you can format the list for including to Makefile by:
797N/A sort | tr '\n' ' ' | fold -s -w74 | sed -e 's/^/ /' -e 's/$/\\/'
797N/A
797N/ALinking with wanboot
797N/A----
797N/A
797N/AWhen linking with wanboot please pay attention to following pitfalls.
797N/A
797N/ACorrect openssl header files need to be included. This is done in
797N/A$ON/usr/src/stand/lib/wanboot/Makefile
797N/AMake sure CPPFLAGS point to the right directories.
797N/A
797N/AEXTREME CAUTION needs to be employed, if WANBOOT GREW IN SIZE because of the
797N/Achanges!
797N/AWanboot is a statically linked standalone binary and it is loaded on a fixed
797N/Aaddress before execution. This address is defined in
797N/A$ON/usr/src/psm/stand/boot/sparc/common/mapfile:
797N/A
3387N/A LOAD_SEGMENT text {
3387N/A FLAGS = READ EXECUTE;
3387N/A VADDR = 0x130000;
3387N/A ASSIGN_SECTION {
3387N/A TYPE = PROGBITS;
3387N/A FLAGS = ALLOC !WRITE;
3387N/A };
3387N/A };
797N/A
797N/AThis address (VADDR) NEEDS TO BE GREATER THEN
797N/A size of wanboot binary + 0x4000
797N/A
797N/AThe reason for this is in how wanboot is loaded by OpenBoot Prom:
797N/A1) user initiates boot from network - "boot net"
797N/A2) obp loads wanboot binary at address 0x4000
797N/A3) obp parses ELF header, reads virtual address where to load wanboot to
797N/A4) obp mem-copies .text section to this address
797N/A5) obp copies .data section behind .text
797N/A6) obp starts executing wanboot at entry address
797N/A
797N/AIf the given address is too small, obp overwrites part of .data with
797N/Ainstructions from .text in step 4. resulting in .data being corrupted.
797N/AInitialized variables get bogus values and failure is inevitable.
797N/AThis is very hard to troubleshoot.
797N/A
797N/A
797N/ATesting wanboot with new openssl
797N/A----
797N/A
797N/AWith every upgrade of OpenSSL, it is necessary to make sure wanboot builds and
2828N/Aworks well with the new bits (post lullaby).
797N/A
797N/AProvided you have a freshly built ON workspace, you can link wanboot with new
2828N/AOpenSSL bits as follows:
797N/A
797N/A # copy wanboot-openssl.o to ON build machine
797N/A cp wanboot-openssl.o /var/tmp/
797N/A
797N/A # prepare to rebuild wanboot
797N/A cd $ON
797N/A cd usr/src/psm/stand/boot/sparcv9/sun4
797N/A
797N/A # hack to force a rebuild
2828N/A touch $ON/build.sparc/usr/src/psm/stand/boot/sparcv9/sun4/wanboot.o
797N/A
2828N/A # modify Makefile and assign the WAN_OPENSSL macro to your binary
2828N/A # something like
2828N/A WAN_OPENSSL = /var/tmp/wanboot-openssl.o
2828N/A
2828N/A # build a wanboot binary
2828N/A build -i dmake all
797N/A
797N/AWanboot should build without warning.
797N/A
797N/AIf there is something like this in the output:
797N/A
797N/A Undefined first referenced
797N/A symbol in file
797N/A CRYPTO_ccm128_setiv /var/tmp/wanboot-openssl.o
797N/A SSL_get_srtp_profiles /var/tmp/wanboot-openssl.o
797N/A ssl_parse_clienthello_use_srtp_ext /var/tmp/wanboot-openssl.o
797N/A CRYPTO_gcm128_setiv /var/tmp/wanboot-openssl.o
797N/A ...
797N/A cmac_pkey_meth /var/tmp/wanboot-openssl.o
797N/A ld: fatal: symbol referencing errors. No output written to wanboot
797N/A *** Error code 1
797N/A dmake: Fatal error: Command failed for target `wanboot'
797N/A
797N/Asome additional work has to be done in OpenSSL to either satisfy the function
797N/Areferences listed in the linker error message, or to remove the calls to these
797N/Afunctions.
797N/A
797N/AFinally, resulting wanboot binary shall be deployed on some install server and
797N/Awanbooting from this server shall be tested.
4368N/A
4368N/A===============
4368N/ACommon Patches
4368N/A===============
4368N/A
4368N/ACommon patch files are located in the components/openssl/common/patches dir,
4368N/Aand they are copied to both FIPS and non-FIPS 'patches' dir as soon as the
4368N/AMakefile is parsed. The Common patch filename has prefix '0',
4368N/A
4368N/A----
4368N/A
4368N/A008-6193522.patch
4368N/AGive CA.pl better defaults. See 6193522 for more information.
4368N/A
4368N/A011-6546806.patch
4368N/AMake sure the HMAC_CTX_init(3) man page gets delivered. See 6546806 for
4368N/Amore information.
4368N/A
4368N/A015-pkcs11_engine-0.9.8a.patch
4368N/APatch which adds the pkcs11 engine. See also the engine/pkcs11
4368N/Asub-directory.
4368N/A
4368N/A018-compiler_opts.patch
4368N/AAdds five Solaris specific configurations (both 32bit and 64bit for both sparc
4368N/Aand x86, plus 64bit sparc for wanboot) to Configure which are then explicitly
4368N/Aused by the Makefiles. Wanboot configuration is special in that it doesn't link
4368N/Awith libc and uses -xF=%all to put functions in separate sections, so that
4368N/Aunused code can be discarded.
4368N/A
4368N/ACare should be taken if modifying this patch as changes to compile-time options
4368N/Acan change the ABI. One example of this is the use of RC4_INT vs RC4_CHAR.
4368N/A
4368N/A020-remove_rpath.patch
4368N/APrevent build binaries having an unnecessary runpath (/lib).
4368N/A
4368N/A023-noexstack.patch
4368N/ABuild with non-executable stacks and non-executable data (x86).
4368N/A
4368N/A027-6978791.patch
4368N/AModifies Makefile.shared so that libssl is built with -znodelete.
4368N/A
4368N/A028-enginesdir.patch
4368N/AAdds a new "enginesdir" option to the Configure script which allows a user to
4368N/Aspecify the engines directory.
4368N/A
4368N/A029-fork_safe.patch
4368N/AAdds the code to setup internal mutexes and callback function.
4368N/ASee PSARC/2014/077.
4368N/A
4368N/A032-aes_cbc_len_check.patch
4368N/AAES-CBC input length is checked to avoid segmentation fault.
4368N/A
4368N/A033-cert_chain.patch
4368N/AFixes the certificate chain bug.
4368N/A
4368N/A036-evp_leak.patch
4368N/AFixes the memory leak bug.
4368N/A
4368N/A038_remove_illegal_instruction_calls.patch
4368N/ASPARC patch. Solaris-only patch.
4368N/AFor instructions in sparcv9cap.c, remove if not supported on any platforms.
4368N/AOtherwise modify them to call getisax() to check for HW capability instead.
4368N/A
4368N/A039-internal_tests.patch
4368N/ARemove test 'test_ca' because it depends on directories not present in the
4368N/Abuild directory.
4368N/A
4368N/A=========================
4368N/ANon-FIPS specific Patches
4368N/A=========================
4368N/A
4368N/ANon-FIPS specific patch files are located in the
4368N/Acomponents/openssl/openssl-1.0.1/patches dir.
4368N/AThe Non-FIPS specific patch filename has prefix '1',
4368N/A
4368N/A----
4368N/A101-manpage_openssl.patch
4368N/AForce openssl to install man pages into man[1357]openssl instead of man[1357].
4368N/A
4368N/A102-wanboot.patch:
4368N/AWanboot specific patches.
4368N/A- modified Makefiles not to build in engines apps test tools
4368N/A- not using vfprintf for error print in crypto/cryptlib.c
4368N/A- not using ERR_load_DSO_strings() in crypto/err/err_all.c
4368N/A- not using EVP_read_pw_string() in crypto/evp/evp_key.c
4368N/A - reading password is implemented in disabled DES library
4368N/A- avoid select() in crypto/rand/rand_unix.c
4368N/A- direct reading of IP to avoid sscanf() in crypto/x509v3/v3_utl.c
4368N/A- using functions from libsock in e_os.h
4368N/A- by-passing version of sparc detection in crypto/sparcv9cap.c
4368N/A - results in not using FPU for big numbers multiplication
4368N/A - should be ok - original detection seems broken, FPU gets never used
4368N/A- implementation of atoi()
4368N/A- avoid using ssl_fill_hello_random() in s3_clnt.c
4368N/A
4368N/A103-openssl_t4_inline.patch
4368N/AAdd patch to support inline T4 instruction in OpenSSL upstream code until
4368N/AOpenSSL 1.0.2 is released.
4368N/A
4368N/A104-suppress_v8plus_abi_warnings.patch
4368N/ASuppress warnings about sparcv8+ ABI violation when building T4-specific
4368N/Amodules as 32-bit.
4368N/A
4368N/A=========================
4368N/AFIPS specific Patches
4368N/A=========================
4368N/A
4368N/AFIPS specific patch files are located in the
4368N/Acomponents/openssl/openssl-1.0.1-fips-140/patches dir.
4368N/AThe FIPS specific patch filename has prefix '2',
4368N/A
4368N/A---
4368N/A201-openssl_fips.patch
4368N/AChange openssl(1) to call the FIPS routines only if the fips mediator is activated.
4368N/A
4368N/A202-17952966.patch
4368N/AFIPS version needs to build with '-lc' explicitly with stuido 12.3 and above.