diff options
-rwxr-xr-x[-rw-r--r--] | include/keys.h | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | include/oddkeys.h | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | make_self.c | 26 | ||||
-rwxr-xr-x | makefile | 9 |
4 files changed, 31 insertions, 21 deletions
diff --git a/include/keys.h b/include/keys.h index 95d1f9a..6d51dae 100644..100755 --- a/include/keys.h +++ b/include/keys.h @@ -1,5 +1,10 @@ // no application symmetric keys are included
+u8 appold_R[] = {0xB0,0xCD,0x2F,0xDF,0x15,0xC9,0xA7,0x9A,0x2C,0x28,0x41,0x5B,0x2B,0x53,0x85,0xED,0x7E,0x91,0xD3,0x8D};
+u8 appold_n[] = {0xB0,0xE7,0xCA,0xFF,0xC8,0xDE,0xEE,0x8A,0x55,0xA3,0x05,0x0D,0x80,0x9A,0xDF,0xE3,0x8F,0xA0,0x1D,0xAB};
+u8 appold_K[] = {0x89,0x7F,0xC3,0xB1,0x45,0xE1,0x0D,0x82,0x8B,0x8A,0x86,0x57,0x0F,0x9D,0xF9,0x40,0x9F,0x75,0xCB,0xB0};
+u8 appold_Da[] = {0x3D,0xE8,0x01,0x67,0xD2,0xF0,0xE9,0xD3,0x0F,0x21,0x45,0x14,0x4A,0x55,0x8D,0x11,0x74,0xF5,0x41,0x0C};
+
u8 npdrm_R[] = {0xA3,0x8B,0xCB,0x3E,0x4E,0x73,0x09,0x90,0x4A,0xEF,0xDF,0xC5,0x04,0x7D,0x0F,0xDF,0x06,0xE3,0x5C,0x0D};
u8 npdrm_n[] = {0xB0,0xE7,0xCA,0xFF,0xC8,0xDE,0xEE,0x8A,0x55,0xA3,0x05,0x0D,0x80,0x9A,0xDF,0xE3,0x8F,0xA0,0x1D,0xAB};
u8 npdrm_K[] = {0x97,0x4E,0x90,0x62,0x79,0x70,0x5E,0x58,0xD9,0xDA,0xB4,0xBF,0xDA,0x8B,0xDA,0x93,0x13,0x51,0x17,0xE2};
diff --git a/include/oddkeys.h b/include/oddkeys.h index b1647e4..5174518 100644..100755 --- a/include/oddkeys.h +++ b/include/oddkeys.h @@ -20,3 +20,15 @@ u8 npdrm_keypair_d[] = { u8 npdrm_omac_key1[] = {0x72,0xF9,0x90,0x78,0x8F,0x9C,0xFF,0x74,0x57,0x25,0xF0,0x8E,0x4C,0x12,0x83,0x87};
u8 npdrm_omac_key2[] = {0x6B,0xA5,0x29,0x76,0xEF,0xDA,0x16,0xEF,0x3C,0x33,0x9F,0xB2,0x97,0x1E,0x25,0x6B};
u8 npdrm_omac_key3[] = {0x9B,0x51,0x5F,0xEA,0xCF,0x75,0x06,0x49,0x81,0xAA,0x60,0x4D,0x91,0xA5,0x4E,0x97};
+
+u8 appold_keypair_e[] = {
+0x28,0x95,0x8D,0x9B,0xE4,0x18,0x4A,0x12,0x01,0xFA,0xD5,0x2B,0xEC,0x44,0x90,0xDB,
+0x90,0xF4,0x45,0x2D,0xB3,0x11,0xA2,0x24,0x01,0xFB,0x17,0xAF,0x4D,0x87,0x36,0x41,
+0xB5,0x35,0x08,0x70,0x80,0x72,0x52,0x4D,0xAB,0xE5,0x2F,0x59,0x98,0x7D,0xFE,0x1C,
+0xD7,0xC4,0x90,0x93,0xBD,0x45,0x70,0x7C,0xCE,0xC8,0x1A,0x47,0x58,0x3F,0xD9,0x4E};
+
+u8 appold_keypair_d[] = {
+0x3D,0xEA,0x9F,0x72,0xE7,0xBE,0xD9,0x79,0xEF,0x78,0x7B,0xA9,0x69,0x30,0xC0,0x1D,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xB2,0x27,0xD4,0xB4,0x7C,0x53,0x21,0xD4,0xFD,0xE9,0x7B,0x04,0xEA,0xF9,0xC7,0xF4,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/make_self.c b/make_self.c index f0d0805..e1ee534 100644..100755 --- a/make_self.c +++ b/make_self.c @@ -24,7 +24,7 @@ #include "include/aes_omac.h"
//#define NO_CRYPT
-#define NPDRM
+//#define NPDRM
//#define SPRX
#ifdef NPDRM
@@ -441,18 +441,16 @@ int main(int argc, char* argv[]) { // generate metadata encryption keys
metadata_crypt_header md_header; memset(&md_header, 0, sizeof(md_header));
+ memcpy(&md_header, KEY(keypair_d), sizeof(md_header));
-#ifdef NPDRM
- memcpy(&md_header, npdrm_keypair_d, sizeof(md_header));
-#else
- mpz_t bigriv, bigerk;
+// can't generate random without symmetric keys
+/*mpz_t bigriv, bigerk;
mpz_init(bigriv); mpz_init(bigerk);
mpz_urandomb(bigerk, r_state, 128);
mpz_urandomb(bigriv, r_state, 128);
mpz_export(md_header.erk, &countp, 1, 0x10, 1, 0, bigerk);
- mpz_export(md_header.riv, &countp, 1, 0x10, 1, 0, bigriv);
-#endif
+ mpz_export(md_header.riv, &countp, 1, 0x10, 1, 0, bigriv);*/
// init signing shit
mpz_t n,k,da,kinv,r,cs,z;
@@ -578,17 +576,9 @@ int main(int argc, char* argv[]) { AES_set_encrypt_key(&output_self_data[metadata_offset], 128, &aes_key);
memcpy(iv, &output_self_data[metadata_offset+0x20], 16);
AES_ctr128_encrypt(&output_self_data[0x40+metadata_offset], &output_self_data[0x40+metadata_offset], get_u64(&(output_self_header.s_shsize))-metadata_offset-0x40, &aes_key, iv, ecount_buf, &num);
- printf("encrypted metadata\n");
-
-#ifdef NPDRM
- memcpy(&output_self_data[metadata_offset], npdrm_keypair_e, sizeof(md_header));
-#else
- AES_set_encrypt_key(KEY(erk), 256, &aes_key);
- memcpy(iv, KEY(riv), 16);
- AES_cbc_encrypt(&output_self_data[metadata_offset], &output_self_data[metadata_offset], 0x40, &aes_key, iv, AES_ENCRYPT);
- printf("encrypted keys\n");
-#endif
-
+ memcpy(&output_self_data[metadata_offset], KEY(keypair_e), sizeof(md_header));
+ /*AES_set_encrypt_key(KEY(erk), 256, &aes_key);
+ AES_cbc_encrypt(&output_self_data[metadata_offset], &output_self_data[metadata_offset], 0x40, &aes_key, iv, AES_ENCRYPT);*/
#else
printf("NO_CRYPT is enabled...self is broken\n");
#endif
@@ -1,11 +1,14 @@ linux: make_self.c package_finalize.c
- gcc make_self.c -lgmp -lcrypto -lz -o build/make_self_npdrm
+ gcc make_self.c -DNPDRM -lgmp -lcrypto -lz -o build/make_self_npdrm
+ gcc make_self.c -lgmp -lcrypto -lz -o build/make_self
gcc package_finalize.c -lcrypto -o build/package_finalize
windows: make_self.c package_finalize.c
- gcc make_self.c -I"C:\Program Files (x86)\GnuWin32\include" -L"C:\OpenSSL-Win32\lib\MinGW" -lgmp -leay32 "C:\Program Files (x86)\GnuWin32\bin\zlib1.dll" -o build/make_self_npdrm.exe
+ gcc make_self.c -DNPDRM -I"C:\Program Files (x86)\GnuWin32\include" -L"C:\OpenSSL-Win32\lib\MinGW" -lgmp -leay32 "C:\Program Files (x86)\GnuWin32\bin\zlib1.dll" -o build/make_self_npdrm.exe
+ gcc make_self.c -I"C:\Program Files (x86)\GnuWin32\include" -L"C:\OpenSSL-Win32\lib\MinGW" -lgmp -leay32 "C:\Program Files (x86)\GnuWin32\bin\zlib1.dll" -o build/make_self.exe
gcc package_finalize.c -L"C:\OpenSSL-Win32\lib\MinGW" -leay32 -o build/package_finalize.exe
osx: make_self.c package_finalize.c
- gcc make_self.c -I/opt/local/include -I/opt/local -L/opt/local/lib -lgmp -lcrypto -lz -o build/make_self_npdrm
+ gcc make_self.c -DNPDRM -I/opt/local/include -I/opt/local -L/opt/local/lib -lgmp -lcrypto -lz -o build/make_self_npdrm
+ gcc make_self.c -I/opt/local/include -I/opt/local -L/opt/local/lib -lgmp -lcrypto -lz -o build/make_self
gcc package_finalize.c -I/opt/local/include -I/opt/local -L/opt/local/lib -lcrypto -o build/package_finalize
|