forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to load decrypted modules ?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
johnmph



Joined: 23 Jul 2005
Posts: 119

PostPosted: Tue Aug 09, 2005 12:36 am    Post subject: How to load decrypted modules ? Reply with quote

Hello, i have decrypted a module with decrypter sample of PSPSDK.

I have try to load it with sceKernelLoadModule but it doesn't work, why ?

Is there a function to load decrypted module (ELF) ?

Thanks.
Back to top
View user's profile Send private message
Agoln



Joined: 08 Jun 2005
Posts: 326
Location: Fort Wayne, IN

PostPosted: Tue Aug 09, 2005 12:53 am    Post subject: Reply with quote

when it sets user mode, make sure you are in kernel mode.
_________________
Lego of my Ago!
Back to top
View user's profile Send private message AIM Address
johnmph



Joined: 23 Jul 2005
Posts: 119

PostPosted: Tue Aug 09, 2005 1:10 am    Post subject: Reply with quote

Agoln wrote:
when it sets user mode, make sure you are in kernel mode.


I am in user mode with kernel memory access and pspSdkInstallNoDeviceCheckPatch(); is called in _init function.

It's works with encrypted module but i have a SCE_KERNEL_ERROR_UNSUPPORTED_PRX_TYPE error with decrypted module.
Back to top
View user's profile Send private message
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Tue Aug 09, 2005 1:32 am    Post subject: Reply with quote

> Is there a function to load decrypted module (ELF) ?
The system can be tricked (along the lines of what you are trying to do)
Kernel memory module flag (0x1000) AND kernel thread required for most of this loading trickery.
http://forums.ps2dev.org/viewtopic.php?p=16537
(look for "LoadModule tips and tricks")

In general most PRXs must be loaded from a kernel thread. You can use them later from a user thread.
This can cause unrelated problems (BTW: I believe it is the root cause of DHCP not working), and the library entries can be tricky.

Which PRX are you loading, and what are you doing special ? (ie. there may be more specific advice)
----
FWIW:
The official system wants support libraries to be encrypted (for obvious reasons).
IMHO, if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image. No need for "pspSdkInstallNoDeviceCheckPatch"
[ie. if trying to tweek a loadable PRX library, I suggest changing the library directly instead of changing the entire system]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Aug 09, 2005 3:45 am    Post subject: Reply with quote

Well I can probably guess why it is failing, you are trying to load a plain text kernel module which by default will not work. You can load plain text user modules such as pspnet but the kernel will refuse anything with the 0x1000 attribute which is born out if you install a kprintf handler.

As psppet says there is probably littlle real reason why you can't just load the original encrypted form, though if you really really really have to do it then (seeing as I am in a good mood) call pspSdkInstallNoPlainModuleCheckPatch in kernel mode to disable the check.
Back to top
View user's profile Send private message
johnmph



Joined: 23 Jul 2005
Posts: 119

PostPosted: Tue Aug 09, 2005 4:17 am    Post subject: Reply with quote

PspPet wrote:
> Is there a function to load decrypted module (ELF) ?
The system can be tricked (along the lines of what you are trying to do)
Kernel memory module flag (0x1000) AND kernel thread required for most of this loading trickery.
http://forums.ps2dev.org/viewtopic.php?p=16537
(look for "LoadModule tips and tricks")

In general most PRXs must be loaded from a kernel thread. You can use them later from a user thread.
This can cause unrelated problems (BTW: I believe it is the root cause of DHCP not working), and the library entries can be tricky.

Which PRX are you loading, and what are you doing special ? (ie. there may be more specific advice)
----
FWIW:
The official system wants support libraries to be encrypted (for obvious reasons).
IMHO, if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image. No need for "pspSdkInstallNoDeviceCheckPatch"
[ie. if trying to tweek a loadable PRX library, I suggest changing the library directly instead of changing the entire system]


In your tricks, you says :

"You can load encrypted files from the MS, but that leads to potential copyright problems.
Trying to load unencrypted PRX files fails [can't load a "PLAIN" module]"

Could the new function pspSdkInstallNoPlainModuleCheckPatch() of the PSPSDK solve the problem?

I have modify PRXdecrypt sample :

/* Check if we managed to decrypt the file */
if(*(unsigned short *)(check+0x5a) & 1)
{
/* Set decrypt buffer pointer */
*(unsigned int*)(check+0x24) = (unsigned int) g_decrypt_buf;
sceKernelCheckExecFile(g_data, check);
//output = g_decrypt_buf;
output = g_data;
}
else
output = g_data;

for writing g_data buffer instead g_decrypt_buf (decompressed but not decrypted) and i have noted only chnnlsv.prx (VSH module) module is not encrypted.

I think we can load decrypted modules but they must be compressed (PSP format) because chnnlsv.prx is in flash0 and he can be loaded.

"if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image"

I will try that, thanks for your help.


Last edited by johnmph on Tue Aug 09, 2005 5:11 am; edited 1 time in total
Back to top
View user's profile Send private message
johnmph



Joined: 23 Jul 2005
Posts: 119

PostPosted: Tue Aug 09, 2005 4:43 am    Post subject: Reply with quote

TyRaNiD wrote:
Well I can probably guess why it is failing, you are trying to load a plain text kernel module which by default will not work. You can load plain text user modules such as pspnet but the kernel will refuse anything with the 0x1000 attribute which is born out if you install a kprintf handler.

As psppet says there is probably littlle real reason why you can't just load the original encrypted form, though if you really really really have to do it then (seeing as I am in a good mood) call pspSdkInstallNoPlainModuleCheckPatch in kernel mode to disable the check.


I had not seen your post message, i have used pspSdkInstallNoPlainModuleCheckPatch but i have a black screen and the psp shutdown.

I will try to load encrypted module and then modify functions in memory if i found address where loaded module is stored.

Thanks
Back to top
View user's profile Send private message
johnmph



Joined: 23 Jul 2005
Posts: 119

PostPosted: Tue Aug 09, 2005 5:43 am    Post subject: Reply with quote

"for writing g_data buffer instead g_decrypt_buf (decompressed but not decrypted) and i have noted only chnnlsv.prx (VSH module) module is not encrypted."

I made an error, i think that chnnlsv.prx is encrypted but not compressed.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group