OpenSSL @VERSION@ for Mac OS X 10.4 Tiger

OpenSSL @VERSION@, the current long-term-support release of OpenSSL, built
for Mac OS X 10.4 on every Mac that runs it: PowerPC (G3, G4 and G5) and
Intel. Its openssl command speaks TLS 1.3 to the servers of today, which
Tiger's own cannot, and its libraries and headers are there to build
programs with. It is put beside Tiger's own OpenSSL 0.9.7l, which stays as
it is: Mac OS X and its programs (ssh, curl, Apache and the rest) go on
using that one. It puts in place:

  /opt/openssl3
      the openssl command, the libraries, the headers, the manual pages
  /opt/openssl3/etc/ssl
      openssl.cnf, and cert.pem, a link to /usr/local/etc/ssl/cert.pem,
      the root certificates of the Root certificates package
  /usr/local/bin/openssl
      a link to /opt/openssl3/bin/openssl
  /usr/local/share/man/man1
      links to the commands' manual pages (openssl*.1ossl)
  /opt/openssl3/share/doc/openssl-tiger
      this Read Me, the license, update-shell-profile.sh

Using it

The installer puts /usr/local/bin at the front of the PATH in your shell
profile (~/.bash_profile for bash, the shell Tiger gives new accounts, or
the .bash_login or .profile you already have) and keeps the old profile
beside it as .opensslsave. Open a new Terminal window: openssl version
then says OpenSSL @VERSION@. Tiger's own is still /usr/bin/openssl.

  openssl s_client -connect www.apple.com:443 -brief
  openssl dgst -sha256 a-file
  openssl genpkey -algorithm ed25519 -out key.pem
  openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
      -keyout key.pem -out cert.pem -subj /CN=my-mac -days 365

man openssl and man openssl-x509 (and the other commands) show this
OpenSSL's pages. The library's are in /opt/openssl3/share/man:
man -M /opt/openssl3/share/man SSL_CTX_new.

One difference from Tiger's openssl: openssl enc makes its key from the
password with SHA-256, where 0.9.7 used MD5. To open a file that Tiger's
openssl enc made, add -md md5:

  openssl enc -d -aes-256-cbc -md md5 -in old-file -out plain-file

For a new file, -pbkdf2 is the better choice.

Building programs with it

Nothing finds this OpenSSL unless it is told to: a compiler on Tiger still
finds 0.9.7's headers in /usr/include and its libraries in /usr/lib. Name
the folder:

  gcc -I/opt/openssl3/include prog.c -L/opt/openssl3/lib -lssl -lcrypto
  ./configure --with-openssl=/opt/openssl3
  PKG_CONFIG_PATH=/opt/openssl3/lib/pkgconfig pkg-config --libs openssl

A program built so loads /opt/openssl3/lib/libssl.3.dylib and
libcrypto.3.dylib, which this package puts there. For one that runs on a
Mac without it, link the static libraries instead:

  gcc -I/opt/openssl3/include prog.c \
      /opt/openssl3/lib/libssl.a /opt/openssl3/lib/libcrypto.a

The static libraries are for programs, not for other libraries: they are
made as Apple's gcc makes a program (-mdynamic-no-pic). They carry what
OpenSSL needs that Xcode 2.5's gcc 4.0.1 lacks, such as the 64-bit atomic
functions on PowerPC.

The libraries are universal (PowerPC and Intel) and the headers serve both,
so gcc 4.0.1 builds a universal program too, with -arch ppc -arch i386
-isysroot /Developer/SDKs/MacOSX10.4u.sdk. Link the static libraries by
their full paths then, as above: with -isysroot, Tiger's linker looks for
the shared ones inside the SDK, which has no /opt. GCC 13 from
tiger.v2core.com builds with these libraries too, one kind of Mac at a
time.

Certificates

The openssl command and the libraries check servers against the roots in
/usr/local/etc/ssl/cert.pem, through the link in /opt/openssl3/etc/ssl.
That file is Mozilla's list of the authorities to trust, and the Root
certificates package puts it there. Install that package before OpenSSL:
the Installer stops if it is not there. Tiger Packages installs it with
OpenSSL, and offers each new list as an update.

Uninstalling

In Terminal:

  sudo rm -rf /opt/openssl3
  sudo rm /usr/local/bin/openssl
  sudo rm /usr/local/share/man/man1/*.1ossl
  sudo rm -rf "/Library/Receipts/OpenSSL "*.pkg

No other package names its manual pages .1ossl. If /opt is then empty and
you did not make it yourself, sudo rmdir /opt. Programs you built with
these libraries stop working without them; the root certificates stay.

How it was made

OpenSSL was cross-compiled on Linux with GCC 13.4 for powerpc-apple-darwin8
(any G3 and up) and i686-apple-darwin8, against the Mac OS X 10.4u SDK,
with OpenSSL's own assembly on both. Its source is not changed. Tiger has
no getentropy(), so it reads /dev/urandom, and its asynchronous jobs are
left out (getcontext() came with 10.5). Every program and library was
checked to load on 10.4. The package and this disk image were made on
Mac OS X 10.4.11 with its own mkbom, pax and hdiutil.

Everything it was built from (OpenSSL's source and the build scripts) is
in openssl-@PKGVERSION@-tiger-source.tar.gz, beside this disk image.

Built @DATE@.
