diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt index 70f5afd06..a4f13aa2f 100644 --- a/indra/llimage/CMakeLists.txt +++ b/indra/llimage/CMakeLists.txt @@ -19,7 +19,6 @@ include_directories( ) set(llimage_SOURCE_FILES - aes.cpp llimagebmp.cpp llimage.cpp llimagedxt.cpp @@ -34,7 +33,7 @@ set(llimage_SOURCE_FILES set(llimage_HEADER_FILES CMakeLists.txt - aes.h + llimage.h llimagebmp.h llimagedxt.h diff --git a/indra/llimage/llimagemetadatareader.cpp b/indra/llimage/llimagemetadatareader.cpp index 23f10a351..2daa3ebbf 100644 --- a/indra/llimage/llimagemetadatareader.cpp +++ b/indra/llimage/llimagemetadatareader.cpp @@ -1,11 +1,7 @@ // #include "linden_common.h" #include "llimagemetadatareader.h" -#include "aes.h" -const unsigned long EMKDU_AES_KEY[] = {0x7810001, 0x0FEB67863, 0x12B03F6E, 0x0C16665CC, 0x0C1AC9681, 0x0F70B663B}; -//const unsigned char EMKDU_AES_KEY[] = {0x01,0x00,0x81,0x07,0x63,0x78,0xB6,0xFE,0x6E,0x3F,0xB0,0x12,0xCC,0x65,0x66,0xC1, -//0x81,0x96,0xAC,0xC1,0x3B,0x66,0x0B,0xF7}; -//#define COMMENT_DEBUGG1ING +//#define COMMENT_DEBUGGING LLJ2cParser::LLJ2cParser(U8* data,int data_size) { if(data && data_size) @@ -53,20 +49,20 @@ std::vector LLJ2cParser::GetNextComment() U8 marker_type = nextChar(); if (marker_type == 0x4f) { - continue; + continue; } if (marker_type == 0x90) { - //llinfos << "FOUND 0x90" << llendl; - break; //return empty vector + //llinfos << "FOUND 0x90" << llendl; + break; //return empty vector } if (marker_type == 0x64) { - //llinfos << "FOUND 0x64 COMMENT SECTION" << llendl; - S32 len = ((S32)nextChar())*256 + (S32)nextChar(); - if (len > 3) content = nextCharArray(len - 2); - return content; + //llinfos << "FOUND 0x64 COMMENT SECTION" << llendl; + S32 len = ((S32)nextChar())*256 + (S32)nextChar(); + if (len > 3) content = nextCharArray(len - 2); + return content; } } } @@ -78,80 +74,59 @@ std::vector LLJ2cParser::GetNextComment() std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size) { LLJ2cParser parser = LLJ2cParser(data,data_size); - std::string result; while(1) { std::vector comment = parser.GetNextComment(); if (comment.empty()) break; //exit loop +#ifndef COMMENT_DEBUGGING if (comment[1] == 0x00 && comment.size() == 130) { - bool xorComment = true; - //llinfos << "FOUND PAYLOAD" << llendl; - std::vector payload(128); - S32 i; - memcpy(&(payload[0]), &(comment[2]), 128); - //std::copy(comment.begin()+2,comment.end(),payload.begin()); - //lets check XOR Cipher first - if (payload[2] == payload[127]) - { - // emkdu.dll - for (i = 4; i < 128; i += 4) - { - payload[i] ^= payload[3]; - payload[i + 1] ^= payload[1]; - payload[i + 2] ^= payload[0]; - payload[i + 3] ^= payload[2]; - } - } - else if (payload[3] == payload[127]) - { - // emkdu.dll or onyxkdu.dll - for (i = 4; i < 128; i += 4) - { - payload[i] ^= payload[2]; - payload[i + 1] ^= payload[0]; - payload[i + 2] ^= payload[1]; - payload[i + 3] ^= payload[3]; - } - } - else - { - xorComment = false; - } - if(!xorComment) - { - //this is terrible i know - std::vector dataout(128); - AES aes; - aes.SetParameters(192); - aes.StartDecryption(reinterpret_cast(EMKDU_AES_KEY)); - aes.Decrypt(&(payload[0]),&(dataout[0]),16); - //payload.clear(); - //memcpy(&(payload[0]),&(dataout[0]),dataout.size()); - for (i = 0 ; i < 128; ++i) - { - if (dataout[i] == 0) break; - } - if(i == 0) continue; - if(result.length() > 0) - result.append(" "); - result.assign(dataout.begin(),dataout.begin()+i); - } - else - { - for (i = 4 ; i < 128; ++i) - { - if (payload[i] == 0) break; - } - if(i < 4) continue; - if(result.length() > 0) - result.append(" "); - result.append(payload.begin()+4,payload.begin()+i); - } - //llinfos << "FOUND COMMENT: " << result << llendl; + //llinfos << "FOUND PAYLOAD" << llendl; + std::vector payload(128); + S32 i; + memcpy(&(payload[0]), &(comment[2]), 128); + //std::copy(comment.begin()+2,comment.end(),payload.begin()); + if (payload[2] == payload[127]) + { + // emkdu.dll + for (i = 4; i < 128; i += 4) + { + payload[i] ^= payload[3]; + payload[i + 1] ^= payload[1]; + payload[i + 2] ^= payload[0]; + payload[i + 3] ^= payload[2]; + } + } + else if (payload[3] == payload[127]) + { + // emkdu.dll or onyxkdu.dll + for (i = 4; i < 128; i += 4) + { + payload[i] ^= payload[2]; + payload[i + 1] ^= payload[0]; + payload[i + 2] ^= payload[1]; + payload[i + 3] ^= payload[3]; + } + } + else + { + break;//exit loop + } + for (i = 4; i < 128; ++i) + { + if (payload[i] == 0) break; + } + if(i < 4) break; + std::string result(payload.begin()+4,payload.begin()+i); + //llinfos << "FOUND COMMENT: " << result << llendl; + return result; } +#else + std::string result(comment.begin(),comment.end()); + return result; +#endif } //end of loop - return result; + return ""; } // diff --git a/indra/newview/llsavedlogins.cpp b/indra/newview/llsavedlogins.cpp index 4b43c3c40..3609a17e9 100644 --- a/indra/newview/llsavedlogins.cpp +++ b/indra/newview/llsavedlogins.cpp @@ -57,14 +57,6 @@ LLSavedLoginEntry::LLSavedLoginEntry(const LLSD& entry_data) { throw std::invalid_argument("Missing grid key."); } - if (!entry_data.has("macaddress")) - { - throw std::invalid_argument("Missing MAC address."); - } - if (!entry_data.has("volumeid")) - { - throw std::invalid_argument("Missing volume ID."); - } if (!entry_data.has("password")) { throw std::invalid_argument("Missing password key."); @@ -88,9 +80,10 @@ LLSavedLoginEntry::LLSavedLoginEntry(const LLSD& entry_data) mEntry = entry_data; } -LLSavedLoginEntry(const EGridInfo gridinfo, const std::string& firstname, - const std::string& lastname, const std::string& password, - const std::string& macaddress, const std::string& volumeid) +LLSavedLoginEntry::LLSavedLoginEntry(const EGridInfo grid, + const std::string& firstname, + const std::string& lastname, + const std::string& password) { mEntry.clear(); mEntry.insert("grid", LLSD(grid)); diff --git a/indra/newview/llsavedlogins.h b/indra/newview/llsavedlogins.h index 4423ea4e1..4b33ad891 100644 --- a/indra/newview/llsavedlogins.h +++ b/indra/newview/llsavedlogins.h @@ -34,7 +34,6 @@ #define LLLOGINHISTORY_H #include "llviewernetwork.h" -#include class LLSD; @@ -58,8 +57,7 @@ public: * @param password Munged password of PASSWORD_HASH_LENGTH. */ LLSavedLoginEntry(const EGridInfo gridinfo, const std::string& firstname, - const std::string& lastname, const std::string& password, - const std::string& macaddress, const std::string& volumeid); + const std::string& lastname, const std::string& password); /** * @brief Returns the display name of the grid ID associated with this entry. * @return String containing grid name. @@ -170,38 +168,6 @@ public: * @param value Munged password suitable for login. */ void setPassword(const std::string& value); - /** - * @brief Returns the MAC address associated with this login entry. - * @return First name as string. - */ - const std::string getMACAddress() const - { - return (mEntry.has("macaddress") ? mEntry.get("macaddress").asString() : std::string()); - } - /** - * @brief Sets the MAC address associated with this login entry. - * @param value String value to set. - */ - void setMACAddress(std::string& value) - { - mEntry.insert("macaddress", LLSD(value)); - } - /** - * @brief Returns the first name associated with this login entry. - * @return First name as string. - */ - const std::string getVolumeID() const - { - return (mEntry.has("volumeid") ? mEntry.get("volumeid").asString() : std::string()); - } - /** - * @brief Sets the first name associated with this login entry. - * @param value String value to set. - */ - void setVolumeID(std::string& value) - { - mEntry.insert("volumeid", LLSD(value)); - } /** * @brief Returns the login entry as an LLSD for serialization. * *return LLSD containing login entry details.