Hand built libsodium libraries, andoird armv8 missing aes128l/256 aegis implementations
This commit is contained in:
parent
5228614fce
commit
bccf9e82f2
17
README.md
17
README.md
@ -128,28 +128,11 @@ Currently supported native platforms:
|
||||
|
||||
### TODO:
|
||||
- Copy/adapt code documentation, currently only some functions have documentation that is a copy-paste from libsodium website
|
||||
- Replace LazySodium with direct JNA calls, and add build scripts for required libraries if missing
|
||||
- Android testing
|
||||
- Fix browser testing, both locally and in CI/CD
|
||||
- LobsodiumUtil `unpad` and `fromBase64` native implementations use a nasty hack to support shared native sourceset. The hack either needs to be removed and replaced with another solution or additional safeguards need to be added.
|
||||
- Complete exposing libsodium constants
|
||||
|
||||
### Known issues:
|
||||
- Using LazySodium self built variant to fix some of the bugs present in LazySodium, but **Android** is using directly
|
||||
LazySodium release which has not been updated (latest version is 4.2.0), this means that randombytes_random, basetobin and
|
||||
base64tohex functions are not working on Android, as well as problems with sodium_pad:
|
||||
|
||||
https://github.com/terl/lazysodium-java/issues/83
|
||||
|
||||
https://github.com/terl/lazysodium-java/issues/85
|
||||
|
||||
https://github.com/terl/lazysodium-java/issues/86
|
||||
|
||||
Also it is not clear where are the precompiled libraries in LazySodium coming from
|
||||
|
||||
This will be handled by providing a new JNA libsodium wrapper library
|
||||
|
||||
|
||||
|
||||
#### Notes for Gitlab runners:
|
||||
- At the moment all runners need to have android sdk
|
||||
|
@ -32,6 +32,8 @@ object Versions {
|
||||
val timber = "4.7.1"
|
||||
val kodeinVersion = "7.1.0"
|
||||
|
||||
val resourceLoader = "1.3.10"
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -39,7 +41,7 @@ object Versions {
|
||||
object ReleaseInfo {
|
||||
val group = "com.ionspin.kotlin"
|
||||
val version = "0.1.0-SNAPSHOT"
|
||||
val bindingsVersion = "0.1.1-SNAPSHOT"
|
||||
val bindingsVersion = "0.8.0-SNAPSHOT"
|
||||
}
|
||||
|
||||
object Deps {
|
||||
@ -112,6 +114,8 @@ object Deps {
|
||||
|
||||
val kotlinPoet = "com.squareup:kotlinpoet:${Versions.kotlinPoet}"
|
||||
|
||||
val resourceLoader = "co.libly:resource-loader:${Versions.resourceLoader}"
|
||||
|
||||
object Delegated {
|
||||
// Temporary until reported lazysodium issues are fixed. My snapshot build with
|
||||
// And cause I registered com.ionspin.kotlin as maven central package root now I have to use
|
||||
|
@ -468,6 +468,8 @@ kotlin {
|
||||
implementation(kotlin(Deps.Jvm.test))
|
||||
implementation(kotlin(Deps.Jvm.testJUnit))
|
||||
|
||||
implementation(Deps.Jvm.resourceLoader)
|
||||
|
||||
//lazysodium
|
||||
implementation(Deps.Jvm.Delegated.lazysodium)
|
||||
implementation(Deps.Jvm.Delegated.jna)
|
||||
@ -678,6 +680,13 @@ tasks {
|
||||
|
||||
}
|
||||
|
||||
allprojects {
|
||||
tasks.withType(JavaCompile::class) {
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
signing {
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,57 @@
|
||||
package com.ionspin.kotlin.crypto.jnitest
|
||||
|
||||
import co.libly.resourceloader.FileLoader
|
||||
import co.libly.resourceloader.ResourceLoader
|
||||
import com.sun.jna.Library
|
||||
import com.sun.jna.Native
|
||||
import com.sun.jna.NativeLibrary
|
||||
import com.sun.jna.Platform
|
||||
import java.io.File
|
||||
import java.lang.RuntimeException
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
/**
|
||||
* Created by Ugljesa Jovanovic
|
||||
* ugljesa.jovanovic@ionspin.com
|
||||
* on 20-Feb-2021
|
||||
*/
|
||||
object JniTest {
|
||||
|
||||
|
||||
init {
|
||||
val libraryFile = when {
|
||||
Platform.isMac() -> {
|
||||
FileLoader.get().load("dynamic-macos-x86-64.dylib", Any::class.java)
|
||||
}
|
||||
Platform.isLinux() -> {
|
||||
FileLoader.get().load("dynamic-linux-x86-64-libsodium.so", Any::class.java)
|
||||
}
|
||||
Platform.isWindows() -> {
|
||||
File("/home/ionspin/Projects/Future/kotlin-multiplatform-libsodium/multiplatform-crypto-libsodium-bindings/src/jvmMain/resources/dynamic-linux-x86-64-libsodium.so")
|
||||
}
|
||||
Platform.isAndroid() -> {
|
||||
File("/home/ionspin/Projects/Future/kotlin-multiplatform-libsodium/multiplatform-crypto-libsodium-bindings/src/jvmMain/resources/dynamic-linux-x86-64-libsodium.so")
|
||||
}
|
||||
else -> throw RuntimeException("Unknown platform")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
println(libraryFile.absoluteFile)
|
||||
val loaded = Native.load(libraryFile.absolutePath, SodiumVersion::class.java) as SodiumVersion
|
||||
val version = loaded.sodium_version_string()
|
||||
|
||||
println("Loaded ${loaded.sodium_version_string()}")
|
||||
assertEquals("1.0.18", version)
|
||||
|
||||
}
|
||||
|
||||
fun work() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface SodiumVersion : Library {
|
||||
fun sodium_version_string() : String
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
||||
package com.ionspin.kotlin.crypto.jnitest
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Created by Ugljesa Jovanovic
|
||||
* ugljesa.jovanovic@ionspin.com
|
||||
* on 20-Feb-2021
|
||||
*/
|
||||
class JniTestTest {
|
||||
|
||||
@Test
|
||||
fun testJniTest() {
|
||||
JniTest.work()
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user