annotate libpurple/tests/test_cipher.c @ 27858:6f27b4d8c1c3

gtkconv: Remove the close-timer when a new message comes in. Fixes #8512. This will happen if I "close" a conversation window (hide it), which starts the close-timer. A new IM then comes in, which is hidden because I have "Hide new IM conversations" set to Always (or When away) and then the timer triggers a few minutes later.
author Paul Aurich <paul@darkrain42.org>
date Fri, 07 Aug 2009 17:11:12 +0000
parents fc5508709e74
children c76eb1c6f6ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 #include <glib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 #include <check.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 #include <stdlib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 #include <string.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 #undef HAVE_DBUS
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7
15888
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
8 #include "tests.h"
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
9
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 #include "../cipher.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 /******************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * MD4 Tests
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 #define MD4_TEST(data, digest) { \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
16 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
17 PurpleCipherContext *context = NULL; \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 gchar cdigest[33]; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 gboolean ret = FALSE; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
21 cipher = purple_ciphers_find_cipher("md4"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
22 context = purple_cipher_context_new(cipher, NULL); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
23 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
25 ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 fail_unless(ret == TRUE, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
32 purple_cipher_context_destroy(context); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 START_TEST(test_md4_empty_string) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 MD4_TEST("", "31d6cfe0d16ae931b73c59d7e0c089c0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 START_TEST(test_md4_a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 MD4_TEST("a", "bde52cb31de33e46245e05fbdbd6fb24");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 START_TEST(test_md4_abc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 MD4_TEST("abc", "a448017aaf21d8525fc10ae87aa6729d");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 START_TEST(test_md4_message_digest) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 MD4_TEST("message digest", "d9130a8164549fe818874806e1c7014b");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 START_TEST(test_md4_a_to_z) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 MD4_TEST("abcdefghijklmnopqrstuvwxyz",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 "d79e1c308aa5bbcdeea8ed63df412da9");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 START_TEST(test_md4_A_to_Z_a_to_z_0_to_9) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 MD4_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 "043f8582f241db351ce627e153e7f0e4");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 START_TEST(test_md4_1_to_0_8_times) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 MD4_TEST("123456789012345678901234567890123456789012345678901234567890"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 "12345678901234567890",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 "e33b4ddc9c38f2199c3e7b164fcc0536");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 /******************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 * MD5 Tests
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 #define MD5_TEST(data, digest) { \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
79 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
80 PurpleCipherContext *context = NULL; \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 gchar cdigest[33]; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 gboolean ret = FALSE; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
84 cipher = purple_ciphers_find_cipher("md5"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
85 context = purple_cipher_context_new(cipher, NULL); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
86 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
88 ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 fail_unless(ret == TRUE, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
95 purple_cipher_context_destroy(context); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 START_TEST(test_md5_empty_string) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 MD5_TEST("", "d41d8cd98f00b204e9800998ecf8427e");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 START_TEST(test_md5_a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 MD5_TEST("a", "0cc175b9c0f1b6a831c399e269772661");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 START_TEST(test_md5_abc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 MD5_TEST("abc", "900150983cd24fb0d6963f7d28e17f72");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 START_TEST(test_md5_message_digest) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 MD5_TEST("message digest", "f96b697d7cb7938d525a2f31aaf161d0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 START_TEST(test_md5_a_to_z) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 MD5_TEST("abcdefghijklmnopqrstuvwxyz",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 "c3fcd3d76192e4007dfb496cca67e13b");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 START_TEST(test_md5_A_to_Z_a_to_z_0_to_9) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 MD5_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 "d174ab98d277d9f5a5611c2c9f419d9f");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 START_TEST(test_md5_1_to_0_8_times) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 MD5_TEST("123456789012345678901234567890123456789012345678901234567890"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 "12345678901234567890",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 "57edf4a22be3c955ac49da2e2107b67a");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 /******************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 * SHA-1 Tests
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 #define SHA1_TEST(data, digest) { \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
141 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
142 PurpleCipherContext *context = NULL; \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 gchar cdigest[41]; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 gboolean ret = FALSE; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
146 cipher = purple_ciphers_find_cipher("sha1"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
147 context = purple_cipher_context_new(cipher, NULL); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 if((data)) { \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
150 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 } else { \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 gint j; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 guchar buff[1000]; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 memset(buff, 'a', 1000); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 for(j = 0; j < 1000; j++) \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
158 purple_cipher_context_append(context, buff, 1000); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 } \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
161 ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 fail_unless(ret == TRUE, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
168 purple_cipher_context_destroy(context); \
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
27308
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
171 START_TEST(test_sha1_empty_string) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
172 SHA1_TEST("", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
173 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
174 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
175
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 START_TEST(test_sha1_a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 SHA1_TEST("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 START_TEST(test_sha1_abc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 SHA1_TEST("abc", "a9993e364706816aba3e25717850c26c9cd0d89d");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 START_TEST(test_sha1_abcd_gibberish) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 SHA1_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 "84983e441c3bd26ebaae4aa1f95129e5e54670f1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 START_TEST(test_sha1_1000_as_1000_times) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 SHA1_TEST(NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 /******************************************************************************
27308
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
198 * SHA-256 Tests
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
199 *****************************************************************************/
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
200 #define SHA256_TEST(data, digest) { \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
201 PurpleCipher *cipher = NULL; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
202 PurpleCipherContext *context = NULL; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
203 gchar cdigest[65]; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
204 gboolean ret = FALSE; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
205 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
206 cipher = purple_ciphers_find_cipher("sha256"); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
207 context = purple_cipher_context_new(cipher, NULL); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
208 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
209 if((data)) { \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
210 purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
211 } else { \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
212 gint j; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
213 guchar buff[1000]; \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
214 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
215 memset(buff, 'a', 1000); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
216 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
217 for(j = 0; j < 1000; j++) \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
218 purple_cipher_context_append(context, buff, 1000); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
219 } \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
220 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
221 ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
222 NULL); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
223 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
224 fail_unless(ret == TRUE, NULL); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
225 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
226 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
227 \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
228 purple_cipher_context_destroy(context); \
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
229 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
230
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
231 START_TEST(test_sha256_empty_string) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
232 SHA256_TEST("", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
233 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
234 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
235
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
236 START_TEST(test_sha256_a) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
237 SHA256_TEST("a", "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
238 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
239 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
240
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
241 START_TEST(test_sha256_abc) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
242 SHA256_TEST("abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
243 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
244 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
245
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
246 START_TEST(test_sha256_abcd_gibberish) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
247 SHA256_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
248 "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
249 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
250 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
251
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
252 START_TEST(test_sha256_1000_as_1000_times) {
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
253 SHA256_TEST(NULL, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
254 }
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
255 END_TEST
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
256
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
257 /******************************************************************************
21907
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
258 * DES Tests
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
259 *****************************************************************************/
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
260 #define DES_TEST(in, keyz, out, len) { \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
261 PurpleCipher *cipher = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
262 PurpleCipherContext *context = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
263 guchar answer[len+1]; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
264 gint ret = 0; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
265 guchar decrypt[len+1] = in; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
266 guchar key[8+1] = keyz;\
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
267 guchar encrypt[len+1] = out;\
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
268 size_t outlen; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
269 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
270 cipher = purple_ciphers_find_cipher("des"); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
271 context = purple_cipher_context_new(cipher, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
272 purple_cipher_context_set_key(context, key); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
273 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
274 ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
275 fail_unless(ret == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
276 fail_unless(outlen == (len), NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
277 fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
278 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
279 ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
280 fail_unless(ret == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
281 fail_unless(outlen == (len), NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
282 fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
283 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
284 purple_cipher_context_destroy(context); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
285 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
286
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
287 START_TEST(test_des_12345678) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
288 DES_TEST("12345678",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
289 "\x3b\x38\x98\x37\x15\x20\xf7\x5e",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
290 "\x06\x22\x05\xac\x6a\x0d\x55\xdd",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
291 8);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
292 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
293 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
294
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
295 START_TEST(test_des_abcdefgh) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
296 DES_TEST("abcdefgh",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
297 "\x3b\x38\x98\x37\x15\x20\xf7\x5e",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
298 "\x62\xe0\xc6\x8c\x48\xe4\x75\xed",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
299 8);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
300 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
301 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
302
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
303 /******************************************************************************
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
304 * DES3 Tests
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
305 * See http://csrc.nist.gov/groups/ST/toolkit/examples.html
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
306 * and some NULL things I made up
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
307 *****************************************************************************/
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
308
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
309 #define DES3_TEST(in, key, iv, out, len, mode) { \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
310 PurpleCipher *cipher = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
311 PurpleCipherContext *context = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
312 guchar answer[len+1]; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
313 guchar decrypt[len+1] = in; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
314 guchar encrypt[len+1] = out; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
315 size_t outlen; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
316 gint ret = 0; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
317 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
318 cipher = purple_ciphers_find_cipher("des3"); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
319 context = purple_cipher_context_new(cipher, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
320 purple_cipher_context_set_key(context, (guchar *)key); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
321 purple_cipher_context_set_batch_mode(context, (mode)); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
322 purple_cipher_context_set_iv(context, (guchar *)iv, 8); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
323 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
324 ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
325 fail_unless(ret == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
326 fail_unless(outlen == (len), NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
327 fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
328 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
329 ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
330 fail_unless(ret == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
331 fail_unless(outlen == (len), NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
332 fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
333 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
334 purple_cipher_context_destroy(context); \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
335 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
336
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
337 START_TEST(test_des3_ecb_nist1) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
338 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
339 "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
340 "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
341 "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
342 "\x23\x45\x67\x89\xAB\xCD\xEF\x01"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
343 "\x45\x67\x89\xAB\xCD\xEF\x01\x23",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
344 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
345 "\x71\x47\x72\xF3\x39\x84\x1D\x34\x26\x7F\xCC\x4B\xD2\x94\x9C\xC3"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
346 "\xEE\x11\xC2\x2A\x57\x6A\x30\x38\x76\x18\x3F\x99\xC0\xB6\xDE\x87",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
347 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
348 PURPLE_CIPHER_BATCH_MODE_ECB);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
349 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
350 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
351
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
352 START_TEST(test_des3_ecb_nist2) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
353 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
354 "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
355 "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
356 "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
357 "\x23\x45\x67\x89\xAB\xCD\xEF\x01"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
358 "\x01\x23\x45\x67\x89\xAB\xCD\xEF",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
359 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
360 "\x06\xED\xE3\xD8\x28\x84\x09\x0A\xFF\x32\x2C\x19\xF0\x51\x84\x86"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
361 "\x73\x05\x76\x97\x2A\x66\x6E\x58\xB6\xC8\x8C\xF1\x07\x34\x0D\x3D",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
362 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
363 PURPLE_CIPHER_BATCH_MODE_ECB);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
364 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
365 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
366
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
367 START_TEST(test_des3_ecb_null_key) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
368 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
369 "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
370 "\x38\x00\x88\x6a\xef\xcb\x00\xad"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
371 "\x5d\xe5\x29\x00\x7d\x98\x64\x4c"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
372 "\x86\x00\x7b\xd3\xc7\x00\x7b\x32",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
373 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
374 "\xc0\x60\x30\xa1\xb7\x25\x42\x44",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
375 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
376 PURPLE_CIPHER_BATCH_MODE_ECB);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
377 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
378 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
379
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
380 START_TEST(test_des3_ecb_null_text) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
381 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
382 "\x65\x73\x34\xc1\x19\x00\x79\x65",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
383 "\x32\x64\xda\x10\x13\x6a\xfe\x1e"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
384 "\x37\x54\xd1\x2c\x41\x04\x10\x40"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
385 "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
386 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
387 "\xe5\x80\xf6\x12\xf8\x4e\xd9\x6c",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
388 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
389 PURPLE_CIPHER_BATCH_MODE_ECB);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
390 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
391 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
392
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
393 START_TEST(test_des3_ecb_null_key_and_text) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
394 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
395 "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
396 "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
397 "\x66\x49\x42\x63\x22\x00\xf0\x99"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
398 "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
399 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
400 "\x73\xd8\x1f\x1f\x50\x01\xe4\x79",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
401 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
402 PURPLE_CIPHER_BATCH_MODE_ECB);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
403 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
404 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
405
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
406 START_TEST(test_des3_cbc_nist1) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
407 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
408 "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
409 "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
410 "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
411 "\x23\x45\x67\x89\xAB\xCD\xEF\x01"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
412 "\x45\x67\x89\xAB\xCD\xEF\x01\x23",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
413 "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
414 "\x20\x79\xC3\xD5\x3A\xA7\x63\xE1\x93\xB7\x9E\x25\x69\xAB\x52\x62"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
415 "\x51\x65\x70\x48\x1F\x25\xB5\x0F\x73\xC0\xBD\xA8\x5C\x8E\x0D\xA7",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
416 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
417 PURPLE_CIPHER_BATCH_MODE_CBC);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
418 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
419 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
420
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
421 START_TEST(test_des3_cbc_nist2) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
422 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
423 "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
424 "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
425 "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
426 "\x23\x45\x67\x89\xAB\xCD\xEF\x01"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
427 "\x01\x23\x45\x67\x89\xAB\xCD\xEF",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
428 "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
429 "\x74\x01\xCE\x1E\xAB\x6D\x00\x3C\xAF\xF8\x4B\xF4\x7B\x36\xCC\x21"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
430 "\x54\xF0\x23\x8F\x9F\xFE\xCD\x8F\x6A\xCF\x11\x83\x92\xB4\x55\x81",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
431 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
432 PURPLE_CIPHER_BATCH_MODE_CBC);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
433 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
434 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
435
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
436 START_TEST(test_des3_cbc_null_key) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
437 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
438 "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
439 "\x38\x00\x88\x6a\xef\xcb\x00\xad"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
440 "\x5d\xe5\x29\x00\x7d\x98\x64\x4c"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
441 "\x86\x00\x7b\xd3\xc7\x00\x7b\x32",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
442 "\x31\x32\x33\x34\x35\x36\x37\x38",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
443 "\x52\xe7\xde\x96\x39\x87\x87\xdb",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
444 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
445 PURPLE_CIPHER_BATCH_MODE_CBC);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
446 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
447 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
448
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
449 START_TEST(test_des3_cbc_null_text) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
450 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
451 "\x65\x73\x34\xc1\x19\x00\x79\x65",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
452 "\x32\x64\xda\x10\x13\x6a\xfe\x1e"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
453 "\x37\x54\xd1\x2c\x41\x04\x10\x40"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
454 "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
455 "\x7C\xAF\x0D\x57\x1E\x57\x10\xDA",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
456 "\x40\x12\x0e\x00\x85\xff\x6c\xc2",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
457 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
458 PURPLE_CIPHER_BATCH_MODE_CBC);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
459 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
460 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
461
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
462 START_TEST(test_des3_cbc_null_key_and_text) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
463 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
464 "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
465 "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
466 "\x66\x49\x42\x63\x22\x00\xf0\x99"
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
467 "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
468 "\x01\x19\x0D\x2c\x40\x67\x89\x67",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
469 "\xa7\xc1\x10\xbe\x9b\xd5\x8a\x67",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
470 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
471 PURPLE_CIPHER_BATCH_MODE_CBC);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
472 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
473 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
474
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
475 /******************************************************************************
21908
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
476 * HMAC Tests
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
477 * See RFC2202 and some other NULL tests I made up
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
478 *****************************************************************************/
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
479
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
480 #define HMAC_TEST(data, data_len, key, key_len, type, digest) { \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
481 PurpleCipher *cipher = NULL; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
482 PurpleCipherContext *context = NULL; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
483 gchar cdigest[41]; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
484 gboolean ret = FALSE; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
485 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
486 cipher = purple_ciphers_find_cipher("hmac"); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
487 context = purple_cipher_context_new(cipher, NULL); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
488 purple_cipher_context_set_option(context, "hash", type); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
489 purple_cipher_context_set_key_with_len(context, (guchar *)key, (key_len)); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
490 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
491 purple_cipher_context_append(context, (guchar *)(data), (data_len)); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
492 ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
493 NULL); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
494 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
495 fail_unless(ret == TRUE, NULL); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
496 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
497 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
498 purple_cipher_context_destroy(context); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
499 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
500
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
501 /* HMAC MD5 */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
502
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
503 START_TEST(test_hmac_md5_Hi) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
504 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
505 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
506 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
507 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
508 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
509 "9294727a3638bb1c13f48ef8158bfc9d");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
510 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
511 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
512
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
513 START_TEST(test_hmac_md5_what) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
514 HMAC_TEST("what do ya want for nothing?",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
515 28,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
516 "Jefe",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
517 4,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
518 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
519 "750c783e6ab0b503eaa86e310a5db738");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
520 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
521 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
522
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
523 START_TEST(test_hmac_md5_dd) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
524 HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
525 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
526 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
527 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
528 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
529 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
530 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
531 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
532 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
533 "56be34521d144c88dbb8c733f0e8b3f6");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
534 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
535 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
536
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
537 START_TEST(test_hmac_md5_cd) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
538 HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
539 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
540 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
541 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
542 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
543 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
544 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
545 "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
546 "\x15\x16\x17\x18\x19",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
547 25,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
548 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
549 "697eaf0aca3a3aea3a75164746ffaa79");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
550 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
551 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
552
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
553 START_TEST(test_hmac_md5_truncation) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
554 HMAC_TEST("Test With Truncation",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
555 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
556 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
557 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
558 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
559 "56461ef2342edc00f9bab995690efd4c");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
560 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
561 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
562
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
563 START_TEST(test_hmac_md5_large_key) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
564 HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
565 54,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
566 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
567 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
568 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
569 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
570 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
571 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
572 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
573 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
574 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
575 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
576 "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
577 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
578 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
579
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
580 START_TEST(test_hmac_md5_large_key_and_data) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
581 HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
582 73,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
583 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
584 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
585 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
586 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
587 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
588 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
589 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
590 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
591 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
592 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
593 "6f630fad67cda0ee1fb1f562db3aa53e");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
594 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
595 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
596
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
597 START_TEST(test_hmac_md5_null_key) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
598 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
599 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
600 "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
601 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
602 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
603 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
604 "597bfd644b797a985561eeb03a169e59");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
605 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
606 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
607
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
608 START_TEST(test_hmac_md5_null_text) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
609 HMAC_TEST("Hi\x00There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
610 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
611 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
612 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
613 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
614 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
615 "70be8e1b7b50dfcc335d6cd7992c564f");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
616 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
617 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
618
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
619 START_TEST(test_hmac_md5_null_key_and_text) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
620 HMAC_TEST("Hi\x00Th\x00re",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
621 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
622 "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
623 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
624 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
625 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
626 "b31bcbba35a33a067cbba9131cba4889");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
627 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
628 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
629
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
630 /* HMAC SHA1 */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
631
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
632 START_TEST(test_hmac_sha1_Hi) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
633 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
634 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
635 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
636 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
637 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
638 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
639 "b617318655057264e28bc0b6fb378c8ef146be00");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
640 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
641 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
642
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
643 START_TEST(test_hmac_sha1_what) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
644 HMAC_TEST("what do ya want for nothing?",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
645 28,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
646 "Jefe",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
647 4,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
648 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
649 "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
650 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
651 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
652
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
653 START_TEST(test_hmac_sha1_dd) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
654 HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
655 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
656 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
657 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
658 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
659 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
660 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
661 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
662 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
663 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
664 "125d7342b9ac11cd91a39af48aa17b4f63f175d3");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
665 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
666 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
667
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
668 START_TEST(test_hmac_sha1_cd) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
669 HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
670 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
671 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
672 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
673 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
674 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
675 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
676 "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
677 "\x15\x16\x17\x18\x19",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
678 25,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
679 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
680 "4c9007f4026250c6bc8414f9bf50c86c2d7235da");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
681 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
682 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
683
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
684 START_TEST(test_hmac_sha1_truncation) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
685 HMAC_TEST("Test With Truncation",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
686 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
687 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
688 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
689 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
690 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
691 "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
692 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
693 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
694
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
695 START_TEST(test_hmac_sha1_large_key) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
696 HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
697 54,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
698 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
699 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
700 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
701 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
702 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
703 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
704 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
705 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
706 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
707 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
708 "aa4ae5e15272d00e95705637ce8a3b55ed402112");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
709 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
710 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
711
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
712 START_TEST(test_hmac_sha1_large_key_and_data) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
713 HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
714 73,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
715 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
716 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
717 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
718 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
719 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
720 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
721 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
722 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
723 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
724 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
725 "e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
726 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
727 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
728
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
729 START_TEST(test_hmac_sha1_null_key) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
730 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
731 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
732 "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
733 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
734 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
735 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
736 "eb62a2e0e33d300be669c52aab3f591bc960aac5");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
737 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
738 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
739
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
740 START_TEST(test_hmac_sha1_null_text) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
741 HMAC_TEST("Hi\x00There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
742 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
743 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
744 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
745 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
746 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
747 "31ca58d849e971e418e3439de2c6f83144b6abb7");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
748 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
749 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
750
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
751 START_TEST(test_hmac_sha1_null_key_and_text) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
752 HMAC_TEST("Hi\x00Th\x00re",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
753 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
754 "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
755 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
756 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
757 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
758 "e6b8e2fede87aa09dcb13e554df1435e056eae36");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
759 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
760 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
761
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
762 /******************************************************************************
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 * Suite
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 Suite *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 cipher_suite(void) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767 Suite *s = suite_create("Cipher Suite");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 TCase *tc = NULL;
15888
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
769
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 /* md4 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 tc = tcase_create("MD4");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 tcase_add_test(tc, test_md4_empty_string);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 tcase_add_test(tc, test_md4_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 tcase_add_test(tc, test_md4_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 tcase_add_test(tc, test_md4_message_digest);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 tcase_add_test(tc, test_md4_a_to_z);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 tcase_add_test(tc, test_md4_A_to_Z_a_to_z_0_to_9);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 tcase_add_test(tc, test_md4_1_to_0_8_times);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 /* md5 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 tc = tcase_create("MD5");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 tcase_add_test(tc, test_md5_empty_string);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 tcase_add_test(tc, test_md5_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 tcase_add_test(tc, test_md5_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786 tcase_add_test(tc, test_md5_message_digest);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 tcase_add_test(tc, test_md5_a_to_z);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788 tcase_add_test(tc, test_md5_A_to_Z_a_to_z_0_to_9);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 tcase_add_test(tc, test_md5_1_to_0_8_times);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 /* sha1 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 tc = tcase_create("SHA1");
27308
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
794 tcase_add_test(tc, test_sha1_empty_string);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 tcase_add_test(tc, test_sha1_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 tcase_add_test(tc, test_sha1_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 tcase_add_test(tc, test_sha1_abcd_gibberish);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 tcase_add_test(tc, test_sha1_1000_as_1000_times);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800
27308
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
801 /* sha256 tests */
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
802 tc = tcase_create("SHA256");
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
803 tcase_add_test(tc, test_sha256_empty_string);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
804 tcase_add_test(tc, test_sha256_a);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
805 tcase_add_test(tc, test_sha256_abc);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
806 tcase_add_test(tc, test_sha256_abcd_gibberish);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
807 tcase_add_test(tc, test_sha256_1000_as_1000_times);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
808 suite_add_tcase(s, tc);
fc5508709e74 Use glib's SHA1, SHA256, and MD5 implementations when available (glib 2.16)
Paul Aurich <paul@darkrain42.org>
parents: 24451
diff changeset
809
21907
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
810 /* des tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
811 tc = tcase_create("DES");
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
812 tcase_add_test(tc, test_des_12345678);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
813 tcase_add_test(tc, test_des_abcdefgh);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
814 suite_add_tcase(s, tc);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
815
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
816 /* des3 ecb tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
817 tc = tcase_create("DES3 ECB");
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
818 tcase_add_test(tc, test_des3_ecb_nist1);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
819 tcase_add_test(tc, test_des3_ecb_nist2);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
820 tcase_add_test(tc, test_des3_ecb_null_key);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
821 tcase_add_test(tc, test_des3_ecb_null_text);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
822 tcase_add_test(tc, test_des3_ecb_null_key_and_text);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
823 suite_add_tcase(s, tc);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
824 /* des3 cbc tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
825 tc = tcase_create("DES3 CBC");
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
826 tcase_add_test(tc, test_des3_cbc_nist1);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
827 tcase_add_test(tc, test_des3_cbc_nist2);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
828 tcase_add_test(tc, test_des3_cbc_null_key);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
829 tcase_add_test(tc, test_des3_cbc_null_text);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
830 tcase_add_test(tc, test_des3_cbc_null_key_and_text);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
831 suite_add_tcase(s, tc);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
832
21908
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
833 /* hmac tests */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
834 tc = tcase_create("HMAC");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
835 tcase_add_test(tc, test_hmac_md5_Hi);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
836 tcase_add_test(tc, test_hmac_md5_what);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
837 tcase_add_test(tc, test_hmac_md5_dd);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
838 tcase_add_test(tc, test_hmac_md5_cd);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
839 tcase_add_test(tc, test_hmac_md5_truncation);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
840 tcase_add_test(tc, test_hmac_md5_large_key);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
841 tcase_add_test(tc, test_hmac_md5_large_key_and_data);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
842 tcase_add_test(tc, test_hmac_md5_null_key);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
843 tcase_add_test(tc, test_hmac_md5_null_text);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
844 tcase_add_test(tc, test_hmac_md5_null_key_and_text);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
845 tcase_add_test(tc, test_hmac_sha1_Hi);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
846 tcase_add_test(tc, test_hmac_sha1_what);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
847 tcase_add_test(tc, test_hmac_sha1_dd);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
848 tcase_add_test(tc, test_hmac_sha1_cd);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
849 tcase_add_test(tc, test_hmac_sha1_truncation);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
850 tcase_add_test(tc, test_hmac_sha1_large_key);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
851 tcase_add_test(tc, test_hmac_sha1_large_key_and_data);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
852 tcase_add_test(tc, test_hmac_sha1_null_key);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
853 tcase_add_test(tc, test_hmac_sha1_null_text);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
854 tcase_add_test(tc, test_hmac_sha1_null_key_and_text);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
855 suite_add_tcase(s, tc);
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
856
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 return s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860