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:
akwizgran
2016-01-21 17:12:13 +00:00
3 changed files with 33 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
@@ -356,6 +357,13 @@ public class CrashReportActivity extends AppCompatActivity implements OnClickLis
if (btDiscoverable) btStatus += "discoverable";
else btStatus += "not discoverable";
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);
// Stack trace

View File

@@ -14,6 +14,7 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
@@ -359,6 +360,13 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
if (btDiscoverable) btStatus += "discoverable";
else btStatus += "not discoverable";
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);
Map<TransportId, TransportProperties> props = Collections.emptyMap();

View File

@@ -1,12 +1,27 @@
package org.briarproject.system;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.inject.Inject;
import static android.provider.Settings.Secure.ANDROID_ID;
class AndroidSeedProvider extends LinuxSeedProvider {
private final Context appContext;
@Inject
AndroidSeedProvider(Application app) {
appContext = app.getApplicationContext();
}
@Override
void writeToEntropyPool(DataOutputStream out) throws IOException {
out.writeInt(android.os.Process.myPid());
@@ -14,6 +29,8 @@ class AndroidSeedProvider extends LinuxSeedProvider {
out.writeInt(android.os.Process.myUid());
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
ContentResolver contentResolver = appContext.getContentResolver();
out.writeUTF(Settings.Secure.getString(contentResolver, ANDROID_ID));
super.writeToEntropyPool(out);
}
}