This commit is contained in:
JimmyZ 2017-08-30 18:46:20 +08:00
parent b0adfd3df1
commit 5c56c3fdb7
17 changed files with 22 additions and 5 deletions

View File

@ -11,3 +11,4 @@ $(PNAME) : $(OBJS)
clean :
rm $(PNAME) *.o

View File

@ -10,3 +10,4 @@ Only tested with [mingw-w64-x86_64](https://mingw-w64.org/)
AES and SHA1 code from [mbed TLS](https://github.com/ARMmbed/mbedtls/) which is Apache 2.0 license,
so I guess this project becomes Apache 2.0 licensed automatically?
or only related files are Apache 2.0? I'm not sure.

View File

@ -232,3 +232,4 @@ void aes_encrypt_128( const uint32_t rk[RK_LEN],
PUT_UINT32_LE( X2, output, 8 );
PUT_UINT32_LE( X3, output, 12 );
}

View File

@ -93,3 +93,4 @@ void aes_encrypt_128(const uint32_t rk[RK_LEN], uint32_t *io) {
io[2] = X2;
io[3] = X3;
}

View File

@ -138,3 +138,4 @@ __constant static const uint32_t RCON[10] =
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x0000001B, 0x00000036
};

View File

@ -74,4 +74,5 @@ inline void dsi_make_ctr(u8 *ctr, u8 *emmc_cid, u64 offset) {
PUT_UINT32_BE(buf[3], emmc_cid, 12);
add_128_64((u64*)emmc_cid, offset);
byte_reverse_16(ctr, emmc_cid);
}
}

View File

@ -43,3 +43,4 @@ __kernel void test_console_id(
*out = console_id;
}
}

View File

@ -30,4 +30,5 @@ __kernel void test_emmc_cid(
if (xor_l == *(u64*)ctr && xor_h == *(u64*)(ctr + 8)) {
*out = get_global_id(0);
}
}
}

View File

@ -22,7 +22,7 @@ __kernel void sha1_16_test(
}
#endif
}
#define AES_BLOCK_SIZE 16
__kernel void aes_128_ecb_test(
@ -47,3 +47,4 @@ __kernel void aes_128_ecb_test(
}
#endif
}

View File

@ -15,3 +15,4 @@ void aes_gen_tables(void);
void aes_set_key_enc_128(unsigned int rk[RK_LEN], const unsigned char *key);
void aes_encrypt_128(const unsigned int rk[8], const unsigned char input[16], unsigned char output[16]);

3
dsi.h
View File

@ -117,4 +117,5 @@ static inline void dsi_make_xor(u8 *xor, const u8 *src, const u8 *ver) {
u8 target_xor[16];
xor_128((u64*)target_xor, (u64*)src, (u64*)ver);
byte_reverse_16(xor, target_xor);
}
}

1
ocl.h
View File

@ -50,3 +50,4 @@ void ocl_get_device(cl_platform_id *p_platform_id, cl_device_id *p_device_id);
cl_program ocl_build_from_sources(
unsigned num_sources, const char *source_names[],
cl_context context, cl_device_id device_id, const char * options);

View File

@ -287,3 +287,4 @@ int ocl_brute_emmc_cid(const cl_uchar *console_id, cl_uchar *emmc_cid,
clReleaseContext(context);
return !out;
}

View File

@ -196,3 +196,4 @@ int ocl_test() {
return succeed;
}

View File

@ -237,3 +237,4 @@ cl_program ocl_build_from_sources(
free(source_sizes);
return program;
}

View File

@ -175,4 +175,5 @@ char * trim(char *in) {
*last_non_ws = '\0';
}
return first_non_ws;
}
}

View File

@ -37,3 +37,4 @@ int cpu_has_rdrand();
int rdrand_fill(unsigned long long *p, size_t size);
char * trim(char *in);