diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2015-03-08 19:07:42 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2015-05-02 16:52:14 +0200 |
commit | b230cf3aa24f3883b8b165bd5fd56620a9a95e47 (patch) | |
tree | 19e46e3697c98c3e51f7f4e91e3879f95bd0bc43 /rbutil/rbutilqt/quazip/crypt.h | |
parent | d4fee369712f006785fd3a8904a5e2b5c529598b (diff) | |
download | rockbox-b230cf3aa24f3883b8b165bd5fd56620a9a95e47.tar.gz rockbox-b230cf3aa24f3883b8b165bd5fd56620a9a95e47.zip |
Update quazip to release 0.7.1.
Update to latest quazip release. Note that quazip is now LGPL and not GPL /
LGPL dual licensed anymore.
Change-Id: Ie1e975b5b546dd31218eef9df472527493fe81e0
Diffstat (limited to 'rbutil/rbutilqt/quazip/crypt.h')
-rw-r--r-- | rbutil/rbutilqt/quazip/crypt.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rbutil/rbutilqt/quazip/crypt.h b/rbutil/rbutilqt/quazip/crypt.h index 359cf6726e..ddee28e7dd 100644 --- a/rbutil/rbutilqt/quazip/crypt.h +++ b/rbutil/rbutilqt/quazip/crypt.h | |||
@@ -27,17 +27,19 @@ | |||
27 | Encryption is not supported. | 27 | Encryption is not supported. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "quazip_global.h" | ||
31 | |||
30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) | 32 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) |
31 | 33 | ||
32 | /*********************************************************************** | 34 | /*********************************************************************** |
33 | * Return the next byte in the pseudo-random sequence | 35 | * Return the next byte in the pseudo-random sequence |
34 | */ | 36 | */ |
35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) | 37 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t FAR * pcrc_32_tab UNUSED) |
36 | { | 38 | { |
39 | //(void) pcrc_32_tab; /* avoid "unused parameter" warning */ | ||
37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an | 40 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an |
38 | * unpredictable manner on 16-bit systems; not a problem | 41 | * unpredictable manner on 16-bit systems; not a problem |
39 | * with any known compiler so far, though */ | 42 | * with any known compiler so far, though */ |
40 | (void) pcrc_32_tab; /* avoid "unused parameter" warning */ | ||
41 | 43 | ||
42 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; | 44 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; |
43 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); | 45 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); |
@@ -46,7 +48,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) | |||
46 | /*********************************************************************** | 48 | /*********************************************************************** |
47 | * Update the encryption keys with the next byte of plain text | 49 | * Update the encryption keys with the next byte of plain text |
48 | */ | 50 | */ |
49 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) | 51 | static int update_keys(unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab,int c) |
50 | { | 52 | { |
51 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); | 53 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); |
52 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; | 54 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; |
@@ -63,7 +65,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int | |||
63 | * Initialize the encryption keys and the random header according to | 65 | * Initialize the encryption keys and the random header according to |
64 | * the given password. | 66 | * the given password. |
65 | */ | 67 | */ |
66 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) | 68 | static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab) |
67 | { | 69 | { |
68 | *(pkeys+0) = 305419896L; | 70 | *(pkeys+0) = 305419896L; |
69 | *(pkeys+1) = 591751049L; | 71 | *(pkeys+1) = 591751049L; |
@@ -93,7 +95,7 @@ static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) | |||
93 | unsigned char *buf; /* where to write header */ | 95 | unsigned char *buf; /* where to write header */ |
94 | int bufSize; | 96 | int bufSize; |
95 | unsigned long* pkeys; | 97 | unsigned long* pkeys; |
96 | const unsigned long* pcrc_32_tab; | 98 | const z_crc_t FAR * pcrc_32_tab; |
97 | unsigned long crcForCrypting; | 99 | unsigned long crcForCrypting; |
98 | { | 100 | { |
99 | int n; /* index in random header */ | 101 | int n; /* index in random header */ |