Skip to content

Commit

Permalink
Add SPDX-License-Identifier headers (open-quantum-safe#749)
Browse files Browse the repository at this point in the history
* Add SPDX-License-Identifier in src/common

* Add SPDX-License-Identifier in FrodoKEM

* Add SPDX-License-Identifier in SIKE

* Add SPDX-License-Identifier in BIKE

* Add SPDX-License-Identifier in OQS headers

* Add SPDX-License-Identifier in files generated during copy-from-pqclean

* Add SPDX-License-Identifier in Picnic

* Add SPDX-License-Identifier in qTesla

* Add SPDX-License-Identifier in CMake files

* Update license info in README

* Add SPDX-License-Identifier in scripts

* Add SPDX-License-Info to CMakeLists

* Add SPDX-License-Info in tests

* Add SPDX-License-Info to various files

* Prettyprint

* Add test for SPDX-License-Identifier headers

* Updated license identifiers for CPU extension detection code.

* Use conjunction for SPDX in file with two licenses

Co-authored-by: xvzcf <[email protected]>
  • Loading branch information
dstebila and xvzcf authored May 12, 2020
1 parent df2f652 commit 6e0b0d7
Show file tree
Hide file tree
Showing 305 changed files with 649 additions and 13 deletions.
1 change: 1 addition & 0 deletions .CMake/CMakeDependentOption.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
CMakeDependentOption
Expand Down
2 changes: 2 additions & 0 deletions .CMake/alg_support.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

include(CMakeDependentOption)

if(NOT DEFINED OQS_KEM_DEFAULT)
Expand Down
2 changes: 2 additions & 0 deletions .CMake/compiler_opts.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Werror)
add_compile_options(-Wall)
Expand Down
2 changes: 2 additions & 0 deletions .CMake/detect_gcc_clang_intrinsics.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <stdio.h>

int main(void) {
Expand Down
2 changes: 2 additions & 0 deletions .CMake/gcc_clang_intrinsics.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

try_run(RUN_RESULT COMPILE_RESULT
"${CMAKE_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/.CMake/detect_gcc_clang_intrinsics.c"
COMPILE_DEFINITIONS -march=native
Expand Down
3 changes: 3 additions & 0 deletions .CMake/toolchain_rasppi.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: MIT

# How to use:
# apt install gcc-8-arm-linux-gnueabihf
# cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_rasppi.cmake -DOQS_USE_OPENSSL=OFF ..

Expand Down
3 changes: 3 additions & 0 deletions .CMake/toolchain_windows-amd64.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: MIT

# How to use:
# apt install gcc-mingw-w64
# cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain_windows-amd64.cmake ..

Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

cmake_minimum_required (VERSION 3.5)
# option() honors normal variables.
# see: https://cmake.org/cmake/help/git-stage/policy/CMP0077.html
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,15 @@ liboqs is licensed under the MIT License; see [LICENSE.txt](https://github.com/o
liboqs includes some third party libraries or modules that are licensed differently; the corresponding subfolder contains the license that applies in that case. In particular:

- `.CMake/CMakeDependentOption.cmake`: BSD 3-Clause License
- `src/crypto/aes/aes_c.c`: public domain
- `src/crypto/sha2/sha2_c.c`: public domain
- `src/crypto/sha3/fips202.c`: CC0 (public domain)
- `src/crypto/sha3/keccak4x`: CC0 (public domain), except `brg_endian.h`
- `src/kem/bike/x86_64`: Apache License v2.0
- `src/common/common.c`: includes portions which are Apache License v2.0
- `src/common/crypto/aes/aes_c.c`: public domain or any OSI-approved license
- `src/common/crypto/sha2/sha2_c.c`: public domain
- `src/common/crypto/sha3/fips202.c`: public domain
- `src/common/crypto/sha3/keccak4x`: CC0 (public domain), except `brg_endian.h`
- `src/kem/bike/additional`: Apache License v2.0
- `src/kem/classic_mceliece/pqclean_*`: public domain
- `src/kem/kyber/pqclean_*`: public domain
- `src/kem/ledacrypt/pqclean_*`: public domain
- `src/kem/newhope/pqclean_*`: public domain
- `src/kem/ntru/pqclean_*`: public domain
- `src/kem/saber/pqclean_*`: public domain
Expand Down
3 changes: 3 additions & 0 deletions scripts/build-android.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

# SPDX-License-Identifier: MIT

set -e

show_help() {
Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/copy_from_pqclean.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

# SPDX-License-Identifier: MIT

import copy
import glob
import jinja2
Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/kem/family/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

# This file was generated by
# scripts/copy_from_pqclean/copy_from_pqclean.py
{%- for scheme in schemes -%}
Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/kem/family/kem_family.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef OQS_KEM_{{ family|upper }}_H
#define OQS_KEM_{{ family|upper }}_H

Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/kem/family/kem_scheme.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <stdlib.h>

#include <oqs/kem_{{ family }}.h>
Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/sig/family/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

# This file was generated by
# scripts/copy_from_pqclean/copy_from_pqclean.py
{%- for scheme in schemes -%}
Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/sig/family/sig_family.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef OQS_SIG_{{ family|upper }}_H
#define OQS_SIG_{{ family|upper }}_H

Expand Down
2 changes: 2 additions & 0 deletions scripts/copy_from_pqclean/src/sig/family/sig_scheme.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <stdlib.h>

#include <oqs/sig_{{ family }}.h>
Expand Down
2 changes: 2 additions & 0 deletions scripts/git_commit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# SPDX-License-Identifier: MIT

# Get the SHA-1 hash of the current git commit, if any
# based on https://stackoverflow.com/questions/8215785/how-can-i-use-ac-revision-with-git

Expand Down
2 changes: 2 additions & 0 deletions scripts/git_no_checkin_in_last_day.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# SPDX-License-Identifier: MIT

# Detects whether there has been a Git commit in the last day on this
# branch. Returns 1 if there has been a commit, 0 if there has not.
# Always returns 1 if running in circleci local
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

add_subdirectory(common)

if(OQS_ENABLE_KEM_BIKE)
Expand Down
2 changes: 2 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: MIT

if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wbad-function-cast)
Expand Down
2 changes: 2 additions & 0 deletions src/common/aes/aes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* \file aes.h
* \brief Header defining the API for OQS AES
*
* SPDX-License-Identifier: MIT
*/

#ifndef OQS_AES_H
Expand Down
1 change: 1 addition & 0 deletions src/common/aes/aes_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// http://en.wikipedia.org/wiki/Rijndael_mix_columns
// http://en.wikipedia.org/wiki/Rijndael_S-box
// This code is public domain, or any OSI-approved license, your choice. No warranty.
// SPDX-License-Identifier: MIT

#include <assert.h>
#include <stdio.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/aes/aes_ossl.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <assert.h>
#include <string.h>

Expand Down
9 changes: 5 additions & 4 deletions src/common/common.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 AND MIT

#include <oqs/common.h>

#include <stdint.h>
Expand All @@ -15,13 +17,12 @@ static unsigned int available_cpu_extensions_set = 0;

#if defined(ARCH_X86_64)

/* The code here, including x86_64_helpers.h, has been taken from:
* https://github.com/vectorclass/version2
* https://github.com/google/cpu_features/blob/master/src/cpuinfo_x86.c
*/

#include "x86_64_helpers.h"

/* set_available_cpu_extensions_x86_64() has been written using:
* https://github.com/google/cpu_features/blob/master/src/cpuinfo_x86.c
*/
static void set_available_cpu_extensions_x86_64(void) {
cpuid_out leaf_1;
cpuid(&leaf_1, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/common/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* \file common.h
* \brief Utility functions for use in liboqs.
*
* SPDX-License-Identifier: MIT
*/


Expand Down
2 changes: 2 additions & 0 deletions src/common/pqclean_shims/aes.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef AES_H
#define AES_H

Expand Down
2 changes: 2 additions & 0 deletions src/common/pqclean_shims/fips202.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef FIPS202_H
#define FIPS202_H

Expand Down
2 changes: 2 additions & 0 deletions src/common/pqclean_shims/randombytes.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef RANDOMBYTES_H
#define RANDOMBYTES_H

Expand Down
2 changes: 2 additions & 0 deletions src/common/pqclean_shims/sha2.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef SHA2_H
#define SHA2_H

Expand Down
2 changes: 2 additions & 0 deletions src/common/pqclean_shims/sp800-185.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#ifndef SP800_185_H
#define SP800_185_H

Expand Down
2 changes: 2 additions & 0 deletions src/common/rand/rand.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <stdio.h>
#if defined(_WIN32)
#include <windows.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/rand/rand.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* \file rand.h
* \brief Random number generator.
*
* SPDX-License-Identifier: MIT
*/

#ifndef OQS_RANDOM_H
Expand Down
1 change: 1 addition & 0 deletions src/common/rand/rand_nist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
// Created by Bassham, Lawrence E (Fed) on 8/29/17.
// Copyright © 2017 Bassham, Lawrence E (Fed). All rights reserved.
// SPDX-License-Identifier: Unknown
// Modified for liboqs by Douglas Stebila
//

Expand Down
2 changes: 2 additions & 0 deletions src/common/sha2/sha2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* functions, but external consumers of liboqs should not use these functions.</b>
*
* \author Douglas Stebila
*
* SPDX-License-Identifier: MIT
*/

#ifndef OQS_SHA2_H
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha2/sha2_c.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Public domain

#include <oqs/oqs.h>

#include "sha2.h"
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha2/sha2_ossl.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* \file sha2_ossl.c
* \brief Implementation of the OQS SHA2 API via calls to OpenSSL's SHA-2 functions
*
* SPDX-License-Identifier: MIT
*/

#include <oqs/oqs.h>
Expand Down
4 changes: 3 additions & 1 deletion src/common/sha3/fips202.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* by Ronny Van Keer
* and the public domain "TweetFips202" implementation
* from https://twitter.com/tweetfips202
* by Gilles Van Assche, Daniel J. Bernstein, and Peter Schwabe */
* by Gilles Van Assche, Daniel J. Bernstein, and Peter Schwabe
* SPDX-License-Identifier: Public domain
*/

#include <stddef.h>
#include <stdint.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/KeccakP-1600-times4-SIMD256.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For more information, feedback or questions, please refer to our websites:
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
SPDX-License-Identifier: CC0-1.0
*/

/* Simplified for liboqs: remove code that wasn't used in shake128_4x */
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/KeccakP-1600-times4-SnP.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For more information, feedback or questions, please refer to our websites:
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
SPDX-License-Identifier: CC0-1.0
*/

/* Simplified for liboqs: remove code that wasn't used in shake128_4x */
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/KeccakP-1600-unrolling.macros
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ http://ketje.noekeon.org/
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/

SPDX-License-Identifier: CC0-1.0
*/

#if (defined(FullUnrolling))
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/SIMD256-config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: CC0-1.0

#define KeccakP1600times4_implementation_config "AVX2, all rounds unrolled"
#define KeccakP1600times4_fullUnrolling
#define KeccakP1600times4_useAVX2
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/align.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For more information, feedback or questions, please refer to our websites:
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
SPDX-License-Identifier: CC0-1.0
*/

#ifndef _align_h_
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/keccak4x/brg_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
---------------------------------------------------------------------------
Issue Date: 20/12/2007
Changes for ARM 9/9/2010
SPDX-License-Identifier: Unknown
*/

#ifndef _BRG_ENDIAN_H
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/sha3.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* functions, but external consumers of liboqs should not use these functions.</b>
*
* \author John Underhill, Douglas Stebila
*
* SPDX-License-Identifier: MIT
*/

#ifndef OQS_SHA3_H
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/sha3_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* \file sha3_c.c
* \brief Implementation of the OQS SHA3 API via the files fips202.c
* from PQClean (https://github.com/PQClean/PQClean/tree/master/common)
*
* SPDX-License-Identifier: MIT
*/

#include <oqs/oqs.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/sha3_ossl.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* \file sha3_ossl.c
* \brief Implementation of the OQS SHA3 API via calls to OpenSSL's SHA-3 functions
*
* SPDX-License-Identifier: MIT
*/

#include <oqs/oqs.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/sha3x4.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <immintrin.h>
#include <stdint.h>
#include <assert.h>
Expand Down
2 changes: 2 additions & 0 deletions src/common/sha3/sp800-185.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: MIT

#include <stddef.h>
#include <stdint.h>

Expand Down
6 changes: 6 additions & 0 deletions src/common/x86_64_helpers.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* This file has been written using:
* https://github.com/vectorclass/version2/blob/master/instrset_detect.cpp
* https://github.com/google/cpu_features/blob/master/src/cpuinfo_x86.c
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdint.h>

#if defined(_MSC_VER)
Expand Down
Loading

0 comments on commit 6e0b0d7

Please sign in to comment.