summaryrefslogtreecommitdiff
path: root/indra/llmessage/llnullcipher.cpp
blob: 0d28b5c3938560cc16fbe6d6cabc4ccc156b8182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/** 
 * @file llnullcipher.cpp
 * @brief Implementation of a cipher which does not encrypt.
 *
 * Copyright (c) 2003-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

#include "linden_common.h"

#include "llnullcipher.h"

///----------------------------------------------------------------------------
/// Class LLNullCipher
///----------------------------------------------------------------------------

U32  LLNullCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
{
	if((src_len == dst_len) && src && dst)
	{
		memmove(dst, src, src_len);
		return src_len;
	}
	return 0;
}

U32 LLNullCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len)
{
	if((src_len == dst_len) && src && dst)
	{
		memmove(dst, src, src_len);
		return src_len;
	}
	return 0;
}

U32 LLNullCipher::requiredEncryptionSpace(U32 len) const
{
	return len;
}