Thomas
11/06/2019, 4:22 PMval identityBytes: ByteArray = someValue()
val pskBytes: ByteArray = someValue()
// <https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_set_psk_client_callback.html>
SSL_CTX_set_psk_client_callback(ctx, staticCFunction { ssl, hint, identity, maxIdentityLen, psk, maxPskLen ->
require(identityBytes.size <= maxIdentityLen.toInt())
require(pskBytes.size <= maxPskLen.toInt())
identityBytes.forEachIndexed { index, value ->
identity!![index] = value
}
pskBytes.forEachIndexed { index, value ->
psk!![index] = value.toUByte()
}
// ...
TODO()
})
When compiling this gives an error:
kotlinx.cinterop.staticCFunction must take an unbound, non-capturing function or lambda
I need to access identityBytes and pskBytes from this lambda. Is that possible?olonho
11/06/2019, 4:36 PMThomas
11/06/2019, 4:53 PMThomas
11/06/2019, 4:54 PMThomas
11/06/2019, 4:57 PMolonho
11/07/2019, 4:14 AM