rpcs3/rpcs3/Crypto/utils.h
Hykem 196c2ffe5b Updated the crypto engine:
- Updated AES and SHA-1 source code;
- Fixed a few code warnings;
- Implemented EDAT/SDAT decryption.

Started SPURS implementation:
- Added an internal SPURSManager class draft;
- Added several drafts for cellSpurs functions.

Implemented key.edat decryption in sceNpDrmIsAvailable:
- NOTE: Currently, the decrypted key.edat is stored under dev_hdd1/titleID and the user must replace this file in dev_hdd0. This behavior will change in the future as it's currently intended for controlled testing only.
2014-03-30 21:09:49 +01:00

22 lines
No EOL
1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "aes.h"
#include "sha1.h"
// Auxiliary functions (endian swap and xor).
u16 swap16(u16 i);
u32 swap32(u32 i);
u64 swap64(u64 i);
void xor(unsigned char *dest, unsigned char *src1, unsigned char *src2, int size);
// Hex string conversion auxiliary functions.
u64 hex_to_u64(const char* hex_str);
void hex_to_bytes(unsigned char *data, const char *hex_str);
// Crypto functions (AES128-CBC, AES128-ECB, SHA1-HMAC and AES-CMAC).
void aescbc128_decrypt(unsigned char *key, unsigned char *iv, unsigned char *in, unsigned char *out, int len);
void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out);
bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash);
bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash);
// Reverse-engineered custom LempelZivMarkov based compression (unknown variant of LZRC).
int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size);