Update sodium dependency to forked repo

This commit is contained in:
ceokot 2022-05-18 19:46:15 +10:00
parent 748407f951
commit c7db9529f9
6 changed files with 7 additions and 14 deletions

View File

@ -105,9 +105,8 @@ dependencies {
implementation project(":libsession") implementation project(":libsession")
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxJsonVersion" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxJsonVersion"
implementation "org.whispersystems:curve25519-java:$curve25519Version" implementation "org.whispersystems:curve25519-java:$curve25519Version"
implementation project(":liblazysodium") implementation 'com.github.oxen-io:session-lazysodium-android:master-SNAPSHOT@aar'
// implementation 'com.goterl:lazysodium-android:5.0.2@aar' implementation "net.java.dev.jna:jna:5.9.0@aar"
implementation "net.java.dev.jna:jna:5.8.0@aar"
implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion" implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion" implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"

View File

@ -1,2 +0,0 @@
configurations.maybeCreate("default")
artifacts.add("default", file('lazysodium.aar'))

Binary file not shown.

View File

@ -18,9 +18,8 @@ android {
dependencies { dependencies {
implementation project(":libsignal") implementation project(":libsignal")
implementation project(":liblazysodium") implementation 'com.github.oxen-io:session-lazysodium-android:master-SNAPSHOT@aar'
// implementation 'com.goterl:lazysodium-android:5.0.2@aar' implementation "net.java.dev.jna:jna:5.9.0@aar"
implementation "net.java.dev.jna:jna:5.8.0@aar"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'

View File

@ -2,10 +2,8 @@ package org.session.libsession.messaging.utilities
import com.goterl.lazysodium.LazySodiumAndroid import com.goterl.lazysodium.LazySodiumAndroid
import com.goterl.lazysodium.SodiumAndroid import com.goterl.lazysodium.SodiumAndroid
import com.goterl.lazysodium.interfaces.AEAD
import com.goterl.lazysodium.interfaces.GenericHash import com.goterl.lazysodium.interfaces.GenericHash
import com.goterl.lazysodium.interfaces.Hash import com.goterl.lazysodium.interfaces.Hash
import com.goterl.lazysodium.interfaces.Sign
import com.goterl.lazysodium.utils.Key import com.goterl.lazysodium.utils.Key
import com.goterl.lazysodium.utils.KeyPair import com.goterl.lazysodium.utils.KeyPair
import org.session.libsignal.utilities.Hex import org.session.libsignal.utilities.Hex
@ -62,7 +60,7 @@ object SodiumUtilities {
if (kaBytes.all { it.toInt() == 0 }) return null if (kaBytes.all { it.toInt() == 0 }) return null
val kABytes = ByteArray(PUBLIC_KEY_LENGTH) val kABytes = ByteArray(PUBLIC_KEY_LENGTH)
return if (sodium.cryptoScalarMultE25519BaseNoClamp(kABytes, kaBytes)) { return if (sodium.cryptoScalarMultEd25519BaseNoClamp(kABytes, kaBytes)) {
KeyPair(Key.fromBytes(kABytes), Key.fromBytes(kaBytes)) KeyPair(Key.fromBytes(kABytes), Key.fromBytes(kaBytes))
} else { } else {
null null
@ -94,7 +92,7 @@ object SodiumUtilities {
// sig_R = salt.crypto_scalarmult_ed25519_base_noclamp(r) // sig_R = salt.crypto_scalarmult_ed25519_base_noclamp(r)
val sig_R = ByteArray(NO_CLAMP_LENGTH) val sig_R = ByteArray(NO_CLAMP_LENGTH)
if (!sodium.cryptoScalarMultE25519BaseNoClamp(sig_R, r)) return null if (!sodium.cryptoScalarMultEd25519BaseNoClamp(sig_R, r)) return null
// HRAM = salt.crypto_core_ed25519_scalar_reduce(sha512_multipart(sig_R, kA, message_parts)) // HRAM = salt.crypto_core_ed25519_scalar_reduce(sha512_multipart(sig_R, kA, message_parts))
val hRamHash = sha512Multipart(listOf(sig_R, blindedPublicKey, message)) ?: return null val hRamHash = sha512Multipart(listOf(sig_R, blindedPublicKey, message)) ?: return null
@ -129,7 +127,7 @@ object SodiumUtilities {
/* Combines two keys (`kA`) */ /* Combines two keys (`kA`) */
internal fun combineKeys(lhsKey: ByteArray, rhsKey: ByteArray): ByteArray? { internal fun combineKeys(lhsKey: ByteArray, rhsKey: ByteArray): ByteArray? {
val kA = ByteArray(NO_CLAMP_LENGTH) val kA = ByteArray(NO_CLAMP_LENGTH)
return if (sodium.cryptoScalarMultE25519NoClamp(kA, lhsKey, rhsKey)) { return if (sodium.cryptoScalarMultEd25519NoClamp(kA, lhsKey, rhsKey)) {
kA kA
} else null } else null
} }

View File

@ -1,6 +1,5 @@
rootProject.name = "session-android" rootProject.name = "session-android"
include ':app' include ':app'
include ':liblazysodium'
include ':libsession' include ':libsession'
include ':libsignal' include ':libsignal'