libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
ps3_crypto.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 disc encryption: key derivation, sector encrypt/decrypt, IV derivation.
19 */
20
21#ifndef LIBAARUFORMAT_PS3_CRYPTO_H
22#define LIBAARUFORMAT_PS3_CRYPTO_H
23
24#include <stdbool.h>
25#include <stdint.h>
26
27/* Forward declaration */
29
30#ifdef __cplusplus
31extern "C"
32{
33#endif
34
43 void ps3_derive_disc_key(const uint8_t data1[16], uint8_t disc_key[16]);
44
53 void ps3_derive_iv(uint64_t sector_num, uint8_t iv[16]);
54
63 void ps3_encrypt_sector(const uint8_t disc_key[16], uint64_t sector_num, uint8_t *data, uint32_t length);
64
73 void ps3_decrypt_sector(const uint8_t disc_key[16], uint64_t sector_num, uint8_t *data, uint32_t length);
74
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* LIBAARUFORMAT_PS3_CRYPTO_H */
void ps3_lazy_init(aaruformat_context *ctx)
Lazy-initialize PS3 encryption state from context media tags.
Definition ps3_crypto.c:70
void ps3_derive_disc_key(const uint8_t data1[16], uint8_t disc_key[16])
Derive a PS3 disc key from a data1 key.
Definition ps3_crypto.c:39
void ps3_derive_iv(uint64_t sector_num, uint8_t iv[16])
Derive the per-sector AES IV from a sector number.
Definition ps3_crypto.c:45
void ps3_decrypt_sector(const uint8_t disc_key[16], uint64_t sector_num, uint8_t *data, uint32_t length)
Decrypt a sector using PS3 disc encryption (AES-128-CBC).
Definition ps3_crypto.c:63
void ps3_encrypt_sector(const uint8_t disc_key[16], uint64_t sector_num, uint8_t *data, uint32_t length)
Encrypt a sector using PS3 disc encryption (AES-128-CBC).
Definition ps3_crypto.c:56
Master context representing an open or in‑creation Aaru image.
Definition context.h:175