SHOW:
|
|
- or go back to the newest paste.
| 1 | // make_self_npdrm by geohot | |
| 2 | // part of geohot's awesome tools for the PS3 | |
| 3 | // released under GPLv3, see http://gplv3.fsf.org/ | |
| 4 | ||
| 5 | #include <stdio.h> | |
| 6 | #include <stdlib.h> | |
| 7 | #include <string.h> | |
| 8 | ||
| 9 | #include <gmp.h> | |
| 10 | #include <time.h> | |
| 11 | ||
| 12 | #include <openssl/sha.h> | |
| 13 | #include <openssl/aes.h> | |
| 14 | #include "zlib.h" | |
| 15 | ||
| 16 | #include "include/ps3_common.h" | |
| 17 | #include "include/elf.h" | |
| 18 | #include "include/keys.h" | |
| 19 | #include "include/oddkeys.h" | |
| 20 | #include "include/sha1_hmac.h" | |
| 21 | ||
| 22 | #include "include/self.h" | |
| 23 | ||
| 24 | #include "include/aes_omac.h" | |
| 25 | ||
| 26 | //#define NO_CRYPT | |
| 27 | //#define NPDRM | |
| 28 | //#define SPRX | |
| 29 | ||
| 30 | #ifdef NPDRM | |
| 31 | #define KEY(SUFFIX) npdrm_##SUFFIX | |
| 32 | #else | |
| 33 | #define KEY(SUFFIX) appold_##SUFFIX | |
| 34 | #endif | |
| 35 | ||
| 36 | u8 nubpadding_static[] = {
| |
| 37 | 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 38 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 39 | #ifdef SPRX | |
| 40 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7B,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x00 | |
| 41 | #else | |
| 42 | #ifdef NPDRM | |
| 43 | // this broke lv2diag.self | |
| 44 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x00,0x00,0x00,0x01,0x00,0x00,0x20,0x00 | |
| 45 | #else | |
| 46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00 | |
| 47 | #endif | |
| 48 | #endif | |
| 49 | }; | |
| 50 | // 0x1B in retail | |
| 51 | // 0x3B in lv2diag | |
| 52 | ||
| 53 | u8 cflags_static[] = {
| |
| 54 | 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, | |
| 55 | - | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0x40000000 == control flag set as Root |
| 55 | + | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 56 | // 0x40000000 == control flag set as Root | |
| 57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02, | |
| 58 | #ifndef NPDRM | |
| 59 | 0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 60 | 0x62,0x7C,0xB1,0x80,0x8A,0xB9,0x38,0xE3,0x2C,0x8C,0x09,0x17,0x08,0x72,0x6A,0x57, | |
| 61 | 0x9E,0x25,0x86,0xE4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 62 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 63 | #else | |
| 64 | 0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, | |
| 65 | 0x62,0x7C,0xB1,0x80,0x8A,0xB9,0x38,0xE3,0x2C,0x8C,0x09,0x17,0x08,0x72,0x6A,0x57, | |
| 66 | 0x9E,0x25,0x86,0xE4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | |
| 67 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5D,0xC0, | |
| 68 | #endif | |
| 69 | }; |