aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-08-30 21:42:45 +1000
committerDavid Walter Seikel2013-08-30 21:42:45 +1000
commit56a1de48ee43bfacbd3ef2859f392082a26bc814 (patch)
tree03bd6092dab42985e536b84d2f311a3a12e4edb4 /linden/indra/llmessage
parentAdded a licensing note about gpg.vs, as used to build OTR on Windows. (diff)
parentMerge remote-tracking branch 'origin/next' into WL-refactor (diff)
downloadmeta-impy-56a1de48ee43bfacbd3ef2859f392082a26bc814.zip
meta-impy-56a1de48ee43bfacbd3ef2859f392082a26bc814.tar.gz
meta-impy-56a1de48ee43bfacbd3ef2859f392082a26bc814.tar.bz2
meta-impy-56a1de48ee43bfacbd3ef2859f392082a26bc814.tar.xz
Merge remote-tracking branch 'imprudence/next' into next
Unless otherwise stated, Imprudence changes accepted. The three images seem to be the same. Conflicts: .gitignore linden/indra/develop.py linden/indra/llcommon/llsdserialize_xml.cpp linden/indra/newview/CMakeLists.txt Manually combined MOAP, OTR, and WL changes from both. linden/indra/newview/app_settings/default_grids.xml Manually merged the grid collection. Also updated IG info. linden/indra/newview/hippoupdate.cpp linden/indra/newview/llettherebelight.cpp Just used the Imprudence copy. linden/indra/newview/llviewermessage.cpp Keep unbranding. linden/indra/newview/llvoavatar.cpp Manually merge client tags. linden/indra/newview/res/viewerRes.rc Manually merge version from Impy. linden/indra/newview/skins/dark/colors_base.xml Keep unbranding. linden/indra/newview/skins/default/html/unabletoconnect.png linden/indra/newview/skins/default/textures/icon_top_pick.tga linden/indra/newview/skins/default/xui/en-us/floater_about.xml Manual merging of contributors. linden/indra/newview/skins/gemini/colors_base.xml Keep unbranding. linden/indra/newview/skins/gemini/textures/icon_top_pick.tga linden/indra/newview/viewer_manifest.py Manually merged boost, gstreamer, OTR, and name. linden/indra/newview/viewerinfo.cpp Manually merge the comment.
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/llblowfishcipher.cpp68
-rw-r--r--linden/indra/llmessage/llhttpassetstorage.cpp3
2 files changed, 62 insertions, 9 deletions
diff --git a/linden/indra/llmessage/llblowfishcipher.cpp b/linden/indra/llmessage/llblowfishcipher.cpp
index f24d103..3eebfad 100644
--- a/linden/indra/llmessage/llblowfishcipher.cpp
+++ b/linden/indra/llmessage/llblowfishcipher.cpp
@@ -73,13 +73,13 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
73 unsigned char initial_vector[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 73 unsigned char initial_vector[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
74 EVP_EncryptInit_ex(&context, NULL, NULL, mSecret, initial_vector); 74 EVP_EncryptInit_ex(&context, NULL, NULL, mSecret, initial_vector);
75 75
76 int blocksize = EVP_CIPHER_CTX_block_size(&context); 76// int blocksize = EVP_CIPHER_CTX_block_size(&context);
77 int keylen = EVP_CIPHER_CTX_key_length(&context); 77// int keylen = EVP_CIPHER_CTX_key_length(&context);
78 int iv_length = EVP_CIPHER_CTX_iv_length(&context); 78// int iv_length = EVP_CIPHER_CTX_iv_length(&context);
79 lldebugs << "LLBlowfishCipher blocksize " << blocksize 79// lldebugs << "LLBlowfishCipher blocksize " << blocksize
80 << " keylen " << keylen 80// << " keylen " << keylen
81 << " iv_len " << iv_length 81// << " iv_len " << iv_length
82 << llendl; 82// << llendl;
83 83
84 int output_len = 0; 84 int output_len = 0;
85 int temp_len = 0; 85 int temp_len = 0;
@@ -113,7 +113,59 @@ ERROR:
113// virtual 113// virtual
114U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) 114U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
115{ 115{
116 llerrs << "LLBlowfishCipher decrypt unsupported" << llendl; 116 if (!src || !src_len || !dst || !dst_len) return 0;
117 if (src_len > dst_len) return 0;
118
119 // OpenSSL uses "cipher contexts" to hold encryption parameters.
120 EVP_CIPHER_CTX context;
121 EVP_CIPHER_CTX_init(&context);
122
123 // We want a blowfish cyclic block chain cipher, but need to set
124 // the key length before we pass in a key, so call EncryptInit
125 // first with NULLs.
126 EVP_DecryptInit_ex(&context, EVP_bf_cbc(), NULL, NULL, NULL);
127 EVP_CIPHER_CTX_set_key_length(&context, (int)mSecretSize);
128
129 // Complete initialization. Per EVP_EncryptInit man page, the
130 // cipher pointer must be NULL. Apparently initial_vector must
131 // be 8 bytes for blowfish, as this is the block size.
132 unsigned char initial_vector[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
133 EVP_DecryptInit_ex(&context, NULL, NULL, mSecret, initial_vector);
134
135// int blocksize = EVP_CIPHER_CTX_block_size(&context);
136// int keylen = EVP_CIPHER_CTX_key_length(&context);
137// int iv_length = EVP_CIPHER_CTX_iv_length(&context);
138// lldebugs << "LLBlowfishCipher blocksize " << blocksize
139// << " keylen " << keylen
140// << " iv_len " << iv_length
141// << llendl;
142
143 int output_len = 0;
144 int temp_len = 0;
145 if (!EVP_DecryptUpdate(&context,
146 dst,
147 &output_len,
148 src,
149 src_len))
150 {
151 llwarns << "LLBlowfishCipher::decrypt EVP_DecryptUpdate failure" << llendl;
152 goto ERROR;
153 }
154
155 // There may be some final data left to decrypt if the input is
156 // not an exact multiple of the block size.
157 if (!EVP_DecryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len))
158 {
159 llwarns << "LLBlowfishCipher::decrypt EVP_DecryptFinal failure" << llendl;
160 goto ERROR;
161 }
162 output_len += temp_len;
163
164 EVP_CIPHER_CTX_cleanup(&context);
165 return output_len;
166
167ERROR:
168 EVP_CIPHER_CTX_cleanup(&context);
117 return 0; 169 return 0;
118} 170}
119 171
diff --git a/linden/indra/llmessage/llhttpassetstorage.cpp b/linden/indra/llmessage/llhttpassetstorage.cpp
index 49dbdbd..fcdb354 100644
--- a/linden/indra/llmessage/llhttpassetstorage.cpp
+++ b/linden/indra/llmessage/llhttpassetstorage.cpp
@@ -743,7 +743,8 @@ LLAssetRequest* LLHTTPAssetStorage::findNextRequest(LLAssetStorage::request_list
743 request_list_t::iterator running_end = running.end(); 743 request_list_t::iterator running_end = running.end();
744 744
745 request_list_t::iterator pending_iter = pending.begin(); 745 request_list_t::iterator pending_iter = pending.begin();
746 request_list_t::iterator pending_end = pending.end(); 746 // FIXME onefang - I assume this was being used to speed up the for(), but this is just a quick pass to get rid of warnings. Try to understand it later.
747 //request_list_t::iterator pending_end = pending.end();
747 // Loop over all pending requests until we miss finding it in the running list. 748 // Loop over all pending requests until we miss finding it in the running list.
748 for (; pending_iter != pending.end(); ++pending_iter) 749 for (; pending_iter != pending.end(); ++pending_iter)
749 { 750 {