File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 44 */
55package aws.sdk.kotlin.crt.util.hashing
66
7+ import aws.sdk.kotlin.crt.CRT
78import kotlinx.cinterop.*
89import libcrt.aws_checksums_crc32
910import libcrt.aws_checksums_crc32c
@@ -20,6 +21,10 @@ internal typealias AwsChecksumsCrcFunction = (
2021) -> uint32_t
2122
2223internal class Crc (val checksumFn : AwsChecksumsCrcFunction ) : HashFunction {
24+ init {
25+ CRT .initRuntime { }
26+ }
27+
2328 private var crc = 0U
2429
2530 override fun update (input : ByteArray , offset : Int , length : Int ) {
Original file line number Diff line number Diff line change 55package aws.sdk.kotlin.crt.util.hashing
66
77import aws.sdk.kotlin.crt.Allocator
8+ import aws.sdk.kotlin.crt.CRT
89import aws.sdk.kotlin.crt.awsAssertOpSuccess
910import kotlinx.cinterop.addressOf
1011import kotlinx.cinterop.cValue
@@ -23,6 +24,10 @@ import libcrt.aws_md5_new
2324 * MD5 hash function implemented using bindings to CRT
2425 */
2526public class Md5 : HashFunction {
27+ init {
28+ CRT .initRuntime { }
29+ }
30+
2631 private var md5 = checkNotNull(aws_md5_new(Allocator .Default )) { " aws_md5_new" }
2732
2833 override fun update (input : ByteArray , offset : Int , length : Int ) {
Original file line number Diff line number Diff line change 55package aws.sdk.kotlin.crt.util.hashing
66
77import aws.sdk.kotlin.crt.Allocator
8+ import aws.sdk.kotlin.crt.CRT
89import aws.sdk.kotlin.crt.awsAssertOpSuccess
910import kotlinx.cinterop.*
1011import libcrt.*
@@ -48,6 +49,7 @@ internal class Sha(val initializeFn: InitializeHashFn) : HashFunction {
4849 private var hash: CPointer < aws_hash>
4950
5051 init {
52+ CRT .initRuntime { }
5153 hash = initializeHash()
5254 }
5355
You can’t perform that action at this time.
0 commit comments