diff options
author | Kenny Root <kroot@google.com> | 2010-10-13 18:29:43 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-13 18:29:43 -0700 |
commit | 7f7c9a24b66277312c5e0426731598b8bfd11a14 (patch) | |
tree | 3f0c2533650544141d361aba34232f5ce7ca4c70 /include | |
parent | 5ebbba59e7e339b26554f2e5454978f3ce4042ea (diff) | |
parent | 95a68893125105f131ee1b4eaef1dc16da1ef789 (diff) | |
download | frameworks_native-7f7c9a24b66277312c5e0426731598b8bfd11a14.zip frameworks_native-7f7c9a24b66277312c5e0426731598b8bfd11a14.tar.gz frameworks_native-7f7c9a24b66277312c5e0426731598b8bfd11a14.tar.bz2 |
Merge "OBB: use PBKDF2 for key generation." into gingerbread
Diffstat (limited to 'include')
-rw-r--r-- | include/utils/ObbFile.h | 27 |
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; |