libpurple/tests/test_hmac.c

Thu, 22 Sep 2016 22:09:22 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 22 Sep 2016 22:09:22 -0500
changeset 38057
41f47eb1aa19
parent 37597
c92c6f818320
permissions
-rw-r--r--

Add our license spiel to a bunch of files

38057
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
1 /*
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
2 * purple
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
3 *
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
6 * source distribution.
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
7 *
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
8 * This program is free software; you can redistribute it and/or modify
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
9 * it under the terms of the GNU General Public License as published by
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
11 * (at your option) any later version.
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
12 *
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
13 * This program is distributed in the hope that it will be useful,
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
16 * GNU General Public License for more details.
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
17 *
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
18 * You should have received a copy of the GNU General Public License
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
19 * along with this program; if not, write to the Free Software
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
21 *
41f47eb1aa19 Add our license spiel to a bunch of files
Gary Kramlich <grim@reaperworld.com>
parents: 37597
diff changeset
22 */
37597
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib.h>
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <purple.h>
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "ciphers/hmaccipher.h"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include "ciphers/md5hash.h"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 #include "ciphers/sha1hash.h"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 /******************************************************************************
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 * HMAC Tests
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 * See RFC2202 and some other NULL tests I made up
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 *****************************************************************************/
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 test_hmac(gchar *data, size_t data_len,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 const gchar *key, size_t key_len,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 PurpleHash *hash, const gchar *digest)
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PurpleCipher *cipher = NULL;
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 gchar cdigest[41];
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 gboolean ret = FALSE;
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 cipher = purple_hmac_cipher_new(hash);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 purple_cipher_set_key(cipher, (guchar *)key, key_len);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 purple_cipher_append(cipher, (guchar *)data, data_len);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 ret = purple_cipher_digest_to_str(cipher, cdigest, sizeof(cdigest));
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 g_assert(ret);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 g_assert_cmpstr(digest, ==, cdigest);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 g_object_unref(G_OBJECT(cipher));
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_object_unref(G_OBJECT(hash));
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 test_hmac_md5_hi(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 "Hi There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 16,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 "9294727a3638bb1c13f48ef8158bfc9d"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 test_hmac_md5_what(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 "what do ya want for nothing?",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 28,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 "Jefe",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 4,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 "750c783e6ab0b503eaa86e310a5db738"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 test_hmac_md5_dd(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 50,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 16,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 "56be34521d144c88dbb8c733f0e8b3f6"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 test_hmac_md5_cd(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 50,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 "\x15\x16\x17\x18\x19",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 25,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 "697eaf0aca3a3aea3a75164746ffaa79"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 test_hmac_md5_truncation(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 "Test With Truncation",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 16,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 "56461ef2342edc00f9bab995690efd4c"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 test_hmac_md5_large_key(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 "Test Using Larger Than Block-Size Key - Hash Key First",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 54,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 80,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 test_hmac_md5_large_key_and_data(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 73,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 80,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 "6f630fad67cda0ee1fb1f562db3aa53e"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 test_hmac_md5_null_key(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 "Hi There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 "597bfd644b797a985561eeb03a169e59"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 test_hmac_md5_null_text(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 "Hi\x00There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 "70be8e1b7b50dfcc335d6cd7992c564f"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 test_hmac_md5_null_key_and_text(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 "Hi\x00Th\x00re",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 purple_md5_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 "b31bcbba35a33a067cbba9131cba4889"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 test_hmac_sha1_hi(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 "Hi There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 "b617318655057264e28bc0b6fb378c8ef146be00"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 test_hmac_sha1_what(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 "what do ya want for nothing?",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 28,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 "Jefe",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 4,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 test_hmac_sha1_dd(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 50,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 "125d7342b9ac11cd91a39af48aa17b4f63f175d3"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 test_hmac_sha1_cd(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 50,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 "\x15\x16\x17\x18\x19",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 25,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 "4c9007f4026250c6bc8414f9bf50c86c2d7235da"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 test_hmac_sha1_truncation(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 "Test With Truncation",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 test_hmac_sha1_large_key(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 "Test Using Larger Than Block-Size Key - Hash Key First",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 54,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 80,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 "aa4ae5e15272d00e95705637ce8a3b55ed402112"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 test_hmac_sha1_large_key_and_data(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 73,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 80,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 test_hmac_sha1_null_key(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 "Hi There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 "eb62a2e0e33d300be669c52aab3f591bc960aac5"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 test_hmac_sha1_null_text(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 "Hi\x00There",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 "31ca58d849e971e418e3439de2c6f83144b6abb7"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 static void
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 test_hmac_sha1_null_key_and_text(void) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 test_hmac(
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 "Hi\x00Th\x00re",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345 8,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 20,
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 purple_sha1_hash_new(),
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 "e6b8e2fede87aa09dcb13e554df1435e056eae36"
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 );
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352 }
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 gint
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 main(gint argc, gchar **argv) {
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 g_test_init(&argc, &argv, NULL);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 g_test_add_func("/hmac/md5/hi",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 test_hmac_md5_hi);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 g_test_add_func("/hmac/md5/what",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 test_hmac_md5_what);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 g_test_add_func("/hmac/md5/dd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 test_hmac_md5_dd);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 g_test_add_func("/hmac/md5/cd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 test_hmac_md5_cd);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 g_test_add_func("/hmac/md5/truncation",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 test_hmac_md5_truncation);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 g_test_add_func("/hmac/md5/large key",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 test_hmac_md5_large_key);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 g_test_add_func("/hmac/md5/large key and data",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 test_hmac_md5_large_key_and_data);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 g_test_add_func("/hmac/md5/null key",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 test_hmac_md5_null_key);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 g_test_add_func("/hmac/md5/null text",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 test_hmac_md5_null_text);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 g_test_add_func("/hmac/md5/null key and text",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 test_hmac_md5_null_key_and_text);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 g_test_add_func("/hmac/sha1/hi",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 test_hmac_sha1_hi);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 g_test_add_func("/hmac/sha1/what",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 test_hmac_sha1_what);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383 g_test_add_func("/hmac/sha1/dd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384 test_hmac_sha1_dd);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 g_test_add_func("/hmac/sha1/cd",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386 test_hmac_sha1_cd);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 g_test_add_func("/hmac/sha1/truncation",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 test_hmac_sha1_truncation);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 g_test_add_func("/hmac/sha1/large key",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 test_hmac_sha1_large_key);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 g_test_add_func("/hmac/sha1/large key and data",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 test_hmac_sha1_large_key_and_data);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 g_test_add_func("/hmac/sha1/null key",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 test_hmac_sha1_null_key);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 g_test_add_func("/hmac/sha1/null text",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 test_hmac_sha1_null_text);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 g_test_add_func("/hmac/sha1/null key and text",
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 test_hmac_sha1_null_key_and_text);
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 return g_test_run();
c92c6f818320 Finish up the ciphers and hashes
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 }

mercurial