Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define SCE_KERNEL_SYSROOT_SELF_INDEX_RMAUTH_SM 1
- typedef struct SceSblSmCommContext130 {
- uint32_t unk_0;
- uint32_t self_type; // 2 - user = 1 / kernel = 0
- char data0[0x90]; //hardcoded data
- char data1[0x90];
- uint32_t pathId; // 2 (2 = os0)
- uint32_t unk_12C;
- } SceSblSmCommContext130;
- typedef struct SceSblSmCommPair {
- uint32_t unk_0;
- uint32_t unk_4;
- } SceSblSmCommPair;
- typedef struct SceSblSmCommMsifData {
- unsigned int unk00;
- unsigned int unk04;
- unsigned int unk08;
- unsigned int unk0C;
- unsigned int unk10;
- unsigned int unk14;
- unsigned int unk18;
- unsigned int unk1C;
- } SceSblSmCommMsifData;
- extern int ksceSblSmCommStartSmFromData(int priority, const char *elf_data, int elf_size, int num1, SceSblSmCommContext130 *ctx, int *id);
- extern int ksceSblSmCommStopSm(int id, SceSblSmCommPair *res);
- extern int ksceSblSmCommCallFunc(int id, int command_id, int *f00d_resp, void *data, int size);
- static const unsigned char ctx_130_data[0x90] =
- {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x28, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0xC0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
- 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x09,
- 0x80, 0x03, 0x00, 0x00, 0xC3, 0x00, 0x00, 0x00, 0x80, 0x09,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
- static int sblcomm_start_rmauth_sm(int *rmauth_sm_id)
- {
- int ret;
- SceKernelSysrootSelfInfo self_info;
- SceSblSmCommContext130 smcomm_ctx;
- memset(&self_info, 0, sizeof(self_info));
- self_info.size = sizeof(self_info);
- ret = ksceSysrootGetSelfInfo(SCE_KERNEL_SYSROOT_SELF_INDEX_RMAUTH_SM, &self_info);
- if (ret < 0)
- return ret;
- memset(&smcomm_ctx, 0, sizeof(smcomm_ctx));
- memcpy(smcomm_ctx.data0, ctx_130_data, 0x90);
- smcomm_ctx.pathId = 2;
- smcomm_ctx.self_type = (smcomm_ctx.self_type & 0xFFFFFFF0) | 2;
- ret = ksceSblSmCommStartSmFromData(0, self_info.self_data,
- self_info.self_size, 0,
- &smcomm_ctx, rmauth_sm_id);
- if (ret < 0)
- return ret;
- return 0;
- }
- static int f00d_rmauth_sm_cmd_1(int *res)
- {
- int ret;
- int rmauth_sm_id;
- int f00d_resp;
- SceSblSmCommPair stop_res;
- SceSblSmCommMsifData data;
- ret = sblcomm_start_rmauth_sm(&rmauth_sm_id);
- if (ret < 0)
- return ret;
- ret = ksceSblSmCommCallFunc(rmauth_sm_id, 1, &f00d_resp, &data, 0x20);
- if (ret < 0)
- return ret;
- ret = ksceSblSmCommStopSm(rmauth_sm_id, &stop_res);
- if (ret < 0)
- return ret;
- *res = data.unk10;
- return f00d_resp;
- }
- static int f00d_rmauth_sm_cmd_2(uint32_t seed[8])
- {
- int ret;
- int rmauth_sm_id;
- int f00d_resp;
- SceSblSmCommPair stop_res;
- ret = sblcomm_start_rmauth_sm(&rmauth_sm_id);
- if (ret < 0)
- return ret;
- ret = ksceSblSmCommCallFunc(rmauth_sm_id, 2, &f00d_resp, seed, 0x20);
- if (ret < 0)
- return ret;
- ret = ksceSblSmCommStopSm(rmauth_sm_id, &stop_res);
- if (ret < 0)
- return ret;
- return f00d_resp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement