Well since the thread has been revived I might as well ask my question here.
Has anyone ever had problems using mp3lib after using ME to do another task. In AirCrack-PSP for the wpa cracker I use ME to give it a little boost, so for every passphrase tested I do CallME with the crack function then KillME once its done (this is done in a seperate thread from the main thread and is deleted after KillME). After you run the wpa cracker and try using the scanner it just freezes at sceMp3InitResource(); (when scaner finds a new AP and attemps to beep, this is also in a seperate thread so the psp isnt really frozen but stuck in that function)
I will post some code:
Where variables are defined (at begining of app)
Code: Select all
//Do this once. because i think it causes memory leaks.
mei = malloc_64(sizeof(struct me_struct));
mei = (volatile struct me_struct *)(((int) mei) | 0x40000000);
me_param = malloc_64(sizeof(struct me_param_struct));
//me_param = (volatile struct me_param_struct *)(((int) me_param) | 0x40000000);
sceKernelDcacheWritebackInvalidateAll();
Where ME is initialized in the main thread
Code: Select all
else if (!strcasecmp(files[y + scrllpos].d_name+(strlen(files[y + scrllpos].d_name)-5), ".dict")) {
PrinToBox(LINESPACING, AUTOSCROLL, COPYPRINT, "Opening dict file %s\n", files[y + scrllpos].d_name);
fp = fopen(files[y + scrllpos].d_name, "rb");
if (fp == NULL) {
PrinToBox(LINESPACING, AUTOSCROLL, PRINT, "Error opening dictfile %s\n", files[y + scrllpos].d_name);
goto failed;
}
PrinToBox(LINESPACING, AUTOSCROLL, COPYPRINT, "Starting dictionary attack. Please be patient.\n");
sceKernelDelayThread(1500000);
gettimeofday(&start, 0);
if (InitME(mei) != 0)
{
PrinToBox(LINESPACING, AUTOSCROLL, PRINT, "Couldn't initialize MediaEngine Instance\n");
goto failed;
}
SceUID me_attack = sceKernelCreateThread("me_dict_attack_thread", me_dict_attack_thread, 0x30, 512 * 1024, PSP_THREAD_ATTR_USER, NULL);
if (me_attack < 0) {
PrinToBox(LINESPACING, AUTOSCROLL, PRINT, "Could not create me_dict_attack_thread!\n");
goto failed;
}
sceKernelStartThread(me_attack, 0, NULL);
}
while ((!keyfound) && (!stop) && (me_done+done != 1)) {
sceKernelDelayThread(100000);
sceCtrlReadBufferPositive(&pad, 1);
if((pad.Buttons & PSP_CTRL_CIRCLE) || (stop)) {
stop = 1; //Needs to be invalidated for the ME to see it
sceKernelDcacheWritebackInvalidateAll();
sceKernelDelayThread(300000);
}
}
ME function and thread
Code: Select all
int me_attack(){
calc_pmk((char*)me_param->me_word, (char*)me_param->me_essid, (unsigned char*)me_param->me_pmk);
dcache_wbinv_all();
return 0;
}
int me_dict_attack_thread(SceSize args, void *argp){
u8 ptk[80];
u8 keymic[16];
char tpassphrase[MAXPASSLEN+1];
int fret;
sprintf((char*)me_param->me_essid, ssid);
while (!keyfound && !stop) {
while(eventwarn) {
cracking = 0;
sceKernelDelayThread(100000);
}
cracking = 1;
totalwords++;
menu.statusbox[0] = R_NULL;
PrinToBox(LINESPACING, AUTOSCROLL, COPY, "Reading word #%d, %d tested, %d invalid\n", totalwords+1, wordstested, badwords);
fret = nextword(tpassphrase, fp);
if (fret < 8 || fret > 63) {
if (fret == -1) {
PrinToBox(LINESPACING, AUTOSCROLL, COPYPRINT, "EOF!\n");
break;
}
else if (fret == -2) {
badwords++;
PrinToBox(LINESPACING, AUTOSCROLL, COPYPRINT, "Error reading file!\n");
continue;
}
else {
badwords++;
PrinToBox(LINESPACING, AUTOSCROLL, COPY, "Invalid passphrase length: (%d) %s\n", strlen(tpassphrase), tpassphrase);
continue;
}
}
wordstested++;
PrinToBox(LINESPACING, AUTOSCROLL, COPY, "Calculating PMK for \"%s\"\n", tpassphrase);
sprintf((char*)me_param->me_word, tpassphrase);
sceKernelDcacheWritebackInvalidateRange((struct me_param_struct*)me_param, sizeof(struct me_param_struct));
if (CallME(mei, (int)me_attack, 0) < 0) {
PrinToBox(LINESPACING, AUTOSCROLL, PRINT, "Error calling CallME.\n");
me_done = 1;
}
PrinToBox(LINESPACING, AUTOSCROLL, COPY, "Calculating PTK with collected data and PMK.\n");
wpa_pmk_to_ptk((unsigned char*)me_param->me_pmk, cdata.aa, cdata.spa, cdata.anonce, cdata.snonce, ptk, sizeof(ptk));
PrinToBox(LINESPACING, AUTOSCROLL, COPYPRINT, "Calculating hmac-MD5 Key MIC for this frame.\n");
hmac_hash(cdata.ver, ptk, 16, cdata.eapolframe, sizeof(cdata.eapolframe), keymic);
if (memcmp(&cdata.keymic, &keymic, sizeof(keymic)) == 0) {
strcpy(passphrase, tpassphrase);
keyfound = 1;
break;
}
cracking = 0;
}
KillME(mei);
sceKernelDcacheWritebackAll();
//sceKernelIcacheClearAll();
me_done = 1;
sceKernelExitDeleteThread(0);
return 0;
}
EDIT:
Oh and JF could you post a link toan archive containing the source you posted above and mediaengine.prx source, seems I dont have the latest.