diff --git a/akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala b/akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala old mode 100644 new mode 100755 index 8e24796db3..f109a433ac --- a/akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala +++ b/akka-remote/src/main/scala/akka/remote/security/provider/AESCounterBuiltinRNG.scala @@ -9,6 +9,8 @@ import java.util.concurrent.ThreadFactory import javax.crypto.Cipher import javax.crypto.spec.IvParameterSpec +import akka.annotation.InternalApi + import scala.concurrent.duration.{ Duration, FiniteDuration } import scala.concurrent.{ Await, ExecutionContext, Future, duration } @@ -28,7 +30,7 @@ import scala.concurrent.{ Await, ExecutionContext, Future, duration } * * NOTE: this class is not serializable */ -// FIMXE add @InternalApi +@InternalApi private[akka] class AESCounterBuiltinRNG(val seed: Array[Byte], implicit val executionContext: ExecutionContext, val reseedingThreshold: Long = CounterRNGConstants.ReseedingThreshold, 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 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) ivArr(0) = (ivArr(0) + 1.toByte).toByte private val ivSpec = new IvParameterSpec(ivArr) @@ -127,5 +132,9 @@ private object CounterRNGConstants { } 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 + } } diff --git a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala index dfb2d76f17..e510c78cba 100644 --- a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala @@ -13,12 +13,10 @@ import akka.remote.transport.netty.{ NettySSLSupport, SSLSettings } import akka.testkit._ import akka.util.Timeout import com.typesafe.config._ -import org.uncommons.maths.random.RandomDotOrgSeedGenerator import scala.concurrent.{ Await, Future } import scala.concurrent.duration._ import scala.reflect.classTag -import scala.util.control.NonFatal object Configuration { // set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 90e6fe2f7a..75c5bbe5a0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -48,8 +48,7 @@ object Dependencies { val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.16" // MIT - // mirrored in OSGi sample - val uncommonsMath = "org.uncommons.maths" % "uncommons-maths" % "1.2.2a" exclude("jfree", "jcommon") exclude("jfree", "jfreechart") // ApacheV2 + // mirrored in OSGi sample val osgiCore = "org.osgi" % "org.osgi.core" % "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 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)