android: Update app-specific/MIME type icons
[LibreOffice.git] / sal / qa / rtl / cipher / rtl_cipher.cxx
blob1f6852184b43441757b584884c6845ed483660bd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cstring>
22 #include <sal/types.h>
23 #include <cppunit/TestFixture.h>
24 #include <cppunit/extensions/HelperMacros.h>
25 #include <cppunit/plugin/TestPlugIn.h>
27 #include <rtl/strbuf.hxx>
28 #include <rtl/cipher.h>
30 namespace rtl_cipher
33 class create : public CppUnit::TestFixture
35 public:
37 void create_001()
39 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
40 #if defined LIBO_CIPHER_OPENSSL_BACKEND
41 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
42 #else
43 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
44 rtl_cipher_destroy(aCipher);
45 #endif
47 void create_002()
49 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeECB);
50 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
52 void create_003()
54 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeCBC);
55 #if defined LIBO_CIPHER_OPENSSL_BACKEND
56 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
57 #else
58 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
59 rtl_cipher_destroy(aCipher);
60 #endif
62 void create_004()
64 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeCBC);
65 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
67 void create_005()
69 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
70 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
71 rtl_cipher_destroy(aCipher);
73 void create_006()
75 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeStream);
76 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
78 void create_007()
80 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeInvalid);
81 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
83 void create_008()
85 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeInvalid);
86 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
89 // Change the following lines only, if you add, remove or rename
90 // member functions of the current class,
91 // because these macros are need by auto register mechanism.
93 CPPUNIT_TEST_SUITE(create);
94 CPPUNIT_TEST(create_001);
95 CPPUNIT_TEST(create_002);
96 CPPUNIT_TEST(create_003);
97 CPPUNIT_TEST(create_004);
98 CPPUNIT_TEST(create_005);
99 CPPUNIT_TEST(create_006);
100 CPPUNIT_TEST(create_007);
101 CPPUNIT_TEST(create_008);
102 CPPUNIT_TEST_SUITE_END();
103 }; // class create
105 class createBF : public CppUnit::TestFixture
107 public:
109 void createBF_001()
111 rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
112 #if defined LIBO_CIPHER_OPENSSL_BACKEND
113 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
114 #else
115 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
116 rtl_cipher_destroy(aCipher);
117 #endif
119 void createBF_002()
121 rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeCBC);
122 #if defined LIBO_CIPHER_OPENSSL_BACKEND
123 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
124 #else
125 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
126 rtl_cipher_destroy(aCipher);
127 #endif
129 void createBF_003()
131 rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeStream);
132 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
133 rtl_cipher_destroy(aCipher);
135 void createBF_004()
137 rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeInvalid);
138 CPPUNIT_ASSERT_EQUAL_MESSAGE("create provide wrong object.", static_cast<rtlCipher>(nullptr), aCipher);
139 // rtl_cipher_destroy(aCipher);
141 // Change the following lines only, if you add, remove or rename
142 // member functions of the current class,
143 // because these macros are need by auto register mechanism.
145 CPPUNIT_TEST_SUITE(createBF);
146 CPPUNIT_TEST(createBF_001);
147 CPPUNIT_TEST(createBF_002);
148 CPPUNIT_TEST(createBF_003);
149 CPPUNIT_TEST(createBF_004);
150 CPPUNIT_TEST_SUITE_END();
151 }; // class createBF
153 class decode : public CppUnit::TestFixture
155 public:
157 void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, OString const& _sPlainTextStr)
159 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
160 #if defined LIBO_CIPHER_OPENSSL_BACKEND
161 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
162 (void) _nKeyValue;
163 (void) _nArgValue;
164 (void) _sPlainTextStr;
165 #else
166 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
168 sal_uInt32 nKeyLen = 16;
169 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
170 memset(pKeyBuffer, 0, nKeyLen);
171 pKeyBuffer[0] = _nKeyValue;
173 sal_uInt32 nArgLen = 16;
174 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
175 memset(pArgBuffer, 0, nArgLen);
176 pArgBuffer[0] = _nArgValue;
178 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
179 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
181 sal_uInt32 nPlainTextLen = 16;
182 sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
183 memset(pPlainTextBuffer, 0, nPlainTextLen);
184 strncpy(reinterpret_cast<char*>(pPlainTextBuffer), _sPlainTextStr.getStr(), 16);
186 sal_uInt32 nCipherLen = 16;
187 sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
188 memset(pCipherBuffer, 0, nCipherLen);
190 /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
191 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong encode", rtl_Cipher_E_None, aError);
193 sal_uInt32 nPlainText2Len = 16;
194 sal_uInt8 *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
195 memset(pPlainText2Buffer, 0, nPlainText2Len);
197 /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
198 CPPUNIT_ASSERT_MESSAGE("decode should not work", aError != rtl_Cipher_E_None);
200 delete [] pPlainText2Buffer;
202 delete [] pCipherBuffer;
203 delete [] pPlainTextBuffer;
205 delete [] pArgBuffer;
206 delete [] pKeyBuffer;
208 rtl_cipher_destroy(aCipher);
209 #endif
212 void test_encode_and_decode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, OString const& _sPlainTextStr)
214 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
215 #if defined LIBO_CIPHER_OPENSSL_BACKEND
216 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
217 (void) _nKeyValue;
218 (void) _nArgValue;
219 (void) _sPlainTextStr;
220 #else
221 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
223 sal_uInt32 nKeyLen = 16;
224 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
225 memset(pKeyBuffer, 0, nKeyLen);
226 pKeyBuffer[0] = _nKeyValue;
228 sal_uInt32 nArgLen = 16;
229 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
230 memset(pArgBuffer, 0, nArgLen);
231 pArgBuffer[0] = _nArgValue;
233 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionBoth, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
234 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
236 sal_uInt32 nPlainTextLen = 16;
237 sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
238 memset(pPlainTextBuffer, 0, nPlainTextLen);
239 strncpy(reinterpret_cast<char*>(pPlainTextBuffer), _sPlainTextStr.getStr(), 16);
241 sal_uInt32 nCipherLen = 16;
242 sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
243 memset(pCipherBuffer, 0, nCipherLen);
245 /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
246 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong encode", rtl_Cipher_E_None, aError);
248 sal_uInt32 nPlainText2Len = 16;
249 sal_uInt8 *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
250 memset(pPlainText2Buffer, 0, nPlainText2Len);
252 /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
253 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong decode", rtl_Cipher_E_None, aError);
255 sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 16);
257 CPPUNIT_ASSERT_EQUAL_MESSAGE("compare between plain and decoded plain failed", static_cast<sal_Int32>(0), nCompare);
259 delete [] pPlainText2Buffer;
261 delete [] pCipherBuffer;
262 delete [] pPlainTextBuffer;
264 delete [] pArgBuffer;
265 delete [] pKeyBuffer;
267 rtl_cipher_destroy(aCipher);
268 #endif
271 void decode_001()
273 test_encode_and_decode(0,0,"");
274 test_encode_and_decode(0,0,"hallo");
275 test_encode_and_decode(1,0,"B2Aahg5B");
276 test_encode_and_decode(1,2,"Longer text string");
279 void decode_002()
281 test_encode(0,0,"");
282 test_encode(0,0,"hallo");
283 test_encode(1,0,"B2Aahg5B");
284 test_encode(1,2,"Longer text string");
286 // Change the following lines only, if you add, remove or rename
287 // member functions of the current class,
288 // because these macros are need by auto register mechanism.
290 CPPUNIT_TEST_SUITE(decode);
291 CPPUNIT_TEST(decode_001);
292 CPPUNIT_TEST(decode_002);
293 CPPUNIT_TEST_SUITE_END();
294 }; // class decode
296 class decodeBF : public CppUnit::TestFixture
298 public:
300 void decodeBF_001()
303 // Change the following lines only, if you add, remove or rename
304 // member functions of the current class,
305 // because these macros are need by auto register mechanism.
307 CPPUNIT_TEST_SUITE(decodeBF);
308 CPPUNIT_TEST(decodeBF_001);
309 CPPUNIT_TEST_SUITE_END();
310 }; // class decodeBF
312 class destroy : public CppUnit::TestFixture
314 public:
316 void destroy_001()
318 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeCBC);
319 #if defined LIBO_CIPHER_OPENSSL_BACKEND
320 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
321 #else
322 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
323 rtl_cipher_destroy(aCipher);
324 #endif
326 // Change the following lines only, if you add, remove or rename
327 // member functions of the current class,
328 // because these macros are need by auto register mechanism.
330 CPPUNIT_TEST_SUITE(destroy);
331 CPPUNIT_TEST(destroy_001);
332 CPPUNIT_TEST_SUITE_END();
333 }; // class destroy
335 class destroyBF : public CppUnit::TestFixture
337 public:
339 void destroyBF_001()
341 rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
342 #if defined LIBO_CIPHER_OPENSSL_BACKEND
343 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
344 #else
345 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
346 rtl_cipher_destroyBF(aCipher);
347 // more proforma
348 // should not GPF
349 #endif
351 // Change the following lines only, if you add, remove or rename
352 // member functions of the current class,
353 // because these macros are need by auto register mechanism.
355 CPPUNIT_TEST_SUITE(destroyBF);
356 CPPUNIT_TEST(destroyBF_001);
357 CPPUNIT_TEST_SUITE_END();
358 }; // class destroyBF
360 class encode : public CppUnit::TestFixture
362 public:
364 void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, sal_uInt8 _nDataValue)
366 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
367 #if defined LIBO_CIPHER_OPENSSL_BACKEND
368 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
369 (void) _nKeyValue;
370 (void) _nArgValue;
371 (void) _nDataValue;
372 #else
373 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
375 sal_uInt32 nKeyLen = 16;
376 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
377 memset(pKeyBuffer, 0, nKeyLen);
378 pKeyBuffer[0] = _nKeyValue;
380 sal_uInt32 nArgLen = 16;
381 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
382 memset(pArgBuffer, 0, nArgLen);
383 pArgBuffer[0] = _nArgValue;
385 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
386 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
388 sal_uInt32 nDataLen = 16;
389 sal_uInt8 *pDataBuffer = new sal_uInt8[ nDataLen ];
390 memset(pDataBuffer, 0, nDataLen);
391 pDataBuffer[0] = _nDataValue;
393 sal_uInt32 nLen = 16;
394 sal_uInt8 *pBuffer = new sal_uInt8[ nLen ];
395 memset(pBuffer, 0, nLen);
397 /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pDataBuffer, nDataLen, pBuffer, nLen);
398 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong encode", rtl_Cipher_E_None, aError);
400 delete [] pBuffer;
401 delete [] pDataBuffer;
403 delete [] pArgBuffer;
404 delete [] pKeyBuffer;
406 rtl_cipher_destroy(aCipher);
407 #endif
410 void encode_001()
412 test_encode(0,0,0);
413 test_encode(1,0,0);
414 test_encode(0,1,0);
415 test_encode(1,1,0);
417 test_encode(0,0,1);
418 test_encode(1,0,1);
419 test_encode(0,1,1);
420 test_encode(1,1,1);
423 // Change the following lines only, if you add, remove or rename
424 // member functions of the current class,
425 // because these macros are need by auto register mechanism.
427 CPPUNIT_TEST_SUITE(encode);
428 CPPUNIT_TEST(encode_001);
429 CPPUNIT_TEST_SUITE_END();
430 }; // class encode
432 class encodeBF : public CppUnit::TestFixture
434 public:
436 void encodeBF_001()
439 // Change the following lines only, if you add, remove or rename
440 // member functions of the current class,
441 // because these macros are need by auto register mechanism.
443 CPPUNIT_TEST_SUITE(encodeBF);
444 CPPUNIT_TEST(encodeBF_001);
445 CPPUNIT_TEST_SUITE_END();
446 }; // class encodeBF
448 class init : public CppUnit::TestFixture
450 public:
452 void init_001()
454 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
455 #if defined LIBO_CIPHER_OPENSSL_BACKEND
456 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
457 #else
458 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
460 sal_uInt32 nKeyLen = 16;
461 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
462 memset(pKeyBuffer, 0, nKeyLen);
464 sal_uInt32 nArgLen = 16;
465 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
466 memset(pArgBuffer, 0, nArgLen);
468 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
469 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
471 delete [] pArgBuffer;
472 delete [] pKeyBuffer;
474 rtl_cipher_destroy(aCipher);
475 #endif
478 void init_002()
480 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
481 #if defined LIBO_CIPHER_OPENSSL_BACKEND
482 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
483 #else
484 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
486 sal_uInt32 nKeyLen = 16;
487 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
488 memset(pKeyBuffer, 0, nKeyLen);
489 pKeyBuffer[0] = 1;
491 sal_uInt32 nArgLen = 16;
492 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
493 memset(pArgBuffer, 0, nArgLen);
495 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
496 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
498 delete [] pArgBuffer;
499 delete [] pKeyBuffer;
501 rtl_cipher_destroy(aCipher);
502 #endif
504 void init_003()
506 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
507 #if defined LIBO_CIPHER_OPENSSL_BACKEND
508 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
509 #else
510 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
512 sal_uInt32 nKeyLen = 16;
513 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
514 memset(pKeyBuffer, 0, nKeyLen);
516 sal_uInt32 nArgLen = 16;
517 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
518 memset(pArgBuffer, 0, nArgLen);
519 pArgBuffer[0] = 1;
521 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
522 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
524 delete [] pArgBuffer;
525 delete [] pKeyBuffer;
527 rtl_cipher_destroy(aCipher);
528 #endif
530 void init_004()
532 rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
533 #if defined LIBO_CIPHER_OPENSSL_BACKEND
534 CPPUNIT_ASSERT_EQUAL(rtlCipher(nullptr), aCipher);
535 #else
536 CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != nullptr);
538 sal_uInt32 nKeyLen = 16;
539 sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
540 memset(pKeyBuffer, 0, nKeyLen);
541 pKeyBuffer[0] = 1;
543 sal_uInt32 nArgLen = 16;
544 sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
545 memset(pArgBuffer, 0, nArgLen);
546 pArgBuffer[0] = 1;
548 rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
549 CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong init", rtl_Cipher_E_None, aError);
551 delete [] pArgBuffer;
552 delete [] pKeyBuffer;
554 rtl_cipher_destroy(aCipher);
555 #endif
557 // Change the following lines only, if you add, remove or rename
558 // member functions of the current class,
559 // because these macros are need by auto register mechanism.
561 CPPUNIT_TEST_SUITE(init);
562 CPPUNIT_TEST(init_001);
563 CPPUNIT_TEST(init_002);
564 CPPUNIT_TEST(init_003);
565 CPPUNIT_TEST(init_004);
566 CPPUNIT_TEST_SUITE_END();
567 }; // class init
569 class initBF : public CppUnit::TestFixture
571 public:
573 void initBF_001()
575 // seems to be the same as init, so empty
578 // Change the following lines only, if you add, remove or rename
579 // member functions of the current class,
580 // because these macros are need by auto register mechanism.
582 CPPUNIT_TEST_SUITE(initBF);
583 CPPUNIT_TEST(initBF_001);
584 CPPUNIT_TEST_SUITE_END();
585 }; // class initBF
587 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::create);
588 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::createBF);
589 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decode);
590 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decodeBF);
591 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroy);
592 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroyBF);
593 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encode);
594 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encodeBF);
595 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::init);
596 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::initBF);
598 } // namespace rtl_cipher
600 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */