mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 18:50:43 +01:00
temporary disabled SecureRandom (linux bug)
This commit is contained in:
parent
8c05b270c1
commit
529d55150f
@ -1,28 +1,27 @@
|
||||
package fr.acinq.eclair.channel
|
||||
|
||||
import java.security.SecureRandom
|
||||
|
||||
import akka.actor.{Actor, ActorLogging}
|
||||
import fr.acinq.bitcoin.{BinaryData, Crypto}
|
||||
import fr.acinq.eclair._
|
||||
import lightning.update_add_htlc
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
/**
|
||||
* Created by PM on 17/06/2016.
|
||||
*/
|
||||
class LocalPaymentHandler extends Actor with ActorLogging {
|
||||
|
||||
val random = SecureRandom.getInstanceStrong
|
||||
// see http://bugs.java.com/view_bug.do?bug_id=6521844
|
||||
//val random = SecureRandom.getInstanceStrong
|
||||
val random = new Random()
|
||||
|
||||
def generateR(): BinaryData = {
|
||||
val r = Array.fill[Byte](32)(0)
|
||||
random.nextBytes(r)
|
||||
r
|
||||
}
|
||||
|
||||
context.become(run(Map()))
|
||||
|
||||
override def receive: Receive = ???
|
||||
override def receive: Receive = run(Map())
|
||||
|
||||
//TODO: store this map on file ?
|
||||
def run(h2r: Map[BinaryData, BinaryData]): Receive = {
|
||||
|
@ -13,6 +13,8 @@ import org.bouncycastle.crypto.params.{KeyParameter, ParametersWithIV}
|
||||
import org.bouncycastle.jce.ECNamedCurveTable
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
/**
|
||||
* Created by PM on 27/10/2015.
|
||||
*/
|
||||
@ -148,11 +150,13 @@ object LightningCrypto {
|
||||
|
||||
case class KeyPair(pub: BinaryData, priv: BinaryData)
|
||||
|
||||
lazy val rand = new SecureRandom()
|
||||
// see http://bugs.java.com/view_bug.do?bug_id=6521844
|
||||
//lazy val random = SecureRandom.getInstanceStrong
|
||||
lazy val random = new Random()
|
||||
|
||||
def randomKeyPair(): KeyPair = {
|
||||
val key = new Array[Byte](32)
|
||||
rand.nextBytes(key)
|
||||
random.nextBytes(key)
|
||||
KeyPair(pub = Crypto.publicKeyFromPrivateKey(key :+ 0x01.toByte), priv = key)
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import java.security.SecureRandom
|
||||
import fr.acinq.bitcoin.{BinaryData, Crypto}
|
||||
import fr.acinq.eclair.crypto.LightningCrypto._
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
|
||||
/**
|
||||
* Created by PM on 14/10/2015.
|
||||
@ -86,12 +88,15 @@ object Onion extends App {
|
||||
Secrets(enckey, hmac, iv, pad_iv)
|
||||
}
|
||||
|
||||
lazy val rand = new SecureRandom()
|
||||
// see http://bugs.java.com/view_bug.do?bug_id=6521844
|
||||
//lazy val random = SecureRandom.getInstanceStrong
|
||||
lazy val random = new Random()
|
||||
|
||||
|
||||
def generatePrivateKey(): BinaryData = {
|
||||
val key = new Array[Byte](32)
|
||||
do {
|
||||
rand.nextBytes(key)
|
||||
random.nextBytes(key)
|
||||
} while (Crypto.publicKeyFromPrivateKey(key :+ 0x01.toByte)(0) != 0x02)
|
||||
key
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.acinq.eclair.channel.simulator
|
||||
|
||||
import java.security.SecureRandom
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
@ -16,8 +15,8 @@ import org.junit.runner.RunWith
|
||||
import org.scalatest.FunSuite
|
||||
import org.scalatest.junit.JUnitRunner
|
||||
|
||||
import scala.util.Random
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.Random
|
||||
|
||||
@RunWith(classOf[JUnitRunner])
|
||||
class ThroughputSpec extends FunSuite {
|
||||
@ -26,7 +25,7 @@ class ThroughputSpec extends FunSuite {
|
||||
val pipe = system.actorOf(Props[Pipe], "pipe")
|
||||
val blockchain = system.actorOf(Props(new PeerWatcher(new TestBitcoinClient(), 300)), "blockchain")
|
||||
val paymentHandler = system.actorOf(Props(new Actor() {
|
||||
val random = SecureRandom.getInstanceStrong
|
||||
val random = new Random()
|
||||
|
||||
def generateR(): BinaryData = {
|
||||
val r = Array.fill[Byte](32)(0)
|
||||
|
Loading…
Reference in New Issue
Block a user