21#ifndef LIBAARUFORMAT_WIIU_CRYPTO_H
22#define LIBAARUFORMAT_WIIU_CRYPTO_H
35#define WIIU_CRYPTO_SECTOR_SIZE 0x8000
36#define WIIU_LOGICAL_PER_PHYSICAL 16
37#define WIIU_HEADER_PHYSICAL_SECTORS 3
38#define WIIU_MAX_PARTITIONS 8
67 uint64_t logical_sector);
A Wii U partition region entry (in-memory representation).
uint8_t key[16]
AES-128 key for encrypted sectors in this partition.
uint32_t start_sector
First physical sector of partition (plaintext header).
uint32_t end_sector
End physical sector (exclusive).
Master context representing an open or in‑creation Aaru image.
void wiiu_encrypt_physical_sector(const uint8_t key[16], uint8_t *data, uint32_t length)
Encrypt a full 0x8000-byte physical sector in-place.
int32_t wiiu_deserialize_partition_key_map(const uint8_t *data, uint32_t data_len, WiiuPartitionRegion **regions, uint32_t *count)
Deserialize a partition key map from a media tag buffer.
void wiiu_lazy_init(aaruformat_context *ctx)
Lazy initialization: load disc key and partition key map from media tags.
void wiiu_decrypt_physical_sector(const uint8_t key[16], uint8_t *data, uint32_t length)
Decrypt a full 0x8000-byte physical sector in-place.
int32_t wiiu_serialize_partition_key_map(const WiiuPartitionRegion *regions, uint32_t count, uint8_t **out_data, uint32_t *out_len)
Serialize a partition key map for storage as a media tag.
const uint8_t * wiiu_get_sector_key(const WiiuPartitionRegion *regions, uint32_t region_count, uint64_t logical_sector)
Get the encryption key for a given logical sector (2048-byte).
bool wiiu_is_sector_encrypted(const WiiuPartitionRegion *regions, uint32_t region_count, uint64_t logical_sector)
Check if a logical sector (2048-byte) is in an encrypted region.