kerberos: Fix numerous segfaults when using weak crypto
Weak crypto is provided by the openssl legacy provider which is
not load by default. Load the legacy providers as needed.
When the legacy provider is loaded into the default context the default
provider will no longer be automatically loaded. Without the default
provider the various kerberos applicaions and functions will abort().
This is the second attempt at this patch. Instead of linking
secure/lib/libcrypto at build time we now link it at runtime, avoiding
buildworld failures under Linux and MacOS. This is because
TARGET_ENDIANNESS is undefined at pre-build time.
PR: 272835
Tested by: netchild
Joerg Pulz <Joerg.Pulz@frm2.tum.de> (previous version)
Approved by: so
Security: FreeBSD-EN-24:08.kerberos
(cherry picked from commit 476d63e091c2e663b51d18acf6acb282e1f22bbc)
(cherry picked from commit c7db2e15e4045e1daba939bb151fc5878f791c7b)