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