diff options
| author | jakob <jakob@memeware.net> | 2017-06-03 19:00:07 -0400 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-06-03 19:00:07 -0400 |
| commit | 17b658ceadd08d693f23448c276958e2eea5970e (patch) | |
| tree | 8d0f62709646de856373a0ffa4fc2513f717f770 /src/crypto.c | |
| parent | 6adad1bfad91274aad030cf6167c1f19fb602d62 (diff) | |
Fully working repacker, no bugs related to the encoded output being larger than the buffer, and filenames are properly encoded.
Diffstat (limited to 'src/crypto.c')
| -rw-r--r-- | src/crypto.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/crypto.c b/src/crypto.c index 5a91f39..958fb06 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -67,6 +67,7 @@ uint8_t derive_initial(struct game_key k, uint64_t file_key) { /* Generates a primary key for the given key structure and file key. */ uint8_t derive_primary(struct game_key k, uint64_t file_key) { + if (!k.master) return 0x00; uint32_t tmp = k.master ^ file_key; uint8_t primary = (tmp >> 24 ^ tmp >> 16 ^ tmp >> 8 ^ tmp) & 0xff; return primary == 0 ? k.fallback_primary : primary; |