Page MenuHomeFreeBSD

openssl: build the legacy provider the way upstream does
Needs ReviewPublic

Authored by gordon on Tue, Oct 6, 12:15 AM.

Details

Reviewers
ngie
Group Reviewers
secteam
Summary
  • Build with libcrypto's compile flags: modules/Makefile.inc now includes libcrypto's Makefile.inc, which brings in Makefile.common (NDEBUG, the asm dispatch defines, OPENSSL_PIC, the directory defines). Before this change, assertions were enabled in legacy.so.
  • Use upstream's per-architecture source list: the provider's own CPU capability code (cpuid asm and armcap.c/ppccap.c, or mem_clr.c without asm), and the MD5, RC4 and DES asm where upstream uses it. The provider no longer uses libcrypto's exported RC4, SHA1 and CRYPTO_*128 functions.
  • Drop the objects that upstream's linker leaves out of legacy.so (fcrypt_b.c, md5_one.c, md5_sha1.c, provider_err.c and ciphercommon_{ccm,gcm}*.c / ciphercommon_hw.c). Without them, params_idx.c is not needed either.
  • Add a version script, a copy of upstream's providers/legacy.ld, so that only OSSL_provider_init is exported. On arm64, 209 symbols were exported before.

Tested on arm64: legacy.so builds, and its imports match upstream's
legacy.so except for the stack protector symbols. It loads with
LD_BIND_NOW=1. openssl(1) output with -provider legacy matches
upstream's for RC4, DES-EDE3-CBC, BF-CBC, CAST5-CBC, SEED-CBC and MD5,
with OPENSSL_armcap unset, 0 and 1. For the other architectures, the
source lists were compared with upstream's configuration for each one,
but nothing was built.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Did you run the smoke test under /usr/tests/secure/lib/libcrypto/ to confirm that the provider loads after this change?

secure/lib/libcrypto/modules/legacy/Makefile
25

Why was needed?