diff options
| author | Eric Biggers <ebiggers@google.com> | 2022-03-01 21:19:10 +0000 |
|---|---|---|
| committer | Eric Biggers <ebiggers@google.com> | 2022-03-04 04:51:54 +0000 |
| commit | 8bc9340b4c186a77dfd467c0e4e5106df77be06e (patch) | |
| tree | 1b84ac22e318a35ceef1d02b68d09173238e2a47 /core/java | |
| parent | 7ee20f28301596f1825e7ff8fedef3ee700e6d08 (diff) | |
Remove broken code for mounting encrypted OBB files
Mounting encrypted OBB files has never worked reliably across devices,
partly due to its reliance on Twofish encryption support in the kernel.
This is because Twofish support (CONFIG_CRYPTO_TWOFISH) has never been
required or even recommended for Android. It has never been enabled in
GKI, but even before GKI it wasn't required or recommended. Moreover,
this is now the only Android feature that still uses dm-crypt
(CONFIG_DM_CRYPT), and some devices don't have that enabled either.
Therefore, it appears that this feature is unused. That's perhaps not
surprising, considering that the documentation for OBBs
(https://developer.android.com/google/play/expansion-files) says that
they are deprecated, and also it explains OBBs as being app files that
are opaque to the platform; the ability of the platform to mount OBBs
that happen to be in a particular format is never mentioned. That means
that OBB mounting is probably rarely used even with unencrypted OBBs.
Finally, the usefulness of OBBs having their own encryption layer (in
addition to what the platform already provides via FBE) is not clear
either, especially with such an unusual choice of cipher.
To avoid the confusion that is being caused by having the broken code
for mounting encrypted OBBs still sitting around, let's remove it.
Test: atest StorageManagerTest # on Cuttlefish
Test: atest StorageManagerIntegrationTest # on Cuttlefish
Bug: 216475849
Change-Id: I6e6a6462ab8343299dc5e0145b87dc28b16b0bc1
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/storage/IStorageManager.aidl | 12 | ||||
| -rw-r--r-- | core/java/android/os/storage/StorageManager.java | 13 |
2 files changed, 13 insertions, 12 deletions
diff --git a/core/java/android/os/storage/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl index 9385402c3d72..6c0a1f99e112 100644 --- a/core/java/android/os/storage/IStorageManager.aidl +++ b/core/java/android/os/storage/IStorageManager.aidl @@ -54,13 +54,13 @@ interface IStorageManager { */ void shutdown(IStorageShutdownObserver observer) = 19; /** - * Mounts an Opaque Binary Blob (OBB) with the specified decryption key and - * only allows the calling process's UID access to the contents. - * StorageManagerService will call back to the supplied IObbActionListener to inform - * it of the terminal state of the call. + * Mounts an Opaque Binary Blob (OBB). Only allows the calling process's UID + * access to the contents. StorageManagerService will call back to the + * supplied IObbActionListener to inform it of the terminal state of the + * call. */ - void mountObb(in String rawPath, in String canonicalPath, in String key, - IObbActionListener token, int nonce, in ObbInfo obbInfo) = 21; + void mountObb(in String rawPath, in String canonicalPath, IObbActionListener token, + int nonce, in ObbInfo obbInfo) = 21; /** * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, * any program using it will be forcibly killed to unmount the image. diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 77c794cd17a8..39f87d558098 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -665,9 +665,7 @@ public class StorageManager { } /** - * Mount an Opaque Binary Blob (OBB) file. If a <code>key</code> is - * specified, it is supplied to the mounting process to be used in any - * encryption used in the OBB. + * Mount an Opaque Binary Blob (OBB) file. * <p> * The OBB will remain mounted for as long as the StorageManager reference * is held by the application. As soon as this reference is lost, the OBBs @@ -680,19 +678,22 @@ public class StorageManager { * application's OBB that shares its UID. * * @param rawPath the path to the OBB file - * @param key secret used to encrypt the OBB; may be <code>null</code> if no - * encryption was used on the OBB. + * @param key must be <code>null</code>. Previously, some Android device + * implementations accepted a non-<code>null</code> key to mount + * an encrypted OBB file. However, this never worked reliably and + * is no longer supported. * @param listener will receive the success or failure of the operation * @return whether the mount call was successfully queued or not */ public boolean mountObb(String rawPath, String key, OnObbStateChangeListener listener) { Preconditions.checkNotNull(rawPath, "rawPath cannot be null"); + Preconditions.checkArgument(key == null, "mounting encrypted OBBs is no longer supported"); Preconditions.checkNotNull(listener, "listener cannot be null"); try { final String canonicalPath = new File(rawPath).getCanonicalPath(); final int nonce = mObbActionListener.addListener(listener); - mStorageManager.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce, + mStorageManager.mountObb(rawPath, canonicalPath, mObbActionListener, nonce, getObbInfo(canonicalPath)); return true; } catch (IOException e) { |
