aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llblowfishcipher.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage/llblowfishcipher.h')
-rw-r--r--linden/indra/llmessage/llblowfishcipher.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llblowfishcipher.h b/linden/indra/llmessage/llblowfishcipher.h
new file mode 100644
index 0000000..2557598
--- /dev/null
+++ b/linden/indra/llmessage/llblowfishcipher.h
@@ -0,0 +1,58 @@
1/**
2 * @file llblowfishcipher.h
3 * @brief A symmetric block cipher, designed in 1993 by Bruce Schneier.
4 * We use it because it has an 8 byte block size, allowing encryption of
5 * two UUIDs and a timestamp (16x2 + 4 = 36 bytes) with only 40 bytes of
6 * output. AES has a block size of 32 bytes, so this would require 64 bytes.
7 *
8 * Copyright (c) 2007-2007, Linden Research, Inc.
9 *
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 */
30
31#ifndef LLBLOWFISHCIPHER_H
32#define LLBLOWFISHCIPHER_H
33
34#include "llcipher.h"
35
36
37class LLBlowfishCipher : public LLCipher
38{
39public:
40 // Secret may be up to 56 bytes in length per Blowfish spec.
41 LLBlowfishCipher(const U8* secret, size_t secret_size);
42 virtual ~LLBlowfishCipher();
43
44 // See llcipher.h for documentation.
45 /*virtual*/ U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len);
46 /*virtual*/ U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len);
47 /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const;
48
49#ifdef _DEBUG
50 static BOOL testHarness();
51#endif
52
53private:
54 U8* mSecret;
55 size_t mSecretSize;
56};
57
58#endif // LL_LLCRYPTO_H