I'm somewhat confused. I converted a c-function, w...
# kotlin-native
j
I'm somewhat confused. I converted a c-function, which ends up being this in kotlin:
Copy code
public fun AES_CBC_encrypt_buffer(output: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<platform.posix.uint8_t /* = kotlin.UByte */> */>?, input: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<platform.posix.uint8_t /* = kotlin.UByte */> */>?, length: platform.posix.uint32_t /* = kotlin.UInt */, key: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<platform.posix.uint8_t /* = kotlin.UByte */> */>?, iv: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<platform.posix.uint8_t /* = kotlin.UByte */> */>?): kotlin.Unit { /* compiled code */ }
I'm trying to use it with the following setup: https://gist.github.com/Syrou/52db691f91928cb6aad6bcfd84bf5cff 1. Am I wrong in trying to use toCValues() method to translate the uByteArrays into what is specified in the method argument? 2. Am I using the buffer pinning wrong? Because each time I run this code I end up with a new result. This might be an error in the c-lib to start with, but I'm currently investigating if my implementation of the native code is wrong.
a
j
Lol. Didn't think anyone had the exact same usecase as me. I will check that one out now..
Seems to have the same issue even following that, I'm getting the feeling that the aes library does not transform well into android native
Nevermind, got confused with all the different online tools of aes 128 cbc that generated different results. What you linked, especially the alloc part works
🎉 1