Fix for #42, add check for values returned by libsodium that signal failure, reintroduce xChaCha20 stream API since iosArm32 is not supported any more, use forked resource loader that deletes tmp folders properly

This commit is contained in:
Ugljesa Jovanovic committed 2024-04-06 11:46:28 +02:00
1 parent bd988cc493
commit 59c5f958ca
43 files changed
+388 -339

No files matched your search

@@ -0,0 +1,11 @@
package com.ionspin.kotlin.crypto
class GeneralLibsodiumException : RuntimeException("Libsodium reported error! Returned value was -1") {
companion object {
fun Int.ensureLibsodiumSuccess() {
if (this == -1) {
throw GeneralLibsodiumException()
}
}
}
}
@@ -15,9 +15,6 @@ expect class Sha512State
expect object Hash {
//Not present in LazySodium
//fun hash(data: UByteArray) : UByteArray
fun sha256(data: UByteArray) : UByteArray
fun sha256Init() : Sha256State
fun sha256Update(state: Sha256State, data : UByteArray)
@@ -23,8 +23,8 @@ expect object Stream {
fun chacha20IetfXor(message : UByteArray, nonce: UByteArray, key: UByteArray) : UByteArray
fun chacha20IetfXorIc(message: UByteArray, nonce: UByteArray, initialCounter: UInt, key: UByteArray) : UByteArray
// fun xChacha20Keygen() : UByteArray
//
// fun xChacha20Xor(message : UByteArray, nonce: UByteArray, key: UByteArray) : UByteArray
// fun xChacha20XorIc(message : UByteArray, nonce: UByteArray, initialCounter: ULong, key: UByteArray) : UByteArray
fun xChacha20Keygen() : UByteArray
fun xChacha20Xor(message : UByteArray, nonce: UByteArray, key: UByteArray) : UByteArray
fun xChacha20XorIc(message : UByteArray, nonce: UByteArray, initialCounter: ULong, key: UByteArray) : UByteArray
}