libaaruformat
1.0
Aaru Data Preservation Suite - Format Library
Toggle main menu visibility
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
28
extern
"C"
29
{
30
#endif
31
33
typedef
struct
Ps3PlaintextRegion
34
{
35
uint32_t
start_sector
;
36
uint32_t
end_sector
;
37
}
Ps3PlaintextRegion
;
38
39
#define PS3_MAX_PLAINTEXT_REGIONS 64
40
50
int32_t
ps3_parse_encryption_map
(
const
uint8_t *sector0, uint32_t length,
Ps3PlaintextRegion
**regions,
51
uint32_t *count);
52
64
int32_t
ps3_serialize_encryption_map
(
const
Ps3PlaintextRegion
*regions, uint32_t count, uint8_t **out_data,
65
uint32_t *out_length);
66
76
int32_t
ps3_deserialize_encryption_map
(
const
uint8_t *data, uint32_t length,
Ps3PlaintextRegion
**regions,
77
uint32_t *count);
78
87
bool
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 */
ps3_is_sector_encrypted
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).
Definition
ps3_encryption_map.c:151
ps3_deserialize_encryption_map
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).
Definition
ps3_encryption_map.c:117
ps3_parse_encryption_map
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).
Definition
ps3_encryption_map.c:48
ps3_serialize_encryption_map
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.
Definition
ps3_encryption_map.c:94
Ps3PlaintextRegion
A plaintext (unencrypted) region on a PS3 disc.
Definition
ps3_encryption_map.h:34
Ps3PlaintextRegion::start_sector
uint32_t start_sector
First sector of plaintext region (inclusive).
Definition
ps3_encryption_map.h:35
Ps3PlaintextRegion::end_sector
uint32_t end_sector
Last sector of plaintext region (inclusive).
Definition
ps3_encryption_map.h:36
src
ps3
ps3_encryption_map.h
Generated by
1.18.0