hmaccipher: Remove in favor of GHmac
--- a/doc/reference/libpurple/libpurple-docs.xml Wed Sep 28 13:55:30 2016 -0500
+++ b/doc/reference/libpurple/libpurple-docs.xml Wed Sep 28 13:58:54 2016 -0500
@@ -112,7 +112,6 @@
<xi:include href="xml/aescipher.xml" />
<xi:include href="xml/descipher.xml" />
<xi:include href="xml/des3cipher.xml" />
- <xi:include href="xml/hmaccipher.xml" />
<xi:include href="xml/pbkdf2cipher.xml" />
<xi:include href="xml/rc4cipher.xml" />
<xi:include href="xml/md4hash.xml" />
--- a/libpurple/Makefile.am Wed Sep 28 13:55:30 2016 -0500
+++ b/libpurple/Makefile.am Wed Sep 28 13:58:54 2016 -0500
@@ -44,7 +44,6 @@
@@ -247,7 +246,6 @@
--- a/libpurple/Makefile.mingw Wed Sep 28 13:55:30 2016 -0500
+++ b/libpurple/Makefile.mingw Wed Sep 28 13:58:54 2016 -0500
@@ -71,7 +71,6 @@
--- a/libpurple/ciphers/hmaccipher.c Wed Sep 28 13:55:30 2016 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-/*******************************************************************************
- ******************************************************************************/
-#define PURPLE_HMAC_CIPHER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_HMAC_CIPHER, PurpleHMACCipherPrivate))
-} PurpleHMACCipherPrivate;
-/******************************************************************************
- *****************************************************************************/
-/*******************************************************************************
- ******************************************************************************/
-static GObjectClass *parent_class = NULL;
-static GParamSpec *properties[PROP_LAST];
-/*******************************************************************************
- ******************************************************************************/
-purple_hmac_cipher_set_hash(PurpleCipher *cipher,
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- priv->hash = g_object_ref(G_OBJECT(hash));
- g_object_notify_by_pspec(G_OBJECT(cipher), properties[PROP_HASH]);
-/*******************************************************************************
- ******************************************************************************/
-purple_hmac_cipher_reset(PurpleCipher *cipher) {
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- if(PURPLE_IS_HASH(priv->hash))
- purple_hash_reset(priv->hash);
-purple_hmac_cipher_reset_state(PurpleCipher *cipher) {
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- if(PURPLE_IS_HASH(priv->hash)) {
- purple_hash_reset_state(priv->hash);
- purple_hash_append(priv->hash, priv->ipad,
- purple_hash_get_block_size(priv->hash));
-purple_hmac_cipher_append(PurpleCipher *cipher, const guchar *d, size_t l) {
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- g_return_if_fail(PURPLE_IS_HASH(priv->hash));
- purple_hash_append(priv->hash, d, l);
-purple_hmac_cipher_digest(PurpleCipher *cipher, guchar *out, size_t len)
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- size_t hash_len, block_size;
- gboolean result = FALSE;
- g_return_val_if_fail(PURPLE_IS_HASH(priv->hash), FALSE);
- hash_len = purple_hash_get_digest_size(priv->hash);
- g_return_val_if_fail(hash_len > 0, FALSE);
- block_size = purple_hash_get_block_size(priv->hash);
- digest = g_malloc(hash_len);
- /* get the digest of the data */
- result = purple_hash_digest(priv->hash, digest, hash_len);
- purple_hash_reset(priv->hash);
- /* now append the opad and the digest from above */
- purple_hash_append(priv->hash, priv->opad, block_size);
- purple_hash_append(priv->hash, digest, hash_len);
- /* do our last digest */
- result = purple_hash_digest(priv->hash, out, len);
-purple_hmac_cipher_get_digest_size(PurpleCipher *cipher)
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- g_return_val_if_fail(priv->hash != NULL, 0);
- return purple_hash_get_digest_size(priv->hash);
-purple_hmac_cipher_set_key(PurpleCipher *cipher, const guchar *key,
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- g_return_if_fail(priv->hash);
- block_size = purple_hash_get_block_size(priv->hash);
- priv->ipad = g_malloc(block_size);
- priv->opad = g_malloc(block_size);
- if (key_len > block_size) {
- purple_hash_reset(priv->hash);
- purple_hash_append(priv->hash, key, key_len);
- key_len = purple_hash_get_digest_size(priv->hash);
- full_key = g_malloc(key_len);
- purple_hash_digest(priv->hash, full_key, key_len);
- full_key = g_memdup(key, key_len);
- if (key_len < block_size) {
- full_key = g_realloc(full_key, block_size);
- memset(full_key + key_len, 0, block_size - key_len);
- for(i = 0; i < block_size; i++) {
- priv->ipad[i] = 0x36 ^ full_key[i];
- priv->opad[i] = 0x5c ^ full_key[i];
- purple_hash_reset(priv->hash);
- purple_hash_append(priv->hash, priv->ipad, block_size);
-purple_hmac_cipher_get_block_size(PurpleCipher *cipher)
- PurpleHMACCipherPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_HMAC_CIPHER(cipher), 0);
- priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- return purple_hash_get_block_size(priv->hash);
-/******************************************************************************
- *****************************************************************************/
-purple_hmac_cipher_set_property(GObject *obj, guint param_id,
- PurpleCipher *cipher = PURPLE_CIPHER(obj);
- purple_hmac_cipher_set_hash(cipher, g_value_get_object(value));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_hmac_cipher_get_property(GObject *obj, guint param_id, GValue *value,
- PurpleHMACCipher *cipher = PURPLE_HMAC_CIPHER(obj);
- g_value_set_object(value,
- purple_hmac_cipher_get_hash(cipher));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_hmac_cipher_finalize(GObject *obj) {
- PurpleCipher *cipher = PURPLE_CIPHER(obj);
- PurpleHMACCipherPrivate *priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
- purple_hmac_cipher_reset(cipher);
- if (priv->hash != NULL)
- g_object_unref(priv->hash);
- parent_class->finalize(obj);
-purple_hmac_cipher_class_init(PurpleHMACCipherClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- PurpleCipherClass *cipher_class = PURPLE_CIPHER_CLASS(klass);
- parent_class = g_type_class_peek_parent(klass);
- g_type_class_add_private(klass, sizeof(PurpleHMACCipherPrivate));
- obj_class->finalize = purple_hmac_cipher_finalize;
- obj_class->get_property = purple_hmac_cipher_get_property;
- obj_class->set_property = purple_hmac_cipher_set_property;
- cipher_class->reset = purple_hmac_cipher_reset;
- cipher_class->reset_state = purple_hmac_cipher_reset_state;
- cipher_class->append = purple_hmac_cipher_append;
- cipher_class->digest = purple_hmac_cipher_digest;
- cipher_class->get_digest_size = purple_hmac_cipher_get_digest_size;
- cipher_class->set_key = purple_hmac_cipher_set_key;
- cipher_class->get_block_size = purple_hmac_cipher_get_block_size;
- properties[PROP_HASH] = g_param_spec_object("hash", "hash", "hash",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-/******************************************************************************
- *****************************************************************************/
-purple_hmac_cipher_get_type(void) {
- static const GTypeInfo info = {
- sizeof(PurpleHMACCipherClass),
- (GClassInitFunc)purple_hmac_cipher_class_init,
- sizeof(PurpleHMACCipher),
- (GInstanceInitFunc)purple_cipher_reset,
- type = g_type_register_static(PURPLE_TYPE_CIPHER,
-purple_hmac_cipher_new(PurpleHash *hash) {
- g_return_val_if_fail(PURPLE_IS_HASH(hash), NULL);
- return g_object_new(PURPLE_TYPE_HMAC_CIPHER,
-purple_hmac_cipher_get_hash(const PurpleHMACCipher *cipher) {
- PurpleHMACCipherPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_HMAC_CIPHER(cipher), NULL);
- priv = PURPLE_HMAC_CIPHER_GET_PRIVATE(cipher);
--- a/libpurple/ciphers/hmaccipher.h Wed Sep 28 13:55:30 2016 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-#ifndef PURPLE_HMAC_CIPHER_H
-#define PURPLE_HMAC_CIPHER_H
- * @section_id: libpurple-hmaccipher
- * @short_description: <filename>ciphers/hmaccipher.h</filename>
-#define PURPLE_TYPE_HMAC_CIPHER (purple_hmac_cipher_get_type())
-#define PURPLE_HMAC_CIPHER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_HMAC_CIPHER, PurpleHMACCipher))
-#define PURPLE_HMAC_CIPHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_HMAC_CIPHER, PurpleHMACCipherClass))
-#define PURPLE_IS_HMAC_CIPHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_HMAC_CIPHER))
-#define PURPLE_IS_HMAC_CIPHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), PURPLE_TYPE_HMAC_CIPHER))
-#define PURPLE_HMAC_CIPHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_HMAC_CIPHER, PurpleHMACCipherClass))
-typedef struct _PurpleHMACCipher PurpleHMACCipher;
-typedef struct _PurpleHMACCipherClass PurpleHMACCipherClass;
-struct _PurpleHMACCipher {
-struct _PurpleHMACCipherClass {
- PurpleCipherClass gparent;
- void (*_purple_reserved1)(void);
- void (*_purple_reserved2)(void);
- void (*_purple_reserved3)(void);
- void (*_purple_reserved4)(void);
-GType purple_hmac_cipher_get_type(void);
-PurpleCipher *purple_hmac_cipher_new(PurpleHash *hash);
-PurpleHash *purple_hmac_cipher_get_hash(const PurpleHMACCipher *cipher);
-#endif /* PURPLE_HMAC_CIPHER_H */
--- a/libpurple/tests/Makefile.am Wed Sep 28 13:55:30 2016 -0500
+++ b/libpurple/tests/Makefile.am Wed Sep 28 13:58:54 2016 -0500
@@ -8,7 +8,6 @@
@@ -24,9 +23,6 @@
test_des3_SOURCES=test_des3.c
test_des3_LDADD=$(COMMON_LIBS)
-test_hmac_SOURCES=test_hmac.c
-test_hmac_LDADD=$(COMMON_LIBS)
test_md4_SOURCES=test_md4.c
test_md4_LDADD=$(COMMON_LIBS)
--- a/libpurple/tests/test_hmac.c Wed Sep 28 13:55:30 2016 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,401 +0,0 @@
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
-#include "ciphers/hmaccipher.h"
-#include "ciphers/md5hash.h"
-#include "ciphers/sha1hash.h"
-/******************************************************************************
- * See RFC2202 and some other NULL tests I made up
- *****************************************************************************/
-test_hmac(gchar *data, size_t data_len,
- const gchar *key, size_t key_len,
- PurpleHash *hash, const gchar *digest)
- PurpleCipher *cipher = NULL;
- cipher = purple_hmac_cipher_new(hash);
- purple_cipher_set_key(cipher, (guchar *)key, key_len);
- purple_cipher_append(cipher, (guchar *)data, data_len);
- ret = purple_cipher_digest_to_str(cipher, cdigest, sizeof(cdigest));
- g_assert_cmpstr(digest, ==, cdigest);
- g_object_unref(G_OBJECT(cipher));
- g_object_unref(G_OBJECT(hash));
-test_hmac_md5_hi(void) {
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- "9294727a3638bb1c13f48ef8158bfc9d"
-test_hmac_md5_what(void) {
- "what do ya want for nothing?",
- "750c783e6ab0b503eaa86e310a5db738"
-test_hmac_md5_dd(void) {
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- "56be34521d144c88dbb8c733f0e8b3f6"
-test_hmac_md5_cd(void) {
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
- "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
- "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
- "\x15\x16\x17\x18\x19",
- "697eaf0aca3a3aea3a75164746ffaa79"
-test_hmac_md5_truncation(void) {
- "Test With Truncation",
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
- "56461ef2342edc00f9bab995690efd4c"
-test_hmac_md5_large_key(void) {
- "Test Using Larger Than Block-Size Key - Hash Key First",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"
-test_hmac_md5_large_key_and_data(void) {
- "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- "6f630fad67cda0ee1fb1f562db3aa53e"
-test_hmac_md5_null_key(void) {
- "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
- "597bfd644b797a985561eeb03a169e59"
-test_hmac_md5_null_text(void) {
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- "70be8e1b7b50dfcc335d6cd7992c564f"
-test_hmac_md5_null_key_and_text(void) {
- "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
- "b31bcbba35a33a067cbba9131cba4889"
-test_hmac_sha1_hi(void) {
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- purple_sha1_hash_new(),
- "b617318655057264e28bc0b6fb378c8ef146be00"
-test_hmac_sha1_what(void) {
- "what do ya want for nothing?",
- purple_sha1_hash_new(),
- "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"
-test_hmac_sha1_dd(void) {
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- purple_sha1_hash_new(),
- "125d7342b9ac11cd91a39af48aa17b4f63f175d3"
-test_hmac_sha1_cd(void) {
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
- "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
- "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
- "\x15\x16\x17\x18\x19",
- purple_sha1_hash_new(),
- "4c9007f4026250c6bc8414f9bf50c86c2d7235da"
-test_hmac_sha1_truncation(void) {
- "Test With Truncation",
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
- purple_sha1_hash_new(),
- "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"
-test_hmac_sha1_large_key(void) {
- "Test Using Larger Than Block-Size Key - Hash Key First",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- purple_sha1_hash_new(),
- "aa4ae5e15272d00e95705637ce8a3b55ed402112"
-test_hmac_sha1_large_key_and_data(void) {
- "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
- purple_sha1_hash_new(),
- "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"
-test_hmac_sha1_null_key(void) {
- "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
- purple_sha1_hash_new(),
- "eb62a2e0e33d300be669c52aab3f591bc960aac5"
-test_hmac_sha1_null_text(void) {
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- purple_sha1_hash_new(),
- "31ca58d849e971e418e3439de2c6f83144b6abb7"
-test_hmac_sha1_null_key_and_text(void) {
- "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
- purple_sha1_hash_new(),
- "e6b8e2fede87aa09dcb13e554df1435e056eae36"
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- g_test_add_func("/hmac/md5/hi",
- g_test_add_func("/hmac/md5/what",
- g_test_add_func("/hmac/md5/dd",
- g_test_add_func("/hmac/md5/cd",
- g_test_add_func("/hmac/md5/truncation",
- test_hmac_md5_truncation);
- g_test_add_func("/hmac/md5/large key",
- test_hmac_md5_large_key);
- g_test_add_func("/hmac/md5/large key and data",
- test_hmac_md5_large_key_and_data);
- g_test_add_func("/hmac/md5/null key",
- test_hmac_md5_null_key);
- g_test_add_func("/hmac/md5/null text",
- test_hmac_md5_null_text);
- g_test_add_func("/hmac/md5/null key and text",
- test_hmac_md5_null_key_and_text);
- g_test_add_func("/hmac/sha1/hi",
- g_test_add_func("/hmac/sha1/what",
- g_test_add_func("/hmac/sha1/dd",
- g_test_add_func("/hmac/sha1/cd",
- g_test_add_func("/hmac/sha1/truncation",
- test_hmac_sha1_truncation);
- g_test_add_func("/hmac/sha1/large key",
- test_hmac_sha1_large_key);
- g_test_add_func("/hmac/sha1/large key and data",
- test_hmac_sha1_large_key_and_data);
- g_test_add_func("/hmac/sha1/null key",
- test_hmac_sha1_null_key);
- g_test_add_func("/hmac/sha1/null text",
- test_hmac_sha1_null_text);
- g_test_add_func("/hmac/sha1/null key and text",
- test_hmac_sha1_null_key_and_text);