Idea cinterop stopped working, again... fixed blake2b stateless segmentation

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-06-07 00:55:46 +02:00
1 parent d380863a29
commit 1be0470745
4 files changed
+32 -36

No files matched your search

@@ -70,15 +70,16 @@ actual object Blake2bDelegatedStateless : Blake2bStateless {
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
val hashResult = UByteArray(MAX_HASH_BYTES)
val hashResultPinned = hashResult.pin()
crypto_generichash(
StableRef.create(hashResult).asCPointer().reinterpret(),
hashResultPinned.addressOf(0),
hashLength.convert(),
inputMessage.toCValues(),
inputMessage.size.convert(),
key.toCValues(),
key.size.convert() ?: 0UL
)
hashResultPinned.unpin()
return hashResult
}