libpurple/tests/test_cipher.c

Sun, 16 Jun 2013 01:55:52 +0530

author
Ankit Vani <a@nevitus.org>
date
Sun, 16 Jun 2013 01:55:52 +0530
branch
soc.2013.gobjectification
changeset 34562
a9e7ea4338a7
parent 29125
6a53fd54a74b
child 34567
ea5103f66b0e
permissions
-rw-r--r--

Refactored the cipher test suite to use the GObject-based PurpleCipher

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

mercurial