From 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:50 -0500 Subject: Second Life viewer sources 1.14.0.0 --- linden/indra/llmessage/llxorcipher.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'linden/indra/llmessage/llxorcipher.cpp') diff --git a/linden/indra/llmessage/llxorcipher.cpp b/linden/indra/llmessage/llxorcipher.cpp index 7a72866..3c3f690 100644 --- a/linden/indra/llmessage/llxorcipher.cpp +++ b/linden/indra/llmessage/llxorcipher.cpp @@ -27,7 +27,8 @@ #include "linden_common.h" -#include "llcrypto.h" +#include "llxorcipher.h" + #include "llerror.h" ///---------------------------------------------------------------------------- @@ -63,25 +64,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; } -- cgit v1.1