Skip to content

Commit

Permalink
Merge pull request #969 from typelevel/update/series/0.6.x/nscplugin-…
Browse files Browse the repository at this point in the history
…0.4.15

Update nscplugin, sbt-scala-native, ... to 0.4.15 in series/0.6.x
  • Loading branch information
armanbilge authored Sep 5, 2023
2 parents 0d729c1 + f0511ae commit 3858d85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 3858d85

Please sign in to comment.