annotate libpurple/tests/test_cipher.c @ 23552:711773577380

Clean up some MSN SOAP stuff. I think soap2.[ch] have proven themselves since we've been using them all this time. Removed soap.[ch] and any references to them, since those were mostly in header files, without any actual use in code. Also, removed some SOAP templates from group.h which are now taken care of by contact.[ch].
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 28 Jun 2008 06:01:22 +0000
parents f786e478e08b
children fae699fece1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
16 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
21 cipher = purple_ciphers_find_cipher("md4"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
22 context = purple_cipher_context_new(cipher, NULL); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
79 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
84 cipher = purple_ciphers_find_cipher("md5"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
85 context = purple_cipher_context_new(cipher, NULL); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
141 PurpleCipher *cipher = NULL; \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
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; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
146 cipher = purple_ciphers_find_cipher("sha1"); \
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
147 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
148 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 if((data)) { \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
150 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
151 } else { \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 gint j; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 guchar buff[1000]; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 memset(buff, 'a', 1000); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 for(j = 0; j < 1000; j++) \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
158 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
159 } \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
161 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
162 NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 fail_unless(ret == TRUE, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 fail_unless(strcmp((digest), cdigest) == 0, NULL); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 \
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
168 purple_cipher_context_destroy(context); \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 START_TEST(test_sha1_a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 SHA1_TEST("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 START_TEST(test_sha1_abc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 SHA1_TEST("abc", "a9993e364706816aba3e25717850c26c9cd0d89d");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 START_TEST(test_sha1_abcd_gibberish) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 SHA1_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 "84983e441c3bd26ebaae4aa1f95129e5e54670f1");
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_1000_as_1000_times) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 SHA1_TEST(NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 /******************************************************************************
21907
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
193 * DES Tests
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
194 *****************************************************************************/
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
195 #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
196 PurpleCipher *cipher = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
197 PurpleCipherContext *context = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
198 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
199 gint ret = 0; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
200 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
201 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
202 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
203 size_t outlen; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
204 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
205 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
206 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
207 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
208 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
209 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
210 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
211 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
212 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
213 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
214 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
215 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
216 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
217 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
218 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
219 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
220 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
221
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
222 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
223 DES_TEST("12345678",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
224 "\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
225 "\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
226 8);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
227 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
228 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
229
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
230 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
231 DES_TEST("abcdefgh",
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
232 "\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
233 "\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
234 8);
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
235 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
236 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
237
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
238 /******************************************************************************
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
239 * DES3 Tests
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
240 * 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
241 * 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
242 *****************************************************************************/
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
243
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
244 #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
245 PurpleCipher *cipher = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
246 PurpleCipherContext *context = NULL; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
247 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
248 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
249 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
250 size_t outlen; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
251 gint ret = 0; \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
252 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
253 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
254 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
255 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
256 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
257 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
258 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
259 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
260 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
261 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
262 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
263 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
264 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
265 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
266 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
267 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
268 \
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
269 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
270 }
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 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
273 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
274 "\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
275 "\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
276 "\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
277 "\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
278 "\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
279 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
280 "\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
281 "\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
282 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
283 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
284 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
285 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
286
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
287 START_TEST(test_des3_ecb_nist2) {
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
288 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
289 "\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
290 "\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
291 "\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
292 "\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
293 "\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
294 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
295 "\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
296 "\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
297 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
298 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
299 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
300 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
301
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
302 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
303 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
304 "\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
305 "\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
306 "\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
307 "\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
308 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
309 "\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
310 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
311 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
312 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
313 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
314
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
315 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
316 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
317 "\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
318 "\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
319 "\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
320 "\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
321 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
322 "\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
323 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
324 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
325 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
326 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
327
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
328 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
329 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
330 "\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
331 "\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
332 "\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
333 "\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
334 "00000000", /* ignored */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
335 "\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
336 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
337 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
338 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
339 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
340
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
341 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
342 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
343 "\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
344 "\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
345 "\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
346 "\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
347 "\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
348 "\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
349 "\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
350 "\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
351 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
352 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
353 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
354 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
355
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
356 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
357 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
358 "\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
359 "\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
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 "\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
362 "\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
363 "\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
364 "\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
365 "\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
366 32,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
367 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
368 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
369 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
370
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
371 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
372 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
373 "\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
374 "\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
375 "\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
376 "\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
377 "\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
378 "\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
379 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
380 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
381 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
382 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
383
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
384 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
385 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
386 "\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
387 "\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
388 "\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
389 "\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
390 "\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
391 "\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
392 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
393 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
394 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
395 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
396
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
397 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
398 DES3_TEST(
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
399 "\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
400 "\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
401 "\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
402 "\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
403 "\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
404 "\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
405 8,
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
406 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
407 }
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
408 END_TEST
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
409
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
410 /******************************************************************************
21908
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
411 * HMAC Tests
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
412 * 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
413 *****************************************************************************/
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
414
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
415 #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
416 PurpleCipher *cipher = NULL; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
417 PurpleCipherContext *context = NULL; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
418 gchar cdigest[41]; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
419 gboolean ret = FALSE; \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
420 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
421 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
422 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
423 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
424 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
425 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
426 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
427 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
428 NULL); \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
429 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
430 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
431 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
432 \
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
433 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
434 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
435
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
436 /* HMAC MD5 */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
437
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
438 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
439 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
440 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
441 "\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
442 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
443 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
444 "9294727a3638bb1c13f48ef8158bfc9d");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
445 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
446 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
447
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
448 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
449 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
450 28,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
451 "Jefe",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
452 4,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
453 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
454 "750c783e6ab0b503eaa86e310a5db738");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
455 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
456 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
457
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
458 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
459 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
460 "\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
461 "\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
462 "\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
463 "\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
464 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
465 "\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
466 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
467 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
468 "56be34521d144c88dbb8c733f0e8b3f6");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
469 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
470 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
471
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
472 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
473 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
474 "\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
475 "\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
476 "\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
477 "\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
478 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
479 "\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
480 "\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
481 "\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
482 25,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
483 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
484 "697eaf0aca3a3aea3a75164746ffaa79");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
485 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
486 END_TEST
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 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
489 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
490 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
491 "\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
492 16,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
493 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
494 "56461ef2342edc00f9bab995690efd4c");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
495 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
496 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
497
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
498 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
499 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
500 54,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
501 "\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
502 "\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
503 "\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
504 "\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
505 "\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
506 "\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
507 "\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
508 "\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
509 80,
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 "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd");
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_large_key_and_data) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
516 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
517 73,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
518 "\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
519 "\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
520 "\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
521 "\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
522 "\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
523 "\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
524 "\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
525 "\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
526 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
527 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
528 "6f630fad67cda0ee1fb1f562db3aa53e");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
529 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
530 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
531
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
532 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
533 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
534 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
535 "\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
536 "\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
537 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
538 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
539 "597bfd644b797a985561eeb03a169e59");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
540 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
541 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
542
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
543 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
544 HMAC_TEST("Hi\x00There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
545 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
546 "\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
547 "\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
548 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
549 "md5",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
550 "70be8e1b7b50dfcc335d6cd7992c564f");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
551 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
552 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
553
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
554 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
555 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
556 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
557 "\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
558 "\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
559 20,
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 "b31bcbba35a33a067cbba9131cba4889");
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 /* HMAC SHA1 */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
566
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
567 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
568 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
569 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
570 "\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
571 "\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
572 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
573 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
574 "b617318655057264e28bc0b6fb378c8ef146be00");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
575 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
576 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
577
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
578 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
579 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
580 28,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
581 "Jefe",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
582 4,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
583 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
584 "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
585 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
586 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
587
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
588 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
589 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
590 "\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
591 "\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
592 "\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
593 "\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
594 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
595 "\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
596 "\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
597 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
598 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
599 "125d7342b9ac11cd91a39af48aa17b4f63f175d3");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
600 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
601 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
602
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
603 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
604 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
605 "\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
606 "\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
607 "\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
608 "\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
609 50,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
610 "\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
611 "\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
612 "\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
613 25,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
614 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
615 "4c9007f4026250c6bc8414f9bf50c86c2d7235da");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
616 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
617 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
618
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
619 START_TEST(test_hmac_sha1_truncation) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
620 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
621 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
622 "\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
623 "\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
624 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
625 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
626 "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
627 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
628 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
629
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
630 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
631 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
632 54,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
633 "\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
634 "\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
635 "\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
636 "\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
637 "\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
638 "\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
639 "\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
640 "\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
641 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
642 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
643 "aa4ae5e15272d00e95705637ce8a3b55ed402112");
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 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
646
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
647 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
648 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
649 73,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
650 "\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
651 "\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
652 "\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
653 "\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
654 "\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
655 "\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
656 "\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
657 "\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
658 80,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
659 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
660 "e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
661 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
662 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
663
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
664 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
665 HMAC_TEST("Hi There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
666 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
667 "\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
668 "\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
669 20,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
670 "sha1",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
671 "eb62a2e0e33d300be669c52aab3f591bc960aac5");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
672 }
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
673 END_TEST
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
674
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
675 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
676 HMAC_TEST("Hi\x00There",
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
677 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
678 "\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
679 "\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
680 20,
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 "31ca58d849e971e418e3439de2c6f83144b6abb7");
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_null_key_and_text) {
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
687 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
688 8,
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
689 "\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
690 "\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
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 "e6b8e2fede87aa09dcb13e554df1435e056eae36");
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 /******************************************************************************
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 * Suite
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699 *****************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 Suite *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 cipher_suite(void) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 Suite *s = suite_create("Cipher Suite");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 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
704
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 /* md4 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 tc = tcase_create("MD4");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 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
708 tcase_add_test(tc, test_md4_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 tcase_add_test(tc, test_md4_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 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
711 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
712 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
713 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
714 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 /* md5 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 tc = tcase_create("MD5");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 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
719 tcase_add_test(tc, test_md5_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 tcase_add_test(tc, test_md5_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 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
722 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
723 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
724 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
725 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 /* sha1 tests */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 tc = tcase_create("SHA1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 tcase_add_test(tc, test_sha1_a);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 tcase_add_test(tc, test_sha1_abc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 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
732 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
733 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734
21907
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
735 /* des tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
736 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
737 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
738 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
739 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
740
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
741 /* des3 ecb tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
742 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
743 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
744 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
745 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
746 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
747 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
748 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
749 /* des3 cbc tests */
03463c52b9d7 Triple DES cipher support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 20827
diff changeset
750 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
751 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
752 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
753 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
754 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
755 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
756 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
757
21908
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
758 /* hmac tests */
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
759 tc = tcase_create("HMAC");
f786e478e08b HMAC digest support from Elliott Sales de Andrade
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21907
diff changeset
760 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
761 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
762 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
763 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
764 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
765 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
766 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
767 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
768 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
769 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
770 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
771 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
772 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
773 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
774 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
775 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
776 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
777 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
778 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
779 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
780 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
781
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 return s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785