libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
ps3_encryption_map.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2026 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; version 2.1 of the License.
8 *
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see
16 * <https://www.gnu.org/licenses/>.
17 *
18 * PS3 encryption map: plaintext region parsing, serialization, and lookup.
19 */
20
21#ifndef LIBAARUFORMAT_PS3_ENCRYPTION_MAP_H
22#define LIBAARUFORMAT_PS3_ENCRYPTION_MAP_H
23
24#include <stdbool.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C"
29{
30#endif
31
38
39#define PS3_MAX_PLAINTEXT_REGIONS 64
40
50int32_t ps3_parse_encryption_map(const uint8_t *sector0, uint32_t length, Ps3PlaintextRegion **regions,
51 uint32_t *count);
52
64int32_t ps3_serialize_encryption_map(const Ps3PlaintextRegion *regions, uint32_t count, uint8_t **out_data,
65 uint32_t *out_length);
66
76int32_t ps3_deserialize_encryption_map(const uint8_t *data, uint32_t length, Ps3PlaintextRegion **regions,
77 uint32_t *count);
78
87bool ps3_is_sector_encrypted(const Ps3PlaintextRegion *plaintext_regions, uint32_t region_count,
88 uint64_t sector_address);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* LIBAARUFORMAT_PS3_ENCRYPTION_MAP_H */
bool ps3_is_sector_encrypted(const Ps3PlaintextRegion *plaintext_regions, uint32_t region_count, uint64_t sector_address)
Check whether a sector is encrypted (i.e., not in any plaintext region).
int32_t ps3_deserialize_encryption_map(const uint8_t *data, uint32_t length, Ps3PlaintextRegion **regions, uint32_t *count)
Deserialize plaintext regions from little-endian binary (media tag format).
int32_t ps3_parse_encryption_map(const uint8_t *sector0, uint32_t length, Ps3PlaintextRegion **regions, uint32_t *count)
Parse the encryption map from PS3 disc sector 0 (big-endian on disc).
int32_t ps3_serialize_encryption_map(const Ps3PlaintextRegion *regions, uint32_t count, uint8_t **out_data, uint32_t *out_length)
Serialize plaintext regions to little-endian binary for storage as a media tag.
A plaintext (unencrypted) region on a PS3 disc.
uint32_t start_sector
First sector of plaintext region (inclusive).
uint32_t end_sector
Last sector of plaintext region (inclusive).