Remove org.bouncycastle dependency (#8664)

Remove `org.bouncycastle` dependency from `org.enso.runtime`.
This commit is contained in:
Pavel Marek 2024-01-04 17:16:41 +01:00 committed by GitHub
parent bbf71ec4f1
commit 428e83de36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 50 additions and 155 deletions

View File

@ -552,7 +552,6 @@ lazy val `text-buffer` = project
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
)
@ -1296,13 +1295,9 @@ lazy val `language-server` = (project in file("engine/language-server"))
),
Test / modulePath := {
val updateReport = (Test / update).value
// org.bouncycastle is a module required by `org.enso.runtime` module.
val requiredModIds =
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.bouncycastle" % "bcutil-jdk18on" % "1.76",
"org.bouncycastle" % "bcpkix-jdk18on" % "1.76",
"org.bouncycastle" % "bcprov-jdk18on" % "1.76"
"org.slf4j" % "slf4j-api" % slf4jVersion
)
val requiredMods = JPMSUtils.filterModulesFromUpdate(
updateReport,
@ -1976,14 +1971,7 @@ lazy val `runtime-fat-jar` =
assembly / test := {},
assembly / assemblyOutputPath := file("runtime.jar"),
assembly / assemblyExcludedJars := {
// bouncycastle jdk5 needs to be excluded from the Uber jar, as otherwise its packages would
// clash with packages in org.bouncycastle.jdk18 modules
val bouncyCastleJdk5 = Seq(
"org.bouncycastle" % "bcutil-jdk15on" % bcpkixJdk15Version,
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
"org.bouncycastle" % "bcprov-jdk15on" % bcpkixJdk15Version
)
val pkgsToExclude = JPMSUtils.componentModules ++ bouncyCastleJdk5
val pkgsToExclude = JPMSUtils.componentModules
val ourFullCp = (Runtime / fullClasspath).value
JPMSUtils.filterModulesFromClasspath(
ourFullCp,

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'enumeratum-circe_2.13', licensed under the MIT, is distributed with the engine.
The license information can be found along with the copyright notices.
@ -286,31 +286,16 @@ The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `org.apache.tika.tika-core-2.4.1`.
'bcpkix-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcpkix-jdk15on-1.70`.
'bcpkix-jdk18on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcpkix-jdk18on-1.76`.
'bcprov-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcprov-jdk15on-1.70`.
'bcprov-jdk18on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcprov-jdk18on-1.76`.
'bcutil-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcutil-jdk15on-1.70`.
'bcutil-jdk18on', licensed under the Bouncy Castle Licence, is distributed with the engine.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcutil-jdk18on-1.76`.

View File

@ -1,2 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,36 +0,0 @@
/* Partially optimised Serpent S Box boolean functions derived */
/* using a recursive descent analyser but without a full search */
/* of all subtrees. This set of S boxes is the result of work */
/* by Sam Simpson and Brian Gladman using the spare time on a */
/* cluster of high capacity servers to search for S boxes with */
/* this customised search engine. There are now an average of */
/* 15.375 terms per S box. */
/* */
/* Copyright: Dr B. R Gladman (gladman@seven77.demon.co.uk) */
/* and Sam Simpson (s.simpson@mia.co.uk) */
/* 17th December 1998 */
/* */
/* We hereby give permission for information in this file to be */
/* used freely subject only to acknowledgement of its origin. */
/**
* The Bouncy Castle License
*
* Copyright (c) 2000-2021 The Legion Of The Bouncy Castle Inc. (https://www.bouncycastle.org)
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

View File

@ -1,2 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'redshift-jdbc42', licensed under the Apache License, Version 2.0, is distributed with the AWS.
The license information can be found along with the copyright notices.

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'icu4j', licensed under the Unicode/ICU License, is distributed with the Base.
The license information can be found along with the copyright notices.

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'checker-qual', licensed under the The MIT License, is distributed with the Database.
The license information can be found along with the copyright notices.

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'google-api-client', licensed under the The Apache Software License, Version 2.0, is distributed with the Google_Api.
The license file can be found at `licenses/APACHE2.0`.

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'opencv', licensed under the BSD License, is distributed with the Image.
The license file can be found at `licenses/BSD-3-Clause`.

View File

@ -1,5 +1,5 @@
Enso
Copyright 2020 - 2023 New Byte Order sp. z o. o.
Copyright 2020 - 2024 New Byte Order sp. z o. o.
'curvesapi', licensed under the BSD License, is distributed with the Table.
The license file can be found at `licenses/BSD-3-Clause`.

View File

@ -246,21 +246,6 @@ The license information can be found along with the copyright notices.
Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-lang3-3.12.0`.
'bcpkix-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the project-manager.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcpkix-jdk15on-1.70`.
'bcprov-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the project-manager.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcprov-jdk15on-1.70`.
'bcutil-jdk15on', licensed under the Bouncy Castle Licence, is distributed with the project-manager.
The license file can be found at `licenses/Bouncy_Castle_Licence.txt`.
Copyright notices related to this dependency can be found in the directory `org.bouncycastle.bcutil-jdk15on-1.70`.
'polyglot', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`.
Copyright notices related to this dependency can be found in the directory `org.graalvm.polyglot.polyglot-23.1.0`.

View File

@ -1,7 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,2 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,16 +0,0 @@
/* Partially optimised Serpent S Box boolean functions derived */
/* using a recursive descent analyser but without a full search */
/* of all subtrees. This set of S boxes is the result of work */
/* by Sam Simpson and Brian Gladman using the spare time on a */
/* cluster of high capacity servers to search for S boxes with */
/* this customised search engine. There are now an average of */
/* 15.375 terms per S box. */
/* */
/* Copyright: Dr B. R Gladman (gladman@seven77.demon.co.uk) */
/* and Sam Simpson (s.simpson@mia.co.uk) */
/* 17th December 1998 */
/* */
/* We hereby give permission for information in this file to be */
/* used freely subject only to acknowledgement of its origin. */
Copyright (c) 2000-2021 The Legion Of The Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,2 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -4,12 +4,12 @@ import akka.actor.{Actor, Props}
import akka.pattern.pipe
import akka.routing.SmallestMailboxPool
import com.typesafe.scalalogging.LazyLogging
import org.bouncycastle.util.encoders.Hex
import org.enso.languageserver.data.FileManagerConfig
import org.enso.languageserver.effect._
import org.enso.languageserver.filemanager.FileManagerProtocol.TextualFileContent
import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
import org.enso.languageserver.util.UnhandledLogging
import org.enso.text.Hex
import zio._
import java.io.File

View File

@ -8,7 +8,6 @@ open module org.enso.runtime {
requires org.graalvm.polyglot;
requires org.graalvm.truffle;
requires static org.slf4j;
requires org.bouncycastle.provider;
uses org.slf4j.spi.SLF4JServiceProvider;

View File

@ -10,15 +10,15 @@ import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import org.bouncycastle.jcajce.provider.digest.SHA1;
import org.bouncycastle.util.encoders.Hex;
import org.enso.interpreter.runtime.EnsoContext;
import org.enso.logger.masking.MaskedPath;
import org.enso.pkg.SourceFile;
import org.enso.text.Hex;
/**
* Cache encapsulates a common functionality needed to serialize and de-serialize objects, while
@ -393,7 +393,11 @@ public abstract class Cache<T, M extends Cache.Metadata> {
* @return digest used for computing hashes
*/
protected MessageDigest messageDigest() {
return new SHA1.Digest();
try {
return MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException ex) {
throw new IllegalStateException("Unreachable", ex);
}
}
/**

View File

@ -0,0 +1,18 @@
package org.enso.text;
/**
* A utility class that serves as a replacement of some methods from {@code org.bouncycastle}, so
* that we don't have to depend on it.
*/
public final class Hex {
/** Converts the byte array to its hexadecimal String representation. */
public static String toHexString(byte[] bytes) {
char[] out = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
int v = bytes[i] & 0xFF;
out[i * 2] = Character.forDigit(v >>> 4, 16);
out[i * 2 + 1] = Character.forDigit(v & 0x0F, 16);
}
return new String(out);
}
}

View File

@ -1,7 +1,5 @@
package org.enso.text
import org.bouncycastle.util.encoders.Hex
/** Version of the text contents. */
case class ContentVersion(toHexString: String)

View File

@ -2,14 +2,14 @@ package org.enso.text
import java.nio.charset.StandardCharsets
import org.bouncycastle.jcajce.provider.digest.SHA3
import java.security.MessageDigest
/** SHA3-224 digest calculator. */
object Sha3_224VersionCalculator extends ContentBasedVersioning {
/** @inheritdoc */
override def evalVersion(content: CharSequence): ContentVersion = {
val digestSHA3 = new SHA3.Digest224()
val digestSHA3 = MessageDigest.getInstance("SHA3-224")
val digest =
digestSHA3.digest(content.toString.getBytes(StandardCharsets.UTF_8))
ContentVersion(digest)

View File

@ -1,3 +1,3 @@
79F8085006CADBE1F915455506E1CDEB9A27B8B59EDFCA78FAA3218A3296DE62
9881D29C00C41E935A59AE991CB1518925A0CB0DFCC612B09C6C2823F25047D9
6F5A08E5432F0B0C17A5CFC28207781B7C39E85B120D4F74B9B6AA35FF80E8C0
0

View File

@ -1,3 +1,3 @@
58F42EA238F4F16E775412B67F584C74188267FB305705B57A50E10124FE56BC
7C5FEB79459C03EB21D2098EFC33BF7AA26E3C51204A9F32F3DCFC854D5A36A0
DC3F2E51015236DC72560E5DD29B13156A2244C6753828B6D0848683018D5ABA
0

View File

@ -1,3 +1,3 @@
4DFA19B7C7AB8984E827C35E9CA6EF40CC3B246094BB0A763D65AD6BF76F0D26
A9799420579F008532E370B2E2B7D3A811348AE47C8B408E238B741B68AC5224
DF30306CEDC69A2DB5BF394CDD77B240B6F6B2E695D4DE6BDC343EAA271CEB34
0

View File

@ -1,3 +1,3 @@
C5C845C319F900C420F04C815ACFC315E24C581960BE61B03BB6A2F8D71122C9
F5B860DA0130C53DB5E531A7FDBBFCB7BB54FCEA064A0C8B250EDB7530D6A611
12BB786E599BE5441F12C0061839D42DBA889C1FBC45F74938E71F664ABD0E65
0

View File

@ -1,3 +1,3 @@
F091B0AA1B0A0AE841293C582ED74A6D26913D9BB4E8C64DF1C8FC466E8418A8
6C4D25C4E9D8A12671E24EE1E60C49C63E8DBA26BE88480F0E12A9112DBF7C03
87C7DE197372E63C24D6AF3384EA2898F4ECD5486863DA8520660D597995BE28
0

View File

@ -1,3 +1,3 @@
AE474B24FC7C88ACA56C70EC19DCD5F224178089AA2910DB117EE7D914D6C7FF
A4E29BBEAAEE4B4A5593D949D658170B8591E0FADA2F469CDCBF640B307B74D4
45B9C528D26D13399A07F9FFE79576924709B1DEB991862372B4AFB185869893
0

View File

@ -1 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,3 +0,0 @@
+ "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE"
+ "The above copyright notice and this permission notice shall be included in all copies or substantial"
"Copyright (c) 2000-2021 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) "

View File

@ -1,2 +0,0 @@
Copyright: Dr B. R Gladman (gladman@seven77.demon.co.uk) */
Copyright (c) 2000-2021 The Legion Of The Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,3 +1,3 @@
C8A7F23E0F92119165D3B2ED47723018A69580A04331359C9BE435FD62F93E51
F31394818AC1E81F6172B92D39A06004A7E24D211399E26DE0EE51F7FE10BFCD
D8B011DD7E11E226FD042DCDEE28B22C5D74D2B7A666346317619CCB487832C4
0035ED295654FAACCD79D0DA6D2CDDA8E2EC8D0BA9254722FB55C6F622A68B94
0

View File

@ -1 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,3 +0,0 @@
+ "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE"
+ "The above copyright notice and this permission notice shall be included in all copies or substantial"
"Copyright (c) 2000-2021 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) "

View File

@ -1 +0,0 @@
Copyright (c) 2000-2021 The Legion Of The Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1 +0,0 @@
Copyright: Dr B. R Gladman (gladman@seven77.demon.co.uk) */

View File

@ -1 +0,0 @@
Copyright (c) 2000 - 2020 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)

View File

@ -1,3 +1,3 @@
9D93C578E044AEEE4683119559D7D91A6C43C5BC4B811B81F76FBAB003CD960F
23C9B84A5312F46DAD4EBFB7D0267E4111E16F97BDA00E8C1AEECA0DEBF81CE5
578C28B786B877E41559F52CBDFBF45DE798CEB12FDF9632A93CC4B1B30C72C6
D1B18FEE4514908AD689F9B25D7E4445E5F3D75296F136BED478DB855D891F88
0

View File

@ -1 +0,0 @@
tools/legal-review/license-texts/Bouncy_Castle_Licence.txt