Add Apache-2.0 headers to all source files
Also normalize the first line of the copyright headers.
This commit was generated using the following script:
# ========================
#!/bin/sh
# Find scripts
find -path './.git' -prune -o '(' -name '*.c' -o -name '*.cpp' -o -name '*.fmt' -o -name '*.h' ')' -print | xargs sed -i '
# Normalize the first line of the copyright headers (no text on the first line of a block comment)
/^\/\*.*Copyright.*Arm/I {
i\
/*
s/^\// /
}
/Copyright.*Arm/I {
# Print copyright declaration
p
# Read the two lines immediately following the copyright declaration
N
N
# Insert Apache header if it is missing
/SPDX/! i\
* SPDX-License-Identifier: Apache-2.0\
*\
* Licensed under the Apache License, Version 2.0 (the "License"); you may\
* not use this file except in compliance with the License.\
* You may obtain a copy of the License at\
*\
* http://www.apache.org/licenses/LICENSE-2.0\
*\
* Unless required by applicable law or agreed to in writing, software\
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\
* See the License for the specific language governing permissions and\
* limitations under the License.
# Clear copyright declaration from buffer
D
}
'
# ========================
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
diff --git a/include/mbedtls/aes.h b/include/mbedtls/aes.h
index 63c0f67..151affd 100644
--- a/include/mbedtls/aes.h
+++ b/include/mbedtls/aes.h
@@ -20,7 +20,8 @@
* <https://ieeexplore.ieee.org/servlet/opac?punumber=4375278>.
*/
-/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
+/*
+ * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/include/mbedtls/aria.h b/include/mbedtls/aria.h
index a72a8c2..f99e76f 100644
--- a/include/mbedtls/aria.h
+++ b/include/mbedtls/aria.h
@@ -9,7 +9,8 @@
* Korean, but see http://210.104.33.10/ARIA/index-e.html in English)
* and also described by the IETF in <em>RFC 5794</em>.
*/
-/* Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/include/mbedtls/chacha20.h b/include/mbedtls/chacha20.h
index 243ae63..696d400 100644
--- a/include/mbedtls/chacha20.h
+++ b/include/mbedtls/chacha20.h
@@ -12,7 +12,8 @@
* \author Daniel King <damaki.gh@gmail.com>
*/
-/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
+/*
+ * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/include/mbedtls/chachapoly.h b/include/mbedtls/chachapoly.h
index 3d842ef..97f1c58 100644
--- a/include/mbedtls/chachapoly.h
+++ b/include/mbedtls/chachapoly.h
@@ -12,7 +12,8 @@
* \author Daniel King <damaki.gh@gmail.com>
*/
-/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
+/*
+ * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/include/mbedtls/poly1305.h b/include/mbedtls/poly1305.h
index 05866a2..4a3e354 100644
--- a/include/mbedtls/poly1305.h
+++ b/include/mbedtls/poly1305.h
@@ -12,7 +12,8 @@
* \author Daniel King <damaki.gh@gmail.com>
*/
-/* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
+/*
+ * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 6932318..3dc3b86 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1,7 +1,8 @@
/*
* PSA crypto layer on top of Mbed TLS crypto
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index edf3ab6..ef40f79 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -1,7 +1,8 @@
/*
* PSA crypto core internal interfaces
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_its.h b/library/psa_crypto_its.h
index 3809787..e2b7466 100644
--- a/library/psa_crypto_its.h
+++ b/library/psa_crypto_its.h
@@ -1,7 +1,8 @@
/** \file psa_crypto_its.h
* \brief Interface of trusted storage that crypto is built on.
*/
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_se.c b/library/psa_crypto_se.c
index 087c768..53a2600 100644
--- a/library/psa_crypto_se.c
+++ b/library/psa_crypto_se.c
@@ -1,7 +1,8 @@
/*
* PSA crypto support for secure element drivers
*/
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_se.h b/library/psa_crypto_se.h
index c145065..3c29b12 100644
--- a/library/psa_crypto_se.h
+++ b/library/psa_crypto_se.h
@@ -1,7 +1,8 @@
/*
* PSA crypto support for secure element drivers
*/
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_service_integration.h b/library/psa_crypto_service_integration.h
index 938bfe1..c129c8e 100644
--- a/library/psa_crypto_service_integration.h
+++ b/library/psa_crypto_service_integration.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 6cd6a11..8ffb5a0 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -1,7 +1,8 @@
/*
* PSA crypto layer on top of Mbed TLS crypto
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_slot_management.h b/library/psa_crypto_slot_management.h
index 472253d..6cb02f5 100644
--- a/library/psa_crypto_slot_management.h
+++ b/library/psa_crypto_slot_management.h
@@ -1,7 +1,8 @@
/*
* PSA crypto layer on top of Mbed TLS crypto
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_crypto_storage.c b/library/psa_crypto_storage.c
index fa1214c..f12fe00 100644
--- a/library/psa_crypto_storage.c
+++ b/library/psa_crypto_storage.c
@@ -1,7 +1,8 @@
/*
* PSA persistent key storage
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/library/psa_its_file.c b/library/psa_its_file.c
index 0935b27..86e2c42 100644
--- a/library/psa_its_file.c
+++ b/library/psa_its_file.c
@@ -1,7 +1,8 @@
/*
* PSA ITS simulator over stdio files.
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/programs/psa/crypto_examples.c b/programs/psa/crypto_examples.c
index 88e34d1..97beb0e 100644
--- a/programs/psa/crypto_examples.c
+++ b/programs/psa/crypto_examples.c
@@ -1,5 +1,18 @@
/*
* Copyright (C) 2018-2019, ARM Limited, All Rights Reserved
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
diff --git a/programs/psa/key_ladder_demo.c b/programs/psa/key_ladder_demo.c
index 1dbbc81..b633f75 100644
--- a/programs/psa/key_ladder_demo.c
+++ b/programs/psa/key_ladder_demo.c
@@ -30,7 +30,8 @@
* `key_ladder_demo.sh` for an example run.
*/
-/* Copyright (C) 2018, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2018, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/programs/psa/psa_constant_names.c b/programs/psa/psa_constant_names.c
index e22791c..964e7b3 100644
--- a/programs/psa/psa_constant_names.c
+++ b/programs/psa/psa_constant_names.c
@@ -1,5 +1,18 @@
/*
* Copyright (C) 2018-2019, ARM Limited, All Rights Reserved
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h
index 36b9e72..36ec8e6 100644
--- a/tests/include/test/helpers.h
+++ b/tests/include/test/helpers.h
@@ -5,7 +5,8 @@
* purpose of testing.
*/
-/* Copyright (C) 2020, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2020, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h
index 25f8312..aaf13ad 100644
--- a/tests/include/test/macros.h
+++ b/tests/include/test/macros.h
@@ -4,7 +4,8 @@
* \brief This file contains generic macros for the purpose of testing.
*/
-/* Copyright (C) 2020, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2020, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h
index 1dd6084..8cd361f 100644
--- a/tests/include/test/psa_crypto_helpers.h
+++ b/tests/include/test/psa_crypto_helpers.h
@@ -1,7 +1,8 @@
/*
* Helper functions for tests that use the PSA Crypto API.
*/
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/include/test/psa_helpers.h b/tests/include/test/psa_helpers.h
index 79f6837..352ae67 100644
--- a/tests/include/test/psa_helpers.h
+++ b/tests/include/test/psa_helpers.h
@@ -1,7 +1,8 @@
/*
* Helper functions for tests that use any PSA API.
*/
-/* Copyright (C) 2019, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/include/test/random.h b/tests/include/test/random.h
index dfdefa6..e085f16 100644
--- a/tests/include/test/random.h
+++ b/tests/include/test/random.h
@@ -5,7 +5,8 @@
* random numbers for the purpose of testing.
*/
-/* Copyright (C) 2020, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2020, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index f0c27c3..08d88a5 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2020, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2020, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tests/src/random.c b/tests/src/random.c
index 25fa4cf..3345f78 100644
--- a/tests/src/random.c
+++ b/tests/src/random.c
@@ -5,7 +5,8 @@
* for the purpose of testing.
*/
-/* Copyright (C) 2020, ARM Limited, All Rights Reserved
+/*
+ * Copyright (C) 2020, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may