Remove xchacha20 streaming API for now, as they are not available on apple builds

This commit is contained in:
Ugljesa Jovanovic committed 2024-04-06 18:56:26 +02:00
1 parent 59c5f958ca
commit 1424db0336
6 files changed
+177 -174

No files matched your search

@@ -97,49 +97,49 @@ actual object Stream {
return result
}
actual fun xChacha20Keygen(): UByteArray {
val result = UByteArray(crypto_stream_chacha20_KEYBYTES)
sodiumJna.crypto_stream_xchacha20_keygen(result.asByteArray())
return result
}
actual fun xChacha20Xor(
message: UByteArray,
nonce: UByteArray,
key: UByteArray
): UByteArray {
val result = UByteArray(message.size)
sodiumJna.crypto_stream_xchacha20_xor(
result.asByteArray(),
message.asByteArray(),
message.size.toLong(),
nonce.asByteArray(),
key.asByteArray()
).ensureLibsodiumSuccess()
return result
}
actual fun xChacha20XorIc(
message: UByteArray,
nonce: UByteArray,
initialCounter: ULong,
key: UByteArray
): UByteArray {
val result = UByteArray(message.size)
sodiumJna.crypto_stream_xchacha20_xor_ic(
result.asByteArray(),
message.asByteArray(),
message.size.toLong(),
nonce.asByteArray(),
initialCounter.toLong(),
key.asByteArray()
).ensureLibsodiumSuccess()
return result
}
// actual fun xChacha20Keygen(): UByteArray {
// val result = UByteArray(crypto_stream_chacha20_KEYBYTES)
//
// sodiumJna.crypto_stream_xchacha20_keygen(result.asByteArray())
//
// return result
// }
//
// actual fun xChacha20Xor(
// message: UByteArray,
// nonce: UByteArray,
// key: UByteArray
// ): UByteArray {
// val result = UByteArray(message.size)
//
// sodiumJna.crypto_stream_xchacha20_xor(
// result.asByteArray(),
// message.asByteArray(),
// message.size.toLong(),
// nonce.asByteArray(),
// key.asByteArray()
// ).ensureLibsodiumSuccess()
//
// return result
// }
//
// actual fun xChacha20XorIc(
// message: UByteArray,
// nonce: UByteArray,
// initialCounter: ULong,
// key: UByteArray
// ): UByteArray {
// val result = UByteArray(message.size)
//
// sodiumJna.crypto_stream_xchacha20_xor_ic(
// result.asByteArray(),
// message.asByteArray(),
// message.size.toLong(),
// nonce.asByteArray(),
// initialCounter.toLong(),
// key.asByteArray()
// ).ensureLibsodiumSuccess()
//
// return result
// }
}