mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Merge branch 'master' of https://github.com/DHrpcs3/rpcs3
This commit is contained in:
commit
b32a8e2e28
52 changed files with 3981 additions and 10290 deletions
|
@ -40,8 +40,7 @@ ${CMAKE_SOURCE_DIR}/Emu/*
|
|||
${CMAKE_SOURCE_DIR}/Gui/*
|
||||
${CMAKE_SOURCE_DIR}/Loader/*
|
||||
${CMAKE_SOURCE_DIR}/../Utilities/*
|
||||
${CMAKE_SOURCE_DIR}/../scetool/scetool.cpp
|
||||
)
|
||||
|
||||
add_executable(rpcs3 ${RPCS3_SRC})
|
||||
target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES})
|
696
rpcs3/Crypto/aes.cpp
Normal file
696
rpcs3/Crypto/aes.cpp
Normal file
|
@ -0,0 +1,696 @@
|
|||
/*
|
||||
* FIPS-197 compliant AES implementation
|
||||
*
|
||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
|
||||
*
|
||||
* http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
|
||||
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "aes.h"
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (little endian)
|
||||
*/
|
||||
#ifndef GET_ULONG_LE
|
||||
#define GET_ULONG_LE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (unsigned long) (b)[(i) ] ) \
|
||||
| ( (unsigned long) (b)[(i) + 1] << 8 ) \
|
||||
| ( (unsigned long) (b)[(i) + 2] << 16 ) \
|
||||
| ( (unsigned long) (b)[(i) + 3] << 24 ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_ULONG_LE
|
||||
#define PUT_ULONG_LE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (unsigned char) ( (n) ); \
|
||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
|
||||
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Forward S-box
|
||||
*/
|
||||
static const unsigned char FSb[256] =
|
||||
{
|
||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
|
||||
0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
||||
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
|
||||
0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
|
||||
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC,
|
||||
0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
||||
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A,
|
||||
0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
|
||||
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
|
||||
0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
|
||||
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B,
|
||||
0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
||||
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85,
|
||||
0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
|
||||
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
|
||||
0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
|
||||
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17,
|
||||
0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88,
|
||||
0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
|
||||
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
|
||||
0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
|
||||
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9,
|
||||
0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
||||
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6,
|
||||
0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
|
||||
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
|
||||
0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
|
||||
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94,
|
||||
0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
|
||||
0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
||||
};
|
||||
|
||||
/*
|
||||
* Forward tables
|
||||
*/
|
||||
#define FT \
|
||||
\
|
||||
V(A5,63,63,C6), V(84,7C,7C,F8), V(99,77,77,EE), V(8D,7B,7B,F6), \
|
||||
V(0D,F2,F2,FF), V(BD,6B,6B,D6), V(B1,6F,6F,DE), V(54,C5,C5,91), \
|
||||
V(50,30,30,60), V(03,01,01,02), V(A9,67,67,CE), V(7D,2B,2B,56), \
|
||||
V(19,FE,FE,E7), V(62,D7,D7,B5), V(E6,AB,AB,4D), V(9A,76,76,EC), \
|
||||
V(45,CA,CA,8F), V(9D,82,82,1F), V(40,C9,C9,89), V(87,7D,7D,FA), \
|
||||
V(15,FA,FA,EF), V(EB,59,59,B2), V(C9,47,47,8E), V(0B,F0,F0,FB), \
|
||||
V(EC,AD,AD,41), V(67,D4,D4,B3), V(FD,A2,A2,5F), V(EA,AF,AF,45), \
|
||||
V(BF,9C,9C,23), V(F7,A4,A4,53), V(96,72,72,E4), V(5B,C0,C0,9B), \
|
||||
V(C2,B7,B7,75), V(1C,FD,FD,E1), V(AE,93,93,3D), V(6A,26,26,4C), \
|
||||
V(5A,36,36,6C), V(41,3F,3F,7E), V(02,F7,F7,F5), V(4F,CC,CC,83), \
|
||||
V(5C,34,34,68), V(F4,A5,A5,51), V(34,E5,E5,D1), V(08,F1,F1,F9), \
|
||||
V(93,71,71,E2), V(73,D8,D8,AB), V(53,31,31,62), V(3F,15,15,2A), \
|
||||
V(0C,04,04,08), V(52,C7,C7,95), V(65,23,23,46), V(5E,C3,C3,9D), \
|
||||
V(28,18,18,30), V(A1,96,96,37), V(0F,05,05,0A), V(B5,9A,9A,2F), \
|
||||
V(09,07,07,0E), V(36,12,12,24), V(9B,80,80,1B), V(3D,E2,E2,DF), \
|
||||
V(26,EB,EB,CD), V(69,27,27,4E), V(CD,B2,B2,7F), V(9F,75,75,EA), \
|
||||
V(1B,09,09,12), V(9E,83,83,1D), V(74,2C,2C,58), V(2E,1A,1A,34), \
|
||||
V(2D,1B,1B,36), V(B2,6E,6E,DC), V(EE,5A,5A,B4), V(FB,A0,A0,5B), \
|
||||
V(F6,52,52,A4), V(4D,3B,3B,76), V(61,D6,D6,B7), V(CE,B3,B3,7D), \
|
||||
V(7B,29,29,52), V(3E,E3,E3,DD), V(71,2F,2F,5E), V(97,84,84,13), \
|
||||
V(F5,53,53,A6), V(68,D1,D1,B9), V(00,00,00,00), V(2C,ED,ED,C1), \
|
||||
V(60,20,20,40), V(1F,FC,FC,E3), V(C8,B1,B1,79), V(ED,5B,5B,B6), \
|
||||
V(BE,6A,6A,D4), V(46,CB,CB,8D), V(D9,BE,BE,67), V(4B,39,39,72), \
|
||||
V(DE,4A,4A,94), V(D4,4C,4C,98), V(E8,58,58,B0), V(4A,CF,CF,85), \
|
||||
V(6B,D0,D0,BB), V(2A,EF,EF,C5), V(E5,AA,AA,4F), V(16,FB,FB,ED), \
|
||||
V(C5,43,43,86), V(D7,4D,4D,9A), V(55,33,33,66), V(94,85,85,11), \
|
||||
V(CF,45,45,8A), V(10,F9,F9,E9), V(06,02,02,04), V(81,7F,7F,FE), \
|
||||
V(F0,50,50,A0), V(44,3C,3C,78), V(BA,9F,9F,25), V(E3,A8,A8,4B), \
|
||||
V(F3,51,51,A2), V(FE,A3,A3,5D), V(C0,40,40,80), V(8A,8F,8F,05), \
|
||||
V(AD,92,92,3F), V(BC,9D,9D,21), V(48,38,38,70), V(04,F5,F5,F1), \
|
||||
V(DF,BC,BC,63), V(C1,B6,B6,77), V(75,DA,DA,AF), V(63,21,21,42), \
|
||||
V(30,10,10,20), V(1A,FF,FF,E5), V(0E,F3,F3,FD), V(6D,D2,D2,BF), \
|
||||
V(4C,CD,CD,81), V(14,0C,0C,18), V(35,13,13,26), V(2F,EC,EC,C3), \
|
||||
V(E1,5F,5F,BE), V(A2,97,97,35), V(CC,44,44,88), V(39,17,17,2E), \
|
||||
V(57,C4,C4,93), V(F2,A7,A7,55), V(82,7E,7E,FC), V(47,3D,3D,7A), \
|
||||
V(AC,64,64,C8), V(E7,5D,5D,BA), V(2B,19,19,32), V(95,73,73,E6), \
|
||||
V(A0,60,60,C0), V(98,81,81,19), V(D1,4F,4F,9E), V(7F,DC,DC,A3), \
|
||||
V(66,22,22,44), V(7E,2A,2A,54), V(AB,90,90,3B), V(83,88,88,0B), \
|
||||
V(CA,46,46,8C), V(29,EE,EE,C7), V(D3,B8,B8,6B), V(3C,14,14,28), \
|
||||
V(79,DE,DE,A7), V(E2,5E,5E,BC), V(1D,0B,0B,16), V(76,DB,DB,AD), \
|
||||
V(3B,E0,E0,DB), V(56,32,32,64), V(4E,3A,3A,74), V(1E,0A,0A,14), \
|
||||
V(DB,49,49,92), V(0A,06,06,0C), V(6C,24,24,48), V(E4,5C,5C,B8), \
|
||||
V(5D,C2,C2,9F), V(6E,D3,D3,BD), V(EF,AC,AC,43), V(A6,62,62,C4), \
|
||||
V(A8,91,91,39), V(A4,95,95,31), V(37,E4,E4,D3), V(8B,79,79,F2), \
|
||||
V(32,E7,E7,D5), V(43,C8,C8,8B), V(59,37,37,6E), V(B7,6D,6D,DA), \
|
||||
V(8C,8D,8D,01), V(64,D5,D5,B1), V(D2,4E,4E,9C), V(E0,A9,A9,49), \
|
||||
V(B4,6C,6C,D8), V(FA,56,56,AC), V(07,F4,F4,F3), V(25,EA,EA,CF), \
|
||||
V(AF,65,65,CA), V(8E,7A,7A,F4), V(E9,AE,AE,47), V(18,08,08,10), \
|
||||
V(D5,BA,BA,6F), V(88,78,78,F0), V(6F,25,25,4A), V(72,2E,2E,5C), \
|
||||
V(24,1C,1C,38), V(F1,A6,A6,57), V(C7,B4,B4,73), V(51,C6,C6,97), \
|
||||
V(23,E8,E8,CB), V(7C,DD,DD,A1), V(9C,74,74,E8), V(21,1F,1F,3E), \
|
||||
V(DD,4B,4B,96), V(DC,BD,BD,61), V(86,8B,8B,0D), V(85,8A,8A,0F), \
|
||||
V(90,70,70,E0), V(42,3E,3E,7C), V(C4,B5,B5,71), V(AA,66,66,CC), \
|
||||
V(D8,48,48,90), V(05,03,03,06), V(01,F6,F6,F7), V(12,0E,0E,1C), \
|
||||
V(A3,61,61,C2), V(5F,35,35,6A), V(F9,57,57,AE), V(D0,B9,B9,69), \
|
||||
V(91,86,86,17), V(58,C1,C1,99), V(27,1D,1D,3A), V(B9,9E,9E,27), \
|
||||
V(38,E1,E1,D9), V(13,F8,F8,EB), V(B3,98,98,2B), V(33,11,11,22), \
|
||||
V(BB,69,69,D2), V(70,D9,D9,A9), V(89,8E,8E,07), V(A7,94,94,33), \
|
||||
V(B6,9B,9B,2D), V(22,1E,1E,3C), V(92,87,87,15), V(20,E9,E9,C9), \
|
||||
V(49,CE,CE,87), V(FF,55,55,AA), V(78,28,28,50), V(7A,DF,DF,A5), \
|
||||
V(8F,8C,8C,03), V(F8,A1,A1,59), V(80,89,89,09), V(17,0D,0D,1A), \
|
||||
V(DA,BF,BF,65), V(31,E6,E6,D7), V(C6,42,42,84), V(B8,68,68,D0), \
|
||||
V(C3,41,41,82), V(B0,99,99,29), V(77,2D,2D,5A), V(11,0F,0F,1E), \
|
||||
V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C)
|
||||
|
||||
#define V(a,b,c,d) 0x##a##b##c##d
|
||||
static const unsigned long FT0[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##b##c##d##a
|
||||
static const unsigned long FT1[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##c##d##a##b
|
||||
static const unsigned long FT2[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##d##a##b##c
|
||||
static const unsigned long FT3[256] = { FT };
|
||||
#undef V
|
||||
|
||||
#undef FT
|
||||
|
||||
/*
|
||||
* Reverse S-box
|
||||
*/
|
||||
static const unsigned char RSb[256] =
|
||||
{
|
||||
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38,
|
||||
0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
|
||||
0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87,
|
||||
0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
|
||||
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D,
|
||||
0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
||||
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2,
|
||||
0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
|
||||
0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16,
|
||||
0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
|
||||
0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA,
|
||||
0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
||||
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A,
|
||||
0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
|
||||
0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02,
|
||||
0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
|
||||
0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA,
|
||||
0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
||||
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85,
|
||||
0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
|
||||
0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89,
|
||||
0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
|
||||
0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20,
|
||||
0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
||||
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31,
|
||||
0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
|
||||
0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
|
||||
0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
|
||||
0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0,
|
||||
0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
||||
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26,
|
||||
0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
|
||||
};
|
||||
|
||||
/*
|
||||
* Reverse tables
|
||||
*/
|
||||
#define RT \
|
||||
\
|
||||
V(50,A7,F4,51), V(53,65,41,7E), V(C3,A4,17,1A), V(96,5E,27,3A), \
|
||||
V(CB,6B,AB,3B), V(F1,45,9D,1F), V(AB,58,FA,AC), V(93,03,E3,4B), \
|
||||
V(55,FA,30,20), V(F6,6D,76,AD), V(91,76,CC,88), V(25,4C,02,F5), \
|
||||
V(FC,D7,E5,4F), V(D7,CB,2A,C5), V(80,44,35,26), V(8F,A3,62,B5), \
|
||||
V(49,5A,B1,DE), V(67,1B,BA,25), V(98,0E,EA,45), V(E1,C0,FE,5D), \
|
||||
V(02,75,2F,C3), V(12,F0,4C,81), V(A3,97,46,8D), V(C6,F9,D3,6B), \
|
||||
V(E7,5F,8F,03), V(95,9C,92,15), V(EB,7A,6D,BF), V(DA,59,52,95), \
|
||||
V(2D,83,BE,D4), V(D3,21,74,58), V(29,69,E0,49), V(44,C8,C9,8E), \
|
||||
V(6A,89,C2,75), V(78,79,8E,F4), V(6B,3E,58,99), V(DD,71,B9,27), \
|
||||
V(B6,4F,E1,BE), V(17,AD,88,F0), V(66,AC,20,C9), V(B4,3A,CE,7D), \
|
||||
V(18,4A,DF,63), V(82,31,1A,E5), V(60,33,51,97), V(45,7F,53,62), \
|
||||
V(E0,77,64,B1), V(84,AE,6B,BB), V(1C,A0,81,FE), V(94,2B,08,F9), \
|
||||
V(58,68,48,70), V(19,FD,45,8F), V(87,6C,DE,94), V(B7,F8,7B,52), \
|
||||
V(23,D3,73,AB), V(E2,02,4B,72), V(57,8F,1F,E3), V(2A,AB,55,66), \
|
||||
V(07,28,EB,B2), V(03,C2,B5,2F), V(9A,7B,C5,86), V(A5,08,37,D3), \
|
||||
V(F2,87,28,30), V(B2,A5,BF,23), V(BA,6A,03,02), V(5C,82,16,ED), \
|
||||
V(2B,1C,CF,8A), V(92,B4,79,A7), V(F0,F2,07,F3), V(A1,E2,69,4E), \
|
||||
V(CD,F4,DA,65), V(D5,BE,05,06), V(1F,62,34,D1), V(8A,FE,A6,C4), \
|
||||
V(9D,53,2E,34), V(A0,55,F3,A2), V(32,E1,8A,05), V(75,EB,F6,A4), \
|
||||
V(39,EC,83,0B), V(AA,EF,60,40), V(06,9F,71,5E), V(51,10,6E,BD), \
|
||||
V(F9,8A,21,3E), V(3D,06,DD,96), V(AE,05,3E,DD), V(46,BD,E6,4D), \
|
||||
V(B5,8D,54,91), V(05,5D,C4,71), V(6F,D4,06,04), V(FF,15,50,60), \
|
||||
V(24,FB,98,19), V(97,E9,BD,D6), V(CC,43,40,89), V(77,9E,D9,67), \
|
||||
V(BD,42,E8,B0), V(88,8B,89,07), V(38,5B,19,E7), V(DB,EE,C8,79), \
|
||||
V(47,0A,7C,A1), V(E9,0F,42,7C), V(C9,1E,84,F8), V(00,00,00,00), \
|
||||
V(83,86,80,09), V(48,ED,2B,32), V(AC,70,11,1E), V(4E,72,5A,6C), \
|
||||
V(FB,FF,0E,FD), V(56,38,85,0F), V(1E,D5,AE,3D), V(27,39,2D,36), \
|
||||
V(64,D9,0F,0A), V(21,A6,5C,68), V(D1,54,5B,9B), V(3A,2E,36,24), \
|
||||
V(B1,67,0A,0C), V(0F,E7,57,93), V(D2,96,EE,B4), V(9E,91,9B,1B), \
|
||||
V(4F,C5,C0,80), V(A2,20,DC,61), V(69,4B,77,5A), V(16,1A,12,1C), \
|
||||
V(0A,BA,93,E2), V(E5,2A,A0,C0), V(43,E0,22,3C), V(1D,17,1B,12), \
|
||||
V(0B,0D,09,0E), V(AD,C7,8B,F2), V(B9,A8,B6,2D), V(C8,A9,1E,14), \
|
||||
V(85,19,F1,57), V(4C,07,75,AF), V(BB,DD,99,EE), V(FD,60,7F,A3), \
|
||||
V(9F,26,01,F7), V(BC,F5,72,5C), V(C5,3B,66,44), V(34,7E,FB,5B), \
|
||||
V(76,29,43,8B), V(DC,C6,23,CB), V(68,FC,ED,B6), V(63,F1,E4,B8), \
|
||||
V(CA,DC,31,D7), V(10,85,63,42), V(40,22,97,13), V(20,11,C6,84), \
|
||||
V(7D,24,4A,85), V(F8,3D,BB,D2), V(11,32,F9,AE), V(6D,A1,29,C7), \
|
||||
V(4B,2F,9E,1D), V(F3,30,B2,DC), V(EC,52,86,0D), V(D0,E3,C1,77), \
|
||||
V(6C,16,B3,2B), V(99,B9,70,A9), V(FA,48,94,11), V(22,64,E9,47), \
|
||||
V(C4,8C,FC,A8), V(1A,3F,F0,A0), V(D8,2C,7D,56), V(EF,90,33,22), \
|
||||
V(C7,4E,49,87), V(C1,D1,38,D9), V(FE,A2,CA,8C), V(36,0B,D4,98), \
|
||||
V(CF,81,F5,A6), V(28,DE,7A,A5), V(26,8E,B7,DA), V(A4,BF,AD,3F), \
|
||||
V(E4,9D,3A,2C), V(0D,92,78,50), V(9B,CC,5F,6A), V(62,46,7E,54), \
|
||||
V(C2,13,8D,F6), V(E8,B8,D8,90), V(5E,F7,39,2E), V(F5,AF,C3,82), \
|
||||
V(BE,80,5D,9F), V(7C,93,D0,69), V(A9,2D,D5,6F), V(B3,12,25,CF), \
|
||||
V(3B,99,AC,C8), V(A7,7D,18,10), V(6E,63,9C,E8), V(7B,BB,3B,DB), \
|
||||
V(09,78,26,CD), V(F4,18,59,6E), V(01,B7,9A,EC), V(A8,9A,4F,83), \
|
||||
V(65,6E,95,E6), V(7E,E6,FF,AA), V(08,CF,BC,21), V(E6,E8,15,EF), \
|
||||
V(D9,9B,E7,BA), V(CE,36,6F,4A), V(D4,09,9F,EA), V(D6,7C,B0,29), \
|
||||
V(AF,B2,A4,31), V(31,23,3F,2A), V(30,94,A5,C6), V(C0,66,A2,35), \
|
||||
V(37,BC,4E,74), V(A6,CA,82,FC), V(B0,D0,90,E0), V(15,D8,A7,33), \
|
||||
V(4A,98,04,F1), V(F7,DA,EC,41), V(0E,50,CD,7F), V(2F,F6,91,17), \
|
||||
V(8D,D6,4D,76), V(4D,B0,EF,43), V(54,4D,AA,CC), V(DF,04,96,E4), \
|
||||
V(E3,B5,D1,9E), V(1B,88,6A,4C), V(B8,1F,2C,C1), V(7F,51,65,46), \
|
||||
V(04,EA,5E,9D), V(5D,35,8C,01), V(73,74,87,FA), V(2E,41,0B,FB), \
|
||||
V(5A,1D,67,B3), V(52,D2,DB,92), V(33,56,10,E9), V(13,47,D6,6D), \
|
||||
V(8C,61,D7,9A), V(7A,0C,A1,37), V(8E,14,F8,59), V(89,3C,13,EB), \
|
||||
V(EE,27,A9,CE), V(35,C9,61,B7), V(ED,E5,1C,E1), V(3C,B1,47,7A), \
|
||||
V(59,DF,D2,9C), V(3F,73,F2,55), V(79,CE,14,18), V(BF,37,C7,73), \
|
||||
V(EA,CD,F7,53), V(5B,AA,FD,5F), V(14,6F,3D,DF), V(86,DB,44,78), \
|
||||
V(81,F3,AF,CA), V(3E,C4,68,B9), V(2C,34,24,38), V(5F,40,A3,C2), \
|
||||
V(72,C3,1D,16), V(0C,25,E2,BC), V(8B,49,3C,28), V(41,95,0D,FF), \
|
||||
V(71,01,A8,39), V(DE,B3,0C,08), V(9C,E4,B4,D8), V(90,C1,56,64), \
|
||||
V(61,84,CB,7B), V(70,B6,32,D5), V(74,5C,6C,48), V(42,57,B8,D0)
|
||||
|
||||
#define V(a,b,c,d) 0x##a##b##c##d
|
||||
static const unsigned long RT0[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##b##c##d##a
|
||||
static const unsigned long RT1[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##c##d##a##b
|
||||
static const unsigned long RT2[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#define V(a,b,c,d) 0x##d##a##b##c
|
||||
static const unsigned long RT3[256] = { RT };
|
||||
#undef V
|
||||
|
||||
#undef RT
|
||||
|
||||
/*
|
||||
* Round constants
|
||||
*/
|
||||
static const unsigned long RCON[10] =
|
||||
{
|
||||
0x00000001, 0x00000002, 0x00000004, 0x00000008,
|
||||
0x00000010, 0x00000020, 0x00000040, 0x00000080,
|
||||
0x0000001B, 0x00000036
|
||||
};
|
||||
|
||||
/*
|
||||
* AES key schedule (encryption)
|
||||
*/
|
||||
int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize )
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned long *RK;
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
case 128: ctx->nr = 10; break;
|
||||
case 192: ctx->nr = 12; break;
|
||||
case 256: ctx->nr = 14; break;
|
||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||
}
|
||||
|
||||
ctx->rk = RK = ctx->buf;
|
||||
|
||||
for( i = 0; i < (keysize >> 5); i++ )
|
||||
{
|
||||
GET_ULONG_LE( RK[i], key, i << 2 );
|
||||
}
|
||||
|
||||
switch( ctx->nr )
|
||||
{
|
||||
case 10:
|
||||
|
||||
for( i = 0; i < 10; i++, RK += 4 )
|
||||
{
|
||||
RK[4] = RK[0] ^ RCON[i] ^
|
||||
( (unsigned long) FSb[ ( RK[3] >> 8 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( RK[3] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( RK[3] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( RK[3] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[5] = RK[1] ^ RK[4];
|
||||
RK[6] = RK[2] ^ RK[5];
|
||||
RK[7] = RK[3] ^ RK[6];
|
||||
}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
|
||||
for( i = 0; i < 8; i++, RK += 6 )
|
||||
{
|
||||
RK[6] = RK[0] ^ RCON[i] ^
|
||||
( (unsigned long) FSb[ ( RK[5] >> 8 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( RK[5] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( RK[5] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( RK[5] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[7] = RK[1] ^ RK[6];
|
||||
RK[8] = RK[2] ^ RK[7];
|
||||
RK[9] = RK[3] ^ RK[8];
|
||||
RK[10] = RK[4] ^ RK[9];
|
||||
RK[11] = RK[5] ^ RK[10];
|
||||
}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
||||
for( i = 0; i < 7; i++, RK += 8 )
|
||||
{
|
||||
RK[8] = RK[0] ^ RCON[i] ^
|
||||
( (unsigned long) FSb[ ( RK[7] >> 8 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( RK[7] >> 16 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( RK[7] >> 24 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( RK[7] ) & 0xFF ] << 24 );
|
||||
|
||||
RK[9] = RK[1] ^ RK[8];
|
||||
RK[10] = RK[2] ^ RK[9];
|
||||
RK[11] = RK[3] ^ RK[10];
|
||||
|
||||
RK[12] = RK[4] ^
|
||||
( (unsigned long) FSb[ ( RK[11] ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( RK[11] >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( RK[11] >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( RK[11] >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
RK[13] = RK[5] ^ RK[12];
|
||||
RK[14] = RK[6] ^ RK[13];
|
||||
RK[15] = RK[7] ^ RK[14];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES key schedule (decryption)
|
||||
*/
|
||||
int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize )
|
||||
{
|
||||
int i, j;
|
||||
aes_context cty;
|
||||
unsigned long *RK;
|
||||
unsigned long *SK;
|
||||
int ret;
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
case 128: ctx->nr = 10; break;
|
||||
case 192: ctx->nr = 12; break;
|
||||
case 256: ctx->nr = 14; break;
|
||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||
}
|
||||
|
||||
ctx->rk = RK = ctx->buf;
|
||||
|
||||
ret = aes_setkey_enc( &cty, key, keysize );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
SK = cty.rk + cty.nr * 4;
|
||||
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
|
||||
for( i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8 )
|
||||
{
|
||||
for( j = 0; j < 4; j++, SK++ )
|
||||
{
|
||||
*RK++ = RT0[ FSb[ ( *SK ) & 0xFF ] ] ^
|
||||
RT1[ FSb[ ( *SK >> 8 ) & 0xFF ] ] ^
|
||||
RT2[ FSb[ ( *SK >> 16 ) & 0xFF ] ] ^
|
||||
RT3[ FSb[ ( *SK >> 24 ) & 0xFF ] ];
|
||||
}
|
||||
}
|
||||
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
*RK++ = *SK++;
|
||||
|
||||
memset( &cty, 0, sizeof( aes_context ) );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
|
||||
{ \
|
||||
X0 = *RK++ ^ FT0[ ( Y0 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y3 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X1 = *RK++ ^ FT0[ ( Y1 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y0 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X2 = *RK++ ^ FT0[ ( Y2 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y1 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X3 = *RK++ ^ FT0[ ( Y3 ) & 0xFF ] ^ \
|
||||
FT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
|
||||
FT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
|
||||
FT3[ ( Y2 >> 24 ) & 0xFF ]; \
|
||||
}
|
||||
|
||||
#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
|
||||
{ \
|
||||
X0 = *RK++ ^ RT0[ ( Y0 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y3 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y2 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y1 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X1 = *RK++ ^ RT0[ ( Y1 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y0 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y3 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y2 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X2 = *RK++ ^ RT0[ ( Y2 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y1 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y0 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y3 >> 24 ) & 0xFF ]; \
|
||||
\
|
||||
X3 = *RK++ ^ RT0[ ( Y3 ) & 0xFF ] ^ \
|
||||
RT1[ ( Y2 >> 8 ) & 0xFF ] ^ \
|
||||
RT2[ ( Y1 >> 16 ) & 0xFF ] ^ \
|
||||
RT3[ ( Y0 >> 24 ) & 0xFF ]; \
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-ECB block encryption/decryption
|
||||
*/
|
||||
int aes_crypt_ecb( aes_context *ctx,
|
||||
int mode,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] )
|
||||
{
|
||||
int i;
|
||||
unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
|
||||
|
||||
RK = ctx->rk;
|
||||
|
||||
GET_ULONG_LE( X0, input, 0 ); X0 ^= *RK++;
|
||||
GET_ULONG_LE( X1, input, 4 ); X1 ^= *RK++;
|
||||
GET_ULONG_LE( X2, input, 8 ); X2 ^= *RK++;
|
||||
GET_ULONG_LE( X3, input, 12 ); X3 ^= *RK++;
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
|
||||
{
|
||||
AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
|
||||
}
|
||||
|
||||
AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
|
||||
X0 = *RK++ ^ \
|
||||
( (unsigned long) RSb[ ( Y0 ) & 0xFF ] ) ^
|
||||
( (unsigned long) RSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) RSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) RSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X1 = *RK++ ^ \
|
||||
( (unsigned long) RSb[ ( Y1 ) & 0xFF ] ) ^
|
||||
( (unsigned long) RSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) RSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) RSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X2 = *RK++ ^ \
|
||||
( (unsigned long) RSb[ ( Y2 ) & 0xFF ] ) ^
|
||||
( (unsigned long) RSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) RSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) RSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X3 = *RK++ ^ \
|
||||
( (unsigned long) RSb[ ( Y3 ) & 0xFF ] ) ^
|
||||
( (unsigned long) RSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) RSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) RSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
|
||||
}
|
||||
else /* AES_ENCRYPT */
|
||||
{
|
||||
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
|
||||
{
|
||||
AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
|
||||
}
|
||||
|
||||
AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
|
||||
|
||||
X0 = *RK++ ^ \
|
||||
( (unsigned long) FSb[ ( Y0 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( Y3 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X1 = *RK++ ^ \
|
||||
( (unsigned long) FSb[ ( Y1 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( Y0 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X2 = *RK++ ^ \
|
||||
( (unsigned long) FSb[ ( Y2 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( Y1 >> 24 ) & 0xFF ] << 24 );
|
||||
|
||||
X3 = *RK++ ^ \
|
||||
( (unsigned long) FSb[ ( Y3 ) & 0xFF ] ) ^
|
||||
( (unsigned long) FSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^
|
||||
( (unsigned long) FSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^
|
||||
( (unsigned long) FSb[ ( Y2 >> 24 ) & 0xFF ] << 24 );
|
||||
}
|
||||
|
||||
PUT_ULONG_LE( X0, output, 0 );
|
||||
PUT_ULONG_LE( X1, output, 4 );
|
||||
PUT_ULONG_LE( X2, output, 8 );
|
||||
PUT_ULONG_LE( X3, output, 12 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-CBC buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_cbc( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int i;
|
||||
unsigned char temp[16];
|
||||
|
||||
if( length % 16 )
|
||||
return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH );
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
memcpy( temp, input, 16 );
|
||||
aes_crypt_ecb( ctx, mode, input, output );
|
||||
|
||||
for( i = 0; i < 16; i++ )
|
||||
output[i] = (unsigned char)( output[i] ^ iv[i] );
|
||||
|
||||
memcpy( iv, temp, 16 );
|
||||
|
||||
input += 16;
|
||||
output += 16;
|
||||
length -= 16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
for( i = 0; i < 16; i++ )
|
||||
output[i] = (unsigned char)( input[i] ^ iv[i] );
|
||||
|
||||
aes_crypt_ecb( ctx, mode, output, output );
|
||||
memcpy( iv, output, 16 );
|
||||
|
||||
input += 16;
|
||||
output += 16;
|
||||
length -= 16;
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* AES-CTR buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int c, i, cb;
|
||||
size_t n = *nc_off;
|
||||
|
||||
while( length-- )
|
||||
{
|
||||
if( n == 0 ) {
|
||||
aes_crypt_ecb( ctx, AES_ENCRYPT, nonce_counter, stream_block );
|
||||
|
||||
i = 15;
|
||||
do {
|
||||
nonce_counter[i]++;
|
||||
cb = nonce_counter[i] == 0;
|
||||
} while( i-- && cb );
|
||||
|
||||
}
|
||||
c = *input++;
|
||||
*output++ = (unsigned char)( c ^ stream_block[n] );
|
||||
|
||||
n = (n + 1) & 0x0F;
|
||||
}
|
||||
|
||||
*nc_off = n;
|
||||
|
||||
return( 0 );
|
||||
}
|
144
rpcs3/Crypto/aes.h
Normal file
144
rpcs3/Crypto/aes.h
Normal file
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* \file aes.h
|
||||
*
|
||||
* \brief AES block cipher
|
||||
*
|
||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#ifndef POLARSSL_AES_H
|
||||
#define POLARSSL_AES_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< Invalid key length. */
|
||||
#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< Invalid data input length. */
|
||||
|
||||
/**
|
||||
* \brief AES context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int nr; /*!< number of rounds */
|
||||
unsigned long *rk; /*!< AES round keys */
|
||||
unsigned long buf[68]; /*!< unaligned data */
|
||||
}
|
||||
aes_context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (encryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key encryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (decryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key decryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES-ECB block encryption/decryption
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode AES_ENCRYPT or AES_DECRYPT
|
||||
* \param input 16-byte input block
|
||||
* \param output 16-byte output block
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_ecb( aes_context *ctx,
|
||||
int mode,
|
||||
const unsigned char input[16],
|
||||
unsigned char output[16] );
|
||||
|
||||
/**
|
||||
* \brief AES-CBC buffer encryption/decryption
|
||||
* Length should be a multiple of the block
|
||||
* size (16 bytes)
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode AES_ENCRYPT or AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
|
||||
*/
|
||||
int aes_crypt_cbc( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
/*
|
||||
* \brief AES-CTR buffer encryption/decryption
|
||||
*
|
||||
* Warning: You have to keep the maximum use of your counter in mind!
|
||||
*
|
||||
* Note: Due to the nature of CTR you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* aes_setkey_enc() for both AES_ENCRYPT and AES_DECRYPT.
|
||||
*
|
||||
* \param length The length of the data
|
||||
* \param nc_off The offset in the current stream_block (for resuming
|
||||
* within current cipher stream). The offset pointer to
|
||||
* should be 0 at the start of a stream.
|
||||
* \param nonce_counter The 128-bit nonce and counter.
|
||||
* \param stream_block The saved stream-block for resuming. Is overwritten
|
||||
* by the function.
|
||||
* \param input The input data stream
|
||||
* \param output The output data stream
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* aes.h */
|
878
rpcs3/Crypto/key_vault.cpp
Normal file
878
rpcs3/Crypto/key_vault.cpp
Normal file
|
@ -0,0 +1,878 @@
|
|||
#include "stdafx.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
KeyVault::KeyVault()
|
||||
{
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV0Keys()
|
||||
{
|
||||
sk_LV0_arr.Clear();
|
||||
sk_LV0_arr.Move(
|
||||
new SELF_KEY(0x0000000000000000, 0x0000, KEY_LV0,
|
||||
"CA7A24EC38BDB45B98CCD7D363EA2AF0C326E65081E0630CB9AB2D215865878A",
|
||||
"F9205F46F6021697E670F13DFA726212",
|
||||
"A8FD6DB24532D094EFA08CB41C9A72287D905C6B27B42BE4AB925AAF4AFFF34D41EEB54DD128700D",
|
||||
"001AD976FCDE86F5B8FF3E63EF3A7F94E861975BA3",
|
||||
0x33));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLDRKeys()
|
||||
{
|
||||
sk_LDR_arr.Clear();
|
||||
sk_LDR_arr.Move(
|
||||
new SELF_KEY(0x0000000000000000, 0x0000, KEY_LDR,
|
||||
"C0CEFE84C227F75BD07A7EB846509F93B238E770DACB9FF4A388F812482BE21B",
|
||||
"47EE7454E4774CC9B8960C7B59F4C14D",
|
||||
"C2D4AAF319355019AF99D44E2B58CA29252C89123D11D6218F40B138CAB29B7101F3AEB72A975019",
|
||||
"00C5B2BFA1A413DD16F26D31C0F2ED4720DCFB0670",
|
||||
0x20));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV1Keys()
|
||||
{
|
||||
sk_LV1_arr.Clear();
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0000, KEY_LV1,
|
||||
"B9F3F9E6107CFF2680A91E118C2403CF4A6F18F3C7EFD7D13D1AC4DB760BD222",
|
||||
"B43661B9A79BAD9D8E2B046469CDA1E7",
|
||||
"4C870BE86DDD996A92A3F7F404F33604244A1D02AB5B78BC9DAF030B78BE8867CF586171B7D45D20",
|
||||
"002CC736C7AD06D264E9AB663EB1F35F5DC159248C",
|
||||
0x33));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0000, KEY_LV1,
|
||||
"B880593856C8C6D2037585626A12977F50DCFCF3F132D2C89AA6E670EAFC1646",
|
||||
"A79B05D4E37B8117A95E6E7C14FB640E",
|
||||
"7454C7CCBFC2F66C142D78A730A3A6F973CC0FB75A46FCBB390790138910A0CAC78E5E21F4DA3375",
|
||||
"00033A699FDD2DA6CDD6CCC03B2C6145F998706F74",
|
||||
0x34));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0000, KEY_LV1,
|
||||
"1E8EEEA9E80A729F3FA52CF523B25941EA44B4155D94E5DADC5C5A77847620C7",
|
||||
"E034D31A80316960024D1B3D3164FDC3",
|
||||
"7E3A196f4A5879F3A7B091A2263F7C24E1716129B580566D308D9C2254B36AEE53DEF30EC85F8398",
|
||||
"005815D17125D04C33790321DE29EB6241365100B5",
|
||||
0x35));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x0000, KEY_LV1,
|
||||
"53ABDF84BE08B0351B734F2B97D2BE1621BC6C889E4362E5C70F39D6C3ED9F23",
|
||||
"44E652661AC7584DBE08ECB810FB5FC0",
|
||||
"733198A7759BC07326755BC9773A8A17C8A7043C7BDAB83D88E230512E2EA3852D7DA4263A7E97F9",
|
||||
"004312C65347ACBE95CC306442FEFD0AF4C2935EB3",
|
||||
0x05));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x0000, KEY_LV1,
|
||||
"48793EBDDA1AF65D737DA2FDA2DD104447A698F8A82CAAEE992831711BA94E83",
|
||||
"15DCF3C67147A45D09DE7521EECA07A1",
|
||||
"85A8868C320127F10B6598964C69221C086702021D31803520E21FDE4DBE827766BE41825CB7328C",
|
||||
"",
|
||||
0x07));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0000, KEY_LV1,
|
||||
"5FF17D836E2C4AD69476E2614F64BDD05B9115389A9A6D055B5B544B1C34E3D5",
|
||||
"DF0F50EC3C4743C5B17839D7B49F24A4",
|
||||
"1CDABE30833823F461CA534104115FFF60010B710631E435A7D915E82AE88EDE667264656CB7062E",
|
||||
"",
|
||||
0x05));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0000, KEY_LV1,
|
||||
"BD0621FA19383C3C72ECBC3B008F1CD55FFD7C3BB7510BF11AD0CF0FC2B70951",
|
||||
"569AF3745E1E02E3E288273CDE244CD8",
|
||||
"21E26F11C2D69478609DD1BD278CDFC940D90386455BA52FCD1FA7E27AC2AFA826C79A10193B625C",
|
||||
"",
|
||||
0x07));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0000, KEY_LV1,
|
||||
"41A6E0039041E9D8AAF4EF2F2A2971248EDBD96A3985611ED7B4CE73EE4804FE",
|
||||
"C8C98D5A5CE23AF5607A352AECACB0DC",
|
||||
"4389664390265F96C1A882374C0F856364E33DB09BE124A4666F9A12F0DD9C811EDD55BA21ED0667",
|
||||
"",
|
||||
0x12));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0000, KEY_LV1,
|
||||
"557EDF6C063F3272B0D44EEC12F418DA774815B5415597CC5F75C21E048BAD74",
|
||||
"7144D7574937818517826227EF4AC0B4",
|
||||
"085D38DBF9B757329EB862107929909D32FA1DAE60641BF4AC25319D7650597EE977F8E810FEEA96",
|
||||
"",
|
||||
0x13));
|
||||
sk_LV1_arr.Move(
|
||||
new SELF_KEY(0x0004005000000000, 0x0000, KEY_LV1,
|
||||
"10CEA04973FCCC12EC19924510822D8D4C41F657FD3D7E73F415A8D687421BCD",
|
||||
"ED8699562C6AC65204FA166257E7FCF4",
|
||||
"9AF86FC869C159FBB62F7D9674EE257ABF12E5A96D5875B4AA73C13C2BC13E2A4079F98B9B935EE2",
|
||||
"",
|
||||
0x14));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfLV2Keys()
|
||||
{
|
||||
sk_LV2_arr.Clear();
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0000, KEY_LV2,
|
||||
"94303F69513572AB5AE17C8C2A1839D2C24C28F65389D3BBB11894CE23E0798F",
|
||||
"9769BFD187B90990AE5FEA4E110B9CF5",
|
||||
"AFAF5E96AF396CBB69071082C46A8F34A030E8EDB799E0A7BE00AA264DFF3AEBF7923920D559404D",
|
||||
"0070ABF9361B02291829D479F56AB248203CD3EB46",
|
||||
0x20));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0000, KEY_LV2,
|
||||
"575B0A6C4B4F2760A03FE4189EBAF4D947279FD982B14070349098B08FF92C10",
|
||||
"411CB18F460CE50CAF2C426D8F0D93C8",
|
||||
"3FEE313954CB3039C321A7E33B97FFDEC8988A8B55759161B04DBF4731284E4A8191E3F17D32B0EA",
|
||||
"0073076441A08CD179E5FACE349B86DA58B5B7BA78",
|
||||
0x21));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0000, KEY_LV2,
|
||||
"6DBD48D787C58803A8D724DA5ACF04FF8FCE91D7545D2322F2B7ABF57014AF68",
|
||||
"603A36213708520ED5D745DEC1325BA5",
|
||||
"5888CB83AC3CCA9610BC173C53141C0CA58B93719E744660CA8823D5EAEE8F9BF736997054E4B7E3",
|
||||
"0009EBC3DE442FA5FBF6C4F3D4F9EAB07778A142BD",
|
||||
0x22));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x0000, KEY_LV2,
|
||||
"84015E90FA23139628A3C75CC09714E6427B527A82D18ABC3E91CD8D7DDAFF17",
|
||||
"5B240444D645F2038118F97FD5A145D5",
|
||||
"B266318245266B2D33641CD8A864066D077FAC60B7E27399099A70A683454B70F9888E7CC0C2BF72",
|
||||
"009D4CBA2BFB1A8330D3E20E59D281D476D231C73A",
|
||||
0x32));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x0000, KEY_LV2,
|
||||
"EAE15444048EFDE7A831BFA9F5D96F047C9FCFF50723E292CF50F5417D81E359",
|
||||
"9CA9282DC7FA9F315EF3156D970B7CD4",
|
||||
"0D58938CB47598A6A672874F1768068F8B80D8D17014D2ABEBAC85E5B0993D9FB6F307DDC3DDA699",
|
||||
"",
|
||||
0x33));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0000, KEY_LV2,
|
||||
"88AD367EDEC2FEED3E2F99B1C685075C41BDEC90C84F526CAF588F89BBD1CBCC",
|
||||
"8D18E8E525230E63DE10291C9DD615BF",
|
||||
"86EED1D65E58890ABDA9ACA486A2BDDB9C0A529C2053FAE301F0F698EAF443DA0F60595A597A7027",
|
||||
"",
|
||||
0x32));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0000, KEY_LV2,
|
||||
"688D5FCAC6F4EA35AC6AC79B10506007286131EE038116DB8AA2C0B0340D9FB0",
|
||||
"75E0239D18B0B669EAE650972F99726B",
|
||||
"008E1C820AC567D1BFB8FE3CC6AD2E1845A1D1B19ED2E18B18CA34A8D28A83EC60C63859CDB3DACA",
|
||||
"",
|
||||
0x33));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0000, KEY_LV2,
|
||||
"E81C5B04C29FB079A4A2687A39D4EA97BFB49D80EF546CEB292979A5F77A6254",
|
||||
"15058FA7F2CAD7C528B5F605F6444EB0",
|
||||
"438D0E5C1E7AFB18234DB6867472FF5F52B750F30C379C7DD1EE0FD23E417B3EA819CC01BAC480ED",
|
||||
"",
|
||||
0x11));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0000, KEY_LV2,
|
||||
"A1E4B86ED02BF7F1372A2C73FE02BC738907EB37CE3BA605FE783C999FAFDB97",
|
||||
"BBE7799B9A37CB272E386618FDFD4AEC",
|
||||
"5B31A8E2A663EBD673196E2E1022E0D64988C4E1BBFE5E474415883A3BA0D9C562A2BE9C30E9B4A8",
|
||||
"",
|
||||
0x07));
|
||||
sk_LV2_arr.Move(
|
||||
new SELF_KEY(0x0004005000000000, 0x0000, KEY_LV2,
|
||||
"0CAF212B6FA53C0DA7E2C575ADF61DBE68F34A33433B1B891ABF5C4251406A03",
|
||||
"9B79374722AD888EB6A35A2DF25A8B3E",
|
||||
"1034A6F98AF6625CC3E3604B59B971CA617DF337538D2179EBB22F3BDC9D0C6DA56BA7DDFD205A50",
|
||||
"",
|
||||
0x14));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfISOKeys()
|
||||
{
|
||||
sk_ISO_arr.Clear();
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0001, KEY_ISO,
|
||||
"8860D0CFF4D0DC688D3223321B96B59A777E6914961488E07048DAECB020ECA4",
|
||||
"C82D015D46CF152F1DD0C16F18B5B1E5",
|
||||
"733918D7C888130509346E6B4A8B6CAA357AB557E814E8122BF102C14A314BF9475B9D70EAF9EC29",
|
||||
"009BE892E122A5C943C1BB7403A67318AA9E1B286F",
|
||||
0x36));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0001, KEY_ISO,
|
||||
"101E27F3FA2FB53ACA924F783AD553162D56B975D05B81351A1111799F20254D",
|
||||
"8D2E9C6297B8AD252998458296AC773C",
|
||||
"138446EE0BDDA5638F97328C8956E6489CBBFE57C5961D40DD5C43BB4138F1C400A8B27204A5D625",
|
||||
"00849DBC57D3B92F01864E6E82EB4EF0EF6311E122",
|
||||
0x32));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0001, KEY_ISO,
|
||||
"3F2604FA27AEADFBE1AC69EB00BB16EF196C2193CBD62900FFD8C25041680843",
|
||||
"A414AC1DB7987E43777651B330B899E1",
|
||||
"1F4633AFDE18614D6CEF38A2FD6C4CCAC7B6EB8109D72CD066ECEBA0193EA3F43C37AE83179A4E5F",
|
||||
"0085B4B05DEBA7E6AD831653C974D95149803BB272",
|
||||
0x33));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x0001, KEY_ISO,
|
||||
"BDB74AA6E3BA2DC10B1BD7F17198399A158DBE1FA0BEA68C90FCACBE4D04BE37",
|
||||
"0207A479B1574F8E7F697528F05D5435",
|
||||
"917E1F1DC48A54EB5F10B38E7569BB5383628A7C906F0DCA62FDA33805C15FAB270016940A09DB58",
|
||||
"00294411363290975BA551336D3965D88AF029A17B",
|
||||
0x03));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x0001, KEY_ISO,
|
||||
"311C015F169F2A1E0757F7064B14C7C9F3A3FFEE015BD4E3A22401A2667857CE",
|
||||
"7BB8B3F5AC8E0890E3148AE5688C7350",
|
||||
"3F040EFA2335FED5670BA4D5C3AB2D9D0B4BA69D154A0062EA995A7D21DBAF0DC5A0DAD333D1C1DD",
|
||||
"",
|
||||
0x08));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0001, KEY_ISO,
|
||||
"8474ADCA3B3244931EECEB9357841442442A1C4A4BCF4E498E6738950F4E4093",
|
||||
"FFF9CACCC4129125CAFB240F419E5F39",
|
||||
"098E1A53E59A95316B00D5A29C05FFEBAE41D1A8A386F9DA96F98858FD25E07BB7A3BC96A5D5B556",
|
||||
"",
|
||||
0x03));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0001, KEY_ISO,
|
||||
"E6A21C599B75696C169EC02582BDA74A776134A6E05108EA701EC0CA2AC03592",
|
||||
"D292A7BD57C0BB2EABBCA1252FA9EDEF",
|
||||
"2ED078A13DC4617EB550AD06E228C83C142A2D588EB5E729402D18038A14842FD65B277DCAD225A5",
|
||||
"",
|
||||
0x08));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0001, KEY_ISO,
|
||||
"072D3A5C3BDB0D674DE209381432B20414BC9BDA0F583ECB94BD9A134176DD51",
|
||||
"8516A81F02CF938740498A406C880871",
|
||||
"5A778DEB5C4F12E8D48E06A2BBBBE3C90FA8C6C47DF9BDB5697FD4A8EB7941CE3F59A557E81C787D",
|
||||
"",
|
||||
0x21));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0100, KEY_ISO,
|
||||
"786FAB8A0B89474A2CB80B3EA104CCCB9E13F66B45EC499BB31865D07C661EA8",
|
||||
"94662F13D99A9F5D211C979FFDF65FE3",
|
||||
"912C94C252B7799CEB45DFBB73EF7CAD9BCC0793A3331BBB79E3C47C0F5C782F698065A8D4DB0D8B",
|
||||
"",
|
||||
0x0E));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0001, KEY_ISO,
|
||||
"4262657A3185D9480F82C8BD2F81766FCC2C8FD7DD5EBE8657B00B939E0C75BD",
|
||||
"4F1E3EF07D893A4714B1B3D5A4E50479",
|
||||
"4DBFCFA68B52F1D66E09AFA6C18EC65479EDBD027B6B8C6A5D85FE5C84D43EA40CEF1672078A0702",
|
||||
"",
|
||||
0x11));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0100, KEY_ISO,
|
||||
"16AA7D7C35399E2B1BFAF68CD19D7512A7855029C08BECC4CC3F035DF7F9C70B",
|
||||
"0E50DB6D937D262CB0499136852FCB80",
|
||||
"AEE2795BF295662A50DFAFE70D1B0B6F0A2EBB211E1323A275FC6E2D13BE4F2F10CA34784F4CF1EC",
|
||||
"",
|
||||
0x0F));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0004005000000000, 0x0001, KEY_ISO,
|
||||
"63565DBE98C3B1A52AADC907C47130FE57A10734E84F22592670F86ED2B0A086",
|
||||
"953F6A99891B4739358F5363A00C08B9",
|
||||
"26BE7B02E7D65C6C21BF4063CDB8C0092FE1679D62FA1A8CCC284A1D21885473A959992537A06612",
|
||||
"",
|
||||
0x15));
|
||||
sk_ISO_arr.Move(
|
||||
new SELF_KEY(0x0004005000000000, 0x0100, KEY_ISO,
|
||||
"B96EA32CB96EA32DB96EA32CB96EA32CB96EA32CB96EA32DB96EA32CB96EA32C",
|
||||
"B96EA32CB96EA32DB96EA32DB96EA32C",
|
||||
"2D7066E68C6AC3373B1346FD76FE7D18A207C811500E65D85DB57BC4A27AD78F59FD53F38F50E151",
|
||||
"0044AA25B4276D79B494A29CB8DE104642424F8EEF",
|
||||
0x02));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfAPPKeys()
|
||||
{
|
||||
sk_APP_arr.Clear();
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0000009200000000, 0x0000, KEY_APP,
|
||||
"95F50019E7A68E341FA72EFDF4D60ED376E25CF46BB48DFDD1F080259DC93F04",
|
||||
"4A0955D946DB70D691A640BB7FAECC4C",
|
||||
"6F8DF8EBD0A1D1DB08B30DD3A951E3F1F27E34030B42C729C55555232D61B834B8BDFFB07E54B343",
|
||||
"006C3E4CCB2C69A5AD7C6F60448E50C7F9184EEAF4",
|
||||
0x21));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0001, KEY_APP,
|
||||
"79481839C406A632BDB4AC093D73D99AE1587F24CE7E69192C1CD0010274A8AB",
|
||||
"6F0F25E1C8C4B7AE70DF968B04521DDA",
|
||||
"94D1B7378BAFF5DFED269240A7A364ED68446741622E50BC6079B6E606A2F8E0A4C56E5CFF836526",
|
||||
"003DE80167D2F0E9D30F2145144A558D1174F5410C",
|
||||
0x11));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0002, KEY_APP,
|
||||
"4F89BE98DDD43CAD343F5BA6B1A133B0A971566F770484AAC20B5DD1DC9FA06A",
|
||||
"90C127A9B43BA9D8E89FE6529E25206F",
|
||||
"8CA6905F46148D7D8D84D2AFCEAE61B41E6750FC22EA435DFA61FCE6F4F860EE4F54D9196CA5290E",
|
||||
"",
|
||||
0x13));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0003, KEY_APP,
|
||||
"C1E6A351FCED6A0636BFCB6801A0942DB7C28BDFC5E0A053A3F52F52FCE9754E",
|
||||
"E0908163F457576440466ACAA443AE7C",
|
||||
"50022D5D37C97905F898E78E7AA14A0B5CAAD5CE8190AE5629A10D6F0CF4173597B37A95A7545C92",
|
||||
"",
|
||||
0x0B));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0004, KEY_APP,
|
||||
"838F5860CF97CDAD75B399CA44F4C214CDF951AC795298D71DF3C3B7E93AAEDA",
|
||||
"7FDBB2E924D182BB0D69844ADC4ECA5B",
|
||||
"1F140E8EF887DAB52F079A06E6915A6460B75CD256834A43FA7AF90C23067AF412EDAFE2C1778D69",
|
||||
"0074E922FDEE5DC4CDF22FC8D7986477F813400860",
|
||||
0x14));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0005, KEY_APP,
|
||||
"C109AB56593DE5BE8BA190578E7D8109346E86A11088B42C727E2B793FD64BDC",
|
||||
"15D3F191295C94B09B71EBDE088A187A",
|
||||
"B6BB0A84C649A90D97EBA55B555366F52381BB38A84C8BB71DA5A5A0949043C6DB249029A43156F7",
|
||||
"",
|
||||
0x15));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0006, KEY_APP,
|
||||
"6DFD7AFB470D2B2C955AB22264B1FF3C67F180983B26C01615DE9F2ECCBE7F41",
|
||||
"24BD1C19D2A8286B8ACE39E4A37801C2",
|
||||
"71F46AC33FF89DF589A100A7FB64CEAC244C9A0CBBC1FDCE80FB4BF8A0D2E66293309CB8EE8CFA95",
|
||||
"",
|
||||
0x2C));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0007, KEY_APP,
|
||||
"945B99C0E69CAF0558C588B95FF41B232660ECB017741F3218C12F9DFDEEDE55",
|
||||
"1D5EFBE7C5D34AD60F9FBC46A5977FCE",
|
||||
"AB284CA549B2DE9AA5C903B75652F78D192F8F4A8F3CD99209415C0A84C5C9FD6BF3095C1C18FFCD",
|
||||
"002CF896D35DB871D0E6A252E799876A70D043C23E",
|
||||
0x15));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0008, KEY_APP,
|
||||
"2C9E8969EC44DFB6A8771DC7F7FDFBCCAF329EC3EC070900CABB23742A9A6E13",
|
||||
"5A4CEFD5A9C3C093D0B9352376D19405",
|
||||
"6E82F6B54A0E9DEBE4A8B3043EE3B24CD9BBB62B4416B0482582E419A2552E29AB4BEA0A4D7FA2D5",
|
||||
"",
|
||||
0x16));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0009, KEY_APP,
|
||||
"F69E4A2934F114D89F386CE766388366CDD210F1D8913E3B973257F1201D632B",
|
||||
"F4D535069301EE888CC2A852DB654461",
|
||||
"1D7B974D10E61C2ED087A0981535904677EC07E96260F89565FF7EBDA4EE035C2AA9BCBDD5893F99",
|
||||
"",
|
||||
0x2D));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x000A, KEY_APP,
|
||||
"29805302E7C92F204009161CA93F776A072141A8C46A108E571C46D473A176A3",
|
||||
"5D1FAB844107676ABCDFC25EAEBCB633",
|
||||
"09301B6436C85B53CB1585300A3F1AF9FB14DB7C30088C4642AD66D5C148B8995BB1A698A8C71827",
|
||||
"0010818ED8A666051C6198662C3D6DDE2CA4901DDC",
|
||||
0x25));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x000B, KEY_APP,
|
||||
"A4C97402CC8A71BC7748661FE9CE7DF44DCE95D0D58938A59F47B9E9DBA7BFC3",
|
||||
"E4792F2B9DB30CB8D1596077A13FB3B5",
|
||||
"2733C889D289550FE00EAA5A47A34CEF0C1AF187610EB07BA35D2C09BB73C80B244EB4147700D1BF",
|
||||
"",
|
||||
0x26));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x000C, KEY_APP,
|
||||
"9814EFFF67B7074D1B263BF85BDC8576CE9DEC914123971B169472A1BC2387FA",
|
||||
"D43B1FA8BE15714B3078C23908BB2BCA",
|
||||
"7D1986C6BEE6CE1E0C5893BD2DF203881F40D5056761CC3F1F2E9D9A378617A2DE40BA5F09844CEB",
|
||||
"",
|
||||
0x3D));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x000D, KEY_APP,
|
||||
"03B4C421E0C0DE708C0F0B71C24E3EE04306AE7383D8C5621394CCB99FF7A194",
|
||||
"5ADB9EAFE897B54CB1060D6885BE22CF",
|
||||
"71502ADB5783583AB88B2D5F23F419AF01C8B1E72FCA1E694AD49FE3266F1F9C61EFC6F29B351142",
|
||||
"",
|
||||
0x12));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x000E, KEY_APP,
|
||||
"39A870173C226EB8A3EEE9CA6FB675E82039B2D0CCB22653BFCE4DB013BAEA03",
|
||||
"90266C98CBAA06C1BF145FF760EA1B45",
|
||||
"84DE5692809848E5ACBE25BE548F6981E3DB14735A5DDE1A0FD1F475866532B862B1AB6A004B7255",
|
||||
"",
|
||||
0x27));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x000F, KEY_APP,
|
||||
"FD52DFA7C6EEF5679628D12E267AA863B9365E6DB95470949CFD235B3FCA0F3B",
|
||||
"64F50296CF8CF49CD7C643572887DA0B",
|
||||
"0696D6CCBD7CF585EF5E00D547503C185D7421581BAD196E081723CD0A97FA40B2C0CD2492B0B5A1",
|
||||
"",
|
||||
0x3A));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0010, KEY_APP,
|
||||
"A5E51AD8F32FFBDE808972ACEE46397F2D3FE6BC823C8218EF875EE3A9B0584F",
|
||||
"7A203D5112F799979DF0E1B8B5B52AA4",
|
||||
"50597B7F680DD89F6594D9BDC0CBEE03666AB53647D0487F7F452FE2DD02694631EA755548C9E934",
|
||||
"",
|
||||
0x25));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0011, KEY_APP,
|
||||
"0F8EAB8884A51D092D7250597388E3B8B75444AC138B9D36E5C7C5B8C3DF18FD",
|
||||
"97AF39C383E7EF1C98FA447C597EA8FE",
|
||||
"2FDA7A56AAEA65921C0284FF1942C6DE137370093D106034B59191951A5201B422D462F8726F852D",
|
||||
"",
|
||||
0x26));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0013, KEY_APP,
|
||||
"DBF62D76FC81C8AC92372A9D631DDC9219F152C59C4B20BFF8F96B64AB065E94",
|
||||
"CB5DD4BE8CF115FFB25801BC6086E729",
|
||||
"B26FE6D3E3A1E766FAE79A8E6A7F48998E7FC1E4B0AD8745FF54C018C2A6CC7A0DD7525FAFEA4917",
|
||||
"",
|
||||
0x12));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0014, KEY_APP,
|
||||
"491B0D72BB21ED115950379F4564CE784A4BFAABB00E8CB71294B192B7B9F88E",
|
||||
"F98843588FED8B0E62D7DDCB6F0CECF4",
|
||||
"04275E8838EF95BD013B223C3DF674540932F21B534C7ED2944B9104D938FEB03B824DDB866AB26E",
|
||||
"",
|
||||
0x27));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0016, KEY_APP,
|
||||
"A106692224F1E91E1C4EBAD4A25FBFF66B4B13E88D878E8CD072F23CD1C5BF7C",
|
||||
"62773C70BD749269C0AFD1F12E73909E",
|
||||
"566635D3E1DCEC47243AAD1628AE6B2CEB33463FC155E4635846CE33899C5E353DDFA47FEF5694AF",
|
||||
"",
|
||||
0x30));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0017, KEY_APP,
|
||||
"4E104DCE09BA878C75DA98D0B1636F0E5F058328D81419E2A3D22AB0256FDF46",
|
||||
"954A86C4629E116532304A740862EF85",
|
||||
"3B7B04C71CAE2B1199D57453C038BB1B541A05AD1B94167B0AB47A9B24CAECB9000CB21407009666",
|
||||
"",
|
||||
0x08));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0018, KEY_APP,
|
||||
"1F876AB252DDBCB70E74DC4A20CD8ED51E330E62490E652F862877E8D8D0F997",
|
||||
"BF8D6B1887FA88E6D85C2EDB2FBEC147",
|
||||
"64A04126D77BF6B4D686F6E8F87DD150A5B014BA922D2B694FFF4453E11239A6E0B58F1703C51494",
|
||||
"",
|
||||
0x11));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0019, KEY_APP,
|
||||
"3236B9937174DF1DC12EC2DD8A318A0EA4D3ECDEA5DFB4AC1B8278447000C297",
|
||||
"6153DEE781B8ADDC6A439498B816DC46",
|
||||
"148DCA961E2738BAF84B2D1B6E2DA2ABD6A95F2C9571E54C6922F9ED9674F062B7F1BE5BD6FA5268",
|
||||
"",
|
||||
0x31));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x001A, KEY_APP,
|
||||
"5EFD1E9961462794E3B9EF2A4D0C1F46F642AAE053B5025504130590E66F19C9",
|
||||
"1AC8FA3B3C90F8FDE639515F91B58327",
|
||||
"BE4B1B513536960618BFEF12A713F6673881B02F9DC616191E823FC8337CCF99ADAA6172019C0C23",
|
||||
"",
|
||||
0x17));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x001B, KEY_APP,
|
||||
"66637570D1DEC098467DB207BAEA786861964D0964D4DBAF89E76F46955D181B",
|
||||
"9F7B5713A5ED59F6B35CD8F8A165D4B8",
|
||||
"4AB6FB1F6F0C3D9219923C1AC683137AB05DF667833CC6A5E8F590E4E28FE2EB180C7D5861117CFB",
|
||||
"",
|
||||
0x12));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0004004600000000, 0x001C, KEY_APP,
|
||||
"CFF025375BA0079226BE01F4A31F346D79F62CFB643CA910E16CF60BD9092752",
|
||||
"FD40664E2EBBA01BF359B0DCDF543DA4",
|
||||
"36C1ACE6DD5CCC0006FDF3424750FAC515FC5CFA2C93EC53C6EC2BC421708D154E91F2E7EA54A893",
|
||||
"",
|
||||
0x09));
|
||||
sk_APP_arr.Move(
|
||||
new SELF_KEY(0x0004004600000000, 0x001D, KEY_APP,
|
||||
"D202174EB65A62048F3674B59EF6FE72E1872962F3E1CD658DE8D7AF71DA1F3E",
|
||||
"ACB9945914EBB7B9A31ECE320AE09F2D",
|
||||
"430322887503CF52928FAAA410FD623C7321281C8825D95F5B47EF078EFCFC44454C3AB4F00BB879",
|
||||
"",
|
||||
0x1A));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfNPDRMKeys()
|
||||
{
|
||||
sk_NPDRM_arr.Clear();
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0001000000000000, 0x0001, KEY_NPDRM,
|
||||
"F9EDD0301F770FABBA8863D9897F0FEA6551B09431F61312654E28F43533EA6B",
|
||||
"A551CCB4A42C37A734A2B4F9657D5540",
|
||||
"B05F9DA5F9121EE4031467E74C505C29A8E29D1022379EDFF0500B9AE480B5DAB4578A4C61C5D6BF",
|
||||
"00040AB47509BED04BD96521AD1B365B86BF620A98",
|
||||
0x11));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0001000000000000, 0x0002, KEY_NPDRM,
|
||||
"8E737230C80E66AD0162EDDD32F1F774EE5E4E187449F19079437A508FCF9C86",
|
||||
"7AAECC60AD12AED90C348D8C11D2BED5",
|
||||
"05BF09CB6FD78050C78DE69CC316FF27C9F1ED66A45BFCE0A1E5A6749B19BD546BBB4602CF373440",
|
||||
"",
|
||||
0x0A));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0003, KEY_NPDRM,
|
||||
"1B715B0C3E8DC4C1A5772EBA9C5D34F7CCFE5B82025D453F3167566497239664",
|
||||
"E31E206FBB8AEA27FAB0D9A2FFB6B62F",
|
||||
"3F51E59FC74D6618D34431FA67987FA11ABBFACC7111811473CD9988FE91C43FC74605E7B8CB732D",
|
||||
"",
|
||||
0x08));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0004, KEY_NPDRM,
|
||||
"BB4DBF66B744A33934172D9F8379A7A5EA74CB0F559BB95D0E7AECE91702B706",
|
||||
"ADF7B207A15AC601110E61DDFC210AF6",
|
||||
"9C327471BAFF1F877AE4FE29F4501AF5AD6A2C459F8622697F583EFCA2CA30ABB5CD45D1131CAB30",
|
||||
"00B61A91DF4AB6A9F142C326BA9592B5265DA88856",
|
||||
0x16));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0006, KEY_NPDRM,
|
||||
"8B4C52849765D2B5FA3D5628AFB17644D52B9FFEE235B4C0DB72A62867EAA020",
|
||||
"05719DF1B1D0306C03910ADDCE4AF887",
|
||||
"2A5D6C6908CA98FC4740D834C6400E6D6AD74CF0A712CF1E7DAE806E98605CC308F6A03658F2970E",
|
||||
"",
|
||||
0x29));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0007, KEY_NPDRM,
|
||||
"3946DFAA141718C7BE339A0D6C26301C76B568AEBC5CD52652F2E2E0297437C3",
|
||||
"E4897BE553AE025CDCBF2B15D1C9234E",
|
||||
"A13AFE8B63F897DA2D3DC3987B39389DC10BAD99DFB703838C4A0BC4E8BB44659C726CFD0CE60D0E",
|
||||
"009EF86907782A318D4CC3617EBACE2480E73A46F6",
|
||||
0x17));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0009, KEY_NPDRM,
|
||||
"0786F4B0CA5937F515BDCE188F569B2EF3109A4DA0780A7AA07BD89C3350810A",
|
||||
"04AD3C2F122A3B35E804850CAD142C6D",
|
||||
"A1FE61035DBBEA5A94D120D03C000D3B2F084B9F4AFA99A2D4A588DF92B8F36327CE9E47889A45D0",
|
||||
"",
|
||||
0x2A));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x000A, KEY_NPDRM,
|
||||
"03C21AD78FBB6A3D425E9AAB1298F9FD70E29FD4E6E3A3C151205DA50C413DE4",
|
||||
"0A99D4D4F8301A88052D714AD2FB565E",
|
||||
"3995C390C9F7FBBAB124A1C14E70F9741A5E6BDF17A605D88239652C8EA7D5FC9F24B30546C1E44B",
|
||||
"009AC6B22A056BA9E0B6D1520F28A57A3135483F9F",
|
||||
0x27));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x000C, KEY_NPDRM,
|
||||
"357EBBEA265FAEC271182D571C6CD2F62CFA04D325588F213DB6B2E0ED166D92",
|
||||
"D26E6DD2B74CD78E866E742E5571B84F",
|
||||
"00DCF5391618604AB42C8CFF3DC304DF45341EBA4551293E9E2B68FFE2DF527FFA3BE8329E015E57",
|
||||
"",
|
||||
0x3A));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x000D, KEY_NPDRM,
|
||||
"337A51416105B56E40D7CAF1B954CDAF4E7645F28379904F35F27E81CA7B6957",
|
||||
"8405C88E042280DBD794EC7E22B74002",
|
||||
"9BFF1CC7118D2393DE50D5CF44909860683411A532767BFDAC78622DB9E5456753FE422CBAFA1DA1",
|
||||
"",
|
||||
0x18));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x000F, KEY_NPDRM,
|
||||
"135C098CBE6A3E037EBE9F2BB9B30218DDE8D68217346F9AD33203352FBB3291",
|
||||
"4070C898C2EAAD1634A288AA547A35A8",
|
||||
"BBD7CCCB556C2EF0F908DC7810FAFC37F2E56B3DAA5F7FAF53A4944AA9B841F76AB091E16B231433",
|
||||
"",
|
||||
0x3B));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0010, KEY_NPDRM,
|
||||
"4B3CD10F6A6AA7D99F9B3A660C35ADE08EF01C2C336B9E46D1BB5678B4261A61",
|
||||
"C0F2AB86E6E0457552DB50D7219371C5",
|
||||
"64A5C60BC2AD18B8A237E4AA690647E12BF7A081523FAD4F29BE89ACAC72F7AB43C74EC9AFFDA213",
|
||||
"",
|
||||
0x27));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0013, KEY_NPDRM,
|
||||
"265C93CF48562EC5D18773BEB7689B8AD10C5EB6D21421455DEBC4FB128CBF46",
|
||||
"8DEA5FF959682A9B98B688CEA1EF4A1D",
|
||||
"9D8DB5A880608DC69717991AFC3AD5C0215A5EE413328C2ABC8F35589E04432373DB2E2339EEF7C8",
|
||||
"",
|
||||
0x18));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0016, KEY_NPDRM,
|
||||
"7910340483E419E55F0D33E4EA5410EEEC3AF47814667ECA2AA9D75602B14D4B",
|
||||
"4AD981431B98DFD39B6388EDAD742A8E",
|
||||
"62DFE488E410B1B6B2F559E4CB932BCB78845AB623CC59FDF65168400FD76FA82ED1DC60E091D1D1",
|
||||
"",
|
||||
0x25));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0019, KEY_NPDRM,
|
||||
"FBDA75963FE690CFF35B7AA7B408CF631744EDEF5F7931A04D58FD6A921FFDB3",
|
||||
"F72C1D80FFDA2E3BF085F4133E6D2805",
|
||||
"637EAD34E7B85C723C627E68ABDD0419914EBED4008311731DD87FDDA2DAF71F856A70E14DA17B42",
|
||||
"",
|
||||
0x24));
|
||||
sk_NPDRM_arr.Move(
|
||||
new SELF_KEY(0x0004004600000000, 0x001C, KEY_NPDRM,
|
||||
"8103EA9DB790578219C4CEDF0592B43064A7D98B601B6C7BC45108C4047AA80F",
|
||||
"246F4B8328BE6A2D394EDE20479247C5",
|
||||
"503172C9551308A87621ECEE90362D14889BFED2CF32B0B3E32A4F9FE527A41464B735E1ADBC6762",
|
||||
"",
|
||||
0x30));
|
||||
}
|
||||
|
||||
void KeyVault::LoadSelfUNK7Keys()
|
||||
{
|
||||
sk_UNK7_arr.Clear();
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003003000000000, 0x0000, KEY_UNK7,
|
||||
"D91166973979EA8694476B011AC62C7E9F37DA26DE1E5C2EE3D66E42B8517085",
|
||||
"DC01280A6E46BC674B81A7E8801EBE6E",
|
||||
"A0FC44108236141BF3517A662B027AFC1AC513A05690496C754DEB7D43BDC41B80FD75C212624EE4",
|
||||
"",
|
||||
0x11));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003004200000000, 0x0000, KEY_UNK7,
|
||||
"B73111B0B00117E48DE5E2EE5E534C0F0EFFA4890BBB8CAD01EE0F848F91583E",
|
||||
"86F56F9E5DE513894874B8BA253334B1",
|
||||
"B0BA1A1AB9723BB4E87CED9637BE056066BC56E16572D43D0210A06411DBF8FEB8885CD912384AE5",
|
||||
"",
|
||||
0x12));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003005000000000, 0x0000, KEY_UNK7,
|
||||
"8E944267C02E69A4FE474B7F5FCD7974A4F936FF4355AEC4F80EFA123858D8F6",
|
||||
"908A75754E521EAC2F5A4889C6D7B72D",
|
||||
"91201DA7D79E8EE2563142ECBD646DA026C963AC09E760E5390FFE24DAE6864310ABE147F8204D0B",
|
||||
"",
|
||||
0x13));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003005500000000, 0x0000, KEY_UNK7,
|
||||
"BB31DF9A6F62C0DF853075FAA65134D9CE2240306C1731D1F7DA9B5329BD699F",
|
||||
"263057225873F83940A65C8C926AC3E4",
|
||||
"BC3A82A4F44C43A197070CD236FDC94FCC542D69A3E803E0AFF78D1F3DA19A79D2F61FAB5B94B437",
|
||||
"",
|
||||
0x23));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003005600000000, 0x0000, KEY_UNK7,
|
||||
"71AA75C70A255580E4AE9BDAA0B08828C53EAA713CD0713797F143B284C1589B",
|
||||
"9DED878CB6BA07121C0F50E7B172A8BF",
|
||||
"387FCDAEAFF1B59CFAF79CE6215A065ACEAFFAF4048A4F217E1FF5CE67C66EC3F089DB235E52F9D3",
|
||||
"",
|
||||
0x29));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003006100000000, 0x0000, KEY_UNK7,
|
||||
"F5D1DBC182F5083CD4EA37C431C7DAC73882C07F232D2699B1DD9FDDF1BF4195",
|
||||
"D3A7C3C91CBA014FCBCA6D5570DE13FF",
|
||||
"97CA8A9781F45E557E98F176EF794FCDA6B151EB3DFD1ABA12151E00AE59957C3B15628FC8875D28",
|
||||
"",
|
||||
0x23));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003006600000000, 0x0000, KEY_UNK7,
|
||||
"BF10F09590C0152F7EF749FF4B990122A4E8E5491DA49A2D931E72EEB990F860",
|
||||
"22C19C5522F7A782AFC547C2640F5BDE",
|
||||
"3233BA2B284189FB1687DF653002257A0925D8EB0C64EBBE8CC7DE87F548D107DE1FD3D1D285DB4F",
|
||||
"",
|
||||
0x29));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0003007400000000, 0x0000, KEY_UNK7,
|
||||
"F11DBD2C97B32AD37E55F8E743BC821D3E67630A6784D9A058DDD26313482F0F",
|
||||
"FC5FA12CA3D2D336C4B8B425D679DA55",
|
||||
"19E27EE90E33EDAB16B22E688B5F704E5C6EC1062070EBF43554CD03DFDAE16D684BB8B5574DBECA",
|
||||
"",
|
||||
0x15));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0004001100000000, 0x0000, KEY_UNK7,
|
||||
"751EE949CD3ADF50A469197494A1EC358409CCBE6E85217EBDE7A87D3FF1ABD8",
|
||||
"23AE4ADA4D3F798DC5ED98000337FF77",
|
||||
"1BABA87CD1AD705C462D4E7427B6DAF59A50383A348A15088F0EDFCF1ADF2B5C2B2D507B2A357D36",
|
||||
"",
|
||||
0x1A));
|
||||
sk_UNK7_arr.Move(
|
||||
new SELF_KEY(0x0004004600000000, 0x0000, KEY_UNK7,
|
||||
"46BD0891224E0CE13E2162921D4BB76193AEEE4416A729FCDD111C5536BF87C9",
|
||||
"BF036387CDB613C0AC88A6D9D2CC5316",
|
||||
"A14F6D5F9AD7EBB3B7A39A7C32F13E5DC3B0BA16BDC33D39FDDF88F4AEEA6CFEEB0C0796C917A952",
|
||||
"",
|
||||
0x0F));
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV0Key()
|
||||
{
|
||||
return sk_LV0_arr[0];
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLDRKey()
|
||||
{
|
||||
return sk_LDR_arr[0];
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV1Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_LV1_arr.GetCount(); i++)
|
||||
{
|
||||
if (sk_LV1_arr[i].version == version)
|
||||
{
|
||||
key = sk_LV1_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfLV2Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_LV2_arr.GetCount(); i++)
|
||||
{
|
||||
if (sk_LV2_arr[i].version == version)
|
||||
{
|
||||
key = sk_LV2_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfISOKey(u16 revision, u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_ISO_arr.GetCount(); i++)
|
||||
{
|
||||
if ((sk_ISO_arr[i].version == version) &&
|
||||
(sk_ISO_arr[i].revision == revision))
|
||||
{
|
||||
key = sk_ISO_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfAPPKey(u16 revision)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_APP_arr.GetCount(); i++)
|
||||
{
|
||||
if (sk_APP_arr[i].revision == revision)
|
||||
{
|
||||
key = sk_APP_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfUNK7Key(u64 version)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_UNK7_arr.GetCount(); i++)
|
||||
{
|
||||
if (sk_UNK7_arr[i].version == version)
|
||||
{
|
||||
key = sk_UNK7_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::GetSelfNPDRMKey(u16 revision)
|
||||
{
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
for(int i = 0; i < sk_NPDRM_arr.GetCount(); i++)
|
||||
{
|
||||
if (sk_NPDRM_arr[i].revision == revision)
|
||||
{
|
||||
key = sk_NPDRM_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
SELF_KEY KeyVault::FindSelfKey(u32 type, u16 revision, u64 version)
|
||||
{
|
||||
// Empty key.
|
||||
SELF_KEY key(0, 0, 0, "", "", "", "", 0);
|
||||
|
||||
// Check SELF type.
|
||||
switch (type)
|
||||
{
|
||||
case KEY_LV0:
|
||||
LoadSelfLV0Keys();
|
||||
key = GetSelfLV0Key();
|
||||
break;
|
||||
case KEY_LV1:
|
||||
LoadSelfLV1Keys();
|
||||
key = GetSelfLV1Key(version);
|
||||
break;
|
||||
case KEY_LV2:
|
||||
LoadSelfLV2Keys();
|
||||
key = GetSelfLV2Key(version);
|
||||
break;
|
||||
case KEY_APP:
|
||||
LoadSelfAPPKeys();
|
||||
key = GetSelfAPPKey(revision);
|
||||
break;
|
||||
case KEY_ISO:
|
||||
LoadSelfISOKeys();
|
||||
key = GetSelfISOKey(revision, version);
|
||||
break;
|
||||
case KEY_LDR:
|
||||
LoadSelfLDRKeys();
|
||||
key = GetSelfLDRKey();
|
||||
break;
|
||||
case KEY_UNK7:
|
||||
LoadSelfUNK7Keys();
|
||||
key = GetSelfUNK7Key(version);
|
||||
break;
|
||||
case KEY_NPDRM:
|
||||
LoadSelfNPDRMKeys();
|
||||
key = GetSelfNPDRMKey(revision);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
void KeyVault::SetKlicenseeKey(u8 *key)
|
||||
{
|
||||
memcpy(klicensee_key, key, 0x10);
|
||||
}
|
||||
|
||||
u8 *KeyVault::GetKlicenseeKey()
|
||||
{
|
||||
return klicensee_key;
|
||||
}
|
||||
|
||||
void KeyVault::RapToRif(unsigned char* rap, unsigned char* rif)
|
||||
{
|
||||
int i;
|
||||
int round;
|
||||
aes_context aes;
|
||||
|
||||
unsigned char key[0x10];
|
||||
unsigned char iv[0x10];
|
||||
memset(key, 0, 0x10);
|
||||
memset(iv, 0, 0x10);
|
||||
|
||||
// Initial decrypt.
|
||||
aes_setkey_dec(&aes, RAP_KEY, 128);
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, 0x10, iv, rap, key);
|
||||
|
||||
// rap2rifkey round.
|
||||
for (round = 0; round < 5; ++round) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
int p = RAP_PBOX[i];
|
||||
key[p] ^= RAP_E1[p];
|
||||
}
|
||||
for (i = 15; i >= 1; --i) {
|
||||
int p = RAP_PBOX[i];
|
||||
int pp = RAP_PBOX[i - 1];
|
||||
key[p] ^= key[pp];
|
||||
}
|
||||
int o = 0;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
int p = RAP_PBOX[i];
|
||||
unsigned char kc = key[p] - o;
|
||||
unsigned char ec2 = RAP_E2[p];
|
||||
if (o != 1 || kc != 0xFF) {
|
||||
o = kc < ec2 ? 1 : 0;
|
||||
key[p] = kc - ec2;
|
||||
} else if (kc == 0xFF) {
|
||||
key[p] = kc - ec2;
|
||||
} else {
|
||||
key[p] = kc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(rif, key, 0x10);
|
||||
}
|
111
rpcs3/Crypto/key_vault.h
Normal file
111
rpcs3/Crypto/key_vault.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "utils.h"
|
||||
|
||||
enum SELF_KEY_TYPE {
|
||||
KEY_LV0 = 1,
|
||||
KEY_LV1,
|
||||
KEY_LV2,
|
||||
KEY_APP,
|
||||
KEY_ISO,
|
||||
KEY_LDR,
|
||||
KEY_UNK7,
|
||||
KEY_NPDRM
|
||||
};
|
||||
|
||||
struct SELF_KEY {
|
||||
u64 version;
|
||||
u16 revision;
|
||||
u32 self_type;
|
||||
u8 erk[0x20];
|
||||
u8 riv[0x10];
|
||||
u8 pub[0x28];
|
||||
u8 priv[0x15];
|
||||
u32 curve_type;
|
||||
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, wxString e, wxString r, wxString pb, wxString pr, u32 ct)
|
||||
{
|
||||
version = ver;
|
||||
revision = rev;
|
||||
self_type = type;
|
||||
hex_to_bytes(erk, e.c_str());
|
||||
hex_to_bytes(riv, r.c_str());
|
||||
hex_to_bytes(pub, pb.c_str());
|
||||
hex_to_bytes(priv, pr.c_str());
|
||||
curve_type = ct;
|
||||
}
|
||||
};
|
||||
|
||||
static const u8 PKG_AES_KEY[0x10] = {
|
||||
0x2e, 0x7b, 0x71, 0xd7, 0xc9, 0xc9, 0xa1, 0x4e, 0xa3, 0x22, 0x1f, 0x18, 0x88, 0x28, 0xb8, 0xf8
|
||||
};
|
||||
|
||||
static const u8 NP_IDPS[0x10] = {
|
||||
0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
static const u8 NP_KLIC_FREE[0x10] = {
|
||||
0x72, 0xF9, 0x90, 0x78, 0x8F, 0x9C, 0xFF, 0x74, 0x57, 0x25, 0xF0, 0x8E, 0x4C, 0x12, 0x83, 0x87
|
||||
};
|
||||
|
||||
static const u8 NP_KLIC_KEY[0x10] = {
|
||||
0xF2, 0xFB, 0xCA, 0x7A, 0x75, 0xB0, 0x4E, 0xDC, 0x13, 0x90, 0x63, 0x8C, 0xCD, 0xFD, 0xD1, 0xEE
|
||||
};
|
||||
|
||||
static const u8 NP_RIF_KEY[0x10] = {
|
||||
0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53, 0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B
|
||||
};
|
||||
|
||||
static const u8 RAP_KEY[0x10] = {
|
||||
0x86, 0x9F, 0x77, 0x45, 0xC1, 0x3F, 0xD8, 0x90, 0xCC, 0xF2, 0x91, 0x88, 0xE3, 0xCC, 0x3E, 0xDF
|
||||
};
|
||||
|
||||
static const u8 RAP_PBOX[0x10] = {
|
||||
0x0C, 0x03, 0x06, 0x04, 0x01, 0x0B, 0x0F, 0x08, 0x02, 0x07, 0x00, 0x05, 0x0A, 0x0E, 0x0D, 0x09
|
||||
};
|
||||
|
||||
static const u8 RAP_E1[0x10] = {
|
||||
0xA9, 0x3E, 0x1F, 0xD6, 0x7C, 0x55, 0xA3, 0x29, 0xB7, 0x5F, 0xDD, 0xA6, 0x2A, 0x95, 0xC7, 0xA5
|
||||
};
|
||||
|
||||
static const u8 RAP_E2[0x10] = {
|
||||
0x67, 0xD4, 0x5D, 0xA3, 0x29, 0x6D, 0x00, 0x6A, 0x4E, 0x7C, 0x53, 0x7B, 0xF5, 0x53, 0x8C, 0x74
|
||||
};
|
||||
|
||||
class KeyVault
|
||||
{
|
||||
Array<SELF_KEY> sk_LV0_arr;
|
||||
Array<SELF_KEY> sk_LV1_arr;
|
||||
Array<SELF_KEY> sk_LV2_arr;
|
||||
Array<SELF_KEY> sk_APP_arr;
|
||||
Array<SELF_KEY> sk_ISO_arr;
|
||||
Array<SELF_KEY> sk_LDR_arr;
|
||||
Array<SELF_KEY> sk_UNK7_arr;
|
||||
Array<SELF_KEY> sk_NPDRM_arr;
|
||||
u8 klicensee_key[0x10];
|
||||
|
||||
public:
|
||||
KeyVault();
|
||||
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
|
||||
void SetKlicenseeKey(u8 *key);
|
||||
u8 *GetKlicenseeKey();
|
||||
void RapToRif(unsigned char* rap, unsigned char* rif);
|
||||
|
||||
private:
|
||||
void LoadSelfLV0Keys();
|
||||
void LoadSelfLDRKeys();
|
||||
void LoadSelfLV1Keys();
|
||||
void LoadSelfLV2Keys();
|
||||
void LoadSelfISOKeys();
|
||||
void LoadSelfAPPKeys();
|
||||
void LoadSelfUNK7Keys();
|
||||
void LoadSelfNPDRMKeys();
|
||||
SELF_KEY GetSelfLV0Key();
|
||||
SELF_KEY GetSelfLDRKey();
|
||||
SELF_KEY GetSelfLV1Key(u64 version);
|
||||
SELF_KEY GetSelfLV2Key(u64 version);
|
||||
SELF_KEY GetSelfISOKey(u16 revision, u64 version);
|
||||
SELF_KEY GetSelfAPPKey(u16 revision);
|
||||
SELF_KEY GetSelfUNK7Key(u64 version);
|
||||
SELF_KEY GetSelfNPDRMKey(u16 revision);
|
||||
};
|
400
rpcs3/Crypto/sha1.cpp
Normal file
400
rpcs3/Crypto/sha1.cpp
Normal file
|
@ -0,0 +1,400 @@
|
|||
/*
|
||||
* FIPS-180-1 compliant SHA-1 implementation
|
||||
*
|
||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/*
|
||||
* The SHA-1 standard was published by NIST in 1993.
|
||||
*
|
||||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "sha1.h"
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (big endian)
|
||||
*/
|
||||
#ifndef GET_ULONG_BE
|
||||
#define GET_ULONG_BE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (unsigned long) (b)[(i) ] << 24 ) \
|
||||
| ( (unsigned long) (b)[(i) + 1] << 16 ) \
|
||||
| ( (unsigned long) (b)[(i) + 2] << 8 ) \
|
||||
| ( (unsigned long) (b)[(i) + 3] ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_ULONG_BE
|
||||
#define PUT_ULONG_BE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
||||
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SHA-1 context setup
|
||||
*/
|
||||
void sha1_starts( sha1_context *ctx )
|
||||
{
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xEFCDAB89;
|
||||
ctx->state[2] = 0x98BADCFE;
|
||||
ctx->state[3] = 0x10325476;
|
||||
ctx->state[4] = 0xC3D2E1F0;
|
||||
}
|
||||
|
||||
static void sha1_process( sha1_context *ctx, const unsigned char data[64] )
|
||||
{
|
||||
unsigned long temp, W[16], A, B, C, D, E;
|
||||
|
||||
GET_ULONG_BE( W[ 0], data, 0 );
|
||||
GET_ULONG_BE( W[ 1], data, 4 );
|
||||
GET_ULONG_BE( W[ 2], data, 8 );
|
||||
GET_ULONG_BE( W[ 3], data, 12 );
|
||||
GET_ULONG_BE( W[ 4], data, 16 );
|
||||
GET_ULONG_BE( W[ 5], data, 20 );
|
||||
GET_ULONG_BE( W[ 6], data, 24 );
|
||||
GET_ULONG_BE( W[ 7], data, 28 );
|
||||
GET_ULONG_BE( W[ 8], data, 32 );
|
||||
GET_ULONG_BE( W[ 9], data, 36 );
|
||||
GET_ULONG_BE( W[10], data, 40 );
|
||||
GET_ULONG_BE( W[11], data, 44 );
|
||||
GET_ULONG_BE( W[12], data, 48 );
|
||||
GET_ULONG_BE( W[13], data, 52 );
|
||||
GET_ULONG_BE( W[14], data, 56 );
|
||||
GET_ULONG_BE( W[15], data, 60 );
|
||||
|
||||
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
|
||||
|
||||
#define R(t) \
|
||||
( \
|
||||
temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \
|
||||
W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \
|
||||
( W[t & 0x0F] = S(temp,1) ) \
|
||||
)
|
||||
|
||||
#define P(a,b,c,d,e,x) \
|
||||
{ \
|
||||
e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \
|
||||
}
|
||||
|
||||
A = ctx->state[0];
|
||||
B = ctx->state[1];
|
||||
C = ctx->state[2];
|
||||
D = ctx->state[3];
|
||||
E = ctx->state[4];
|
||||
|
||||
#define F(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define K 0x5A827999
|
||||
|
||||
P( A, B, C, D, E, W[0] );
|
||||
P( E, A, B, C, D, W[1] );
|
||||
P( D, E, A, B, C, W[2] );
|
||||
P( C, D, E, A, B, W[3] );
|
||||
P( B, C, D, E, A, W[4] );
|
||||
P( A, B, C, D, E, W[5] );
|
||||
P( E, A, B, C, D, W[6] );
|
||||
P( D, E, A, B, C, W[7] );
|
||||
P( C, D, E, A, B, W[8] );
|
||||
P( B, C, D, E, A, W[9] );
|
||||
P( A, B, C, D, E, W[10] );
|
||||
P( E, A, B, C, D, W[11] );
|
||||
P( D, E, A, B, C, W[12] );
|
||||
P( C, D, E, A, B, W[13] );
|
||||
P( B, C, D, E, A, W[14] );
|
||||
P( A, B, C, D, E, W[15] );
|
||||
P( E, A, B, C, D, R(16) );
|
||||
P( D, E, A, B, C, R(17) );
|
||||
P( C, D, E, A, B, R(18) );
|
||||
P( B, C, D, E, A, R(19) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
#define K 0x6ED9EBA1
|
||||
|
||||
P( A, B, C, D, E, R(20) );
|
||||
P( E, A, B, C, D, R(21) );
|
||||
P( D, E, A, B, C, R(22) );
|
||||
P( C, D, E, A, B, R(23) );
|
||||
P( B, C, D, E, A, R(24) );
|
||||
P( A, B, C, D, E, R(25) );
|
||||
P( E, A, B, C, D, R(26) );
|
||||
P( D, E, A, B, C, R(27) );
|
||||
P( C, D, E, A, B, R(28) );
|
||||
P( B, C, D, E, A, R(29) );
|
||||
P( A, B, C, D, E, R(30) );
|
||||
P( E, A, B, C, D, R(31) );
|
||||
P( D, E, A, B, C, R(32) );
|
||||
P( C, D, E, A, B, R(33) );
|
||||
P( B, C, D, E, A, R(34) );
|
||||
P( A, B, C, D, E, R(35) );
|
||||
P( E, A, B, C, D, R(36) );
|
||||
P( D, E, A, B, C, R(37) );
|
||||
P( C, D, E, A, B, R(38) );
|
||||
P( B, C, D, E, A, R(39) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) ((x & y) | (z & (x | y)))
|
||||
#define K 0x8F1BBCDC
|
||||
|
||||
P( A, B, C, D, E, R(40) );
|
||||
P( E, A, B, C, D, R(41) );
|
||||
P( D, E, A, B, C, R(42) );
|
||||
P( C, D, E, A, B, R(43) );
|
||||
P( B, C, D, E, A, R(44) );
|
||||
P( A, B, C, D, E, R(45) );
|
||||
P( E, A, B, C, D, R(46) );
|
||||
P( D, E, A, B, C, R(47) );
|
||||
P( C, D, E, A, B, R(48) );
|
||||
P( B, C, D, E, A, R(49) );
|
||||
P( A, B, C, D, E, R(50) );
|
||||
P( E, A, B, C, D, R(51) );
|
||||
P( D, E, A, B, C, R(52) );
|
||||
P( C, D, E, A, B, R(53) );
|
||||
P( B, C, D, E, A, R(54) );
|
||||
P( A, B, C, D, E, R(55) );
|
||||
P( E, A, B, C, D, R(56) );
|
||||
P( D, E, A, B, C, R(57) );
|
||||
P( C, D, E, A, B, R(58) );
|
||||
P( B, C, D, E, A, R(59) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
#define F(x,y,z) (x ^ y ^ z)
|
||||
#define K 0xCA62C1D6
|
||||
|
||||
P( A, B, C, D, E, R(60) );
|
||||
P( E, A, B, C, D, R(61) );
|
||||
P( D, E, A, B, C, R(62) );
|
||||
P( C, D, E, A, B, R(63) );
|
||||
P( B, C, D, E, A, R(64) );
|
||||
P( A, B, C, D, E, R(65) );
|
||||
P( E, A, B, C, D, R(66) );
|
||||
P( D, E, A, B, C, R(67) );
|
||||
P( C, D, E, A, B, R(68) );
|
||||
P( B, C, D, E, A, R(69) );
|
||||
P( A, B, C, D, E, R(70) );
|
||||
P( E, A, B, C, D, R(71) );
|
||||
P( D, E, A, B, C, R(72) );
|
||||
P( C, D, E, A, B, R(73) );
|
||||
P( B, C, D, E, A, R(74) );
|
||||
P( A, B, C, D, E, R(75) );
|
||||
P( E, A, B, C, D, R(76) );
|
||||
P( D, E, A, B, C, R(77) );
|
||||
P( C, D, E, A, B, R(78) );
|
||||
P( B, C, D, E, A, R(79) );
|
||||
|
||||
#undef K
|
||||
#undef F
|
||||
|
||||
ctx->state[0] += A;
|
||||
ctx->state[1] += B;
|
||||
ctx->state[2] += C;
|
||||
ctx->state[3] += D;
|
||||
ctx->state[4] += E;
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 process buffer
|
||||
*/
|
||||
void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
size_t fill;
|
||||
unsigned long left;
|
||||
|
||||
if( ilen <= 0 )
|
||||
return;
|
||||
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += (unsigned long) ilen;
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < (unsigned long) ilen )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && ilen >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, fill );
|
||||
sha1_process( ctx, ctx->buffer );
|
||||
input += fill;
|
||||
ilen -= fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while( ilen >= 64 )
|
||||
{
|
||||
sha1_process( ctx, input );
|
||||
input += 64;
|
||||
ilen -= 64;
|
||||
}
|
||||
|
||||
if( ilen > 0 )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left),
|
||||
(void *) input, ilen );
|
||||
}
|
||||
}
|
||||
|
||||
static const unsigned char sha1_padding[64] =
|
||||
{
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* SHA-1 final digest
|
||||
*/
|
||||
void sha1_finish( sha1_context *ctx, unsigned char output[20] )
|
||||
{
|
||||
unsigned long last, padn;
|
||||
unsigned long high, low;
|
||||
unsigned char msglen[8];
|
||||
|
||||
high = ( ctx->total[0] >> 29 )
|
||||
| ( ctx->total[1] << 3 );
|
||||
low = ( ctx->total[0] << 3 );
|
||||
|
||||
PUT_ULONG_BE( high, msglen, 0 );
|
||||
PUT_ULONG_BE( low, msglen, 4 );
|
||||
|
||||
last = ctx->total[0] & 0x3F;
|
||||
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
|
||||
|
||||
sha1_update( ctx, (unsigned char *) sha1_padding, padn );
|
||||
sha1_update( ctx, msglen, 8 );
|
||||
|
||||
PUT_ULONG_BE( ctx->state[0], output, 0 );
|
||||
PUT_ULONG_BE( ctx->state[1], output, 4 );
|
||||
PUT_ULONG_BE( ctx->state[2], output, 8 );
|
||||
PUT_ULONG_BE( ctx->state[3], output, 12 );
|
||||
PUT_ULONG_BE( ctx->state[4], output, 16 );
|
||||
}
|
||||
|
||||
/*
|
||||
* output = SHA-1( input buffer )
|
||||
*/
|
||||
void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] )
|
||||
{
|
||||
sha1_context ctx;
|
||||
|
||||
sha1_starts( &ctx );
|
||||
sha1_update( &ctx, input, ilen );
|
||||
sha1_finish( &ctx, output );
|
||||
|
||||
memset( &ctx, 0, sizeof( sha1_context ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC context setup
|
||||
*/
|
||||
void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen )
|
||||
{
|
||||
size_t i;
|
||||
unsigned char sum[20];
|
||||
|
||||
if( keylen > 64 )
|
||||
{
|
||||
sha1( key, keylen, sum );
|
||||
keylen = 20;
|
||||
key = sum;
|
||||
}
|
||||
|
||||
memset( ctx->ipad, 0x36, 64 );
|
||||
memset( ctx->opad, 0x5C, 64 );
|
||||
|
||||
for( i = 0; i < keylen; i++ )
|
||||
{
|
||||
ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
|
||||
ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
|
||||
}
|
||||
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->ipad, 64 );
|
||||
|
||||
memset( sum, 0, sizeof( sum ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC process buffer
|
||||
*/
|
||||
void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
||||
{
|
||||
sha1_update( ctx, input, ilen );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 HMAC final digest
|
||||
*/
|
||||
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] )
|
||||
{
|
||||
unsigned char tmpbuf[20];
|
||||
|
||||
sha1_finish( ctx, tmpbuf );
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->opad, 64 );
|
||||
sha1_update( ctx, tmpbuf, 20 );
|
||||
sha1_finish( ctx, output );
|
||||
|
||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA1 HMAC context reset
|
||||
*/
|
||||
void sha1_hmac_reset( sha1_context *ctx )
|
||||
{
|
||||
sha1_starts( ctx );
|
||||
sha1_update( ctx, ctx->ipad, 64 );
|
||||
}
|
||||
|
||||
/*
|
||||
* output = HMAC-SHA-1( hmac key, input buffer )
|
||||
*/
|
||||
void sha1_hmac( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char output[20] )
|
||||
{
|
||||
sha1_context ctx;
|
||||
|
||||
sha1_hmac_starts( &ctx, key, keylen );
|
||||
sha1_hmac_update( &ctx, input, ilen );
|
||||
sha1_hmac_finish( &ctx, output );
|
||||
|
||||
memset( &ctx, 0, sizeof( sha1_context ) );
|
||||
}
|
133
rpcs3/Crypto/sha1.h
Normal file
133
rpcs3/Crypto/sha1.h
Normal file
|
@ -0,0 +1,133 @@
|
|||
/**
|
||||
* \file sha1.h
|
||||
*
|
||||
* \brief SHA-1 cryptographic hash function
|
||||
*
|
||||
* Copyright (C) 2006-2010, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#ifndef POLARSSL_SHA1_H
|
||||
#define POLARSSL_SHA1_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* \brief SHA-1 context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned long total[2]; /*!< number of bytes processed */
|
||||
unsigned long state[5]; /*!< intermediate digest state */
|
||||
unsigned char buffer[64]; /*!< data block being processed */
|
||||
|
||||
unsigned char ipad[64]; /*!< HMAC: inner padding */
|
||||
unsigned char opad[64]; /*!< HMAC: outer padding */
|
||||
}
|
||||
sha1_context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief SHA-1 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*/
|
||||
void sha1_starts( sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 process buffer
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 final digest
|
||||
*
|
||||
* \param ctx SHA-1 context
|
||||
* \param output SHA-1 checksum result
|
||||
*/
|
||||
void sha1_finish( sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief Output = SHA-1( input buffer )
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output SHA-1 checksum result
|
||||
*/
|
||||
void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC context setup
|
||||
*
|
||||
* \param ctx HMAC context to be initialized
|
||||
* \param key HMAC secret key
|
||||
* \param keylen length of the HMAC key
|
||||
*/
|
||||
void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC process buffer
|
||||
*
|
||||
* \param ctx HMAC context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC final digest
|
||||
*
|
||||
* \param ctx HMAC context
|
||||
* \param output SHA-1 HMAC checksum result
|
||||
*/
|
||||
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
|
||||
|
||||
/**
|
||||
* \brief SHA-1 HMAC context reset
|
||||
*
|
||||
* \param ctx HMAC context to be reset
|
||||
*/
|
||||
void sha1_hmac_reset( sha1_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief Output = HMAC-SHA-1( hmac key, input buffer )
|
||||
*
|
||||
* \param key HMAC secret key
|
||||
* \param keylen length of the HMAC key
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output HMAC-SHA-1 result
|
||||
*/
|
||||
void sha1_hmac( const unsigned char *key, size_t keylen,
|
||||
const unsigned char *input, size_t ilen,
|
||||
unsigned char output[20] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* sha1.h */
|
222
rpcs3/Crypto/unpkg.cpp
Normal file
222
rpcs3/Crypto/unpkg.cpp
Normal file
|
@ -0,0 +1,222 @@
|
|||
#include "stdafx.h"
|
||||
#include "unpkg.h"
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
// Decryption.
|
||||
bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
if (m_header->pkg_magic != 0x7F504B47) {
|
||||
ConLog.Error("PKG: Not a package file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_header->pkg_type)
|
||||
{
|
||||
case PKG_RELEASE_TYPE_DEBUG: break;
|
||||
case PKG_RELEASE_TYPE_RELEASE: break;
|
||||
default:
|
||||
ConLog.Error("PKG: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_header->pkg_platform)
|
||||
{
|
||||
case PKG_PLATFORM_TYPE_PS3: break;
|
||||
case PKG_PLATFORM_TYPE_PSP: break;
|
||||
default:
|
||||
ConLog.Error("PKG: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->header_size != PKG_HEADER_SIZE) {
|
||||
ConLog.Error("PKG: Wrong header size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->pkg_size != pkg_f.Length()) {
|
||||
ConLog.Error("PKG: File size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header->data_size + m_header->data_offset + 0x60 != pkg_f.Length()) {
|
||||
ConLog.Error("PKG: Data size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadHeader(wxFile& pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
pkg_f.Seek(0);
|
||||
|
||||
if (pkg_f.Read(m_header, sizeof(PKGHeader)) != sizeof(PKGHeader)) {
|
||||
ConLog.Error("PKG: Package file is too short!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckHeader(pkg_f, m_header))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Decrypt(wxFile& pkg_f, wxFile& dec_pkg_f, PKGHeader* m_header)
|
||||
{
|
||||
if (!LoadHeader(pkg_f, m_header))
|
||||
return -1;
|
||||
|
||||
aes_context c;
|
||||
u8 iv[HASH_LEN];
|
||||
u8 buf[BUF_SIZE];
|
||||
u8 ctr[BUF_SIZE];
|
||||
|
||||
// Debug key
|
||||
u8 key[0x40];
|
||||
memset(key, 0, 0x40);
|
||||
memcpy(key+0x00, &m_header->qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x08, &m_header->qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x10, &m_header->qa_digest[8], 8); // &data[0x68]
|
||||
memcpy(key+0x18, &m_header->qa_digest[8], 8); // &data[0x68]
|
||||
|
||||
pkg_f.Seek(m_header->data_offset);
|
||||
u32 parts = (m_header->data_size + BUF_SIZE - 1) / BUF_SIZE;
|
||||
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, decrypting...", parts, 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
memcpy(iv, m_header->klicensee, sizeof(iv));
|
||||
aes_setkey_enc(&c, PKG_AES_KEY, 128);
|
||||
|
||||
for (u32 i=0; i<parts; i++)
|
||||
{
|
||||
memset(buf, 0, sizeof(buf));
|
||||
u32 length = pkg_f.Read(buf, BUF_SIZE);
|
||||
u32 bits = (length + HASH_LEN - 1) / HASH_LEN;
|
||||
|
||||
if (m_header->pkg_type == PKG_RELEASE_TYPE_DEBUG)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
u8 hash[0x14];
|
||||
sha1(key, 0x40, hash);
|
||||
*(u64*)&buf[j*HASH_LEN + 0] ^= *(u64*)&hash[0];
|
||||
*(u64*)&buf[j*HASH_LEN + 8] ^= *(u64*)&hash[8];
|
||||
*(be_t<u64>*)&key[0x38] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_header->pkg_type == PKG_RELEASE_TYPE_RELEASE)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
aes_crypt_ecb(&c, AES_ENCRYPT, iv, ctr+j*HASH_LEN);
|
||||
|
||||
be_t<u64> hi = *(be_t<u64>*)&iv[0];
|
||||
be_t<u64> lo = *(be_t<u64>*)&iv[8] + 1;
|
||||
|
||||
if (lo == 0)
|
||||
hi += 1;
|
||||
|
||||
*(be_t<u64>*)&iv[0] = hi;
|
||||
*(be_t<u64>*)&iv[8] = lo;
|
||||
}
|
||||
|
||||
for (u32 j=0; j<length; j++) {
|
||||
buf[j] ^= ctr[j];
|
||||
}
|
||||
}
|
||||
dec_pkg_f.Write(buf, length);
|
||||
pdlg.Update(i);
|
||||
}
|
||||
pdlg.Update(parts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Unpacking.
|
||||
bool LoadEntries(wxFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries)
|
||||
{
|
||||
dec_pkg_f.Seek(0);
|
||||
dec_pkg_f.Read(m_entries, sizeof(PKGEntry) * m_header->file_count);
|
||||
|
||||
if (m_entries->name_offset / sizeof(PKGEntry) != m_header->file_count) {
|
||||
ConLog.Error("PKG: Entries are damaged!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UnpackEntry(wxFile& dec_pkg_f, const PKGEntry& entry, std::string dir)
|
||||
{
|
||||
u8 buf[BUF_SIZE];
|
||||
|
||||
dec_pkg_f.Seek(entry.name_offset);
|
||||
dec_pkg_f.Read(buf, entry.name_size);
|
||||
buf[entry.name_size] = 0;
|
||||
|
||||
switch (entry.type & (0xff))
|
||||
{
|
||||
case PKG_FILE_ENTRY_NPDRM:
|
||||
case PKG_FILE_ENTRY_NPDRMEDAT:
|
||||
case PKG_FILE_ENTRY_SDAT:
|
||||
case PKG_FILE_ENTRY_REGULAR:
|
||||
{
|
||||
wxFile out;
|
||||
out.Create(dir + buf);
|
||||
dec_pkg_f.Seek(entry.file_offset);
|
||||
|
||||
for (u64 size = 0; size < entry.file_size; ) {
|
||||
size += dec_pkg_f.Read(buf, BUF_SIZE);
|
||||
if (size > entry.file_size)
|
||||
out.Write(buf, BUF_SIZE - (size - entry.file_size));
|
||||
else
|
||||
out.Write(buf, BUF_SIZE);
|
||||
}
|
||||
out.Close();
|
||||
}
|
||||
break;
|
||||
|
||||
case PKG_FILE_ENTRY_FOLDER:
|
||||
wxMkdir(dir + buf);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int Unpack(wxFile& pkg_f, std::string src, std::string dst)
|
||||
{
|
||||
PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader));
|
||||
|
||||
wxFile dec_pkg_f;
|
||||
std::string decryptedFile = wxGetCwd() + "/dev_hdd1/" + src + ".dec";
|
||||
|
||||
dec_pkg_f.Create(decryptedFile, true);
|
||||
|
||||
if (Decrypt(pkg_f, dec_pkg_f, m_header) < 0)
|
||||
return -1;
|
||||
|
||||
dec_pkg_f.Close();
|
||||
|
||||
wxFile n_dec_pkg_f(decryptedFile, wxFile::read);
|
||||
|
||||
std::vector<PKGEntry> m_entries;
|
||||
m_entries.resize(m_header->file_count);
|
||||
|
||||
PKGEntry *m_entries_ptr = &m_entries[0];
|
||||
if (!LoadEntries(n_dec_pkg_f, m_header, m_entries_ptr))
|
||||
return -1;
|
||||
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, unpacking...", m_entries.size(), 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
for (const PKGEntry& entry : m_entries)
|
||||
{
|
||||
UnpackEntry(n_dec_pkg_f, entry, dst + src + "/");
|
||||
pdlg.Update(pdlg.GetValue() + 1);
|
||||
}
|
||||
pdlg.Update(m_entries.size());
|
||||
|
||||
n_dec_pkg_f.Close();
|
||||
wxRemoveFile(decryptedFile);
|
||||
|
||||
return 0;
|
||||
}
|
51
rpcs3/Crypto/unpkg.h
Normal file
51
rpcs3/Crypto/unpkg.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
#include "key_vault.h"
|
||||
|
||||
// Constants
|
||||
#define PKG_HEADER_SIZE 0xC0 //sizeof(pkg_header) + sizeof(pkg_unk_checksum)
|
||||
#define PKG_RELEASE_TYPE_RELEASE 0x8000
|
||||
#define PKG_RELEASE_TYPE_DEBUG 0x0000
|
||||
#define PKG_PLATFORM_TYPE_PS3 0x0001
|
||||
#define PKG_PLATFORM_TYPE_PSP 0x0002
|
||||
|
||||
#define PKG_FILE_ENTRY_NPDRM 0x0001
|
||||
#define PKG_FILE_ENTRY_NPDRMEDAT 0x0002
|
||||
#define PKG_FILE_ENTRY_REGULAR 0x0003
|
||||
#define PKG_FILE_ENTRY_FOLDER 0x0004
|
||||
#define PKG_FILE_ENTRY_SDAT 0x0009
|
||||
#define PKG_FILE_ENTRY_OVERWRITE 0x80000000
|
||||
|
||||
#define HASH_LEN 16
|
||||
#define BUF_SIZE 4096
|
||||
|
||||
// Structs
|
||||
struct PKGHeader
|
||||
{
|
||||
be_t<u32> pkg_magic; // Magic (0x7f504b47)
|
||||
be_t<u16> pkg_type; // Release type (Retail:0x8000, Debug:0x0000)
|
||||
be_t<u16> pkg_platform; // Platform type (PS3:0x0001, PSP:0x0002)
|
||||
be_t<u32> header_size; // Header size (0xc0)
|
||||
be_t<u32> unk1; // Some PKG version maybe?
|
||||
be_t<u32> meta_size; // Size of metadata (block after header & hashes)
|
||||
be_t<u32> file_count; // Number of files
|
||||
be_t<u64> pkg_size; // PKG size in bytes
|
||||
be_t<u64> data_offset; // Encrypted data offset
|
||||
be_t<u64> data_size; // Encrypted data size in bytes
|
||||
char title_id[48]; // Title ID
|
||||
u8 qa_digest[16]; // This should be the hash of "files + attribs"
|
||||
u8 klicensee[16]; // Nonce
|
||||
};
|
||||
|
||||
struct PKGEntry
|
||||
{
|
||||
be_t<u32> name_offset; // File name offset
|
||||
be_t<u32> name_size; // File name size
|
||||
be_t<u64> file_offset; // File offset
|
||||
be_t<u64> file_size; // File size
|
||||
be_t<u32> type; // File type
|
||||
be_t<u32> pad; // Padding (zeros)
|
||||
};
|
||||
|
||||
extern int Unpack(wxFile& dec_pkg_f, std::string src, std::string dst);
|
674
rpcs3/Crypto/unself.cpp
Normal file
674
rpcs3/Crypto/unself.cpp
Normal file
|
@ -0,0 +1,674 @@
|
|||
#include "stdafx.h"
|
||||
#include "unself.h"
|
||||
|
||||
SELFDecrypter::SELFDecrypter(vfsStream& s)
|
||||
: self_f(s), key_v()
|
||||
{
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
{
|
||||
// Read SCE header.
|
||||
self_f.Seek(0);
|
||||
sce_hdr.Load(self_f);
|
||||
|
||||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
ConLog.Error("SELF: Not a SELF file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read SELF header.
|
||||
self_hdr.Load(self_f);
|
||||
|
||||
// Read the APP INFO.
|
||||
self_f.Seek(self_hdr.se_appinfooff);
|
||||
app_info.Load(self_f);
|
||||
|
||||
// Read ELF header.
|
||||
self_f.Seek(self_hdr.se_elfoff);
|
||||
if (isElf32)
|
||||
elf32_hdr.Load(self_f);
|
||||
else
|
||||
elf64_hdr.Load(self_f);
|
||||
|
||||
// Read ELF program headers.
|
||||
if (isElf32)
|
||||
{
|
||||
phdr32_arr.Clear();
|
||||
if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
|
||||
{
|
||||
Elf32_Phdr* phdr = new Elf32_Phdr();
|
||||
phdr->Load(self_f);
|
||||
phdr32_arr.Move(phdr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
phdr64_arr.Clear();
|
||||
if(elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_phnum; ++i)
|
||||
{
|
||||
Elf64_Phdr* phdr = new Elf64_Phdr();
|
||||
phdr->Load(self_f);
|
||||
phdr64_arr.Move(phdr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Read section info.
|
||||
secinfo_arr.Clear();
|
||||
self_f.Seek(self_hdr.se_secinfoff);
|
||||
|
||||
for(u32 i = 0; i < ((isElf32) ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i)
|
||||
{
|
||||
SectionInfo* sinfo = new SectionInfo();
|
||||
sinfo->Load(self_f);
|
||||
secinfo_arr.Move(sinfo);
|
||||
}
|
||||
|
||||
// Read SCE version info.
|
||||
self_f.Seek(self_hdr.se_sceveroff);
|
||||
scev_info.Load(self_f);
|
||||
|
||||
// Read control info.
|
||||
ctrlinfo_arr.Clear();
|
||||
self_f.Seek(self_hdr.se_controloff);
|
||||
|
||||
u32 i = 0;
|
||||
while(i < self_hdr.se_controlsize)
|
||||
{
|
||||
ControlInfo* cinfo = new ControlInfo();
|
||||
cinfo->Load(self_f);
|
||||
ctrlinfo_arr.Move(cinfo);
|
||||
|
||||
i += cinfo->size;
|
||||
}
|
||||
|
||||
// Read ELF section headers.
|
||||
if (isElf32)
|
||||
{
|
||||
shdr32_arr.Clear();
|
||||
if(elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf32_hdr.e_shnum; ++i)
|
||||
{
|
||||
Elf32_Shdr* shdr = new Elf32_Shdr();
|
||||
shdr->Load(self_f);
|
||||
shdr32_arr.Move(shdr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shdr64_arr.Clear();
|
||||
if(elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
for(u32 i = 0; i < elf64_hdr.e_shnum; ++i)
|
||||
{
|
||||
Elf64_Shdr* shdr = new Elf64_Shdr();
|
||||
shdr->Load(self_f);
|
||||
shdr64_arr.Move(shdr);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
{
|
||||
ConLog.Write("SCE header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
sce_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("SELF header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
self_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("APP INFO");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
app_info.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
isElf32 ? elf32_hdr.Show() : elf64_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF program headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(int i = 0; i < ((isElf32) ? phdr32_arr.GetCount() : phdr64_arr.GetCount()); i++)
|
||||
isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Section info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(int i = 0; i < secinfo_arr.GetCount(); i++)
|
||||
secinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("SCE version info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
scev_info.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Control info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(int i = 0; i < ctrlinfo_arr.GetCount(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF section headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
for(int i = 0; i < ((isElf32) ? shdr32_arr.GetCount() : shdr64_arr.GetCount()); i++)
|
||||
isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
{
|
||||
aes_context aes;
|
||||
ControlInfo *ctrl = NULL;
|
||||
u8 npdrm_key[0x10];
|
||||
u8 npdrm_iv[0x10];
|
||||
|
||||
// Parse the control info structures to find the NPDRM control info.
|
||||
for(int i = 0; i < ctrlinfo_arr.GetCount(); i++)
|
||||
{
|
||||
if (ctrlinfo_arr[i].type == 3)
|
||||
{
|
||||
ctrl = &ctrlinfo_arr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we have a valid NPDRM control info structure.
|
||||
// If not, the data has no NPDRM layer.
|
||||
if (!ctrl)
|
||||
{
|
||||
ConLog.Warning("SELF: No NPDRM control info found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
u8 klicensee_key[0x10];
|
||||
memcpy(klicensee_key, key_v.GetKlicenseeKey(), 0x10);
|
||||
|
||||
// Use klicensee if available.
|
||||
if (klicensee_key != NULL)
|
||||
memcpy(npdrm_key, klicensee_key, 0x10);
|
||||
|
||||
if (ctrl->npdrm.license == 1) // Network license.
|
||||
{
|
||||
ConLog.Error("SELF: Can't decrypt network NPDRM!");
|
||||
return false;
|
||||
}
|
||||
else if (ctrl->npdrm.license == 2) // Local license.
|
||||
{
|
||||
// Try to find a RAP file to get the key.
|
||||
if (!GetKeyFromRap(ctrl->npdrm.content_id, npdrm_key))
|
||||
{
|
||||
ConLog.Error("SELF: Can't find RAP file for NPDRM decryption!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ctrl->npdrm.license == 3) // Free license.
|
||||
{
|
||||
// Use the NP_KLIC_FREE.
|
||||
memcpy(npdrm_key, NP_KLIC_FREE, 0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("SELF: Invalid NPDRM license type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decrypt our key with NP_KLIC_KEY.
|
||||
aes_setkey_dec(&aes, NP_KLIC_KEY, 128);
|
||||
aes_crypt_ecb(&aes, AES_DECRYPT, npdrm_key, npdrm_key);
|
||||
|
||||
// IV is empty.
|
||||
memset(npdrm_iv, 0, 0x10);
|
||||
|
||||
// Use our final key to decrypt the NPDRM layer.
|
||||
aes_setkey_dec(&aes, npdrm_key, 128);
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, metadata_size, npdrm_iv, metadata, metadata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadMetadata()
|
||||
{
|
||||
aes_context aes;
|
||||
u32 metadata_info_size = sizeof(meta_info);
|
||||
u8 *metadata_info = (u8 *)malloc(metadata_info_size);
|
||||
u32 metadata_headers_size = sce_hdr.se_hsize - (sizeof(sce_hdr) + sce_hdr.se_meta + sizeof(meta_info));
|
||||
u8 *metadata_headers = (u8 *)malloc(metadata_headers_size);
|
||||
|
||||
// Locate and read the encrypted metadata info.
|
||||
self_f.Seek(sce_hdr.se_meta + sizeof(sce_hdr));
|
||||
self_f.Read(metadata_info, metadata_info_size);
|
||||
|
||||
// Locate and read the encrypted metadata header and section header.
|
||||
self_f.Seek(sce_hdr.se_meta + sizeof(sce_hdr) + metadata_info_size);
|
||||
self_f.Read(metadata_headers, metadata_headers_size);
|
||||
|
||||
// Find the right keyset from the key vault.
|
||||
SELF_KEY keyset = key_v.FindSelfKey(app_info.self_type, sce_hdr.se_flags, app_info.version);
|
||||
|
||||
// Copy the necessary parameters.
|
||||
u8 metadata_key[0x20];
|
||||
u8 metadata_iv[0x10];
|
||||
memcpy(metadata_key, keyset.erk, 0x20);
|
||||
memcpy(metadata_iv, keyset.riv, 0x10);
|
||||
|
||||
// Check DEBUG flag.
|
||||
if ((sce_hdr.se_flags & 0x8000) != 0x8000)
|
||||
{
|
||||
// Decrypt the NPDRM layer.
|
||||
if (!DecryptNPDRM(metadata_info, metadata_info_size))
|
||||
return false;
|
||||
|
||||
// Decrypt the metadata info.
|
||||
aes_setkey_dec(&aes, metadata_key, 256); // AES-256
|
||||
aes_crypt_cbc(&aes, AES_DECRYPT, metadata_info_size, metadata_iv, metadata_info, metadata_info);
|
||||
}
|
||||
|
||||
// Load the metadata info.
|
||||
meta_info.Load(metadata_info);
|
||||
|
||||
// If the padding is not NULL for the key or iv fields, the metadata info
|
||||
// is not properly decrypted.
|
||||
if ((meta_info.key_pad[0] != 0x00) ||
|
||||
(meta_info.iv_pad[0] != 0x00))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to decrypt metadata info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform AES-CTR encryption on the metadata headers.
|
||||
size_t ctr_nc_off = 0;
|
||||
u8 ctr_stream_block[0x10];
|
||||
aes_setkey_enc(&aes, meta_info.key, 128);
|
||||
aes_crypt_ctr(&aes, metadata_headers_size, &ctr_nc_off, meta_info.iv, ctr_stream_block, metadata_headers, metadata_headers);
|
||||
|
||||
// Load the metadata header.
|
||||
meta_hdr.Load(metadata_headers);
|
||||
|
||||
// Load the metadata section headers.
|
||||
meta_shdr.Clear();
|
||||
for (int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
MetadataSectionHeader* m_shdr = new MetadataSectionHeader();
|
||||
m_shdr->Load(metadata_headers + sizeof(meta_hdr) + sizeof(MetadataSectionHeader) * i);
|
||||
meta_shdr.Move(m_shdr);
|
||||
}
|
||||
|
||||
// Copy the decrypted data keys.
|
||||
data_keys_length = meta_hdr.key_count * 0x10;
|
||||
data_keys = (u8 *) malloc (data_keys_length);
|
||||
memcpy(data_keys, metadata_headers + sizeof(meta_hdr) + meta_hdr.section_count * sizeof(MetadataSectionHeader), data_keys_length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptData()
|
||||
{
|
||||
aes_context aes;
|
||||
|
||||
// Calculate the total data size.
|
||||
for (int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
if ((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
data_buf_length += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a buffer to store decrypted data.
|
||||
data_buf = (u8*)malloc(data_buf_length);
|
||||
|
||||
// Set initial offset.
|
||||
u32 data_buf_offset = 0;
|
||||
|
||||
// Parse the metadata section headers to find the offsets of encrypted data.
|
||||
for (int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
size_t ctr_nc_off = 0;
|
||||
u8 ctr_stream_block[0x10];
|
||||
u8 data_key[0x10];
|
||||
u8 data_iv[0x10];
|
||||
|
||||
// Check if this is an encrypted section.
|
||||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
// Make sure the key and iv are not out of boundaries.
|
||||
if((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
{
|
||||
// Get the key and iv from the previously stored key buffer.
|
||||
memcpy(data_key, data_keys + meta_shdr[i].key_idx * 0x10, 0x10);
|
||||
memcpy(data_iv, data_keys + meta_shdr[i].iv_idx * 0x10, 0x10);
|
||||
|
||||
// Allocate a buffer to hold the data.
|
||||
u8 *buf = (u8 *)malloc(meta_shdr[i].data_size);
|
||||
|
||||
// Seek to the section data offset and read the encrypted data.
|
||||
self_f.Seek(meta_shdr[i].data_offset);
|
||||
self_f.Read(buf, meta_shdr[i].data_size);
|
||||
|
||||
// Perform AES-CTR encryption on the data blocks.
|
||||
aes_setkey_enc(&aes, data_key, 128);
|
||||
aes_crypt_ctr(&aes, meta_shdr[i].data_size, &ctr_nc_off, data_iv, ctr_stream_block, buf, buf);
|
||||
|
||||
// Copy the decrypted data.
|
||||
memcpy(data_buf + data_buf_offset, buf, meta_shdr[i].data_size);
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
|
||||
// Release the temporary buffer.
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
|
||||
{
|
||||
// Create a new ELF file.
|
||||
wxFile e(elf.c_str(), wxFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", wxString(elf).wx_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set initial offset.
|
||||
u32 data_buf_offset = 0;
|
||||
|
||||
if (isElf32)
|
||||
{
|
||||
// Write ELF header.
|
||||
WriteEhdr(e, elf32_hdr);
|
||||
|
||||
// Write program headers.
|
||||
for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
|
||||
WritePhdr(e, phdr32_arr[i]);
|
||||
|
||||
for (int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
// PHDR type.
|
||||
if (meta_shdr[i].type == 2)
|
||||
{
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr32_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Write section headers.
|
||||
if(self_hdr.se_shdroff != NULL)
|
||||
{
|
||||
e.Seek(elf32_hdr.e_shoff);
|
||||
|
||||
for(u32 i = 0; i < elf32_hdr.e_shnum; ++i)
|
||||
WriteShdr(e, shdr32_arr[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Write ELF header.
|
||||
WriteEhdr(e, elf64_hdr);
|
||||
|
||||
// Write program headers.
|
||||
for(u32 i = 0; i < elf64_hdr.e_phnum; ++i)
|
||||
WritePhdr(e, phdr64_arr[i]);
|
||||
|
||||
// Write data.
|
||||
for (int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
// PHDR type.
|
||||
if (meta_shdr[i].type == 2)
|
||||
{
|
||||
// Decompress if necessary.
|
||||
if (meta_shdr[i].compressed == 2)
|
||||
{
|
||||
// Allocate a buffer for decompression.
|
||||
u8 *decomp_buf = (u8 *)malloc(phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Set up memory streams for input/output.
|
||||
wxMemoryInputStream decomp_stream_in(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
wxMemoryOutputStream decomp_stream_out;
|
||||
|
||||
// Create a Zlib stream, read the data and flush the stream.
|
||||
wxZlibInputStream* z_stream = new wxZlibInputStream(decomp_stream_in);
|
||||
z_stream->Read(decomp_stream_out);
|
||||
delete z_stream;
|
||||
|
||||
// Copy the decompressed result from the stream.
|
||||
decomp_stream_out.CopyTo(decomp_buf, phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr64_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(decomp_buf, phdr64_arr[meta_shdr[i].program_idx].p_filesz);
|
||||
|
||||
// Release the decompression buffer.
|
||||
free(decomp_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Seek to the program header data offset and write the data.
|
||||
e.Seek(phdr64_arr[meta_shdr[i].program_idx].p_offset);
|
||||
e.Write(data_buf + data_buf_offset, meta_shdr[i].data_size);
|
||||
}
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += meta_shdr[i].data_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Write section headers.
|
||||
if(self_hdr.se_shdroff != NULL)
|
||||
{
|
||||
e.Seek(elf64_hdr.e_shoff);
|
||||
|
||||
for(u32 i = 0; i < elf64_hdr.e_shnum; ++i)
|
||||
WriteShdr(e, shdr64_arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
e.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
||||
{
|
||||
// Set empty RAP key.
|
||||
u8 rap_key[0x10];
|
||||
memset(rap_key, 0, 0x10);
|
||||
|
||||
// Try to find a matching RAP file under dev_usb000.
|
||||
wxString ci_str(content_id);
|
||||
wxString rap_path(wxGetCwd() + "/dev_usb000/" + ci_str + ".rap");
|
||||
|
||||
// Check if we have a valid RAP file.
|
||||
if (!wxFile::Exists(rap_path))
|
||||
{
|
||||
ConLog.Error("This application requires a valid RAP file for decryption!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open the RAP file and read the key.
|
||||
wxFile rap_file(rap_path, wxFile::read);
|
||||
|
||||
if (!rap_file.IsOpened())
|
||||
{
|
||||
ConLog.Error("Failed to load RAP file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ConLog.Write("Loading RAP file %s", ci_str + ".rap");
|
||||
rap_file.Read(rap_key, 0x10);
|
||||
rap_file.Close();
|
||||
|
||||
// Call the key vault to convert the RAP key.
|
||||
key_v.RapToRif(rap_key, npdrm_key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSelf(const std::string& path)
|
||||
{
|
||||
vfsLocalFile f(nullptr);
|
||||
|
||||
if(!f.Open(path))
|
||||
return false;
|
||||
|
||||
SceHeader hdr;
|
||||
hdr.Load(f);
|
||||
|
||||
return hdr.CheckMagic();
|
||||
}
|
||||
|
||||
bool IsSelfElf32(const std::string& path)
|
||||
{
|
||||
vfsLocalFile f(nullptr);
|
||||
|
||||
if(!f.Open(path))
|
||||
return false;
|
||||
|
||||
SceHeader hdr;
|
||||
SelfHeader sh;
|
||||
hdr.Load(f);
|
||||
sh.Load(f);
|
||||
|
||||
// Locate the class byte and check it.
|
||||
u8 elf_class[0x8];
|
||||
f.Seek(sh.se_elfoff);
|
||||
f.Read(elf_class, 0x8);
|
||||
|
||||
return (elf_class[4] == 1);
|
||||
}
|
||||
|
||||
bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
||||
{
|
||||
// Open the SELF file.
|
||||
wxFile s(self.c_str());
|
||||
|
||||
if(!s.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not open SELF file! (%s)", wxString(self).wx_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the key version.
|
||||
s.Seek(0x08);
|
||||
u16 key_version;
|
||||
s.Read(&key_version, sizeof(key_version));
|
||||
|
||||
// Check for DEBUG version.
|
||||
if(swap16(key_version) == 0x8000)
|
||||
{
|
||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
||||
|
||||
// Get the real elf offset.
|
||||
s.Seek(0x10);
|
||||
u64 elf_offset;
|
||||
s.Read(&elf_offset, sizeof(elf_offset));
|
||||
|
||||
// Start at the real elf offset.
|
||||
elf_offset = swap64(elf_offset);
|
||||
s.Seek(elf_offset);
|
||||
|
||||
// Write the real ELF file back.
|
||||
wxFile e(elf.c_str(), wxFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", wxString(elf).wx_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the data.
|
||||
char buf[2048];
|
||||
while (ssize_t size = s.Read(buf, 2048))
|
||||
e.Write(buf, size);
|
||||
|
||||
e.Close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Leave the file untouched.
|
||||
s.Seek(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
s.Close();
|
||||
}
|
||||
|
||||
bool DecryptSelf(const std::string& elf, const std::string& self)
|
||||
{
|
||||
// Check for a debug SELF first.
|
||||
if (!CheckDebugSelf(self, elf))
|
||||
{
|
||||
// Set a virtual pointer to the SELF file.
|
||||
vfsLocalFile self_vf(nullptr);
|
||||
|
||||
if (!self_vf.Open(self))
|
||||
return false;
|
||||
|
||||
// Check the ELF file class (32 or 64 bit).
|
||||
bool isElf32 = IsSelfElf32(self);
|
||||
|
||||
// Start the decrypter on this SELF file.
|
||||
SELFDecrypter self_dec(self_vf);
|
||||
|
||||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to load SELF file headers!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata())
|
||||
{
|
||||
ConLog.Error("SELF: Failed to load SELF file metadata!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decrypt the SELF file data.
|
||||
if (!self_dec.DecryptData())
|
||||
{
|
||||
ConLog.Error("SELF: Failed to decrypt SELF file data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make a new ELF file from this SELF.
|
||||
if (!self_dec.MakeElf(elf, isElf32))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to make ELF file from SELF!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
508
rpcs3/Crypto/unself.h
Normal file
508
rpcs3/Crypto/unself.h
Normal file
|
@ -0,0 +1,508 @@
|
|||
#pragma once
|
||||
#include "aes.h"
|
||||
#include "sha1.h"
|
||||
#include "key_vault.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Loader/SELF.h"
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
struct AppInfo
|
||||
{
|
||||
u64 authid;
|
||||
u32 vendor_id;
|
||||
u32 self_type;
|
||||
u64 version;
|
||||
u64 padding;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
authid = Read64(f);
|
||||
vendor_id = Read32(f);
|
||||
self_type = Read32(f);
|
||||
version = Read64(f);
|
||||
padding = Read64(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("AuthID: 0x%llx", authid);
|
||||
ConLog.Write("VendorID: 0x%08x", vendor_id);
|
||||
ConLog.Write("SELF type: 0x%08x", self_type);
|
||||
ConLog.Write("Version: 0x%llx", version);
|
||||
}
|
||||
};
|
||||
|
||||
struct SectionInfo
|
||||
{
|
||||
u64 offset;
|
||||
u64 size;
|
||||
u32 compressed;
|
||||
u32 unknown1;
|
||||
u32 unknown2;
|
||||
u32 encrypted;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
offset = Read64(f);
|
||||
size = Read64(f);
|
||||
compressed = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read32(f);
|
||||
encrypted = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Offset: 0x%llx", offset);
|
||||
ConLog.Write("Size: 0x%llx", size);
|
||||
ConLog.Write("Compressed: 0x%08x", compressed);
|
||||
ConLog.Write("Unknown1: 0x%08x", unknown1);
|
||||
ConLog.Write("Unknown2: 0x%08x", unknown2);
|
||||
ConLog.Write("Encrypted: 0x%08x", encrypted);
|
||||
}
|
||||
};
|
||||
|
||||
struct SCEVersionInfo
|
||||
{
|
||||
u32 subheader_type;
|
||||
u32 present;
|
||||
u32 size;
|
||||
u32 unknown;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Sub-header type: 0x%08x", subheader_type);
|
||||
ConLog.Write("Present: 0x%08x", present);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
ConLog.Write("Unknown: 0x%08x", unknown);
|
||||
}
|
||||
};
|
||||
|
||||
struct ControlInfo
|
||||
{
|
||||
u32 type;
|
||||
u32 size;
|
||||
u64 next;
|
||||
|
||||
union {
|
||||
// type 1 0x30 bytes
|
||||
struct {
|
||||
u32 ctrl_flag1;
|
||||
u32 unknown1;
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
u32 unknown6;
|
||||
u32 unknown7;
|
||||
} control_flags;
|
||||
|
||||
// type 2 0x30 bytes
|
||||
struct {
|
||||
u8 digest[20];
|
||||
u64 unknown;
|
||||
} file_digest_30;
|
||||
|
||||
// type 2 0x40 bytes
|
||||
struct {
|
||||
u8 digest1[20];
|
||||
u8 digest2[20];
|
||||
u64 unknown;
|
||||
} file_digest_40;
|
||||
|
||||
// type 3 0x90 bytes
|
||||
struct {
|
||||
u32 magic;
|
||||
u32 unknown1;
|
||||
u32 license;
|
||||
u32 type;
|
||||
u8 content_id[48];
|
||||
u8 digest[16];
|
||||
u8 invdigest[16];
|
||||
u8 xordigest[16];
|
||||
u64 unknown2;
|
||||
u64 unknown3;
|
||||
} npdrm;
|
||||
};
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
next = Read64(f);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
control_flags.ctrl_flag1 = Read32(f);
|
||||
control_flags.unknown1 = Read32(f);
|
||||
control_flags.unknown2 = Read32(f);
|
||||
control_flags.unknown3 = Read32(f);
|
||||
control_flags.unknown4 = Read32(f);
|
||||
control_flags.unknown5 = Read32(f);
|
||||
control_flags.unknown6 = Read32(f);
|
||||
control_flags.unknown7 = Read32(f);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
f.Read(file_digest_30.digest, 20);
|
||||
file_digest_30.unknown = Read64(f);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
f.Read(file_digest_40.digest1, 20);
|
||||
f.Read(file_digest_40.digest2, 20);
|
||||
file_digest_40.unknown = Read64(f);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
npdrm.magic = Read32(f);
|
||||
npdrm.unknown1 = Read32(f);
|
||||
npdrm.license = Read32(f);
|
||||
npdrm.type = Read32(f);
|
||||
f.Read(npdrm.content_id, 48);
|
||||
f.Read(npdrm.digest, 16);
|
||||
f.Read(npdrm.invdigest, 16);
|
||||
f.Read(npdrm.xordigest, 16);
|
||||
npdrm.unknown2 = Read64(f);
|
||||
npdrm.unknown3 = Read64(f);
|
||||
}
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
ConLog.Write("Size: 0x%08x", size);
|
||||
ConLog.Write("Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
ConLog.Write("Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
ConLog.Write("Unknown1: 0x%08x", control_flags.unknown1);
|
||||
ConLog.Write("Unknown2: 0x%08x", control_flags.unknown2);
|
||||
ConLog.Write("Unknown3: 0x%08x", control_flags.unknown3);
|
||||
ConLog.Write("Unknown4: 0x%08x", control_flags.unknown4);
|
||||
ConLog.Write("Unknown5: 0x%08x", control_flags.unknown5);
|
||||
ConLog.Write("Unknown6: 0x%08x", control_flags.unknown6);
|
||||
ConLog.Write("Unknown7: 0x%08x", control_flags.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
wxString digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += wxString::Format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
ConLog.Write("Digest: %s", digest_str);
|
||||
ConLog.Write("Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
wxString digest_str1;
|
||||
wxString digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += wxString::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += wxString::Format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Digest1: %s", digest_str1);
|
||||
ConLog.Write("Digest2: %s", digest_str2);
|
||||
ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
wxString contentid_str;
|
||||
wxString digest_str;
|
||||
wxString invdigest_str;
|
||||
wxString xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += wxString::Format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
digest_str += wxString::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += wxString::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += wxString::Format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Magic: 0x%08x", npdrm.magic);
|
||||
ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1);
|
||||
ConLog.Write("License: 0x%08x", npdrm.license);
|
||||
ConLog.Write("Type: 0x%08x", npdrm.type);
|
||||
ConLog.Write("ContentID: %s", contentid_str);
|
||||
ConLog.Write("Digest: %s", digest_str);
|
||||
ConLog.Write("Inverse digest: %s", invdigest_str);
|
||||
ConLog.Write("XOR digest: %s", xordigest_str);
|
||||
ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2);
|
||||
ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct MetadataInfo
|
||||
{
|
||||
u8 key[0x10];
|
||||
u8 key_pad[0x10];
|
||||
u8 iv[0x10];
|
||||
u8 iv_pad[0x10];
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(key, in, 0x10);
|
||||
memcpy(key_pad, in + 0x10, 0x10);
|
||||
memcpy(iv, in + 0x20, 0x10);
|
||||
memcpy(iv_pad, in + 0x30, 0x10);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
wxString key_str;
|
||||
wxString key_pad_str;
|
||||
wxString iv_str;
|
||||
wxString iv_pad_str;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
key_str += wxString::Format("%02x", key[i]);
|
||||
key_pad_str += wxString::Format("%02x", key_pad[i]);
|
||||
iv_str += wxString::Format("%02x", iv[i]);
|
||||
iv_pad_str += wxString::Format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Key: %s", key_str);
|
||||
ConLog.Write("Key pad: %s", key_pad_str);
|
||||
ConLog.Write("IV: %s", iv_str);
|
||||
ConLog.Write("IV pad: %s", iv_pad_str);
|
||||
}
|
||||
};
|
||||
|
||||
struct MetadataHeader
|
||||
{
|
||||
u64 signature_input_length;
|
||||
u32 unknown1;
|
||||
u32 section_count;
|
||||
u32 key_count;
|
||||
u32 opt_header_size;
|
||||
u32 unknown2;
|
||||
u32 unknown3;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&signature_input_length, in, 8);
|
||||
memcpy(&unknown1, in + 8, 4);
|
||||
memcpy(§ion_count, in + 12, 4);
|
||||
memcpy(&key_count, in + 16, 4);
|
||||
memcpy(&opt_header_size, in + 20, 4);
|
||||
memcpy(&unknown2, in + 24, 4);
|
||||
memcpy(&unknown3, in + 28, 4);
|
||||
|
||||
// Endian swap.
|
||||
signature_input_length = swap64(signature_input_length);
|
||||
unknown1 = swap32(unknown1);
|
||||
section_count = swap32(section_count);
|
||||
key_count = swap32(key_count);
|
||||
opt_header_size = swap32(opt_header_size);
|
||||
unknown2 = swap32(unknown2);
|
||||
unknown3 = swap32(unknown3);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Signature input length: 0x%llx", signature_input_length);
|
||||
ConLog.Write("Unknown1: 0x%08x", unknown1);
|
||||
ConLog.Write("Section count: 0x%08x", section_count);
|
||||
ConLog.Write("Key count: 0x%08x", key_count);
|
||||
ConLog.Write("Optional header size: 0x%08x", opt_header_size);
|
||||
ConLog.Write("Unknown2: 0x%08x", unknown2);
|
||||
ConLog.Write("Unknown3: 0x%08x", unknown3);
|
||||
}
|
||||
};
|
||||
|
||||
struct MetadataSectionHeader
|
||||
{
|
||||
u64 data_offset;
|
||||
u64 data_size;
|
||||
u32 type;
|
||||
u32 program_idx;
|
||||
u32 hashed;
|
||||
u32 sha1_idx;
|
||||
u32 encrypted;
|
||||
u32 key_idx;
|
||||
u32 iv_idx;
|
||||
u32 compressed;
|
||||
|
||||
void Load(u8* in)
|
||||
{
|
||||
memcpy(&data_offset, in, 8);
|
||||
memcpy(&data_size, in + 8, 8);
|
||||
memcpy(&type, in + 16, 4);
|
||||
memcpy(&program_idx, in + 20, 4);
|
||||
memcpy(&hashed, in + 24, 4);
|
||||
memcpy(&sha1_idx, in + 28, 4);
|
||||
memcpy(&encrypted, in + 32, 4);
|
||||
memcpy(&key_idx, in + 36, 4);
|
||||
memcpy(&iv_idx, in + 40, 4);
|
||||
memcpy(&compressed, in + 44, 4);
|
||||
|
||||
// Endian swap.
|
||||
data_offset = swap64(data_offset);
|
||||
data_size = swap64(data_size);
|
||||
type = swap32(type);
|
||||
program_idx = swap32(program_idx);
|
||||
hashed = swap32(hashed);
|
||||
sha1_idx = swap32(sha1_idx);
|
||||
encrypted = swap32(encrypted);
|
||||
key_idx = swap32(key_idx);
|
||||
iv_idx = swap32(iv_idx);
|
||||
compressed = swap32(compressed);
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ConLog.Write("Data offset: 0x%llx", data_offset);
|
||||
ConLog.Write("Data size: 0x%llx", data_size);
|
||||
ConLog.Write("Type: 0x%08x", type);
|
||||
ConLog.Write("Program index: 0x%08x", program_idx);
|
||||
ConLog.Write("Hashed: 0x%08x", hashed);
|
||||
ConLog.Write("SHA1 index: 0x%08x", sha1_idx);
|
||||
ConLog.Write("Encrypted: 0x%08x", encrypted);
|
||||
ConLog.Write("Key index: 0x%08x", key_idx);
|
||||
ConLog.Write("IV index: 0x%08x", iv_idx);
|
||||
ConLog.Write("Compressed: 0x%08x", compressed);
|
||||
}
|
||||
};
|
||||
|
||||
struct SectionHash {
|
||||
u8 sha1[20];
|
||||
u8 padding[12];
|
||||
u8 hmac_key[64];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(sha1, 20);
|
||||
f.Read(padding, 12);
|
||||
f.Read(hmac_key, 64);
|
||||
}
|
||||
};
|
||||
|
||||
struct CapabilitiesInfo
|
||||
{
|
||||
u32 type;
|
||||
u32 capabilities_size;
|
||||
u32 next;
|
||||
u32 unknown1;
|
||||
u64 unknown2;
|
||||
u64 unknown3;
|
||||
u64 flags;
|
||||
u32 unknown4;
|
||||
u32 unknown5;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
capabilities_size = Read32(f);
|
||||
next = Read32(f);
|
||||
unknown1 = Read32(f);
|
||||
unknown2 = Read64(f);
|
||||
unknown3 = Read64(f);
|
||||
flags = Read64(f);
|
||||
unknown4 = Read32(f);
|
||||
unknown5 = Read32(f);
|
||||
}
|
||||
};
|
||||
|
||||
struct Signature
|
||||
{
|
||||
u8 r[21];
|
||||
u8 s[21];
|
||||
u8 padding[6];
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
f.Read(r, 21);
|
||||
f.Read(s, 21);
|
||||
f.Read(padding, 6);
|
||||
}
|
||||
};
|
||||
|
||||
struct SelfSection
|
||||
{
|
||||
u8 *data;
|
||||
u64 size;
|
||||
u64 offset;
|
||||
|
||||
void Load(vfsStream& f)
|
||||
{
|
||||
*data = Read32(f);
|
||||
size = Read64(f);
|
||||
offset = Read64(f);
|
||||
}
|
||||
};
|
||||
|
||||
class SELFDecrypter
|
||||
{
|
||||
// Main SELF file stream.
|
||||
vfsStream& self_f;
|
||||
|
||||
// SCE, SELF and APP headers.
|
||||
SceHeader sce_hdr;
|
||||
SelfHeader self_hdr;
|
||||
AppInfo app_info;
|
||||
|
||||
// ELF64 header and program header/section header arrays.
|
||||
Elf64_Ehdr elf64_hdr;
|
||||
Array<Elf64_Shdr> shdr64_arr;
|
||||
Array<Elf64_Phdr> phdr64_arr;
|
||||
|
||||
// ELF32 header and program header/section header arrays.
|
||||
Elf32_Ehdr elf32_hdr;
|
||||
Array<Elf32_Shdr> shdr32_arr;
|
||||
Array<Elf32_Phdr> phdr32_arr;
|
||||
|
||||
// Decryption info structs.
|
||||
Array<SectionInfo> secinfo_arr;
|
||||
SCEVersionInfo scev_info;
|
||||
Array<ControlInfo> ctrlinfo_arr;
|
||||
|
||||
// Metadata structs.
|
||||
MetadataInfo meta_info;
|
||||
MetadataHeader meta_hdr;
|
||||
Array<MetadataSectionHeader> meta_shdr;
|
||||
|
||||
// Internal data buffers.
|
||||
u8 *data_keys;
|
||||
u32 data_keys_length;
|
||||
u8 *data_buf;
|
||||
u32 data_buf_length;
|
||||
|
||||
// Main key vault instance.
|
||||
KeyVault key_v;
|
||||
|
||||
public:
|
||||
SELFDecrypter(vfsStream& s);
|
||||
bool MakeElf(const std::string& elf, bool isElf32);
|
||||
bool LoadHeaders(bool isElf32);
|
||||
void ShowHeaders(bool isElf32);
|
||||
bool LoadMetadata();
|
||||
bool DecryptData();
|
||||
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
|
||||
bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
|
||||
};
|
||||
|
||||
extern bool IsSelf(const std::string& path);
|
||||
extern bool IsSelfElf32(const std::string& path);
|
||||
extern bool CheckDebugSelf(const std::string& self, const std::string& elf);
|
||||
extern bool DecryptSelf(const std::string& elf, const std::string& self);
|
71
rpcs3/Crypto/utils.cpp
Normal file
71
rpcs3/Crypto/utils.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Endian swap auxiliary functions.
|
||||
u16 swap16(u16 i)
|
||||
{
|
||||
return ((i & 0xFF00) >> 8) | ((i & 0xFF) << 8);
|
||||
}
|
||||
|
||||
u32 swap32(u32 i)
|
||||
{
|
||||
return ((i & 0xFF000000) >> 24) | ((i & 0xFF0000) >> 8) | ((i & 0xFF00) << 8) | ((i & 0xFF) << 24);
|
||||
}
|
||||
|
||||
u64 swap64(u64 i)
|
||||
{
|
||||
return ((i & 0x00000000000000ff) << 56) | ((i & 0x000000000000ff00) << 40) |
|
||||
((i & 0x0000000000ff0000) << 24) | ((i & 0x00000000ff000000) << 8) |
|
||||
((i & 0x000000ff00000000) >> 8) | ((i & 0x0000ff0000000000) >> 24) |
|
||||
((i & 0x00ff000000000000) >> 40) | ((i & 0xff00000000000000) >> 56);
|
||||
}
|
||||
|
||||
// Hex string conversion auxiliary functions.
|
||||
u64 hex_to_u64(const char* hex_str)
|
||||
{
|
||||
u32 length = strlen(hex_str);
|
||||
u64 tmp = 0;
|
||||
u64 result = 0;
|
||||
char c;
|
||||
|
||||
while (length--)
|
||||
{
|
||||
c = *hex_str++;
|
||||
if((c >= '0') && (c <= '9'))
|
||||
tmp = c - '0';
|
||||
else if((c >= 'a') && (c <= 'f'))
|
||||
tmp = c - 'a' + 10;
|
||||
else if((c >= 'A') && (c <= 'F'))
|
||||
tmp = c - 'A' + 10;
|
||||
else
|
||||
tmp = 0;
|
||||
result |= (tmp << (length * 4));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str)
|
||||
{
|
||||
u32 str_length = strlen(hex_str);
|
||||
u32 data_length = str_length / 2;
|
||||
char tmp_buf[3] = {0, 0, 0};
|
||||
|
||||
// Don't convert if the string length is odd.
|
||||
if (!(str_length % 2))
|
||||
{
|
||||
u8 *out = (u8 *) malloc (str_length * sizeof(u8));
|
||||
u8 *pos = out;
|
||||
|
||||
while (str_length--)
|
||||
{
|
||||
tmp_buf[0] = *hex_str++;
|
||||
tmp_buf[1] = *hex_str++;
|
||||
|
||||
*pos++ = (u8)(hex_to_u64(tmp_buf) & 0xFF);
|
||||
}
|
||||
|
||||
// Copy back to our array.
|
||||
memcpy(data, out, data_length);
|
||||
}
|
||||
}
|
7
rpcs3/Crypto/utils.h
Normal file
7
rpcs3/Crypto/utils.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
u16 swap16(u16 i);
|
||||
u32 swap32(u32 i);
|
||||
u64 swap64(u64 i);
|
||||
u64 hex_to_u64(const char* hex_str);
|
||||
void hex_to_bytes(unsigned char *data, const char *hex_str);
|
|
@ -294,5 +294,6 @@ void sys_fs_init()
|
|||
sys_fs.AddFunc(0xdb869f20, cellFsAioInit);
|
||||
sys_fs.AddFunc(0x9f951810, cellFsAioFinish);
|
||||
sys_fs.AddFunc(0x1a108ab7, cellFsGetBlockSize);
|
||||
sys_fs.AddFunc(0xaa3b4bcd, cellFsGetFreeSize);
|
||||
aio_init = false;
|
||||
}
|
||||
|
|
|
@ -261,6 +261,7 @@ extern int cellFsFtruncate(u32 fd, u64 size);
|
|||
extern int cellFsTruncate(u32 path_addr, u64 size);
|
||||
extern int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size);
|
||||
extern int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size);
|
||||
extern int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count);
|
||||
|
||||
//cellVideo
|
||||
extern int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr);
|
||||
|
|
|
@ -465,3 +465,22 @@ int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
|||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
||||
{
|
||||
const wxString& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
|
||||
ps3_path.wx_str(), block_size.GetAddr(), block_count.GetAddr());
|
||||
|
||||
if (Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
if (ps3_path.empty())
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
|
||||
block_size = 4096; // ?
|
||||
block_count = 10485760; // ?
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
#include "Emu/Cell/SPUThread.h"
|
||||
#include "Emu/Cell/PPUInstrTable.h"
|
||||
|
||||
#include "scetool/scetool.h"
|
||||
|
||||
#include "Loader/SELF.h"
|
||||
#include "../Crypto/unself.h"
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
using namespace PPU_instr;
|
||||
|
@ -91,72 +89,6 @@ void Emulator::CheckStatus()
|
|||
}
|
||||
}
|
||||
|
||||
bool Emulator::IsSelf(const std::string& path)
|
||||
{
|
||||
vfsLocalFile f(nullptr);
|
||||
|
||||
if(!f.Open(path))
|
||||
return false;
|
||||
|
||||
SceHeader hdr;
|
||||
hdr.Load(f);
|
||||
|
||||
return hdr.CheckMagic();
|
||||
}
|
||||
|
||||
bool Emulator::DecryptSelf(const std::string& elf, const std::string& self)
|
||||
{
|
||||
// Check if the data really needs to be decrypted.
|
||||
wxFile f(self.c_str());
|
||||
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not open SELF file! (%s)", wxString(self).wx_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the key version.
|
||||
f.Seek(0x08);
|
||||
be_t<u16> key_version;
|
||||
f.Read(&key_version, sizeof(key_version));
|
||||
|
||||
if(key_version.ToBE() == const_se_t<u16, 0x8000>::value)
|
||||
{
|
||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
||||
|
||||
// Get the real elf offset.
|
||||
f.Seek(0x10);
|
||||
be_t<u64> elf_offset;
|
||||
f.Read(&elf_offset, sizeof(elf_offset));
|
||||
|
||||
// Start at the real elf offset.
|
||||
f.Seek(elf_offset);
|
||||
|
||||
wxFile out(elf.c_str(), wxFile::write);
|
||||
|
||||
if(!out.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", wxString(elf).wx_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the data.
|
||||
char buf[2048];
|
||||
while (ssize_t size = f.Read(buf, 2048))
|
||||
out.Write(buf, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!scetool_decrypt((scetool::s8 *)self.c_str(), (scetool::s8 *)elf.c_str()))
|
||||
{
|
||||
ConLog.Write("SELF: Could not decrypt file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Emulator::BootGame(const std::string& path)
|
||||
{
|
||||
static const char* elf_path[6] =
|
||||
|
|
|
@ -145,9 +145,6 @@ public:
|
|||
u32 GetPPUThreadExit() const { return m_ppu_thr_exit; }
|
||||
|
||||
void CheckStatus();
|
||||
|
||||
bool IsSelf(const std::string& path);
|
||||
bool DecryptSelf(const std::string& elf, const std::string& self);
|
||||
bool BootGame(const std::string& path);
|
||||
|
||||
void Load();
|
||||
|
@ -165,4 +162,4 @@ public:
|
|||
__forceinline bool IsReady() const { return m_status == Ready; }
|
||||
};
|
||||
|
||||
extern Emulator Emu;
|
||||
extern Emulator Emu;
|
|
@ -47,14 +47,12 @@ AboutDialog::AboutDialog(wxWindow *parent)
|
|||
wxBoxSizer* s_panel_credits(new wxBoxSizer(wxHORIZONTAL));
|
||||
wxStaticText* t_section1 = new wxStaticText(this, wxID_ANY, "\nDevelopers:\n\nDH\nAlexAltea\nHykem\nOil", wxDefaultPosition, wxSize(156,160));
|
||||
wxStaticText* t_section2 = new wxStaticText(this, wxID_ANY, "\nThanks:\n\nBlackDaemon", wxDefaultPosition, wxSize(156,160));
|
||||
wxStaticText* t_section3 = new wxStaticText(this, wxID_ANY, "\nExternal code:\n\n - SELF Decrypter based on scetool (C) 2011-2013 by naehrwert", wxDefaultPosition, wxSize(156,160));
|
||||
|
||||
s_panel_credits->AddSpacer(12);
|
||||
s_panel_credits->Add(t_section1);
|
||||
s_panel_credits->AddSpacer(8);
|
||||
s_panel_credits->Add(t_section2);
|
||||
s_panel_credits->AddSpacer(8);
|
||||
s_panel_credits->Add(t_section3);
|
||||
s_panel_credits->AddSpacer(12);
|
||||
|
||||
//Buttons
|
||||
|
|
|
@ -1,6 +1,55 @@
|
|||
#include "stdafx.h"
|
||||
#include "ELF32.h"
|
||||
|
||||
void WriteEhdr(wxFile& f, Elf32_Ehdr& ehdr)
|
||||
{
|
||||
Write32(f, ehdr.e_magic);
|
||||
Write8(f, ehdr.e_class);
|
||||
Write8(f, ehdr.e_data);
|
||||
Write8(f, ehdr.e_curver);
|
||||
Write8(f, ehdr.e_os_abi);
|
||||
Write64(f, ehdr.e_abi_ver);
|
||||
Write16(f, ehdr.e_type);
|
||||
Write16(f, ehdr.e_machine);
|
||||
Write32(f, ehdr.e_version);
|
||||
Write32(f, ehdr.e_entry);
|
||||
Write32(f, ehdr.e_phoff);
|
||||
Write32(f, ehdr.e_shoff);
|
||||
Write32(f, ehdr.e_flags);
|
||||
Write16(f, ehdr.e_ehsize);
|
||||
Write16(f, ehdr.e_phentsize);
|
||||
Write16(f, ehdr.e_phnum);
|
||||
Write16(f, ehdr.e_shentsize);
|
||||
Write16(f, ehdr.e_shnum);
|
||||
Write16(f, ehdr.e_shstrndx);
|
||||
}
|
||||
|
||||
void WritePhdr(wxFile& f, Elf32_Phdr& phdr)
|
||||
{
|
||||
Write32(f, phdr.p_type);
|
||||
Write32(f, phdr.p_offset);
|
||||
Write32(f, phdr.p_vaddr);
|
||||
Write32(f, phdr.p_paddr);
|
||||
Write32(f, phdr.p_filesz);
|
||||
Write32(f, phdr.p_memsz);
|
||||
Write32(f, phdr.p_flags);
|
||||
Write32(f, phdr.p_align);
|
||||
}
|
||||
|
||||
void WriteShdr(wxFile& f, Elf32_Shdr& shdr)
|
||||
{
|
||||
Write32(f, shdr.sh_name);
|
||||
Write32(f, shdr.sh_type);
|
||||
Write32(f, shdr.sh_flags);
|
||||
Write32(f, shdr.sh_addr);
|
||||
Write32(f, shdr.sh_offset);
|
||||
Write32(f, shdr.sh_size);
|
||||
Write32(f, shdr.sh_link);
|
||||
Write32(f, shdr.sh_info);
|
||||
Write32(f, shdr.sh_addralign);
|
||||
Write32(f, shdr.sh_entsize);
|
||||
}
|
||||
|
||||
ELF32Loader::ELF32Loader(vfsStream& f)
|
||||
: elf32_f(f)
|
||||
, LoaderBase()
|
||||
|
|
|
@ -305,4 +305,8 @@ private:
|
|||
bool LoadEhdrData(u64 offset);
|
||||
bool LoadPhdrData(u64 offset);
|
||||
bool LoadShdrData(u64 offset);
|
||||
};
|
||||
};
|
||||
|
||||
void WriteEhdr(wxFile& f, Elf32_Ehdr& ehdr);
|
||||
void WritePhdr(wxFile& f, Elf32_Phdr& phdr);
|
||||
void WriteShdr(wxFile& f, Elf32_Shdr& shdr);
|
|
@ -1,15 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "PKG.h"
|
||||
#include "scetool/aes.h"
|
||||
#include "scetool/sha1.h"
|
||||
|
||||
#include <wx/progdlg.h>
|
||||
#include "../Crypto/unpkg.h"
|
||||
|
||||
PKGLoader::PKGLoader(wxFile& f) : pkg_f(f)
|
||||
{
|
||||
}
|
||||
|
||||
bool PKGLoader::Install(std::string dest, bool show)
|
||||
bool PKGLoader::Install(std::string dest)
|
||||
{
|
||||
// Initial checks
|
||||
if (!pkg_f.IsOpened())
|
||||
|
@ -19,11 +16,12 @@ bool PKGLoader::Install(std::string dest, bool show)
|
|||
if (!dest.empty() && dest.back() != '/')
|
||||
dest += '/';
|
||||
|
||||
if(!LoadHeader(show))
|
||||
return false;
|
||||
|
||||
std::string titleID = std::string(m_header.title_id).substr(7, 9);
|
||||
std::string decryptedFile = wxGetCwd().ToStdString() + "/dev_hdd1/" + titleID + ".dec";
|
||||
// Fetch title ID from the header.
|
||||
char title_id[48];
|
||||
pkg_f.Seek(48);
|
||||
pkg_f.Read(title_id, 48);
|
||||
|
||||
std::string titleID = std::string(title_id).substr(7, 9);
|
||||
|
||||
if (wxDirExists(dest+titleID)) {
|
||||
wxMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", wxYES_NO|wxCENTRE);
|
||||
|
@ -40,209 +38,20 @@ bool PKGLoader::Install(std::string dest, bool show)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Decrypt the PKG file
|
||||
wxFile out;
|
||||
out.Create(decryptedFile, true);
|
||||
Decrypt(out);
|
||||
out.Close();
|
||||
|
||||
// Unpack the decrypted file
|
||||
wxFile dec(decryptedFile, wxFile::read);
|
||||
LoadEntries(dec);
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, unpacking...", m_entries.size(), 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
for (const PKGEntry& entry : m_entries)
|
||||
// Decrypt and unpack the PKG file.
|
||||
if (Unpack(pkg_f, titleID, dest) < 0)
|
||||
{
|
||||
UnpackEntry(dec, entry, dest+titleID+'/');
|
||||
pdlg.Update(pdlg.GetValue() + 1);
|
||||
ConLog.Error("PKG Loader: Failed to install package!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConLog.Write("PKG Loader: Package successfully installed in: /dev_hdd0/game/%s", wxString(titleID.c_str()).wx_str());
|
||||
return true;
|
||||
}
|
||||
pdlg.Update(m_entries.size());
|
||||
|
||||
// Delete decrypted file
|
||||
dec.Close();
|
||||
wxRemoveFile(decryptedFile);
|
||||
ConLog.Write("PKG Loader: Package successfully installed in: /dev_hdd0/game/%s", wxString(titleID.c_str()).wx_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PKGLoader::Close()
|
||||
{
|
||||
return pkg_f.Close();
|
||||
}
|
||||
|
||||
bool PKGLoader::LoadHeader(bool show)
|
||||
{
|
||||
pkg_f.Seek(0);
|
||||
if (pkg_f.Read(&m_header, sizeof(PKGHeader)) != sizeof(PKGHeader)) {
|
||||
ConLog.Error("PKG Loader: Package file is too short!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckHeader())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PKGLoader::CheckHeader()
|
||||
{
|
||||
if (m_header.pkg_magic != 0x7F504B47) {
|
||||
ConLog.Error("PKG Loader: Not a package file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_header.pkg_type)
|
||||
{
|
||||
case PKG_RELEASE_TYPE_DEBUG: break;
|
||||
case PKG_RELEASE_TYPE_RELEASE: break;
|
||||
default:
|
||||
ConLog.Error("PKG Loader: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_header.pkg_platform)
|
||||
{
|
||||
case PKG_PLATFORM_TYPE_PS3: break;
|
||||
case PKG_PLATFORM_TYPE_PSP: break;
|
||||
default:
|
||||
ConLog.Error("PKG Loader: Unknown PKG type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header.header_size != PKG_HEADER_SIZE) {
|
||||
ConLog.Error("PKG Loader: Wrong header size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header.pkg_size != pkg_f.Length()) {
|
||||
ConLog.Error("PKG Loader: File size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_header.data_size + m_header.data_offset + 0x60 != pkg_f.Length()) {
|
||||
ConLog.Error("PKG Loader: Data size mismatch.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PKGLoader::LoadEntries(wxFile& dec)
|
||||
{
|
||||
m_entries.resize(m_header.file_count);
|
||||
|
||||
dec.Seek(0);
|
||||
dec.Read(&m_entries[0], sizeof(PKGEntry) * m_header.file_count);
|
||||
|
||||
if (m_entries[0].name_offset / sizeof(PKGEntry) != m_header.file_count) {
|
||||
ConLog.Error("PKG Loader: Entries are damaged!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PKGLoader::UnpackEntry(wxFile& dec, const PKGEntry& entry, std::string dir)
|
||||
{
|
||||
u8 buf[BUF_SIZE];
|
||||
|
||||
dec.Seek(entry.name_offset);
|
||||
dec.Read(buf, entry.name_size);
|
||||
buf[entry.name_size] = 0;
|
||||
|
||||
switch (entry.type & (0xff))
|
||||
{
|
||||
case PKG_FILE_ENTRY_NPDRM:
|
||||
case PKG_FILE_ENTRY_NPDRMEDAT:
|
||||
case PKG_FILE_ENTRY_SDAT:
|
||||
case PKG_FILE_ENTRY_REGULAR:
|
||||
{
|
||||
wxFile out;
|
||||
out.Create(dir + buf);
|
||||
dec.Seek(entry.file_offset);
|
||||
|
||||
for (u64 size = 0; size < entry.file_size; ) {
|
||||
size += dec.Read(buf, BUF_SIZE);
|
||||
if (size > entry.file_size)
|
||||
out.Write(buf, BUF_SIZE - (size - entry.file_size));
|
||||
else
|
||||
out.Write(buf, BUF_SIZE);
|
||||
}
|
||||
out.Close();
|
||||
}
|
||||
break;
|
||||
|
||||
case PKG_FILE_ENTRY_FOLDER:
|
||||
wxMkdir(dir + buf);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PKGLoader::Decrypt(wxFile& out)
|
||||
{
|
||||
aes_context c;
|
||||
u8 iv[HASH_LEN];
|
||||
u8 buf[BUF_SIZE];
|
||||
u8 ctr[BUF_SIZE];
|
||||
|
||||
// Debug key
|
||||
u8 key[0x40];
|
||||
memset(key, 0, 0x40);
|
||||
memcpy(key+0x00, &m_header.qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x08, &m_header.qa_digest[0], 8); // &data[0x60]
|
||||
memcpy(key+0x10, &m_header.qa_digest[8], 8); // &data[0x68]
|
||||
memcpy(key+0x18, &m_header.qa_digest[8], 8); // &data[0x68]
|
||||
|
||||
pkg_f.Seek(m_header.data_offset);
|
||||
u32 parts = (m_header.data_size + BUF_SIZE - 1) / BUF_SIZE;
|
||||
|
||||
wxProgressDialog pdlg("PKG Decrypter / Installer", "Please wait, decrypting...", parts, 0, wxPD_AUTO_HIDE | wxPD_APP_MODAL);
|
||||
|
||||
memcpy(iv, m_header.klicensee, sizeof(iv));
|
||||
aes_setkey_enc(&c, PKG_AES_KEY, 128);
|
||||
|
||||
for (u32 i=0; i<parts; i++)
|
||||
{
|
||||
memset(buf, 0, sizeof(buf));
|
||||
u32 length = pkg_f.Read(buf, BUF_SIZE);
|
||||
u32 bits = (length + HASH_LEN - 1) / HASH_LEN;
|
||||
|
||||
if (m_header.pkg_type == PKG_RELEASE_TYPE_DEBUG)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
u8 hash[0x14];
|
||||
sha1(key, 0x40, hash);
|
||||
*(u64*)&buf[j*HASH_LEN + 0] ^= *(u64*)&hash[0];
|
||||
*(u64*)&buf[j*HASH_LEN + 8] ^= *(u64*)&hash[8];
|
||||
*(be_t<u64>*)&key[0x38] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_header.pkg_type == PKG_RELEASE_TYPE_RELEASE)
|
||||
{
|
||||
for (u32 j=0; j<bits; j++)
|
||||
{
|
||||
aes_crypt_ecb(&c, AES_ENCRYPT, iv, ctr+j*HASH_LEN);
|
||||
|
||||
be_t<u64> hi = *(be_t<u64>*)&iv[0];
|
||||
be_t<u64> lo = *(be_t<u64>*)&iv[8] + 1;
|
||||
|
||||
if (lo == 0)
|
||||
hi += 1;
|
||||
|
||||
*(be_t<u64>*)&iv[0] = hi;
|
||||
*(be_t<u64>*)&iv[8] = lo;
|
||||
}
|
||||
|
||||
for (u32 j=0; j<length; j++) {
|
||||
buf[j] ^= ctr[j];
|
||||
}
|
||||
}
|
||||
|
||||
out.Write(buf, length);
|
||||
pdlg.Update(i);
|
||||
}
|
||||
pdlg.Update(parts);
|
||||
}
|
||||
}
|
|
@ -1,76 +1,12 @@
|
|||
#pragma once
|
||||
#include "Loader.h"
|
||||
|
||||
// Constants
|
||||
#define PKG_HEADER_SIZE 0xC0 //sizeof(pkg_header) + sizeof(pkg_unk_checksum)
|
||||
#define PKG_RELEASE_TYPE_RELEASE 0x8000
|
||||
#define PKG_RELEASE_TYPE_DEBUG 0x0000
|
||||
#define PKG_PLATFORM_TYPE_PS3 0x0001
|
||||
#define PKG_PLATFORM_TYPE_PSP 0x0002
|
||||
|
||||
#define PKG_FILE_ENTRY_NPDRM 0x0001
|
||||
#define PKG_FILE_ENTRY_NPDRMEDAT 0x0002
|
||||
#define PKG_FILE_ENTRY_REGULAR 0x0003
|
||||
#define PKG_FILE_ENTRY_FOLDER 0x0004
|
||||
#define PKG_FILE_ENTRY_SDAT 0x0009
|
||||
#define PKG_FILE_ENTRY_OVERWRITE 0x80000000
|
||||
|
||||
#define HASH_LEN 16
|
||||
#define BUF_SIZE 4096
|
||||
|
||||
// Key
|
||||
static const u8 PKG_AES_KEY[16] = {
|
||||
0x2e, 0x7b, 0x71, 0xd7,
|
||||
0xc9, 0xc9, 0xa1, 0x4e,
|
||||
0xa3, 0x22, 0x1f, 0x18,
|
||||
0x88, 0x28, 0xb8, 0xf8
|
||||
};
|
||||
|
||||
// Structs
|
||||
struct PKGHeader
|
||||
{
|
||||
be_t<u32> pkg_magic; // Magic (0x7f504b47)
|
||||
be_t<u16> pkg_type; // Release type (Retail:0x8000, Debug:0x0000)
|
||||
be_t<u16> pkg_platform; // Platform type (PS3:0x0001, PSP:0x0002)
|
||||
be_t<u32> header_size; // Header size (0xc0)
|
||||
be_t<u32> unk1; // Some PKG version maybe?
|
||||
be_t<u32> meta_size; // Size of metadata (block after header & hashes)
|
||||
be_t<u32> file_count; // Number of files
|
||||
be_t<u64> pkg_size; // PKG size in bytes
|
||||
be_t<u64> data_offset; // Encrypted data offset
|
||||
be_t<u64> data_size; // Encrypted data size in bytes
|
||||
char title_id[48]; // Title ID
|
||||
u8 qa_digest[16]; // This should be the hash of "files + attribs"
|
||||
u8 klicensee[16]; // Nonce
|
||||
};
|
||||
|
||||
struct PKGEntry
|
||||
{
|
||||
be_t<u32> name_offset; // File name offset
|
||||
be_t<u32> name_size; // File name size
|
||||
be_t<u64> file_offset; // File offset
|
||||
be_t<u64> file_size; // File size
|
||||
be_t<u32> type; // File type
|
||||
be_t<u32> pad; // Padding (zeros)
|
||||
};
|
||||
|
||||
class PKGLoader
|
||||
{
|
||||
wxFile& pkg_f;
|
||||
PKGHeader m_header;
|
||||
std::vector<PKGEntry> m_entries;
|
||||
|
||||
virtual void Decrypt(wxFile& out);
|
||||
|
||||
public:
|
||||
PKGLoader(wxFile& f);
|
||||
virtual bool Install(std::string dest, bool show = false);
|
||||
|
||||
virtual bool LoadHeader(bool show = false);
|
||||
virtual bool CheckHeader();
|
||||
|
||||
virtual bool LoadEntries(wxFile& dec);
|
||||
virtual bool UnpackEntry(wxFile& dec, const PKGEntry& entry, std::string dir);
|
||||
|
||||
virtual bool Install(std::string dest);
|
||||
virtual bool Close();
|
||||
};
|
||||
|
|
|
@ -1,409 +1,415 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>rpcs3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)-dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)-dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)\Utilities\git-version-gen.cmd"</Command>
|
||||
</PreBuildEvent>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>
|
||||
</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>
|
||||
</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\scetool\scetool.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Utilities\SMutex.cpp" />
|
||||
<ClCompile Include="..\Utilities\Thread.cpp" />
|
||||
<ClCompile Include="AppConnector.cpp" />
|
||||
<ClCompile Include="Emu\Audio\AudioManager.cpp" />
|
||||
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\MFC.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPCDecoder.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPCThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPUProgramCompiler.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPUThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\RawSPUThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\SPUThread.cpp" />
|
||||
<ClCompile Include="Emu\CPU\CPUThread.cpp" />
|
||||
<ClCompile Include="Emu\CPU\CPUThreadManager.cpp" />
|
||||
<ClCompile Include="Emu\DbgConsole.cpp" />
|
||||
<ClCompile Include="Emu\Event.cpp" />
|
||||
<ClCompile Include="Emu\FS\VFS.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDevice.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDeviceLocalFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDir.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDirBase.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsFileBase.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsLocalDir.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsLocalFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsStream.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsStreamMemory.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLBuffers.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLFragmentProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLGSRender.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLProgramBuffer.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLVertexProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\OpenGL.cpp" />
|
||||
<ClCompile Include="Emu\GS\GSManager.cpp" />
|
||||
<ClCompile Include="Emu\GS\GSRender.cpp" />
|
||||
<ClCompile Include="Emu\GS\RSXTexture.cpp" />
|
||||
<ClCompile Include="Emu\GS\RSXThread.cpp" />
|
||||
<ClCompile Include="Emu\HDD\HDD.cpp" />
|
||||
<ClCompile Include="Emu\Io\Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\Io\Mouse.cpp" />
|
||||
<ClCompile Include="Emu\Io\Pad.cpp" />
|
||||
<ClCompile Include="Emu\Memory\Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Callback.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\FuncList.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Condition.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event_flag.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_FileSystem.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_GCM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Heap.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwcond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwmutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Pad.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Process.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_RSX.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Rwlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Semaphore.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_SPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Time.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Timer.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Trace.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_TTY.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAdec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAudio.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellDmux.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellFont.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellFontFT.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGame.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGcmSys.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGifDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellJpgDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellPamf.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellPngDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellResc.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellRtc.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSync.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysmodule.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutil.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutilAp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_io.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\SysCalls.cpp" />
|
||||
<ClCompile Include="Emu\System.cpp" />
|
||||
<ClCompile Include="Gui\CompilerELF.cpp" />
|
||||
<ClCompile Include="Gui\ConLog.cpp" />
|
||||
<ClCompile Include="Gui\Debugger.cpp" />
|
||||
<ClCompile Include="Gui\DisAsmFrame.cpp" />
|
||||
<ClCompile Include="Gui\GameViewer.cpp" />
|
||||
<ClCompile Include="Gui\InterpreterDisAsm.cpp" />
|
||||
<ClCompile Include="Gui\MainFrame.cpp" />
|
||||
<ClCompile Include="Gui\MemoryViewer.cpp" />
|
||||
<ClCompile Include="Gui\RSXDebugger.cpp" />
|
||||
<ClCompile Include="Gui\TextInputDialog.cpp" />
|
||||
<ClCompile Include="Gui\VFSManager.cpp" />
|
||||
<ClCompile Include="Gui\VHDDManager.cpp" />
|
||||
<ClCompile Include="Ini.cpp" />
|
||||
<ClCompile Include="Loader\ELF.cpp" />
|
||||
<ClCompile Include="Loader\ELF32.cpp" />
|
||||
<ClCompile Include="Loader\ELF64.cpp" />
|
||||
<ClCompile Include="Loader\Loader.cpp" />
|
||||
<ClCompile Include="Loader\PKG.cpp" />
|
||||
<ClCompile Include="Loader\PSF.cpp" />
|
||||
<ClCompile Include="Loader\SELF.cpp" />
|
||||
<ClCompile Include="Loader\TRP.cpp" />
|
||||
<ClCompile Include="rpcs3.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="rpcs3.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Utilities\Array.h" />
|
||||
<ClInclude Include="..\Utilities\BEType.h" />
|
||||
<ClInclude Include="..\Utilities\IdManager.h" />
|
||||
<ClInclude Include="..\Utilities\MTProgressDialog.h" />
|
||||
<ClInclude Include="..\Utilities\SMutex.h" />
|
||||
<ClInclude Include="..\Utilities\SQueue.h" />
|
||||
<ClInclude Include="..\Utilities\Thread.h" />
|
||||
<ClInclude Include="..\Utilities\Timer.h" />
|
||||
<ClInclude Include="Emu\Audio\AudioManager.h" />
|
||||
<ClInclude Include="Emu\Audio\cellAudio.h" />
|
||||
<ClInclude Include="Emu\Cell\MFC.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCInstrTable.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCThread.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCThreadManager.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUInstrTable.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUInterpreter.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUOpcodes.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUProgramCompiler.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUThread.h" />
|
||||
<ClInclude Include="Emu\Cell\RawSPUThread.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUInterpreter.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUOpcodes.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUThread.h" />
|
||||
<ClInclude Include="Emu\DbgConsole.h" />
|
||||
<ClInclude Include="Emu\GameInfo.h" />
|
||||
<ClInclude Include="Emu\GS\GCM.h" />
|
||||
<ClInclude Include="Emu\GS\GL\GLGSRender.h" />
|
||||
<ClInclude Include="Emu\GS\GSManager.h" />
|
||||
<ClInclude Include="Emu\GS\GSRender.h" />
|
||||
<ClInclude Include="Emu\GS\Null\NullGSRender.h" />
|
||||
<ClInclude Include="Emu\Io\Null\NullPadHandler.h" />
|
||||
<ClInclude Include="Emu\Io\Pad.h" />
|
||||
<ClInclude Include="Emu\Io\PadHandler.h" />
|
||||
<ClInclude Include="Emu\Memory\Memory.h" />
|
||||
<ClInclude Include="Emu\Memory\MemoryBlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\ErrorCodes.h" />
|
||||
<ClInclude Include="Emu\SysCalls\SysCalls.h" />
|
||||
<ClInclude Include="Emu\System.h" />
|
||||
<ClInclude Include="Gui\CompilerELF.h" />
|
||||
<ClInclude Include="Gui\ConLog.h" />
|
||||
<ClInclude Include="Gui\DisAsmFrame.h" />
|
||||
<ClInclude Include="Gui\FrameBase.h" />
|
||||
<ClInclude Include="Gui\GameViewer.h" />
|
||||
<ClInclude Include="Gui\InterpreterDisAsm.h" />
|
||||
<ClInclude Include="Gui\MainFrame.h" />
|
||||
<ClInclude Include="Gui\MemoryViewer.h" />
|
||||
<ClInclude Include="Ini.h" />
|
||||
<ClInclude Include="Loader\ELF.h" />
|
||||
<ClInclude Include="Loader\ELF32.h" />
|
||||
<ClInclude Include="Loader\ELF64.h" />
|
||||
<ClInclude Include="Loader\Loader.h" />
|
||||
<ClInclude Include="Loader\PSF.h" />
|
||||
<ClInclude Include="Loader\SELF.h" />
|
||||
<ClInclude Include="rpcs3.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>rpcs3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)-dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)-dbg</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<LibraryPath>..\libs\$(Configuration)\;$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<TargetName>$(ProjectName)-$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(SolutionDir)\Utilities\git-version-gen.cmd"</Command>
|
||||
</PreBuildEvent>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>
|
||||
</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\wxWidgets\include\msvc</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreAllDefaultLibraries>
|
||||
</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<AdditionalLibraryDirectories>..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Utilities\SMutex.cpp" />
|
||||
<ClCompile Include="..\Utilities\Thread.cpp" />
|
||||
<ClCompile Include="AppConnector.cpp" />
|
||||
<ClCompile Include="Crypto\aes.cpp" />
|
||||
<ClCompile Include="Crypto\key_vault.cpp" />
|
||||
<ClCompile Include="Crypto\sha1.cpp" />
|
||||
<ClCompile Include="Crypto\unpkg.cpp" />
|
||||
<ClCompile Include="Crypto\unself.cpp" />
|
||||
<ClCompile Include="Crypto\utils.cpp" />
|
||||
<ClCompile Include="Emu\Audio\AudioManager.cpp" />
|
||||
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\MFC.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPCDecoder.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPCThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPUProgramCompiler.cpp" />
|
||||
<ClCompile Include="Emu\Cell\PPUThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\RawSPUThread.cpp" />
|
||||
<ClCompile Include="Emu\Cell\SPUThread.cpp" />
|
||||
<ClCompile Include="Emu\CPU\CPUThread.cpp" />
|
||||
<ClCompile Include="Emu\CPU\CPUThreadManager.cpp" />
|
||||
<ClCompile Include="Emu\DbgConsole.cpp" />
|
||||
<ClCompile Include="Emu\Event.cpp" />
|
||||
<ClCompile Include="Emu\FS\VFS.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDevice.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDeviceLocalFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDir.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsDirBase.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsFileBase.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsLocalDir.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsLocalFile.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsStream.cpp" />
|
||||
<ClCompile Include="Emu\FS\vfsStreamMemory.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLBuffers.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLFragmentProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLGSRender.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLProgramBuffer.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\GLVertexProgram.cpp" />
|
||||
<ClCompile Include="Emu\GS\GL\OpenGL.cpp" />
|
||||
<ClCompile Include="Emu\GS\GSManager.cpp" />
|
||||
<ClCompile Include="Emu\GS\GSRender.cpp" />
|
||||
<ClCompile Include="Emu\GS\RSXTexture.cpp" />
|
||||
<ClCompile Include="Emu\GS\RSXThread.cpp" />
|
||||
<ClCompile Include="Emu\HDD\HDD.cpp" />
|
||||
<ClCompile Include="Emu\Io\Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\Io\Mouse.cpp" />
|
||||
<ClCompile Include="Emu\Io\Pad.cpp" />
|
||||
<ClCompile Include="Emu\Memory\Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Callback.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\FuncList.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Condition.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event_flag.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_FileSystem.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_GCM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Heap.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwcond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwmutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Pad.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Process.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_RSX.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Rwlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Semaphore.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_SPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Time.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Timer.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Trace.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_TTY.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAdec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAudio.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellDmux.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellFont.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellFontFT.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGame.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGcmSys.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellGifDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellJpgDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellPamf.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellPngDec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellResc.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellRtc.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSync.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysmodule.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutil.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutilAp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_io.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\SysCalls.cpp" />
|
||||
<ClCompile Include="Emu\System.cpp" />
|
||||
<ClCompile Include="Gui\CompilerELF.cpp" />
|
||||
<ClCompile Include="Gui\ConLog.cpp" />
|
||||
<ClCompile Include="Gui\Debugger.cpp" />
|
||||
<ClCompile Include="Gui\DisAsmFrame.cpp" />
|
||||
<ClCompile Include="Gui\GameViewer.cpp" />
|
||||
<ClCompile Include="Gui\InterpreterDisAsm.cpp" />
|
||||
<ClCompile Include="Gui\MainFrame.cpp" />
|
||||
<ClCompile Include="Gui\MemoryViewer.cpp" />
|
||||
<ClCompile Include="Gui\RSXDebugger.cpp" />
|
||||
<ClCompile Include="Gui\TextInputDialog.cpp" />
|
||||
<ClCompile Include="Gui\VFSManager.cpp" />
|
||||
<ClCompile Include="Gui\VHDDManager.cpp" />
|
||||
<ClCompile Include="Ini.cpp" />
|
||||
<ClCompile Include="Loader\ELF.cpp" />
|
||||
<ClCompile Include="Loader\ELF32.cpp" />
|
||||
<ClCompile Include="Loader\ELF64.cpp" />
|
||||
<ClCompile Include="Loader\Loader.cpp" />
|
||||
<ClCompile Include="Loader\PKG.cpp" />
|
||||
<ClCompile Include="Loader\PSF.cpp" />
|
||||
<ClCompile Include="Loader\SELF.cpp" />
|
||||
<ClCompile Include="Loader\TRP.cpp" />
|
||||
<ClCompile Include="rpcs3.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="rpcs3.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Utilities\Array.h" />
|
||||
<ClInclude Include="..\Utilities\BEType.h" />
|
||||
<ClInclude Include="..\Utilities\IdManager.h" />
|
||||
<ClInclude Include="..\Utilities\MTProgressDialog.h" />
|
||||
<ClInclude Include="..\Utilities\SMutex.h" />
|
||||
<ClInclude Include="..\Utilities\SQueue.h" />
|
||||
<ClInclude Include="..\Utilities\Thread.h" />
|
||||
<ClInclude Include="..\Utilities\Timer.h" />
|
||||
<ClInclude Include="Crypto\aes.h" />
|
||||
<ClInclude Include="Crypto\key_vault.h" />
|
||||
<ClInclude Include="Crypto\sha1.h" />
|
||||
<ClInclude Include="Crypto\unpkg.h" />
|
||||
<ClInclude Include="Crypto\unself.h" />
|
||||
<ClInclude Include="Crypto\utils.h" />
|
||||
<ClInclude Include="Emu\Audio\AudioManager.h" />
|
||||
<ClInclude Include="Emu\Audio\cellAudio.h" />
|
||||
<ClInclude Include="Emu\Cell\MFC.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCInstrTable.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCThread.h" />
|
||||
<ClInclude Include="Emu\Cell\PPCThreadManager.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUInstrTable.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUInterpreter.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUOpcodes.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUProgramCompiler.h" />
|
||||
<ClInclude Include="Emu\Cell\PPUThread.h" />
|
||||
<ClInclude Include="Emu\Cell\RawSPUThread.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUDecoder.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUDisAsm.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUInterpreter.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUOpcodes.h" />
|
||||
<ClInclude Include="Emu\Cell\SPUThread.h" />
|
||||
<ClInclude Include="Emu\DbgConsole.h" />
|
||||
<ClInclude Include="Emu\GameInfo.h" />
|
||||
<ClInclude Include="Emu\GS\GCM.h" />
|
||||
<ClInclude Include="Emu\GS\GL\GLGSRender.h" />
|
||||
<ClInclude Include="Emu\GS\GSManager.h" />
|
||||
<ClInclude Include="Emu\GS\GSRender.h" />
|
||||
<ClInclude Include="Emu\GS\Null\NullGSRender.h" />
|
||||
<ClInclude Include="Emu\Io\Null\NullPadHandler.h" />
|
||||
<ClInclude Include="Emu\Io\Pad.h" />
|
||||
<ClInclude Include="Emu\Io\PadHandler.h" />
|
||||
<ClInclude Include="Emu\Memory\Memory.h" />
|
||||
<ClInclude Include="Emu\Memory\MemoryBlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\ErrorCodes.h" />
|
||||
<ClInclude Include="Emu\SysCalls\SysCalls.h" />
|
||||
<ClInclude Include="Emu\System.h" />
|
||||
<ClInclude Include="Gui\CompilerELF.h" />
|
||||
<ClInclude Include="Gui\ConLog.h" />
|
||||
<ClInclude Include="Gui\DisAsmFrame.h" />
|
||||
<ClInclude Include="Gui\FrameBase.h" />
|
||||
<ClInclude Include="Gui\GameViewer.h" />
|
||||
<ClInclude Include="Gui\InterpreterDisAsm.h" />
|
||||
<ClInclude Include="Gui\MainFrame.h" />
|
||||
<ClInclude Include="Gui\MemoryViewer.h" />
|
||||
<ClInclude Include="Ini.h" />
|
||||
<ClInclude Include="Loader\ELF.h" />
|
||||
<ClInclude Include="Loader\ELF32.h" />
|
||||
<ClInclude Include="Loader\ELF64.h" />
|
||||
<ClInclude Include="Loader\Loader.h" />
|
||||
<ClInclude Include="Loader\PSF.h" />
|
||||
<ClInclude Include="Loader\SELF.h" />
|
||||
<ClInclude Include="rpcs3.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue