cosmopolitan/third_party/mbedtls
Justine Tunney 957c61cbbf
Release Cosmopolitan v3.3
This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.

This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.

Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.

OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().

This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.

We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 13:27:59 -08:00
..
test Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
aes.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
aes.h Reduce header complexity 2023-11-28 14:39:42 -08:00
aesce.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
aesce.h Reduce header complexity 2023-11-28 14:39:42 -08:00
aesni.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
aesni.h Reduce header complexity 2023-11-28 14:39:42 -08:00
asn1.h Reduce header complexity 2023-11-28 14:39:42 -08:00
asn1parse.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
asn1write.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
asn1write.h Reduce header complexity 2023-11-28 14:39:42 -08:00
base64.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
base64.h Reduce header complexity 2023-11-28 14:39:42 -08:00
bigmul.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
bigmul4.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
bignum.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
bignum.h Reduce header complexity 2023-11-28 14:39:42 -08:00
bignum_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
bigshift.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
blake2b256.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
BUILD.mk Use DNS implementation from Musl Libc 2023-12-28 23:04:35 -08:00
ccm.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ccm.h Reduce header complexity 2023-11-28 14:39:42 -08:00
certs.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
certs.h Reduce header complexity 2023-11-28 14:39:42 -08:00
chacha20.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
chacha20.h Reduce header complexity 2023-11-28 14:39:42 -08:00
chachapoly.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
chachapoly.h Reduce header complexity 2023-11-28 14:39:42 -08:00
check.inc Reduce header complexity 2023-11-28 14:39:42 -08:00
chk.h Add SNI support to redbean and improve SSL perf 2021-07-23 13:56:13 -07:00
cipher.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
cipher.h Reduce header complexity 2023-11-28 14:39:42 -08:00
cipher_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
cipher_wrap.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
common.h Add SSL to redbean 2021-06-24 13:20:50 -07:00
config.h Fix some aarch64 build issues 2023-07-08 10:47:45 -07:00
ctr_drbg.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ctr_drbg.h Reduce header complexity 2023-11-28 14:39:42 -08:00
debug.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
debug.h Add SSL to redbean 2021-06-24 13:20:50 -07:00
des.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
des.h Reduce header complexity 2023-11-28 14:39:42 -08:00
describecode.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
dhm.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
dhm.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ecdh.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ecdh.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ecdh_everest.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ecdh_everest.h Make stronger crypto nearly as fast 2021-07-26 16:19:45 -07:00
ecdsa.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ecdsa.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ecp.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ecp.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ecp256.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ecp384.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ecp_curves.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ecp_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ecpshl.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
endian.h Add SNI support to redbean and improve SSL perf 2021-07-23 13:56:13 -07:00
entropy.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
entropy.h Reduce header complexity 2023-11-28 14:39:42 -08:00
entropy_poll.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
entropy_poll.h Reduce header complexity 2023-11-28 14:39:42 -08:00
error.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
error.h Reduce header complexity 2023-11-28 14:39:42 -08:00
everest.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
everest.h Reduce header complexity 2023-11-28 14:39:42 -08:00
fastdiv.h Reduce header complexity 2023-11-28 14:39:42 -08:00
formatclientciphers.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
gcm.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
gcm.h Reduce header complexity 2023-11-28 14:39:42 -08:00
getalertdescription.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getciphersuite.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getciphersuitename.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
getsslstatename.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
hkdf.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
hkdf.h Reduce header complexity 2023-11-28 14:39:42 -08:00
hmac_drbg.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
hmac_drbg.h Reduce header complexity 2023-11-28 14:39:42 -08:00
iana.h Reduce header complexity 2023-11-28 14:39:42 -08:00
isciphersuitegood.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
karatsuba.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
LICENSE Import Mbed TLS v2.26.0 2021-06-24 11:12:45 -07:00
math.h Add SNI support to redbean and improve SSL perf 2021-07-23 13:56:13 -07:00
md.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
md.h Reduce header complexity 2023-11-28 14:39:42 -08:00
md5.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
md5.h Reduce header complexity 2023-11-28 14:39:42 -08:00
md5t.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
mdtype.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
memory_buffer_alloc.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
memory_buffer_alloc.h Reduce header complexity 2023-11-28 14:39:42 -08:00
net_sockets.c Use DNS implementation from Musl Libc 2023-12-28 23:04:35 -08:00
net_sockets.h Reduce header complexity 2023-11-28 14:39:42 -08:00
nist_kw.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
nist_kw.h Reduce header complexity 2023-11-28 14:39:42 -08:00
notice.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
oid.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
oid.h Reduce header complexity 2023-11-28 14:39:42 -08:00
param.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
pem.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
pem.h Reduce header complexity 2023-11-28 14:39:42 -08:00
pk.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
pk.h Reduce header complexity 2023-11-28 14:39:42 -08:00
pk_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
pk_wrap.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
pkcs5.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
pkcs5.h Reduce header complexity 2023-11-28 14:39:42 -08:00
pkparse.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
pktype.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
pkwrite.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
platform.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
platform.h Clean up some code 2023-11-16 17:31:07 -08:00
poly1305.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
poly1305.h Reduce header complexity 2023-11-28 14:39:42 -08:00
profile.h Fix Landlock Make so it can read pattern rule vars 2022-08-13 17:23:05 -07:00
rando.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
README.cosmo Make improvements 2023-09-18 21:04:47 -07:00
rsa.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
rsa.h Reduce header complexity 2023-11-28 14:39:42 -08:00
rsa_internal.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
rsa_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
san.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
san.h Add SSL to redbean 2021-06-24 13:20:50 -07:00
secp256r1.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
secp384r1.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
select.h Reduce header complexity 2023-11-28 14:39:42 -08:00
sha1.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sha1.h Reduce header complexity 2023-11-28 14:39:42 -08:00
sha1t.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sha256.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sha256.h Reduce header complexity 2023-11-28 14:39:42 -08:00
sha256t.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sha512.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sha512.h Reduce header complexity 2023-11-28 14:39:42 -08:00
sha512t.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
shakedescription.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
shiftright-avx.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
shiftright.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sigalg.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
speed.sh Make numerous improvements 2021-09-28 01:52:34 -07:00
srtp.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00
ssl.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_cache.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_cache.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_ciphersuites.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_ciphersuites.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_cli.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_cookie.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_cookie.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_internal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_invasive.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_msg.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_srv.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_ticket.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_ticket.h Reduce header complexity 2023-11-28 14:39:42 -08:00
ssl_tls.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_tls13_keys.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
ssl_tls13_keys.h Add SSL to redbean 2021-06-24 13:20:50 -07:00
version.h Reduce header complexity 2023-11-28 14:39:42 -08:00
x509.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509.h Reduce header complexity 2023-11-28 14:39:42 -08:00
x509_create.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509_crl.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509_crl.h Reduce header complexity 2023-11-28 14:39:42 -08:00
x509_crt.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509_crt.h Reduce header complexity 2023-11-28 14:39:42 -08:00
x509_csr.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509_csr.h Reduce header complexity 2023-11-28 14:39:42 -08:00
x509write_crt.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
x509write_csr.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
zeroize.c flip et / noet in modelines 2023-12-07 22:17:11 -05:00

DESCRIPTION

  Mbed TLS is a crypto library built by ARM that's been released
  under a more permissive license than alternatives like OpenSSL
  and is useful for interoperating with systems that require TLS

SOURCE

  https://github.com/ARMmbed/mbedtls/archive/refs/tags/v2.26.0.tar.gz

LICENSE

  Apache 2.o

LOCAL CHANGES

  - Support ECANCELED (similar to EINTR) needed by pthread_cancel()

  - Strengthened server against DOS by removing expensive protections
    for old Internet Explorer against Lucky Thirteen timing attacks.

  - Reduce build+test latency from 15 seconds to 5 seconds.

  - Features have been added that enable this library to produce SSL
    certificates that can be used by Google Chrome. This required we
    add featurces for editing Subject Alternative Names and Extended
    Key Usage X.509 extension fields since upstream mbedtls can only
    do that currently for Netscape Navigator.

  - Local changes needed to be made to test_suite_ssl.datax due to it
    not taking into consideration disabled features like DTLS.

  - Local changes needed to be made to test_suite_x509parse.datax due
    to the features we added for subject alternative name parsing.

  - We've slimmed things down to meet our own specific local needs.
    For example, we don't need the PSA code since we don't target ARM
    hardware. We also don't need algorithms like camellia, blowfish,
    ripemd, arc4, ecjpake, etc. We want security code that's simple,
    readable, and easy to maintain. For example, the formally verified
    eliptic curve diffie-helman code was 38 files and most of it was
    dead code which could be consolidated into one < 1 kLOC file.

  - The only breaking API change that's been made is to redefine int
    arrays of things like long lists of ciphersuites to be uint8_t or
    uint16_t instead when appropriate.

  - Exported test code so it (a) doesn't have python as a build time
    dependency, (b) doesn't print to stdout on success, (c) bundles
    its dependencies inside a zip container so the tests are able to
    run hermetically if the binary is scp'd to some machine, and (d)
    doesn't have large amounts of duplicated generated code.

  - Fix mbedtls_mpi_sub_abs() to not call malloc/free/memcpy since
    it's called 11,124 times during as SSL handshake.

  - Make P-256 and P-384 modulus goes 5x faster.

  - Make chacha20 26% faster.

  - Make base64 100x faster.

  - Make gcm faster.