diff mbox series

[2/3] crypto: arm - add some missing SPDX headers

Message ID 20230606173127.4050254-3-ardb@kernel.org
State New
Headers show
Series crypto - some SPDX cleanups for arch code | expand

Commit Message

Ard Biesheuvel June 6, 2023, 5:31 p.m. UTC
Add some missing SPDX headers, and drop the associated boilerplate
license text to/from the ARM implementations of ChaCha, CRC-32 and
CRC-T10DIF.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm/crypto/chacha-neon-core.S  | 10 +----
 arch/arm/crypto/crc32-ce-core.S     | 30 ++-------------
 arch/arm/crypto/crct10dif-ce-core.S | 40 +-------------------
 3 files changed, 5 insertions(+), 75 deletions(-)

Comments

Bagas Sanjaya June 10, 2023, 7:30 a.m. UTC | #1
[also Cc'ing Richard]

On Tue, Jun 06, 2023 at 07:31:26PM +0200, Ard Biesheuvel wrote:
> Add some missing SPDX headers, and drop the associated boilerplate
> license text to/from the ARM implementations of ChaCha, CRC-32 and
> CRC-T10DIF.
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/arm/crypto/chacha-neon-core.S  | 10 +----
>  arch/arm/crypto/crc32-ce-core.S     | 30 ++-------------
>  arch/arm/crypto/crct10dif-ce-core.S | 40 +-------------------
>  3 files changed, 5 insertions(+), 75 deletions(-)
> 
> diff --git a/arch/arm/crypto/chacha-neon-core.S b/arch/arm/crypto/chacha-neon-core.S
> index 13d12f672656bb8d..46d708118ef948ec 100644
> --- a/arch/arm/crypto/chacha-neon-core.S
> +++ b/arch/arm/crypto/chacha-neon-core.S
> @@ -1,21 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  /*
>   * ChaCha/XChaCha NEON helper functions
>   *
>   * Copyright (C) 2016 Linaro, Ltd. <ard.biesheuvel@linaro.org>
>   *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
>   * Based on:
>   * ChaCha20 256-bit cipher algorithm, RFC7539, x64 SSE3 functions
>   *
>   * Copyright (C) 2015 Martin Willi
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
>   */

I think above makes sense, since I had to pick the most restrictive one
to satisfy both license option (GPL-2.0+ or GPL-2.0-only).

>  
>   /*
> diff --git a/arch/arm/crypto/crc32-ce-core.S b/arch/arm/crypto/crc32-ce-core.S
> index 3f13a76b9066e0f6..228a1f298f24d3d0 100644
> --- a/arch/arm/crypto/crc32-ce-core.S
> +++ b/arch/arm/crypto/crc32-ce-core.S
> @@ -1,37 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  /*
>   * Accelerated CRC32(C) using ARM CRC, NEON and Crypto Extensions instructions
>   *
>   * Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - */
> -
> -/* GPL HEADER START
> - *
> - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 only,
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful, but
> - * WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> - * General Public License version 2 for more details (a copy is included
> - * in the LICENSE file that accompanied this code).
> - *
> - * You should have received a copy of the GNU General Public License
> - * version 2 along with this program; If not, see http://www.gnu.org/licenses
> - *
> - * Please  visit http://www.xyratex.com/contact if you need additional
> - * information or have any questions.
> - *
> - * GPL HEADER END
>   */

Removing second boilerplate for which the text says it musn't be removed?

>  
>  /*
> + * Derived from the x86 SSE version:
> + *
>   * Copyright 2012 Xyratex Technology Limited
>   *
>   * Using hardware provided PCLMULQDQ instruction to accelerate the CRC32
> diff --git a/arch/arm/crypto/crct10dif-ce-core.S b/arch/arm/crypto/crct10dif-ce-core.S
> index 46c02c518a300ab0..5d24448fae1ccacb 100644
> --- a/arch/arm/crypto/crct10dif-ce-core.S
> +++ b/arch/arm/crypto/crct10dif-ce-core.S
> @@ -1,13 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */
>  //
>  // Accelerated CRC-T10DIF using ARM NEON and Crypto Extensions instructions
>  //
>  // Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org>
>  // Copyright (C) 2019 Google LLC <ebiggers@google.com>
>  //
> -// This program is free software; you can redistribute it and/or modify
> -// it under the terms of the GNU General Public License version 2 as
> -// published by the Free Software Foundation.
> -//
>  
>  // Derived from the x86 version:
>  //
> @@ -21,41 +18,6 @@
>  //     James Guilford <james.guilford@intel.com>
>  //     Tim Chen <tim.c.chen@linux.intel.com>
>  //
> -// This software is available to you under a choice of one of two
> -// licenses.  You may choose to be licensed under the terms of the GNU
> -// General Public License (GPL) Version 2, available from the file
> -// COPYING in the main directory of this source tree, or the
> -// OpenIB.org BSD license below:
> -//
> -// 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 the above copyright
> -//   notice, 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 Intel Corporation nor the names of its
> -//   contributors may be used to endorse or promote products derived from
> -//   this software without specific prior written permission.
> -//
> -//
> -// THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""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 INTEL CORPORATION 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.
> -//

This dual BSD/GPL one LGTM.

Thanks.
Richard Fontana June 20, 2023, 3:50 a.m. UTC | #2
On Sat, Jun 10, 2023 at 3:31 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> [also Cc'ing Richard]
>
> On Tue, Jun 06, 2023 at 07:31:26PM +0200, Ard Biesheuvel wrote:
> > Add some missing SPDX headers, and drop the associated boilerplate
> > license text to/from the ARM implementations of ChaCha, CRC-32 and
> > CRC-T10DIF.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  arch/arm/crypto/chacha-neon-core.S  | 10 +----
> >  arch/arm/crypto/crc32-ce-core.S     | 30 ++-------------
> >  arch/arm/crypto/crct10dif-ce-core.S | 40 +-------------------
> >  3 files changed, 5 insertions(+), 75 deletions(-)
> >
> > diff --git a/arch/arm/crypto/chacha-neon-core.S b/arch/arm/crypto/chacha-neon-core.S
> > index 13d12f672656bb8d..46d708118ef948ec 100644
> > --- a/arch/arm/crypto/chacha-neon-core.S
> > +++ b/arch/arm/crypto/chacha-neon-core.S
> > @@ -1,21 +1,13 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> >  /*
> >   * ChaCha/XChaCha NEON helper functions
> >   *
> >   * Copyright (C) 2016 Linaro, Ltd. <ard.biesheuvel@linaro.org>
> >   *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - *
> >   * Based on:
> >   * ChaCha20 256-bit cipher algorithm, RFC7539, x64 SSE3 functions
> >   *
> >   * Copyright (C) 2015 Martin Willi
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License as published by
> > - * the Free Software Foundation; either version 2 of the License, or
> > - * (at your option) any later version.
> >   */
>
> I think above makes sense, since I had to pick the most restrictive one
> to satisfy both license option (GPL-2.0+ or GPL-2.0-only).

I am not sure "had to pick the most restrictive one" is necessarily
correct - the kernel could adopt that approach but I don't think
there's any reason why you can't have multiple
SPDX-License-Identifier: lines in a single source file, and it is also
syntactically valid to use
SPDX-License-Identifier: GPL-2.0-only AND GPL-2.0-or-later

Richard
Ard Biesheuvel June 23, 2023, 6:37 p.m. UTC | #3
On Tue, 20 Jun 2023 at 05:50, Richard Fontana <rfontana@redhat.com> wrote:
>
> On Sat, Jun 10, 2023 at 3:31 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> >
> > [also Cc'ing Richard]
> >
> > On Tue, Jun 06, 2023 at 07:31:26PM +0200, Ard Biesheuvel wrote:
> > > Add some missing SPDX headers, and drop the associated boilerplate
> > > license text to/from the ARM implementations of ChaCha, CRC-32 and
> > > CRC-T10DIF.
> > >
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > ---
> > >  arch/arm/crypto/chacha-neon-core.S  | 10 +----
> > >  arch/arm/crypto/crc32-ce-core.S     | 30 ++-------------
> > >  arch/arm/crypto/crct10dif-ce-core.S | 40 +-------------------
> > >  3 files changed, 5 insertions(+), 75 deletions(-)
> > >
> > > diff --git a/arch/arm/crypto/chacha-neon-core.S b/arch/arm/crypto/chacha-neon-core.S
> > > index 13d12f672656bb8d..46d708118ef948ec 100644
> > > --- a/arch/arm/crypto/chacha-neon-core.S
> > > +++ b/arch/arm/crypto/chacha-neon-core.S
> > > @@ -1,21 +1,13 @@
> > > +/* SPDX-License-Identifier: GPL-2.0-only */
> > >  /*
> > >   * ChaCha/XChaCha NEON helper functions
> > >   *
> > >   * Copyright (C) 2016 Linaro, Ltd. <ard.biesheuvel@linaro.org>
> > >   *
> > > - * This program is free software; you can redistribute it and/or modify
> > > - * it under the terms of the GNU General Public License version 2 as
> > > - * published by the Free Software Foundation.
> > > - *
> > >   * Based on:
> > >   * ChaCha20 256-bit cipher algorithm, RFC7539, x64 SSE3 functions
> > >   *
> > >   * Copyright (C) 2015 Martin Willi
> > > - *
> > > - * This program is free software; you can redistribute it and/or modify
> > > - * it under the terms of the GNU General Public License as published by
> > > - * the Free Software Foundation; either version 2 of the License, or
> > > - * (at your option) any later version.
> > >   */
> >
> > I think above makes sense, since I had to pick the most restrictive one
> > to satisfy both license option (GPL-2.0+ or GPL-2.0-only).
>
> I am not sure "had to pick the most restrictive one" is necessarily
> correct - the kernel could adopt that approach but I don't think
> there's any reason why you can't have multiple
> SPDX-License-Identifier: lines in a single source file, and it is also
> syntactically valid to use
> SPDX-License-Identifier: GPL-2.0-only AND GPL-2.0-or-later
>

For the record, my reasoning was that my code (which is a rewrite of
the algorithm using a completely different ISA) is the derived work,
and I am permitted to exercise my right granted by the original work
to redistribute it under the GPLv2. So this is why the 'outer' license
(as well a the SPDX header) is GPLv2 only.

I didn't expect there to be a requirement for SPDX to describe the
original licenses of all the constituent parts.

In any case, I am going to take Greg's advice and not pursue this any
further - if anyone needs this cleaned up, they can do it themselves.

Thanks for the education on this topic, I'll know better next time :-)
diff mbox series

Patch

diff --git a/arch/arm/crypto/chacha-neon-core.S b/arch/arm/crypto/chacha-neon-core.S
index 13d12f672656bb8d..46d708118ef948ec 100644
--- a/arch/arm/crypto/chacha-neon-core.S
+++ b/arch/arm/crypto/chacha-neon-core.S
@@ -1,21 +1,13 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * ChaCha/XChaCha NEON helper functions
  *
  * Copyright (C) 2016 Linaro, Ltd. <ard.biesheuvel@linaro.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
  * Based on:
  * ChaCha20 256-bit cipher algorithm, RFC7539, x64 SSE3 functions
  *
  * Copyright (C) 2015 Martin Willi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 
  /*
diff --git a/arch/arm/crypto/crc32-ce-core.S b/arch/arm/crypto/crc32-ce-core.S
index 3f13a76b9066e0f6..228a1f298f24d3d0 100644
--- a/arch/arm/crypto/crc32-ce-core.S
+++ b/arch/arm/crypto/crc32-ce-core.S
@@ -1,37 +1,13 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Accelerated CRC32(C) using ARM CRC, NEON and Crypto Extensions instructions
  *
  * Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-/* GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see http://www.gnu.org/licenses
- *
- * Please  visit http://www.xyratex.com/contact if you need additional
- * information or have any questions.
- *
- * GPL HEADER END
  */
 
 /*
+ * Derived from the x86 SSE version:
+ *
  * Copyright 2012 Xyratex Technology Limited
  *
  * Using hardware provided PCLMULQDQ instruction to accelerate the CRC32
diff --git a/arch/arm/crypto/crct10dif-ce-core.S b/arch/arm/crypto/crct10dif-ce-core.S
index 46c02c518a300ab0..5d24448fae1ccacb 100644
--- a/arch/arm/crypto/crct10dif-ce-core.S
+++ b/arch/arm/crypto/crct10dif-ce-core.S
@@ -1,13 +1,10 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */
 //
 // Accelerated CRC-T10DIF using ARM NEON and Crypto Extensions instructions
 //
 // Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org>
 // Copyright (C) 2019 Google LLC <ebiggers@google.com>
 //
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
 
 // Derived from the x86 version:
 //
@@ -21,41 +18,6 @@ 
 //     James Guilford <james.guilford@intel.com>
 //     Tim Chen <tim.c.chen@linux.intel.com>
 //
-// This software is available to you under a choice of one of two
-// licenses.  You may choose to be licensed under the terms of the GNU
-// General Public License (GPL) Version 2, available from the file
-// COPYING in the main directory of this source tree, or the
-// OpenIB.org BSD license below:
-//
-// 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 the above copyright
-//   notice, 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 Intel Corporation nor the names of its
-//   contributors may be used to endorse or promote products derived from
-//   this software without specific prior written permission.
-//
-//
-// THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""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 INTEL CORPORATION 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.
-//
 //       Reference paper titled "Fast CRC Computation for Generic
 //	Polynomials Using PCLMULQDQ Instruction"
 //       URL: http://www.intel.com/content/dam/www/public/us/en/documents