mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Merge branch '225-bluetooth-address' into 'master'
Show Bluetooth address from Settings.Secure in TestingActivity * To help with investigating #225 (and maybe other bugs in future), show the Bluetooth address from Settings.Secure as well as the address from BluetoothAdapter.getAddress() * Add Settings.Secure.ANDROID_ID to the entropy pool - it may provide up to 64 bits of extra entropy from the perspective of a remote attacker (no extra bits from the perspective of a local attacker in the same user account, who sees the same ANDROID_ID) See merge request !73
This commit is contained in:
@@ -15,6 +15,7 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -356,6 +357,13 @@ public class CrashReportActivity extends AppCompatActivity implements OnClickLis
|
|||||||
if (btDiscoverable) btStatus += "discoverable";
|
if (btDiscoverable) btStatus += "discoverable";
|
||||||
else btStatus += "not discoverable";
|
else btStatus += "not discoverable";
|
||||||
if (bt != null) btStatus += "\nAddress: " + bt.getAddress();
|
if (bt != null) btStatus += "\nAddress: " + bt.getAddress();
|
||||||
|
try {
|
||||||
|
String btAddr = Settings.Secure.getString(getContentResolver(),
|
||||||
|
"bluetooth_address");
|
||||||
|
btStatus += "\nAddress from settings: " + btAddr;
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
btStatus += "\nCould not get address from settings";
|
||||||
|
}
|
||||||
statusMap.put("Bluetooth:", btStatus);
|
statusMap.put("Bluetooth:", btStatus);
|
||||||
|
|
||||||
// Stack trace
|
// Stack trace
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@@ -359,6 +360,13 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
|
|||||||
if (btDiscoverable) btStatus += "discoverable";
|
if (btDiscoverable) btStatus += "discoverable";
|
||||||
else btStatus += "not discoverable";
|
else btStatus += "not discoverable";
|
||||||
if (bt != null) btStatus += "\nAddress: " + bt.getAddress();
|
if (bt != null) btStatus += "\nAddress: " + bt.getAddress();
|
||||||
|
try {
|
||||||
|
String btAddr = Settings.Secure.getString(getContentResolver(),
|
||||||
|
"bluetooth_address");
|
||||||
|
btStatus += "\nAddress from settings: " + btAddr;
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
btStatus += "\nCould not get address from settings";
|
||||||
|
}
|
||||||
statusMap.put("Bluetooth:", btStatus);
|
statusMap.put("Bluetooth:", btStatus);
|
||||||
|
|
||||||
Map<TransportId, TransportProperties> props = Collections.emptyMap();
|
Map<TransportId, TransportProperties> props = Collections.emptyMap();
|
||||||
|
|||||||
@@ -1,12 +1,27 @@
|
|||||||
package org.briarproject.system;
|
package org.briarproject.system;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static android.provider.Settings.Secure.ANDROID_ID;
|
||||||
|
|
||||||
class AndroidSeedProvider extends LinuxSeedProvider {
|
class AndroidSeedProvider extends LinuxSeedProvider {
|
||||||
|
|
||||||
|
private final Context appContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
AndroidSeedProvider(Application app) {
|
||||||
|
appContext = app.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void writeToEntropyPool(DataOutputStream out) throws IOException {
|
void writeToEntropyPool(DataOutputStream out) throws IOException {
|
||||||
out.writeInt(android.os.Process.myPid());
|
out.writeInt(android.os.Process.myPid());
|
||||||
@@ -14,6 +29,8 @@ class AndroidSeedProvider extends LinuxSeedProvider {
|
|||||||
out.writeInt(android.os.Process.myUid());
|
out.writeInt(android.os.Process.myUid());
|
||||||
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
|
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
|
||||||
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
|
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
|
||||||
|
ContentResolver contentResolver = appContext.getContentResolver();
|
||||||
|
out.writeUTF(Settings.Secure.getString(contentResolver, ANDROID_ID));
|
||||||
super.writeToEntropyPool(out);
|
super.writeToEntropyPool(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user