summaryrefslogtreecommitdiff
path: root/src/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto.c')
-rw-r--r--src/crypto.c1
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;