mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-19 18:14:44 +00:00
CryptoInterface cross platform, UDP listen public
This commit is contained in:
parent
8cec84787d
commit
6711786f44
|
|
@ -8,9 +8,9 @@ import scodec.bits.ByteVector
|
|||
|
||||
object CryptoInterface {
|
||||
final val libName = "pscrypto"
|
||||
// TODO: make this cross platform
|
||||
final val fullLibName = "lib" + libName + ".so"
|
||||
final val fullLibName = libName
|
||||
final val psLib = new Library(libName)
|
||||
|
||||
final val RC5_BLOCK_SIZE = 8
|
||||
final val MD5_MAC_SIZE = 16
|
||||
|
||||
|
|
@ -26,10 +26,29 @@ object CryptoInterface {
|
|||
"Free_RC5"
|
||||
)
|
||||
|
||||
/**
|
||||
* Used to initialize the crypto library at runtime. This allows
|
||||
*/
|
||||
def initialize() : Unit = {
|
||||
functionsList foreach psLib.prefetch
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for debugging object loading
|
||||
*/
|
||||
def printEnvironment() : Unit = {
|
||||
import java.io.File
|
||||
|
||||
val classpath = System.getProperty("java.class.path")
|
||||
val classpathEntries = classpath.split(File.pathSeparator)
|
||||
|
||||
val myLibraryPath = System.getProperty("user.dir")
|
||||
println("User dir: " + myLibraryPath)
|
||||
classpathEntries.foreach(println)
|
||||
|
||||
println("Required data model: " + System.getProperty("sun.arch.data.model"))
|
||||
}
|
||||
|
||||
def MD5MAC(key : ByteVector, message : ByteVector, bytesWanted : Int) : ByteVector = {
|
||||
val out = Array.ofDim[Byte](bytesWanted)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
|
||||
import org.specs2.mutable._
|
||||
import psforever.crypto.CryptoInterface
|
||||
import psforever.crypto.CryptoInterface.CryptoDHState
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ object PsLogin {
|
|||
catch {
|
||||
case e : UnsatisfiedLinkError =>
|
||||
println("Unable to initialize " + CryptoInterface.libName)
|
||||
println("Reason: " + e.getMessage)
|
||||
e.getStackTrace.foreach(println)
|
||||
sys.exit(1)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ final case class SendPacket(msg : ByteVector, to : InetSocketAddress)
|
|||
|
||||
class UdpListener(nextActor: ActorRef) extends Actor with ActorLogging {
|
||||
import context.system
|
||||
IO(Udp) ! Udp.Bind(self, new InetSocketAddress("localhost", 51000))
|
||||
IO(Udp) ! Udp.Bind(self, new InetSocketAddress("0.0.0.0", 51000))
|
||||
|
||||
var bytesRecevied = 0L
|
||||
var bytesSent = 0L
|
||||
|
|
|
|||
Loading…
Reference in a new issue