Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove compile time dependency on bouncycastle #8362

Closed
Akirathan opened this issue Nov 22, 2023 · 0 comments · Fixed by #8664
Closed

Remove compile time dependency on bouncycastle #8362

Akirathan opened this issue Nov 22, 2023 · 0 comments · Fixed by #8664
Assignees
Labels
-compiler p-medium Should be completed in the next few sprints x-chore Type: chore

Comments

@Akirathan
Copy link
Member

Akirathan commented Nov 22, 2023

There are unnecessary compile time dependencies on bouncycastle. Let's remove them.

In text-buffer, SHA-3 is used and it seems unnecessary. Let's only use SHA-1 from JDK. Moreover, as declared in build.sbt, text-buffer depends on bouncycastle JDK1.5, instead of the newer JDK1.8.

The dependency on org.bouncacastle in runtime can be removed via something like this:

diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java
index 96cb560fb..b8cd239d6 100644
--- a/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java
+++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java
@@ -10,11 +10,11 @@ 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;
@@ -392,7 +392,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 e) {
+      throw new IllegalStateException(e);
+    }
   }
 
   /**

Note that we need runtime dependency on org.bouncycastle modules because python-language-23.1.0 depends on those anyway.

@Akirathan Akirathan added p-medium Should be completed in the next few sprints x-chore Type: chore -compiler labels Nov 22, 2023
@Akirathan Akirathan self-assigned this Nov 22, 2023
@Akirathan Akirathan moved this from ❓New to 📤 Backlog in Issues Board Nov 22, 2023
@Akirathan Akirathan linked a pull request Jan 3, 2024 that will close this issue
3 tasks
@github-project-automation github-project-automation bot moved this from 📤 Backlog to 🟢 Accepted in Issues Board Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-compiler p-medium Should be completed in the next few sprints x-chore Type: chore
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant