Copyright (C) 2018 - 2023, Stephan Mueller <smueller@chronox.de>

See LICENSE.* for the applicable license.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

================================================================================

The Dilithium signature code is derived in parts from the code distribution
provided with https://github.com/pq-crystals/dilithium. The license for the
original code is:

 That code is released under Public Domain
 (https://creativecommons.org/share-your-work/public-domain/cc0/);
 or Apache 2.0 License (https://www.apache.org/licenses/LICENSE-2.0.html).

================================================================================

The Kyber KEM code is derived in parts from the code distribution provided with
https://github.com/pq-crystals/kyber. The license for the original code is:

 That code is released under Public Domain
 (https://creativecommons.org/share-your-work/public-domain/cc0/).

================================================================================

The Kyber KEM ARMv8 code is derived in parts from the code distribution
provided with https://github.com/psanal2018/kyber-arm64. The license for the
original code is:

 MIT License

 Copyright (c) 2021 Pakize Sanal, Emrah Karagoz, Hwajeong Seo,
 Reza Azarderakhsh, Mehran Mozaffari-Kermani

================================================================================

The AES block cipher code is derived in parts from the code distribution
provided with https://github.com/kokke/tiny-AES-c. The license for the original
code is:

 This is free and unencumbered software released into the public domain.

================================================================================

For hash/src/asm/AVX2/KeccakP-1600-AVX2.S,
hash/src/asm/AVX512/KeccakP-1600-AVX512.S,
hash/src/asm/ARMv8A/KeccakP-1600-armv8a-ce.S,
sym/src/asm/ARMv8/aes_armv8_ce.S,
sym/src/asm/AESNI_x86_64/aes_aesni_x86_64.S:

    Copyright (c) 2006-2017, CRYPTOGAMS by <appro@openssl.org>
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:

        *	Redistributions of source code must retain copyright notices,
        this list of conditions and the following disclaimer.

        *	Redistributions in binary form must reproduce the above
        copyright notice, this list of conditions and the following
        disclaimer in the documentation and/or other materials
        provided with the distribution.

        *	Neither the name of the CRYPTOGAMS nor the names of its
        copyright holder and contributors may be used to endorse or
        promote products derived from this software without specific
        prior written permission.

    ALTERNATIVELY, provided that this notice is retained in full, this
    product may be distributed under the terms of the GNU General Public
    License (GPL), in which case the provisions of the GPL apply INSTEAD OF
    those given above.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

================================================================================

The SHA3 / SHAKE assembler implementations and the associated glue code in
hash/src/keccak_asm_glue.h, code in hash/src/asm/ARMv8A/ and
hash/src/asm/ARMv7A-NEON/ are derived in parts from the code distribution
provided with https://github.com/XKCP/XKCP.

This code is licensed with:

The redistribution and use of this software (with or without changes) is
allowed without the payment of fees or royalties provided that the terms
of the licenses of the different source files used is respected. Most of the
source and header files in the XKCP are released to the public domain and
associated to the CC0 (http://creativecommons.org/publicdomain/zero/1.0/) deed,
but there are exceptions.

================================================================================

The Keccak assembler implementation in hash/src/asm/riscv is derived in parts
from the code distribution provided with
https://github.com/AsmOptC-RiscV/Assembly-Optimized-C-RiscV

This code is MIT licensed.

================================================================================

The x86intrin code in internal/api/ext_x86_*.h are derived from GCC and Clang.
The only reason why this code is duplicated is the fact that the compiler code
cannot be included into kernel code code as is. Thus, the functions used by
leancrypto are extracted - I wished this would not have been necessary.

Anyhow, the GCC code is: GPL 3. The LLVM code is: Apache License v2.0.

================================================================================

The following files are licensed under the Apache License 2.0, copyright:
Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

sym/src/asm/riscv64/riscv64_aes_asm.S
sym/src/asm/riscv64/riscv64_aes_zkn_asm.S

