diff --git a/modules/core/native/src/main/scala/net/message/PasswordMessagePlatform.scala b/modules/core/native/src/main/scala/net/message/PasswordMessagePlatform.scala index 08ad3a01..e39dc47e 100644 --- a/modules/core/native/src/main/scala/net/message/PasswordMessagePlatform.scala +++ b/modules/core/native/src/main/scala/net/message/PasswordMessagePlatform.scala @@ -32,11 +32,11 @@ private[message] trait PasswordMessagePlatform { // First round if (EVP_DigestInit_ex(ctx, `type`, null) != 1) throw new RuntimeException("EVP_DigestInit_ex") - if (EVP_DigestUpdate(ctx, password.getBytes.at(0), password.length.toULong) != 1) + if (EVP_DigestUpdate(ctx, password.getBytes.atUnsafe(0), password.length.toULong) != 1) throw new RuntimeException("EVP_DigestUpdate") - if (EVP_DigestUpdate(ctx, user.getBytes.at(0), user.length.toULong) != 1) + if (EVP_DigestUpdate(ctx, user.getBytes.atUnsafe(0), user.length.toULong) != 1) throw new RuntimeException("EVP_DigestUpdate") - if (EVP_DigestFinal_ex(ctx, md.at(0), size) != 1) + if (EVP_DigestFinal_ex(ctx, md.atUnsafe(0), size) != 1) throw new RuntimeException("EVP_DigestFinal_ex") var hex = BigInt(1, md.take((!size).toInt)).toString(16) while (hex.length < 32) @@ -48,11 +48,11 @@ private[message] trait PasswordMessagePlatform { // Second round if (EVP_DigestInit_ex(ctx, `type`, null) != 1) throw new RuntimeException("EVP_DigestInit_ex") - if (EVP_DigestUpdate(ctx, hex.getBytes.at(0), 32.toULong) != 1) + if (EVP_DigestUpdate(ctx, hex.getBytes.atUnsafe(0), 32.toULong) != 1) throw new RuntimeException("EVP_DigestUpdate") - if (EVP_DigestUpdate(ctx, salt.at(0), salt.length.toULong) != 1) + if (EVP_DigestUpdate(ctx, salt.atUnsafe(0), salt.length.toULong) != 1) throw new RuntimeException("EVP_DigestUpdate") - if (EVP_DigestFinal_ex(ctx, md.at(0), size) != 1) + if (EVP_DigestFinal_ex(ctx, md.atUnsafe(0), size) != 1) throw new RuntimeException("EVP_DigestFinal_ex") hex = BigInt(1, md.take((!size).toInt)).toString(16) while (hex.length < 32) diff --git a/modules/core/native/src/main/scala/net/message/ScramPlatform.scala b/modules/core/native/src/main/scala/net/message/ScramPlatform.scala index 1de03773..2f0d2238 100644 --- a/modules/core/native/src/main/scala/net/message/ScramPlatform.scala +++ b/modules/core/native/src/main/scala/net/message/ScramPlatform.scala @@ -15,7 +15,7 @@ private[message] trait ScramPlatform { this: Scram.type => def clientFirstBareWithRandomNonce: ByteVector = { val buf = new Array[Byte](32) - if (RAND_bytes(buf.at(0), 32) != 1) + if (RAND_bytes(buf.atUnsafe(0), 32) != 1) throw new RuntimeException("RAND_bytes") val nonce = ByteVector.view(buf).toBase64 clientFirstBareWithNonce(nonce) @@ -27,7 +27,7 @@ private[message] trait ScramPlatform { this: Scram.type => throw new RuntimeException("EVP_get_digestbyname") val md = new Array[Byte](EVP_MAX_MD_SIZE) val mdLen = stackalloc[CUnsignedInt]() - if (openssl.HMAC(evpMd, key.toArrayUnsafe.at(0), key.size.toInt, str.toArrayUnsafe.at(0), str.size.toULong, md.at(0), mdLen) == null) + if (openssl.HMAC(evpMd, key.toArrayUnsafe.atUnsafe(0), key.size.toInt, str.toArrayUnsafe.atUnsafe(0), str.size.toULong, md.atUnsafe(0), mdLen) == null) throw new RuntimeException("HMAC") ByteVector.view(md, 0, (!mdLen).toInt) } @@ -38,7 +38,7 @@ private[message] trait ScramPlatform { this: Scram.type => val `type` = EVP_get_digestbyname(c"SHA256") if (`type` == null) throw new RuntimeException("EVP_get_digestbyname") - if (EVP_Digest(input.toArrayUnsafe.at(0), input.size.toULong, md.at(0), size, `type`, null) != 1) + if (EVP_Digest(input.toArrayUnsafe.atUnsafe(0), input.size.toULong, md.atUnsafe(0), size, `type`, null) != 1) throw new RuntimeException("EVP_Digest") ByteVector.view(md, 0, (!size).toInt) } @@ -48,7 +48,7 @@ private[message] trait ScramPlatform { this: Scram.type => if (digest == null) throw new RuntimeException("EVP_get_digestbyname") val out = new Array[Byte](32) - if (PKCS5_PBKDF2_HMAC(str.getBytes.at(0), str.length, salt.toArrayUnsafe.at(0), salt.size.toInt, iterations, digest, 32, out.at(0)) != 1) + if (PKCS5_PBKDF2_HMAC(str.getBytes.atUnsafe(0), str.length, salt.toArrayUnsafe.atUnsafe(0), salt.size.toInt, iterations, digest, 32, out.atUnsafe(0)) != 1) throw new RuntimeException("PKCS5_PBKDF2_HMAC") ByteVector.view(out) } diff --git a/project/plugins.sbt b/project/plugins.sbt index 8f14a0eb..03123c0f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,5 +9,5 @@ addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") addSbtPlugin("com.armanbilge" % "sbt-scala-native-config-brew-github-actions" % "0.2.0-RC1")