zucrypt: copyright and licensing of all included files
======================================================

zucrypt itself
--------------

Everything outside src/vendor/ is Copyright (c) 2026 Pedro Baltazar and is
licensed under the MIT licence; see the LICENSE file at the top of the
package.

That includes the files that configure and adapt the vendored backend:

    src/zuc_crypto_config.h   the TF-PSA-Crypto build configuration, which
                              replaces upstream's psa/crypto_config.h
    src/zuc_random.c          the operating-system random source the backend
                              is configured to call out to
    src/zuc_backend.c         backend bring-up and version reporting
    src/zucrypt_r.c           the R entry points
    src/Makevars              the build, including the explicit object list


Third-party code: TF-PSA-Crypto
-------------------------------

    Location:  src/vendor/tf-psa-crypto/
    Upstream:  https://github.com/Mbed-TLS/TF-PSA-Crypto
    Release:   tf-psa-crypto-1.1.1
    Licence:   Apache-2.0
    Copyright: Copyright The Mbed TLS Contributors

TF-PSA-Crypto is published under a dual Apache-2.0 OR GPL-2.0-or-later
licence, the recipient choosing between them. zucrypt takes it under
Apache-2.0. The full text of both licences, as upstream ships it, is in
src/vendor/tf-psa-crypto/LICENSE in the source package, and is installed as
licenses/tf-psa-crypto-LICENSE in the installed package -- so that it travels
with the compiled backend, including inside libzucrypt.a when another package
links it (Apache-2.0 section 4(a)).

Apache-2.0 and MIT are compatible: each file keeps its own terms, and a
recipient of this package receives the vendored files under Apache-2.0 and
everything else under MIT.

Upstream holds copyright collectively as "The Mbed TLS Contributors", but some
included files also name an individual author, and these are listed in
DESCRIPTION's Authors@R as contributors and copyright holders:

    Adriaan de Jong   named as \author in lib/cipher.c, lib/cipher_wrap.c,
                      lib/cipher_wrap.h, inc/mbedtls/md.h and
                      inc/mbedtls/private/cipher.h
    Daniel King       named as \author in inc/mbedtls/private/chacha20.h,
                      inc/mbedtls/private/chachapoly.h and
                      inc/mbedtls/private/poly1305.h
    Simon Tatham      lib/sha512.c's Arm-accelerated SHA-512 code was
                      originally written by him for PuTTY under the MIT
                      licence, and is dual-licensed as Apache-2.0 with his
                      permission, as the file states

tools/vendor/verify fails if a vendored file names an author who is missing
from DESCRIPTION or from this list.

Only part of the upstream release is included here. The vendored tree is the
dependency closure of the sources that carry a symbol under
src/zuc_crypto_config.h -- 113 files of an archive with several thousand. The
exact list is tools/vendor/keep/tf-psa-crypto.txt, the release and its
checksum are in tools/vendor/manifest.tsv, and tools/vendor/verify checks
offline that the tree, the manifest, the build configuration and this file all
agree.

Local changes are carried as patch files under tools/patches/<source>/ and
applied by tools/vendor/fetch; no upstream file is edited in place. Each patch
is listed in the manifest's `patches` column and named here, and
tools/vendor/verify fails if those three records disagree.

Two patches are applied:

    tools/patches/tf-psa-crypto/0001-avoid-zero-size-pubkey-array.patch

        inc/mbedtls/pk.h declares a zero-size array when no public-key
        algorithm is enabled, which this build does not enable. Zero-size
        arrays are a GNU extension rather than ISO C, and GCC with -Wpedantic
        -- which CRAN's r-devel container passes -- reports it as a
        significant warning. The patch starts the length at 1 instead of 0.
        It changes nothing in a configuration that enables a public-key
        algorithm. The patch file carries the full rationale.

    tools/patches/tf-psa-crypto/0002-drop-diagnostic-pragmas.patch

        lib/constant_time_impl.h and lib/platform_util.c suppress
        -Wredundant-decls and -Wvla with `#pragma GCC/clang diagnostic`,
        which R CMD check reports. Neither warning is enabled by -Wall,
        -Wextra or -pedantic, so the patch removes the pragmas and nothing
        else; the constant-time code and the zeroisation barrier are
        unchanged. The patch file carries the measurements.
