aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/llblowfish_tut.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/test/llblowfish_tut.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/test/llblowfish_tut.cpp')
-rw-r--r--linden/indra/test/llblowfish_tut.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/linden/indra/test/llblowfish_tut.cpp b/linden/indra/test/llblowfish_tut.cpp
index 78253cd..ac40896 100644
--- a/linden/indra/test/llblowfish_tut.cpp
+++ b/linden/indra/test/llblowfish_tut.cpp
@@ -57,8 +57,8 @@ namespace tut
57 mInputSize = 36; 57 mInputSize = 36;
58 } 58 }
59 59
60 bool matchFile(const char* filename, 60 bool matchFile(const std::string& filename,
61 const std::string& data) 61 const std::string& data)
62 { 62 {
63 LLFILE* fp = LLFile::fopen(filename, "rb"); 63 LLFILE* fp = LLFile::fopen(filename, "rb");
64 if (!fp) 64 if (!fp)
@@ -66,7 +66,7 @@ namespace tut
66 // sometimes test is run inside the indra directory 66 // sometimes test is run inside the indra directory
67 std::string path = "test/"; 67 std::string path = "test/";
68 path += filename; 68 path += filename;
69 fp = LLFile::fopen(path.c_str(), "rb"); 69 fp = LLFile::fopen(path, "rb");
70 } 70 }
71 if (!fp) 71 if (!fp)
72 { 72 {
@@ -93,6 +93,9 @@ namespace tut
93 template<> template<> 93 template<> template<>
94 void blowfish_object::test<1>() 94 void blowfish_object::test<1>()
95 { 95 {
96#if !LL_LINUX
97 skip_fail("Blowfish only supported on Linux.");
98#else
96 LLUUID blank; 99 LLUUID blank;
97 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); 100 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES);
98 101
@@ -105,11 +108,15 @@ namespace tut
105 dst_len = cipher.requiredEncryptionSpace(8); 108 dst_len = cipher.requiredEncryptionSpace(8);
106 ensure("encryption space 8", 109 ensure("encryption space 8",
107 (dst_len == 16) ); 110 (dst_len == 16) );
111#endif // !LL_LINUX
108 } 112 }
109 113
110 template<> template<> 114 template<> template<>
111 void blowfish_object::test<2>() 115 void blowfish_object::test<2>()
112 { 116 {
117#if !LL_LINUX
118 skip_fail("Blowfish only supported on Linux.");
119#else
113 LLUUID blank; 120 LLUUID blank;
114 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); 121 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES);
115 122
@@ -123,12 +130,16 @@ namespace tut
123 result.resize(count); 130 result.resize(count);
124 131
125 ensure("encrypt null key", matchFile("blowfish.1.bin", result)); 132 ensure("encrypt null key", matchFile("blowfish.1.bin", result));
133#endif // !LL_LINUX
126 } 134 }
127 135
128 template<> template<> 136 template<> template<>
129 void blowfish_object::test<3>() 137 void blowfish_object::test<3>()
130 { 138 {
131 // same as base64 test id 139#if !LL_LINUX
140 skip_fail("Blowfish only supported on Linux.");
141#else
142 // same as base64 test id
132 LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e"); 143 LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e");
133 LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES); 144 LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES);
134 145
@@ -142,5 +153,6 @@ namespace tut
142 result.resize(count); 153 result.resize(count);
143 154
144 ensure("encrypt real key", matchFile("blowfish.2.bin", result)); 155 ensure("encrypt real key", matchFile("blowfish.2.bin", result));
156#endif // !LL_LINUX
145 } 157 }
146} 158}