From c9533b055c8d485e48d83b0d8e967cffbe0f00c7 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 19 Jul 2021 10:27:50 +0200 Subject: [PATCH 1/4] fixes #17 --- src/main/java/org/cryptomator/siv/SivMode.java | 4 ++-- .../java/org/cryptomator/siv/ThreadLocals.java | 17 +++++++++++++++++ .../java9/org.cryptomator.siv/ThreadLocals.java | 11 +++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/cryptomator/siv/ThreadLocals.java create mode 100644 src/main/java9/org.cryptomator.siv/ThreadLocals.java diff --git a/src/main/java/org/cryptomator/siv/SivMode.java b/src/main/java/org/cryptomator/siv/SivMode.java index fc1a6d2..3f8e635 100644 --- a/src/main/java/org/cryptomator/siv/SivMode.java +++ b/src/main/java/org/cryptomator/siv/SivMode.java @@ -51,7 +51,7 @@ public SivMode() { * @see #SivMode(BlockCipherFactory) */ public SivMode(final Provider jceSecurityProvider) { - this(ThreadLocal.withInitial(() -> new JceAesBlockCipher(jceSecurityProvider)), new JceAesCtrComputer(jceSecurityProvider)); + this(ThreadLocals.withInitial(() -> new JceAesBlockCipher(jceSecurityProvider)), new JceAesCtrComputer(jceSecurityProvider)); } /** @@ -60,7 +60,7 @@ public SivMode(final Provider jceSecurityProvider) { * @param cipherFactory A factory method creating a Blockcipher.get(). Must use a block size of 128 bits (16 bytes). */ public SivMode(final BlockCipherFactory cipherFactory) { - this(ThreadLocal.withInitial(() -> cipherFactory.create())); + this(ThreadLocals.withInitial(() -> cipherFactory.create())); } private SivMode(final ThreadLocal threadLocalCipher) { diff --git a/src/main/java/org/cryptomator/siv/ThreadLocals.java b/src/main/java/org/cryptomator/siv/ThreadLocals.java new file mode 100644 index 0000000..287c23d --- /dev/null +++ b/src/main/java/org/cryptomator/siv/ThreadLocals.java @@ -0,0 +1,17 @@ +package org.cryptomator.siv; + +import java.util.function.Supplier; + +class ThreadLocals { + + static ThreadLocal withInitial(Supplier supplier) { + // ThreadLocal.withInitial is unavailable on Android 7.x + return new ThreadLocal() { + @Override + protected S initialValue() { + return supplier.get(); + } + }; + } + +} diff --git a/src/main/java9/org.cryptomator.siv/ThreadLocals.java b/src/main/java9/org.cryptomator.siv/ThreadLocals.java new file mode 100644 index 0000000..fc5fe82 --- /dev/null +++ b/src/main/java9/org.cryptomator.siv/ThreadLocals.java @@ -0,0 +1,11 @@ +package org.cryptomator.siv; + +import java.util.function.Supplier; + +class ThreadLocals { + + static ThreadLocal withInitial(Supplier supplier) { + return ThreadLocal.withInitial(supplier); + } + +} From 36c77ab2900ee64694a74c4bbef452ee354330ad Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 19 Jul 2021 10:52:24 +0200 Subject: [PATCH 2/4] fix JaCoCo --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index c2a1a5d..56bbbfa 100644 --- a/pom.xml +++ b/pom.xml @@ -268,6 +268,12 @@ + + + + META-INF/** + + From acbd2233cb8839ce558c5871377c34cd349d01cd Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 19 Jul 2021 10:53:34 +0200 Subject: [PATCH 3/4] dependency update --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 56bbbfa..5009c9b 100644 --- a/pom.xml +++ b/pom.xml @@ -37,12 +37,12 @@ UTF-8 - 1.68 + 1.69 - 5.7.1 - 3.10.0 - 1.31 + 5.7.2 + 3.11.2 + 1.32 2.2 30.1.1-jre @@ -174,7 +174,7 @@ maven-javadoc-plugin - 3.2.0 + 3.3.0 attach-javadocs @@ -235,7 +235,7 @@ org.owasp dependency-check-maven - 6.1.0 + 6.2.2 24 0 @@ -259,7 +259,7 @@ org.jacoco jacoco-maven-plugin - 0.8.6 + 0.8.7 prepare-agent @@ -285,7 +285,7 @@ maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts From 0347f474f85f7a3f5d3ecf9ba4dacb81138e8dd5 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 19 Jul 2021 11:07:13 +0200 Subject: [PATCH 4/4] preparing 1.4.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5009c9b..c269d05 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.cryptomator siv-mode - 1.5.0-SNAPSHOT + 1.4.3 SIV Mode RFC 5297 SIV mode: deterministic authenticated encryption