Skip to content

Commit

Permalink
Merge branch 'release/1.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jul 19, 2021
2 parents edd8615 + 0347f47 commit 58f836b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
24 changes: 15 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>siv-mode</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>

<name>SIV Mode</name>
<description>RFC 5297 SIV mode: deterministic authenticated encryption</description>
Expand Down Expand Up @@ -37,12 +37,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- dependencies -->
<bouncycastle.version>1.68</bouncycastle.version>
<bouncycastle.version>1.69</bouncycastle.version>

<!-- test dependencies -->
<junit.version>5.7.1</junit.version>
<mockito.version>3.10.0</mockito.version>
<jmh.version>1.31</jmh.version>
<junit.version>5.7.2</junit.version>
<mockito.version>3.11.2</mockito.version>
<jmh.version>1.32</jmh.version>
<hamcrest.version>2.2</hamcrest.version>
<guava.version>30.1.1-jre</guava.version>
</properties>
Expand Down Expand Up @@ -174,7 +174,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -235,7 +235,7 @@
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.1.0</version>
<version>6.2.2</version>
<configuration>
<cveValidForHours>24</cveValidForHours>
<failBuildOnCVSS>0</failBuildOnCVSS>
Expand All @@ -259,7 +259,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand All @@ -268,6 +268,12 @@
</goals>
</execution>
</executions>
<!-- workaround for https://github.com/jacoco/jacoco/issues/407 -->
<configuration>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
Expand All @@ -279,7 +285,7 @@
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cryptomator/siv/SivMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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<BlockCipher> threadLocalCipher) {
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/cryptomator/siv/ThreadLocals.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.cryptomator.siv;

import java.util.function.Supplier;

class ThreadLocals {

static <S> ThreadLocal<S> withInitial(Supplier<S> supplier) {
// ThreadLocal.withInitial is unavailable on Android 7.x
return new ThreadLocal<S>() {
@Override
protected S initialValue() {
return supplier.get();
}
};
}

}
11 changes: 11 additions & 0 deletions src/main/java9/org.cryptomator.siv/ThreadLocals.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.cryptomator.siv;

import java.util.function.Supplier;

class ThreadLocals {

static <S> ThreadLocal<S> withInitial(Supplier<S> supplier) {
return ThreadLocal.withInitial(supplier);
}

}

0 comments on commit 58f836b

Please sign in to comment.