diff options
| author | James Cook <james@lindenlab.com> | 2007-02-15 20:24:08 +0000 |
|---|---|---|
| committer | James Cook <james@lindenlab.com> | 2007-02-15 20:24:08 +0000 |
| commit | 12ac04231b8d358e70c830f7958f7efbc0f7c0d1 (patch) | |
| tree | 189b9bc4e3bfa63275cc41be8dc42a28b0f54ffe /indra/llmessage/llxorcipher.cpp | |
| parent | 4feabe4a9caec380cad405d5410bc762c862113d (diff) | |
merge -r 57761:57967 im-email-session-3, removes database load from IM to email session tracking, introduces new format for email return addresses
Diffstat (limited to 'indra/llmessage/llxorcipher.cpp')
| -rw-r--r-- | indra/llmessage/llxorcipher.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/indra/llmessage/llxorcipher.cpp b/indra/llmessage/llxorcipher.cpp index 1fbbfec9e0..9ddcf091b2 100644 --- a/indra/llmessage/llxorcipher.cpp +++ b/indra/llmessage/llxorcipher.cpp @@ -8,7 +8,8 @@ #include "linden_common.h" -#include "llcrypto.h" +#include "llxorcipher.h" + #include "llerror.h" ///---------------------------------------------------------------------------- @@ -44,25 +45,26 @@ LLXORCipher& LLXORCipher::operator=(const LLXORCipher& cipher) return *this; } -BOOL LLXORCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) +U32 LLXORCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) { - if(!src || !src_len || !dst || !dst_len || !mPad) return FALSE; + if(!src || !src_len || !dst || !dst_len || !mPad) return 0; U8* pad_end = mPad + mPadLen; - while(src_len--) + U32 count = src_len; + while(count--) { *dst++ = *src++ ^ *mHead++; if(mHead >= pad_end) mHead = mPad; } - return TRUE; + return src_len; } -BOOL LLXORCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) +U32 LLXORCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) { // xor is a symetric cipher, thus, just call the other function. return encrypt(src, src_len, dst, dst_len); } -U32 LLXORCipher::requiredEncryptionSpace(U32 len) +U32 LLXORCipher::requiredEncryptionSpace(U32 len) const { return len; } |
