From bc628fe5ce01c8e6e34eeb940949059ad8ff9a5a Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Tue, 12 Aug 2008 23:51:04 +0000 Subject: Zenutils: * Make update_extract work again * Add other players to zen_crypt * Change stricmp() calls to strcasecmp() in zen_crypt git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18264 a1c6a512-1295-4272-9138-f99709370657 --- utils/zenutils/source/shared/updater.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'utils/zenutils/source/shared/updater.cpp') diff --git a/utils/zenutils/source/shared/updater.cpp b/utils/zenutils/source/shared/updater.cpp index 25d8452..3944863 100644 --- a/utils/zenutils/source/shared/updater.cpp +++ b/utils/zenutils/source/shared/updater.cpp @@ -99,6 +99,24 @@ bool zen::find_firmware_archive(const std::string& filename, dword& va, dword& p bool zen::crypt_firmware(const char* key, byte* buffer, size_t len) { +#if 1 + char key_cpy[255]; + unsigned int i; + unsigned int tmp = 0; + int key_length = strlen(key); + + strcpy(key_cpy, key); + for(i=0; i < strlen(key); i++) + key_cpy[i] = key[i] - 1; + + for(i=0; i < len; i++) + { + buffer[i] ^= key_cpy[tmp] | 0x80; + tmp = (tmp + 1) % key_length; + } + + return true; +#else // Determine if the key length is dword aligned. int keylen = strlen(key); int keylen_rem = keylen % sizeof(dword); @@ -148,4 +166,5 @@ bool zen::crypt_firmware(const char* key, byte* buffer, size_t len) } return true; +#endif } -- cgit v1.1