summaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-10-13 22:54:10 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-13 22:54:10 -0700
commit8fda1636e3e35f060b9046294efd3c062a1fdb84 (patch)
tree9c5d4cb8df12357a067f5214eb2f3dbd08d252ca /include/utils
parente3c50a5470f64fd99438d6fd985f88d9fe20919a (diff)
parentbdf8034c657147226b2390eef113ff841e0d6065 (diff)
downloadframeworks_base-8fda1636e3e35f060b9046294efd3c062a1fdb84.zip
frameworks_base-8fda1636e3e35f060b9046294efd3c062a1fdb84.tar.gz
frameworks_base-8fda1636e3e35f060b9046294efd3c062a1fdb84.tar.bz2
am bdf8034c: Merge "OBB: use PBKDF2 for key generation." into gingerbread
Merge commit 'bdf8034c657147226b2390eef113ff841e0d6065' into gingerbread-plus-aosp * commit 'bdf8034c657147226b2390eef113ff841e0d6065': OBB: use PBKDF2 for key generation.
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/ObbFile.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/utils/ObbFile.h b/include/utils/ObbFile.h
index 5243f50..47559cd 100644
--- a/include/utils/ObbFile.h
+++ b/include/utils/ObbFile.h
@@ -27,6 +27,7 @@ namespace android {
// OBB flags (bit 0)
#define OBB_OVERLAY (1 << 0)
+#define OBB_SALTED (1 << 1)
class ObbFile : public RefBase {
protected:
@@ -70,6 +71,26 @@ public:
mFlags = flags;
}
+ const unsigned char* getSalt(size_t* length) const {
+ if ((mFlags & OBB_SALTED) == 0) {
+ *length = 0;
+ return NULL;
+ }
+
+ *length = sizeof(mSalt);
+ return mSalt;
+ }
+
+ bool setSalt(const unsigned char* salt, size_t length) {
+ if (length != sizeof(mSalt)) {
+ return false;
+ }
+
+ memcpy(mSalt, salt, sizeof(mSalt));
+ mFlags |= OBB_SALTED;
+ return true;
+ }
+
bool isOverlay() {
return (mFlags & OBB_OVERLAY) == OBB_OVERLAY;
}
@@ -103,6 +124,12 @@ private:
/* Flags for this OBB type. */
int32_t mFlags;
+ /* Whether the file is salted. */
+ bool mSalted;
+
+ /* The encryption salt. */
+ unsigned char mSalt[8];
+
const char* mFileName;
size_t mFileSize;