D1st0rt wrote: |
Without looking at it, I would wonder if byte order perhaps had something to do with it? |
Code: Show/Hide int do_dec(EncData *ed, byte *data, int len) { //packet to small if(len < 13) return 0; //my key holds key byte *mykey = (byte*)ed->key; //display IV if its there #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> CLIENTKEY"); dump_pk(mykey,16); lm->Log(L_DRIVEL, "<enc_ss2> END KEY"); #endif //get IV byte *IV = data; byte *Content = data+8; byte* moreData = amalloc(len-8); memcpy(moreData, Content, len-8); //init and clear decryption key byte deckey[24]; memset(&deckey[0], 0, 24); byte* deckeypos = &deckey[0]; memcpy (deckeypos, mykey, 16); memcpy (deckeypos+16, IV, 8); #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> IV"); dump_pk(deckeypos,24); lm->Log(L_DRIVEL, "<enc_ss2> END IV"); #endif struct MD5Context ctx; byte out[16]; MD5Init(&ctx); MD5Update(&ctx, deckeypos, 24); MD5Final(out, &ctx); #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> MD5"); dump_pk(&out[0],16); lm->Log(L_DRIVEL, "<enc_ss2> END MD5"); #endif //out contains the sessionkey #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> DATA TO DECRYPT"); dump_pk(moreData,len-8); lm->Log(L_DRIVEL, "<enc_ss2> END DATA TO DECRYPT"); #endif rc4_skip((byte*)&out, 16, 1024,moreData,len-8); memcpy(data,moreData+4,len-12); afree(moreData); #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> DECRYPTED DATA"); dump_pk(data,len-12); lm->Log(L_DRIVEL, "<enc_ss2> END DECRYPTED DATA"); #endif return len-12; } int Decrypt(Player *p, byte *data, int len) { #ifdef CFG_LOG_CONNECTION lm->Log(L_DRIVEL, "<enc_ss2> Decrypt %i",len); #endif EncData *ed, **p_ed = PPDATA(p, enckey); pthread_mutex_lock(&mtx); ed = *p_ed; pthread_mutex_unlock(&mtx); return ed ? do_dec(ed, data, len) : len; } |
Code: Show/Hide int do_dec(EncData *ed, byte *data, int len) |
Code: Show/Hide local int do_dec(EncData *ed, byte *data, int len) |
Mine GO BOOM wrote: |
GCC compiler attempted to find the best do_dec when compiling that file, and it found correct one. Windows's compiler attempted to find the best one, and it sounds like it found the vie encryption's do_dec, which is not local. It failed the tests in there, and returned nothing. |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
I didn't understand that...
The way you explained it, it would have failed on windows and not on linux. |
Doc Flabby wrote: |
I don't know much about C so i'm guessing something i've done with the pointers is dangerous so linux doesn't like it but windows doesn't care. |
Animate Dreams wrote: |
[..]
I've always heard that Linux cared much less about things like that. That Linux didn't try to protect the OS from the user. So wouldn't that go the opposite way? |