Update signal-service to 2.5.9

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-05-30 18:30:37 -07:00
parent a9ea672888
commit cd55feb2b9
6 changed files with 23 additions and 32 deletions

View File

@@ -31,6 +31,7 @@ import org.thoughtcrime.securesms.util.Base64;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.VerifySpan;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.state.IdentityKeyStore;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
@@ -106,11 +107,10 @@ public class ConfirmIdentityDialog extends AlertDialog {
@Override
protected Void doInBackground(Void... params) {
synchronized (SESSION_LOCK) {
SignalProtocolAddress mismatchAddress = new SignalProtocolAddress(number, 1);
SignalProtocolAddress mismatchAddress = new SignalProtocolAddress(number, 1);
TextSecureIdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(getContext());
if (new TextSecureIdentityKeyStore(getContext()).saveIdentity(mismatchAddress, mismatch.getIdentityKey(), true, true)) {
new TextSecureSessionStore(getContext()).deleteAllSessions(number);
}
identityKeyStore.saveIdentity(mismatchAddress, mismatch.getIdentityKey(), true, true);
}
processMessageRecord(messageRecord);

View File

@@ -39,7 +39,6 @@ import org.thoughtcrime.securesms.components.webrtc.WebRtcCallControls;
import org.thoughtcrime.securesms.components.webrtc.WebRtcCallScreen;
import org.thoughtcrime.securesms.components.webrtc.WebRtcIncomingCallOverlay;
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
import org.thoughtcrime.securesms.events.WebRtcViewModel;
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -258,9 +257,8 @@ public class WebRtcCallActivity extends Activity {
@Override
public void onClick(View v) {
synchronized (SESSION_LOCK) {
if (new TextSecureIdentityKeyStore(WebRtcCallActivity.this).saveIdentity(new SignalProtocolAddress(recipient.getNumber(), 1), theirIdentity, true, true)) {
new TextSecureSessionStore(WebRtcCallActivity.this).deleteAllSessions(recipient.getNumber());
}
TextSecureIdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(WebRtcCallActivity.this);
identityKeyStore.saveIdentity(new SignalProtocolAddress(recipient.getNumber(), 1), theirIdentity, true, true);
}
Intent intent = new Intent(WebRtcCallActivity.this, WebRtcCallService.class);

View File

@@ -42,8 +42,8 @@ public class SignalProtocolStoreImpl implements SignalProtocolStore {
}
@Override
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
return identityKeyStore.saveIdentity(address, identityKey);
public void saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
identityKeyStore.saveIdentity(address, identityKey);
}
@Override

View File

@@ -42,8 +42,8 @@ public class TextSecureIdentityKeyStore implements IdentityKeyStore {
return TextSecurePreferences.getLocalRegistrationId(context);
}
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey,
boolean blockingApproval, boolean nonBlockingApproval)
public void saveIdentity(SignalProtocolAddress address, IdentityKey identityKey,
boolean blockingApproval, boolean nonBlockingApproval)
{
synchronized (LOCK) {
IdentityDatabase identityDatabase = DatabaseFactory.getIdentityDatabase(context);
@@ -54,29 +54,27 @@ public class TextSecureIdentityKeyStore implements IdentityKeyStore {
if (!identityRecord.isPresent()) {
Log.w(TAG, "Saving new identity...");
identityDatabase.saveIdentity(recipientId, identityKey, true, System.currentTimeMillis(), blockingApproval, nonBlockingApproval);
return false;
return;
}
if (!identityRecord.get().getIdentityKey().equals(identityKey)) {
Log.w(TAG, "Replacing existing identity...");
identityDatabase.saveIdentity(recipientId, identityKey, false, System.currentTimeMillis(), blockingApproval, nonBlockingApproval);
IdentityUtil.markIdentityUpdate(context, recipients.getPrimaryRecipient());
return true;
return;
}
if (isBlockingApprovalRequired(identityRecord.get()) || isNonBlockingApprovalRequired(identityRecord.get())) {
Log.w(TAG, "Setting approval status...");
identityDatabase.setApproval(recipientId, blockingApproval, nonBlockingApproval);
return false;
return;
}
return false;
}
}
@Override
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
return saveIdentity(address, identityKey, !TextSecurePreferences.isSendingIdentityApprovalRequired(context), false);
public void saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
saveIdentity(address, identityKey, !TextSecurePreferences.isSendingIdentityApprovalRequired(context), false);
}
@Override

View File

@@ -6,7 +6,6 @@ import android.support.annotation.NonNull;
import android.util.Log;
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.dependencies.InjectableType;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -84,11 +83,7 @@ public class RetrieveProfileJob extends ContextJob implements InjectableType {
synchronized (SESSION_LOCK) {
IdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(context);
if (identityKeyStore.saveIdentity(new SignalProtocolAddress(recipient.getNumber(), 1), identityKey)) {
Log.w(TAG, "Deleting all sessions...");
new TextSecureSessionStore(getContext()).deleteAllSessions(recipient.getNumber());
}
identityKeyStore.saveIdentity(new SignalProtocolAddress(recipient.getNumber(), 1), identityKey);
}
}