remove org.uncommons.maths dependency (#12636)
Also * add InternalApi annotation to AESCounterBuiltinRNG * add setDaemon(true) to re-seeder thread
This commit is contained in:
parent
956676d0bc
commit
c80c3e16c4
3 changed files with 13 additions and 7 deletions
13
akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala
Normal file → Executable file
13
akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala
Normal file → Executable file
|
|
@ -9,6 +9,8 @@ import java.util.concurrent.ThreadFactory
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.IvParameterSpec
|
import javax.crypto.spec.IvParameterSpec
|
||||||
|
|
||||||
|
import akka.annotation.InternalApi
|
||||||
|
|
||||||
import scala.concurrent.duration.{ Duration, FiniteDuration }
|
import scala.concurrent.duration.{ Duration, FiniteDuration }
|
||||||
import scala.concurrent.{ Await, ExecutionContext, Future, duration }
|
import scala.concurrent.{ Await, ExecutionContext, Future, duration }
|
||||||
|
|
||||||
|
|
@ -28,7 +30,7 @@ import scala.concurrent.{ Await, ExecutionContext, Future, duration }
|
||||||
*
|
*
|
||||||
* NOTE: this class is not serializable
|
* NOTE: this class is not serializable
|
||||||
*/
|
*/
|
||||||
// FIMXE add @InternalApi
|
@InternalApi
|
||||||
private[akka] class AESCounterBuiltinRNG(val seed: Array[Byte], implicit val executionContext: ExecutionContext,
|
private[akka] class AESCounterBuiltinRNG(val seed: Array[Byte], implicit val executionContext: ExecutionContext,
|
||||||
val reseedingThreshold: Long = CounterRNGConstants.ReseedingThreshold,
|
val reseedingThreshold: Long = CounterRNGConstants.ReseedingThreshold,
|
||||||
val reseedingDeadline: Long = CounterRNGConstants.ReseedingDeadline,
|
val reseedingDeadline: Long = CounterRNGConstants.ReseedingDeadline,
|
||||||
|
|
@ -45,6 +47,9 @@ private[akka] class AESCounterBuiltinRNG(val seed: Array[Byte], implicit val exe
|
||||||
private var bitsSinceSeeding: Long = 0
|
private var bitsSinceSeeding: Long = 0
|
||||||
|
|
||||||
private val cipher = Cipher.getInstance("AES/CTR/NoPadding")
|
private val cipher = Cipher.getInstance("AES/CTR/NoPadding")
|
||||||
|
|
||||||
|
// this algorithm can be further improved by better selection of the iv
|
||||||
|
// here and at re-seeding time further below
|
||||||
private val ivArr = Array.fill[Byte](CounterSizeBytes)(0)
|
private val ivArr = Array.fill[Byte](CounterSizeBytes)(0)
|
||||||
ivArr(0) = (ivArr(0) + 1.toByte).toByte
|
ivArr(0) = (ivArr(0) + 1.toByte).toByte
|
||||||
private val ivSpec = new IvParameterSpec(ivArr)
|
private val ivSpec = new IvParameterSpec(ivArr)
|
||||||
|
|
@ -127,5 +132,9 @@ private object CounterRNGConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AESCounterBuiltinRNGReSeeder extends ThreadFactory {
|
private class AESCounterBuiltinRNGReSeeder extends ThreadFactory {
|
||||||
override def newThread(r: Runnable): Thread = new Thread(r, "AESCounterBuiltinRNGReSeeder")
|
override def newThread(r: Runnable): Thread = {
|
||||||
|
val thread = new Thread(r, "AESCounterBuiltinRNGReSeeder")
|
||||||
|
thread.setDaemon(true)
|
||||||
|
thread
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,10 @@ import akka.remote.transport.netty.{ NettySSLSupport, SSLSettings }
|
||||||
import akka.testkit._
|
import akka.testkit._
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
import com.typesafe.config._
|
import com.typesafe.config._
|
||||||
import org.uncommons.maths.random.RandomDotOrgSeedGenerator
|
|
||||||
|
|
||||||
import scala.concurrent.{ Await, Future }
|
import scala.concurrent.{ Await, Future }
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import scala.reflect.classTag
|
import scala.reflect.classTag
|
||||||
import scala.util.control.NonFatal
|
|
||||||
|
|
||||||
object Configuration {
|
object Configuration {
|
||||||
// set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager"
|
// set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager"
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ object Dependencies {
|
||||||
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.16" // MIT
|
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.16" // MIT
|
||||||
|
|
||||||
// mirrored in OSGi sample
|
// mirrored in OSGi sample
|
||||||
val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2
|
|
||||||
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2
|
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.1" // ApacheV2
|
||||||
val osgiCompendium= "org.osgi" % "org.osgi.compendium" % "4.3.1" // ApacheV2
|
val osgiCompendium= "org.osgi" % "org.osgi.compendium" % "4.3.1" // ApacheV2
|
||||||
|
|
||||||
|
|
@ -132,7 +131,7 @@ object Dependencies {
|
||||||
|
|
||||||
val actorTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.commonsCodec, Test.commonsMath, Test.mockito, Test.scalacheck.value, Test.junitIntf)
|
val actorTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.commonsCodec, Test.commonsMath, Test.mockito, Test.scalacheck.value, Test.junitIntf)
|
||||||
|
|
||||||
val remote = l ++= Seq(netty, uncommonsMath, aeronDriver, aeronClient, Test.junit, Test.scalatest.value, Test.jimfs)
|
val remote = l ++= Seq(netty, aeronDriver, aeronClient, Test.junit, Test.scalatest.value, Test.jimfs)
|
||||||
|
|
||||||
val remoteTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.scalaXml)
|
val remoteTests = l ++= Seq(Test.junit, Test.scalatest.value, Test.scalaXml)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue