From 17b658ceadd08d693f23448c276958e2eea5970e Mon Sep 17 00:00:00 2001 From: jakob Date: Sat, 3 Jun 2017 19:00:07 -0400 Subject: Fully working repacker, no bugs related to the encoded output being larger than the buffer, and filenames are properly encoded. --- src/crypto.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/crypto.c') 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; -- cgit v1.3