|
|
875063 |
From aaf322dad16235a4af7b9eb101f19153ae1c2c8a Mon Sep 17 00:00:00 2001
|
|
|
875063 |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
875063 |
Date: Tue, 9 Oct 2018 18:33:11 +0200
|
|
|
875063 |
Subject: [PATCH 1/2] Drop AIM, Gadu-Gadu and ICQ
|
|
|
875063 |
|
|
|
875063 |
https://bugzilla.redhat.com/show_bug.cgi?id=1026505
|
|
|
875063 |
https://bugzilla.redhat.com/show_bug.cgi?id=1500403
|
|
|
875063 |
https://bugzilla.redhat.com/show_bug.cgi?id=1579978
|
|
|
875063 |
https://bugzilla.redhat.com/show_bug.cgi?id=1637801
|
|
|
875063 |
---
|
|
|
875063 |
configure.ac | 4 ++--
|
|
|
875063 |
libpurple/tests/Makefile.am | 2 --
|
|
|
875063 |
libpurple/tests/check_libpurple.c | 1 -
|
|
|
875063 |
3 files changed, 2 insertions(+), 5 deletions(-)
|
|
|
875063 |
|
|
|
875063 |
diff --git a/configure.ac b/configure.ac
|
|
|
875063 |
index f973af051bcb..4509a5c58b6c 100644
|
|
|
875063 |
--- a/configure.ac
|
|
|
875063 |
+++ b/configure.ac
|
|
|
875063 |
@@ -1189,7 +1189,7 @@ if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then
|
|
|
875063 |
fi
|
|
|
875063 |
|
|
|
875063 |
if test "x$STATIC_PRPLS" = "xall" ; then
|
|
|
875063 |
- STATIC_PRPLS="bonjour gg irc jabber novell oscar sametime silc simple zephyr"
|
|
|
875063 |
+ STATIC_PRPLS="bonjour irc jabber novell sametime silc simple zephyr"
|
|
|
875063 |
fi
|
|
|
875063 |
if test "x$have_meanwhile" != "xyes" ; then
|
|
|
875063 |
STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'`
|
|
|
875063 |
@@ -1260,7 +1260,7 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init static void static_proto_init
|
|
|
875063 |
|
|
|
875063 |
AC_ARG_WITH(dynamic_prpls, [AC_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`])
|
|
|
875063 |
if test "x$DYNAMIC_PRPLS" = "xall" ; then
|
|
|
875063 |
- DYNAMIC_PRPLS="bonjour gg irc jabber novell oscar sametime silc simple zephyr"
|
|
|
875063 |
+ DYNAMIC_PRPLS="bonjour irc jabber novell sametime silc simple zephyr"
|
|
|
875063 |
fi
|
|
|
875063 |
if test "x$have_meanwhile" != "xyes"; then
|
|
|
875063 |
DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'`
|
|
|
875063 |
diff --git a/libpurple/tests/Makefile.am b/libpurple/tests/Makefile.am
|
|
|
875063 |
index fa49f8a3a5c3..467c7438a766 100644
|
|
|
875063 |
--- a/libpurple/tests/Makefile.am
|
|
|
875063 |
+++ b/libpurple/tests/Makefile.am
|
|
|
875063 |
@@ -14,7 +14,6 @@ check_libpurple_SOURCES=\
|
|
|
875063 |
test_jabber_digest_md5.c \
|
|
|
875063 |
test_jabber_jutil.c \
|
|
|
875063 |
test_jabber_scram.c \
|
|
|
875063 |
- test_oscar_util.c \
|
|
|
875063 |
test_util.c \
|
|
|
875063 |
test_xmlnode.c \
|
|
|
875063 |
$(top_builddir)/libpurple/util.h
|
|
|
875063 |
@@ -30,7 +29,6 @@ check_libpurple_CFLAGS=\
|
|
|
875063 |
|
|
|
875063 |
check_libpurple_LDADD=\
|
|
|
875063 |
$(top_builddir)/libpurple/protocols/jabber/libjabber.la \
|
|
|
875063 |
- $(top_builddir)/libpurple/protocols/oscar/liboscar.la \
|
|
|
875063 |
$(top_builddir)/libpurple/libpurple.la \
|
|
|
875063 |
@CHECK_LIBS@ \
|
|
|
875063 |
$(GLIB_LIBS)
|
|
|
875063 |
diff --git a/libpurple/tests/check_libpurple.c b/libpurple/tests/check_libpurple.c
|
|
|
875063 |
index ace7d1eb9d7b..fa32d996094a 100644
|
|
|
875063 |
--- a/libpurple/tests/check_libpurple.c
|
|
|
875063 |
+++ b/libpurple/tests/check_libpurple.c
|
|
|
875063 |
@@ -91,7 +91,6 @@ int main(void)
|
|
|
875063 |
srunner_add_suite(sr, jabber_digest_md5_suite());
|
|
|
875063 |
srunner_add_suite(sr, jabber_jutil_suite());
|
|
|
875063 |
srunner_add_suite(sr, jabber_scram_suite());
|
|
|
875063 |
- srunner_add_suite(sr, oscar_util_suite());
|
|
|
875063 |
srunner_add_suite(sr, util_suite());
|
|
|
875063 |
srunner_add_suite(sr, xmlnode_suite());
|
|
|
875063 |
|
|
|
875063 |
--
|
|
|
875063 |
2.20.1
|
|
|
875063 |
|
|
|
875063 |
|
|
|
875063 |
From d5015b7560947a7a4f057281b1bdf6d6e114f421 Mon Sep 17 00:00:00 2001
|
|
|
875063 |
From: Debarshi Ray <debarshir@gnome.org>
|
|
|
875063 |
Date: Fri, 7 Jun 2019 17:47:03 +0200
|
|
|
875063 |
Subject: [PATCH 2/2] Port to GHmac
|
|
|
875063 |
|
|
|
875063 |
https://bugzilla.redhat.com/show_bug.cgi?id=1637801
|
|
|
875063 |
---
|
|
|
875063 |
libpurple/cipher.c | 2 -
|
|
|
875063 |
libpurple/ciphers/Makefile.am | 1 -
|
|
|
875063 |
libpurple/ciphers/hmac.c | 218 -----------------
|
|
|
875063 |
libpurple/protocols/jabber/auth.c | 16 +-
|
|
|
875063 |
libpurple/protocols/jabber/auth_scram.c | 65 +++--
|
|
|
875063 |
libpurple/protocols/jabber/auth_scram.h | 3 +-
|
|
|
875063 |
libpurple/tests/test_cipher.c | 311 ------------------------
|
|
|
875063 |
libpurple/tests/test_jabber_scram.c | 2 +-
|
|
|
875063 |
8 files changed, 41 insertions(+), 577 deletions(-)
|
|
|
875063 |
delete mode 100644 libpurple/ciphers/hmac.c
|
|
|
875063 |
|
|
|
875063 |
diff --git a/libpurple/cipher.c b/libpurple/cipher.c
|
|
|
875063 |
index d0a7bb7937ac..bc613ffab916 100644
|
|
|
875063 |
--- a/libpurple/cipher.c
|
|
|
875063 |
+++ b/libpurple/cipher.c
|
|
|
875063 |
@@ -230,7 +230,6 @@ purple_ciphers_get_handle() {
|
|
|
875063 |
*/
|
|
|
875063 |
PurpleCipherOps *purple_des_cipher_get_ops();
|
|
|
875063 |
PurpleCipherOps *purple_des3_cipher_get_ops();
|
|
|
875063 |
-PurpleCipherOps *purple_hmac_cipher_get_ops();
|
|
|
875063 |
PurpleCipherOps *purple_md4_cipher_get_ops();
|
|
|
875063 |
PurpleCipherOps *purple_md5_cipher_get_ops();
|
|
|
875063 |
PurpleCipherOps *purple_rc4_cipher_get_ops();
|
|
|
875063 |
@@ -256,7 +255,6 @@ purple_ciphers_init() {
|
|
|
875063 |
purple_ciphers_register_cipher("sha1", purple_sha1_cipher_get_ops());
|
|
|
875063 |
purple_ciphers_register_cipher("sha256", purple_sha256_cipher_get_ops());
|
|
|
875063 |
purple_ciphers_register_cipher("md4", purple_md4_cipher_get_ops());
|
|
|
875063 |
- purple_ciphers_register_cipher("hmac", purple_hmac_cipher_get_ops());
|
|
|
875063 |
purple_ciphers_register_cipher("des", purple_des_cipher_get_ops());
|
|
|
875063 |
purple_ciphers_register_cipher("des3", purple_des3_cipher_get_ops());
|
|
|
875063 |
purple_ciphers_register_cipher("rc4", purple_rc4_cipher_get_ops());
|
|
|
875063 |
diff --git a/libpurple/ciphers/Makefile.am b/libpurple/ciphers/Makefile.am
|
|
|
875063 |
index 9e2299d0c2e9..c187a477ebfb 100644
|
|
|
875063 |
--- a/libpurple/ciphers/Makefile.am
|
|
|
875063 |
+++ b/libpurple/ciphers/Makefile.am
|
|
|
875063 |
@@ -3,7 +3,6 @@ noinst_LTLIBRARIES=libpurple-ciphers.la
|
|
|
875063 |
libpurple_ciphers_la_SOURCES=\
|
|
|
875063 |
des.c \
|
|
|
875063 |
gchecksum.c \
|
|
|
875063 |
- hmac.c \
|
|
|
875063 |
md4.c \
|
|
|
875063 |
md5.c \
|
|
|
875063 |
rc4.c \
|
|
|
875063 |
diff --git a/libpurple/ciphers/hmac.c b/libpurple/ciphers/hmac.c
|
|
|
875063 |
deleted file mode 100644
|
|
|
875063 |
index b09dbd7e4650..000000000000
|
|
|
875063 |
--- a/libpurple/ciphers/hmac.c
|
|
|
875063 |
+++ /dev/null
|
|
|
875063 |
@@ -1,218 +0,0 @@
|
|
|
875063 |
-/*
|
|
|
875063 |
- * purple
|
|
|
875063 |
- *
|
|
|
875063 |
- * Purple is the legal property of its developers, whose names are too numerous
|
|
|
875063 |
- * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
|
875063 |
- * source distribution.
|
|
|
875063 |
- *
|
|
|
875063 |
- * This program is free software; you can redistribute it and/or modify
|
|
|
875063 |
- * it under the terms of the GNU General Public License as published by
|
|
|
875063 |
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
875063 |
- * (at your option) any later version.
|
|
|
875063 |
- *
|
|
|
875063 |
- * This program is distributed in the hope that it will be useful,
|
|
|
875063 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
875063 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
875063 |
- * GNU General Public License for more details.
|
|
|
875063 |
- *
|
|
|
875063 |
- * You should have received a copy of the GNU General Public License
|
|
|
875063 |
- * along with this program; if not, write to the Free Software
|
|
|
875063 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
|
|
|
875063 |
- */
|
|
|
875063 |
-#include <cipher.h>
|
|
|
875063 |
-
|
|
|
875063 |
-#include <util.h>
|
|
|
875063 |
-
|
|
|
875063 |
-struct HMAC_Context {
|
|
|
875063 |
- PurpleCipherContext *hash;
|
|
|
875063 |
- char *name;
|
|
|
875063 |
- int blocksize;
|
|
|
875063 |
- guchar *opad;
|
|
|
875063 |
-};
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_init(PurpleCipherContext *context, gpointer extra)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx;
|
|
|
875063 |
- hctx = g_new0(struct HMAC_Context, 1);
|
|
|
875063 |
- purple_cipher_context_set_data(context, hctx);
|
|
|
875063 |
- purple_cipher_context_reset(context, extra);
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_reset(PurpleCipherContext *context, gpointer extra)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx;
|
|
|
875063 |
-
|
|
|
875063 |
- hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- g_free(hctx->name);
|
|
|
875063 |
- hctx->name = NULL;
|
|
|
875063 |
- if (hctx->hash)
|
|
|
875063 |
- purple_cipher_context_destroy(hctx->hash);
|
|
|
875063 |
- hctx->hash = NULL;
|
|
|
875063 |
- hctx->blocksize = 0;
|
|
|
875063 |
- g_free(hctx->opad);
|
|
|
875063 |
- hctx->opad = NULL;
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_set_opt(PurpleCipherContext *context, const gchar *name, void *value)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx;
|
|
|
875063 |
-
|
|
|
875063 |
- hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- if (purple_strequal(name, "hash")) {
|
|
|
875063 |
- g_free(hctx->name);
|
|
|
875063 |
- if (hctx->hash)
|
|
|
875063 |
- purple_cipher_context_destroy(hctx->hash);
|
|
|
875063 |
- hctx->name = g_strdup((char*)value);
|
|
|
875063 |
- hctx->hash = purple_cipher_context_new_by_name((char *)value, NULL);
|
|
|
875063 |
- hctx->blocksize = purple_cipher_context_get_block_size(hctx->hash);
|
|
|
875063 |
- }
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void *
|
|
|
875063 |
-hmac_get_opt(PurpleCipherContext *context, const gchar *name)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx;
|
|
|
875063 |
-
|
|
|
875063 |
- hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- if (purple_strequal(name, "hash")) {
|
|
|
875063 |
- return hctx->name;
|
|
|
875063 |
- }
|
|
|
875063 |
-
|
|
|
875063 |
- return NULL;
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_append(PurpleCipherContext *context, const guchar *data, size_t len)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- g_return_if_fail(hctx->hash != NULL);
|
|
|
875063 |
-
|
|
|
875063 |
- purple_cipher_context_append(hctx->hash, data, len);
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static gboolean
|
|
|
875063 |
-hmac_digest(PurpleCipherContext *context, size_t in_len, guchar *out, size_t *out_len)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
- PurpleCipherContext *hash = hctx->hash;
|
|
|
875063 |
- guchar *inner_hash;
|
|
|
875063 |
- size_t hash_len;
|
|
|
875063 |
- gboolean result;
|
|
|
875063 |
-
|
|
|
875063 |
- g_return_val_if_fail(hash != NULL, FALSE);
|
|
|
875063 |
-
|
|
|
875063 |
- inner_hash = g_malloc(100); /* TODO: Should be enough for now... */
|
|
|
875063 |
- result = purple_cipher_context_digest(hash, 100, inner_hash, &hash_len);
|
|
|
875063 |
-
|
|
|
875063 |
- purple_cipher_context_reset(hash, NULL);
|
|
|
875063 |
-
|
|
|
875063 |
- purple_cipher_context_append(hash, hctx->opad, hctx->blocksize);
|
|
|
875063 |
- purple_cipher_context_append(hash, inner_hash, hash_len);
|
|
|
875063 |
-
|
|
|
875063 |
- g_free(inner_hash);
|
|
|
875063 |
-
|
|
|
875063 |
- result = result && purple_cipher_context_digest(hash, in_len, out, out_len);
|
|
|
875063 |
-
|
|
|
875063 |
- return result;
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_uninit(PurpleCipherContext *context)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx;
|
|
|
875063 |
-
|
|
|
875063 |
- purple_cipher_context_reset(context, NULL);
|
|
|
875063 |
-
|
|
|
875063 |
- hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- g_free(hctx);
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_set_key_with_len(PurpleCipherContext *context, const guchar * key, size_t key_len)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
- int blocksize, i;
|
|
|
875063 |
- guchar *ipad;
|
|
|
875063 |
- guchar *full_key;
|
|
|
875063 |
-
|
|
|
875063 |
- g_return_if_fail(hctx->hash != NULL);
|
|
|
875063 |
-
|
|
|
875063 |
- g_free(hctx->opad);
|
|
|
875063 |
-
|
|
|
875063 |
- blocksize = hctx->blocksize;
|
|
|
875063 |
- ipad = g_malloc(blocksize);
|
|
|
875063 |
- hctx->opad = g_malloc(blocksize);
|
|
|
875063 |
-
|
|
|
875063 |
- if (key_len > blocksize) {
|
|
|
875063 |
- purple_cipher_context_reset(hctx->hash, NULL);
|
|
|
875063 |
- purple_cipher_context_append(hctx->hash, key, key_len);
|
|
|
875063 |
- full_key = g_malloc(100); /* TODO: Should be enough for now... */
|
|
|
875063 |
- purple_cipher_context_digest(hctx->hash, 100, full_key, &key_len);
|
|
|
875063 |
- } else
|
|
|
875063 |
- full_key = g_memdup(key, key_len);
|
|
|
875063 |
-
|
|
|
875063 |
- if (key_len < blocksize) {
|
|
|
875063 |
- full_key = g_realloc(full_key, blocksize);
|
|
|
875063 |
- memset(full_key + key_len, 0, blocksize - key_len);
|
|
|
875063 |
- }
|
|
|
875063 |
-
|
|
|
875063 |
- for(i = 0; i < blocksize; i++) {
|
|
|
875063 |
- ipad[i] = 0x36 ^ full_key[i];
|
|
|
875063 |
- hctx->opad[i] = 0x5c ^ full_key[i];
|
|
|
875063 |
- }
|
|
|
875063 |
-
|
|
|
875063 |
- g_free(full_key);
|
|
|
875063 |
-
|
|
|
875063 |
- purple_cipher_context_reset(hctx->hash, NULL);
|
|
|
875063 |
- purple_cipher_context_append(hctx->hash, ipad, blocksize);
|
|
|
875063 |
- g_free(ipad);
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static void
|
|
|
875063 |
-hmac_set_key(PurpleCipherContext *context, const guchar * key)
|
|
|
875063 |
-{
|
|
|
875063 |
- hmac_set_key_with_len(context, key, strlen((char *)key));
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
- static size_t
|
|
|
875063 |
-hmac_get_block_size(PurpleCipherContext *context)
|
|
|
875063 |
-{
|
|
|
875063 |
- struct HMAC_Context *hctx = purple_cipher_context_get_data(context);
|
|
|
875063 |
-
|
|
|
875063 |
- return hctx->blocksize;
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
-static PurpleCipherOps HMACOps = {
|
|
|
875063 |
- hmac_set_opt, /* Set option */
|
|
|
875063 |
- hmac_get_opt, /* Get option */
|
|
|
875063 |
- hmac_init, /* init */
|
|
|
875063 |
- hmac_reset, /* reset */
|
|
|
875063 |
- hmac_uninit, /* uninit */
|
|
|
875063 |
- NULL, /* set iv */
|
|
|
875063 |
- hmac_append, /* append */
|
|
|
875063 |
- hmac_digest, /* digest */
|
|
|
875063 |
- NULL, /* encrypt */
|
|
|
875063 |
- NULL, /* decrypt */
|
|
|
875063 |
- NULL, /* set salt */
|
|
|
875063 |
- NULL, /* get salt size */
|
|
|
875063 |
- hmac_set_key, /* set key */
|
|
|
875063 |
- NULL, /* get key size */
|
|
|
875063 |
- NULL, /* set batch mode */
|
|
|
875063 |
- NULL, /* get batch mode */
|
|
|
875063 |
- hmac_get_block_size, /* get block size */
|
|
|
875063 |
- hmac_set_key_with_len /* set key with len */
|
|
|
875063 |
-};
|
|
|
875063 |
-
|
|
|
875063 |
-PurpleCipherOps *
|
|
|
875063 |
-purple_hmac_cipher_get_ops(void) {
|
|
|
875063 |
- return &HMACOps;
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
|
|
|
875063 |
index e5ffb6c33d83..1ca71ea03e81 100644
|
|
|
875063 |
--- a/libpurple/protocols/jabber/auth.c
|
|
|
875063 |
+++ b/libpurple/protocols/jabber/auth.c
|
|
|
875063 |
@@ -24,7 +24,6 @@
|
|
|
875063 |
|
|
|
875063 |
#include "account.h"
|
|
|
875063 |
#include "debug.h"
|
|
|
875063 |
-#include "cipher.h"
|
|
|
875063 |
#include "core.h"
|
|
|
875063 |
#include "conversation.h"
|
|
|
875063 |
#include "request.h"
|
|
|
875063 |
@@ -275,17 +274,15 @@ static void auth_old_cb(JabberStream *js, const char *from,
|
|
|
875063 |
* to non-SASL authentication.
|
|
|
875063 |
*/
|
|
|
875063 |
const char *challenge;
|
|
|
875063 |
- gchar digest[33];
|
|
|
875063 |
- PurpleCipherContext *hmac;
|
|
|
875063 |
+ gchar *digest;
|
|
|
875063 |
|
|
|
875063 |
/* Calculate the MHAC-MD5 digest */
|
|
|
875063 |
challenge = xmlnode_get_attrib(x, "challenge");
|
|
|
875063 |
- hmac = purple_cipher_context_new_by_name("hmac", NULL);
|
|
|
875063 |
- purple_cipher_context_set_option(hmac, "hash", "md5");
|
|
|
875063 |
- purple_cipher_context_set_key(hmac, (guchar *)pw);
|
|
|
875063 |
- purple_cipher_context_append(hmac, (guchar *)challenge, strlen(challenge));
|
|
|
875063 |
- purple_cipher_context_digest_to_str(hmac, 33, digest, NULL);
|
|
|
875063 |
- purple_cipher_context_destroy(hmac);
|
|
|
875063 |
+ digest = g_compute_hmac_for_string(G_CHECKSUM_MD5,
|
|
|
875063 |
+ (guchar *)pw, strlen(pw),
|
|
|
875063 |
+ challenge, -1);
|
|
|
875063 |
+
|
|
|
875063 |
+ g_return_if_fail(digest != NULL);
|
|
|
875063 |
|
|
|
875063 |
/* Create the response query */
|
|
|
875063 |
iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth");
|
|
|
875063 |
@@ -299,6 +296,7 @@ static void auth_old_cb(JabberStream *js, const char *from,
|
|
|
875063 |
x = xmlnode_new_child(query, "crammd5");
|
|
|
875063 |
|
|
|
875063 |
xmlnode_insert_data(x, digest, 32);
|
|
|
875063 |
+ g_free(digest);
|
|
|
875063 |
|
|
|
875063 |
jabber_iq_set_callback(iq, auth_old_result_cb, NULL);
|
|
|
875063 |
jabber_iq_send(iq);
|
|
|
875063 |
diff --git a/libpurple/protocols/jabber/auth_scram.c b/libpurple/protocols/jabber/auth_scram.c
|
|
|
875063 |
index 7f2a9c827cfb..96c0eb0051e5 100644
|
|
|
875063 |
--- a/libpurple/protocols/jabber/auth_scram.c
|
|
|
875063 |
+++ b/libpurple/protocols/jabber/auth_scram.c
|
|
|
875063 |
@@ -25,11 +25,10 @@
|
|
|
875063 |
#include "auth.h"
|
|
|
875063 |
#include "auth_scram.h"
|
|
|
875063 |
|
|
|
875063 |
-#include "cipher.h"
|
|
|
875063 |
#include "debug.h"
|
|
|
875063 |
|
|
|
875063 |
static const JabberScramHash hashes[] = {
|
|
|
875063 |
- { "-SHA-1", "sha1", 20 },
|
|
|
875063 |
+ { "-SHA-1", G_CHECKSUM_SHA1 },
|
|
|
875063 |
};
|
|
|
875063 |
|
|
|
875063 |
static const JabberScramHash *mech_to_hash(const char *mech)
|
|
|
875063 |
@@ -76,7 +75,8 @@ static const struct {
|
|
|
875063 |
guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str,
|
|
|
875063 |
GString *salt, guint iterations)
|
|
|
875063 |
{
|
|
|
875063 |
- PurpleCipherContext *context;
|
|
|
875063 |
+ GHmac *hmac;
|
|
|
875063 |
+ gsize digest_len;
|
|
|
875063 |
guchar *result;
|
|
|
875063 |
guint i;
|
|
|
875063 |
guchar *prev, *tmp;
|
|
|
875063 |
@@ -86,39 +86,38 @@ guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str,
|
|
|
875063 |
g_return_val_if_fail(salt != NULL && salt->len > 0, NULL);
|
|
|
875063 |
g_return_val_if_fail(iterations > 0, NULL);
|
|
|
875063 |
|
|
|
875063 |
- prev = g_new0(guint8, hash->size);
|
|
|
875063 |
- tmp = g_new0(guint8, hash->size);
|
|
|
875063 |
- result = g_new0(guint8, hash->size);
|
|
|
875063 |
+ digest_len = g_checksum_type_get_length(hash->type);
|
|
|
875063 |
+ prev = g_new0(guint8, digest_len);
|
|
|
875063 |
+ tmp = g_new0(guint8, digest_len);
|
|
|
875063 |
+ result = g_new0(guint8, digest_len);
|
|
|
875063 |
|
|
|
875063 |
- context = purple_cipher_context_new_by_name("hmac", NULL);
|
|
|
875063 |
+ hmac = g_hmac_new(hash->type, (guchar *)str->str, str->len);
|
|
|
875063 |
|
|
|
875063 |
/* Append INT(1), a four-octet encoding of the integer 1, most significant
|
|
|
875063 |
* octet first. */
|
|
|
875063 |
g_string_append_len(salt, "\0\0\0\1", 4);
|
|
|
875063 |
|
|
|
875063 |
/* Compute U0 */
|
|
|
875063 |
- purple_cipher_context_set_option(context, "hash", (gpointer)hash->name);
|
|
|
875063 |
- purple_cipher_context_set_key_with_len(context, (guchar *)str->str, str->len);
|
|
|
875063 |
- purple_cipher_context_append(context, (guchar *)salt->str, salt->len);
|
|
|
875063 |
- purple_cipher_context_digest(context, hash->size, result, NULL);
|
|
|
875063 |
+ g_hmac_update(hmac, (guchar *)salt->str, salt->len);
|
|
|
875063 |
+ g_hmac_get_digest(hmac, result, &digest_len);
|
|
|
875063 |
+ g_hmac_unref(hmac);
|
|
|
875063 |
|
|
|
875063 |
- memcpy(prev, result, hash->size);
|
|
|
875063 |
+ memcpy(prev, result, digest_len);
|
|
|
875063 |
|
|
|
875063 |
/* Compute U1...Ui */
|
|
|
875063 |
for (i = 1; i < iterations; ++i) {
|
|
|
875063 |
guint j;
|
|
|
875063 |
- purple_cipher_context_set_option(context, "hash", (gpointer)hash->name);
|
|
|
875063 |
- purple_cipher_context_set_key_with_len(context, (guchar *)str->str, str->len);
|
|
|
875063 |
- purple_cipher_context_append(context, prev, hash->size);
|
|
|
875063 |
- purple_cipher_context_digest(context, hash->size, tmp, NULL);
|
|
|
875063 |
+ hmac = g_hmac_new(hash->type, (guchar *)str->str, str->len);
|
|
|
875063 |
+ g_hmac_update(hmac, prev, digest_len);
|
|
|
875063 |
+ g_hmac_get_digest(hmac, tmp, &digest_len);
|
|
|
875063 |
+ g_hmac_unref(hmac);
|
|
|
875063 |
|
|
|
875063 |
- for (j = 0; j < hash->size; ++j)
|
|
|
875063 |
+ for (j = 0; j < digest_len; ++j)
|
|
|
875063 |
result[j] ^= tmp[j];
|
|
|
875063 |
|
|
|
875063 |
- memcpy(prev, tmp, hash->size);
|
|
|
875063 |
+ memcpy(prev, tmp, digest_len);
|
|
|
875063 |
}
|
|
|
875063 |
|
|
|
875063 |
- purple_cipher_context_destroy(context);
|
|
|
875063 |
g_free(tmp);
|
|
|
875063 |
g_free(prev);
|
|
|
875063 |
return result;
|
|
|
875063 |
@@ -136,31 +135,31 @@ guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str,
|
|
|
875063 |
static void
|
|
|
875063 |
jabber_scram_hmac(const JabberScramHash *hash, guchar *out, const guchar *key, const gchar *str)
|
|
|
875063 |
{
|
|
|
875063 |
- PurpleCipherContext *context;
|
|
|
875063 |
-
|
|
|
875063 |
- context = purple_cipher_context_new_by_name("hmac", NULL);
|
|
|
875063 |
- purple_cipher_context_set_option(context, "hash", (gpointer)hash->name);
|
|
|
875063 |
- purple_cipher_context_set_key_with_len(context, key, hash->size);
|
|
|
875063 |
- purple_cipher_context_append(context, (guchar *)str, strlen(str));
|
|
|
875063 |
- purple_cipher_context_digest(context, hash->size, out, NULL);
|
|
|
875063 |
- purple_cipher_context_destroy(context);
|
|
|
875063 |
+ GHmac *hmac;
|
|
|
875063 |
+ gsize digest_len = g_checksum_type_get_length(hash->type);
|
|
|
875063 |
+
|
|
|
875063 |
+ hmac = g_hmac_new(hash->type, key, digest_len);
|
|
|
875063 |
+ g_hmac_update(hmac, (guchar *)str, -1);
|
|
|
875063 |
+ g_hmac_get_digest(hmac, out, &digest_len);
|
|
|
875063 |
+ g_hmac_unref(hmac);
|
|
|
875063 |
}
|
|
|
875063 |
|
|
|
875063 |
static void
|
|
|
875063 |
jabber_scram_hash(const JabberScramHash *hash, guchar *out, const guchar *data)
|
|
|
875063 |
{
|
|
|
875063 |
- PurpleCipherContext *context;
|
|
|
875063 |
+ GChecksum *checksum;
|
|
|
875063 |
+ gsize digest_len = g_checksum_type_get_length(hash->type);
|
|
|
875063 |
|
|
|
875063 |
- context = purple_cipher_context_new_by_name(hash->name, NULL);
|
|
|
875063 |
- purple_cipher_context_append(context, data, hash->size);
|
|
|
875063 |
- purple_cipher_context_digest(context, hash->size, out, NULL);
|
|
|
875063 |
- purple_cipher_context_destroy(context);
|
|
|
875063 |
+ checksum = g_checksum_new(hash->type);
|
|
|
875063 |
+ g_checksum_update(checksum, data, digest_len);
|
|
|
875063 |
+ g_checksum_get_digest(checksum, out, &digest_len);
|
|
|
875063 |
+ g_checksum_free(checksum);
|
|
|
875063 |
}
|
|
|
875063 |
|
|
|
875063 |
gboolean
|
|
|
875063 |
jabber_scram_calc_proofs(JabberScramData *data, GString *salt, guint iterations)
|
|
|
875063 |
{
|
|
|
875063 |
- guint hash_len = data->hash->size;
|
|
|
875063 |
+ guint hash_len = g_checksum_type_get_length(data->hash->type);
|
|
|
875063 |
guint i;
|
|
|
875063 |
|
|
|
875063 |
GString *pass = g_string_new(data->password);
|
|
|
875063 |
diff --git a/libpurple/protocols/jabber/auth_scram.h b/libpurple/protocols/jabber/auth_scram.h
|
|
|
875063 |
index e1f52d1cbe31..855d4ab73b21 100644
|
|
|
875063 |
--- a/libpurple/protocols/jabber/auth_scram.h
|
|
|
875063 |
+++ b/libpurple/protocols/jabber/auth_scram.h
|
|
|
875063 |
@@ -34,8 +34,7 @@
|
|
|
875063 |
*/
|
|
|
875063 |
typedef struct {
|
|
|
875063 |
const char *mech_substr;
|
|
|
875063 |
- const char *name;
|
|
|
875063 |
- guint size;
|
|
|
875063 |
+ GChecksumType type;
|
|
|
875063 |
} JabberScramHash;
|
|
|
875063 |
|
|
|
875063 |
typedef struct {
|
|
|
875063 |
diff --git a/libpurple/tests/test_cipher.c b/libpurple/tests/test_cipher.c
|
|
|
875063 |
index 45249319e125..a3148a8bd708 100644
|
|
|
875063 |
--- a/libpurple/tests/test_cipher.c
|
|
|
875063 |
+++ b/libpurple/tests/test_cipher.c
|
|
|
875063 |
@@ -474,293 +474,6 @@ START_TEST(test_des3_cbc_null_key_and_text) {
|
|
|
875063 |
}
|
|
|
875063 |
END_TEST
|
|
|
875063 |
|
|
|
875063 |
-/******************************************************************************
|
|
|
875063 |
- * HMAC Tests
|
|
|
875063 |
- * See RFC2202 and some other NULL tests I made up
|
|
|
875063 |
- *****************************************************************************/
|
|
|
875063 |
-
|
|
|
875063 |
-#define HMAC_TEST(data, data_len, key, key_len, type, digest) { \
|
|
|
875063 |
- PurpleCipher *cipher = NULL; \
|
|
|
875063 |
- PurpleCipherContext *context = NULL; \
|
|
|
875063 |
- gchar cdigest[41]; \
|
|
|
875063 |
- gboolean ret = FALSE; \
|
|
|
875063 |
- \
|
|
|
875063 |
- cipher = purple_ciphers_find_cipher("hmac"); \
|
|
|
875063 |
- context = purple_cipher_context_new(cipher, NULL); \
|
|
|
875063 |
- purple_cipher_context_set_option(context, "hash", type); \
|
|
|
875063 |
- purple_cipher_context_set_key_with_len(context, (guchar *)key, (key_len)); \
|
|
|
875063 |
- \
|
|
|
875063 |
- purple_cipher_context_append(context, (guchar *)(data), (data_len)); \
|
|
|
875063 |
- ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \
|
|
|
875063 |
- NULL); \
|
|
|
875063 |
- \
|
|
|
875063 |
- fail_unless(ret == TRUE, NULL); \
|
|
|
875063 |
- fail_unless(purple_strequal((digest), cdigest), NULL); \
|
|
|
875063 |
- \
|
|
|
875063 |
- purple_cipher_context_destroy(context); \
|
|
|
875063 |
-}
|
|
|
875063 |
-
|
|
|
875063 |
-/* HMAC MD5 */
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_Hi) {
|
|
|
875063 |
- HMAC_TEST("Hi There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
|
|
|
875063 |
- 16,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "9294727a3638bb1c13f48ef8158bfc9d");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_what) {
|
|
|
875063 |
- HMAC_TEST("what do ya want for nothing?",
|
|
|
875063 |
- 28,
|
|
|
875063 |
- "Jefe",
|
|
|
875063 |
- 4,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "750c783e6ab0b503eaa86e310a5db738");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_dd) {
|
|
|
875063 |
- HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
|
|
|
875063 |
- 50,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 16,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "56be34521d144c88dbb8c733f0e8b3f6");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_cd) {
|
|
|
875063 |
- HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
|
|
|
875063 |
- 50,
|
|
|
875063 |
- "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
|
|
|
875063 |
- "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
|
|
|
875063 |
- "\x15\x16\x17\x18\x19",
|
|
|
875063 |
- 25,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "697eaf0aca3a3aea3a75164746ffaa79");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_truncation) {
|
|
|
875063 |
- HMAC_TEST("Test With Truncation",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
|
|
|
875063 |
- 16,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "56461ef2342edc00f9bab995690efd4c");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_large_key) {
|
|
|
875063 |
- HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First",
|
|
|
875063 |
- 54,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 80,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_large_key_and_data) {
|
|
|
875063 |
- HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
|
|
|
875063 |
- 73,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 80,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "6f630fad67cda0ee1fb1f562db3aa53e");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_null_key) {
|
|
|
875063 |
- HMAC_TEST("Hi There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
|
|
|
875063 |
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "597bfd644b797a985561eeb03a169e59");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_null_text) {
|
|
|
875063 |
- HMAC_TEST("Hi\x00There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "70be8e1b7b50dfcc335d6cd7992c564f");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_md5_null_key_and_text) {
|
|
|
875063 |
- HMAC_TEST("Hi\x00Th\x00re",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
|
|
|
875063 |
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "md5",
|
|
|
875063 |
- "b31bcbba35a33a067cbba9131cba4889");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-/* HMAC SHA1 */
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_Hi) {
|
|
|
875063 |
- HMAC_TEST("Hi There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "b617318655057264e28bc0b6fb378c8ef146be00");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_what) {
|
|
|
875063 |
- HMAC_TEST("what do ya want for nothing?",
|
|
|
875063 |
- 28,
|
|
|
875063 |
- "Jefe",
|
|
|
875063 |
- 4,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_dd) {
|
|
|
875063 |
- HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
|
|
|
875063 |
- "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
|
|
|
875063 |
- 50,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "125d7342b9ac11cd91a39af48aa17b4f63f175d3");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_cd) {
|
|
|
875063 |
- HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
|
|
875063 |
- "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
|
|
|
875063 |
- 50,
|
|
|
875063 |
- "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
|
|
|
875063 |
- "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
|
|
|
875063 |
- "\x15\x16\x17\x18\x19",
|
|
|
875063 |
- 25,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "4c9007f4026250c6bc8414f9bf50c86c2d7235da");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_truncation) {
|
|
|
875063 |
- HMAC_TEST("Test With Truncation",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
|
|
|
875063 |
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_large_key) {
|
|
|
875063 |
- HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First",
|
|
|
875063 |
- 54,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 80,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "aa4ae5e15272d00e95705637ce8a3b55ed402112");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_large_key_and_data) {
|
|
|
875063 |
- HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
|
|
|
875063 |
- 73,
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
|
|
875063 |
- "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
|
|
|
875063 |
- 80,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_null_key) {
|
|
|
875063 |
- HMAC_TEST("Hi There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b"
|
|
|
875063 |
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "eb62a2e0e33d300be669c52aab3f591bc960aac5");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_null_text) {
|
|
|
875063 |
- HMAC_TEST("Hi\x00There",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
|
|
875063 |
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "31ca58d849e971e418e3439de2c6f83144b6abb7");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
-START_TEST(test_hmac_sha1_null_key_and_text) {
|
|
|
875063 |
- HMAC_TEST("Hi\x00Th\x00re",
|
|
|
875063 |
- 8,
|
|
|
875063 |
- "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34"
|
|
|
875063 |
- "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b",
|
|
|
875063 |
- 20,
|
|
|
875063 |
- "sha1",
|
|
|
875063 |
- "e6b8e2fede87aa09dcb13e554df1435e056eae36");
|
|
|
875063 |
-}
|
|
|
875063 |
-END_TEST
|
|
|
875063 |
-
|
|
|
875063 |
/******************************************************************************
|
|
|
875063 |
* Suite
|
|
|
875063 |
*****************************************************************************/
|
|
|
875063 |
@@ -832,30 +545,6 @@ cipher_suite(void) {
|
|
|
875063 |
tcase_add_test(tc, test_des3_cbc_null_key_and_text);
|
|
|
875063 |
suite_add_tcase(s, tc);
|
|
|
875063 |
|
|
|
875063 |
- /* hmac tests */
|
|
|
875063 |
- tc = tcase_create("HMAC");
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_Hi);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_what);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_dd);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_cd);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_truncation);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_large_key);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_large_key_and_data);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_null_key);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_null_text);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_md5_null_key_and_text);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_Hi);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_what);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_dd);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_cd);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_truncation);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_large_key);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_large_key_and_data);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_null_key);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_null_text);
|
|
|
875063 |
- tcase_add_test(tc, test_hmac_sha1_null_key_and_text);
|
|
|
875063 |
- suite_add_tcase(s, tc);
|
|
|
875063 |
-
|
|
|
875063 |
return s;
|
|
|
875063 |
}
|
|
|
875063 |
|
|
|
875063 |
diff --git a/libpurple/tests/test_jabber_scram.c b/libpurple/tests/test_jabber_scram.c
|
|
|
875063 |
index b81b3db767cd..be50d3ef754b 100644
|
|
|
875063 |
--- a/libpurple/tests/test_jabber_scram.c
|
|
|
875063 |
+++ b/libpurple/tests/test_jabber_scram.c
|
|
|
875063 |
@@ -5,7 +5,7 @@
|
|
|
875063 |
#include "../protocols/jabber/auth_scram.h"
|
|
|
875063 |
#include "../protocols/jabber/jutil.h"
|
|
|
875063 |
|
|
|
875063 |
-static JabberScramHash sha1_mech = { "-SHA-1", "sha1", 20 };
|
|
|
875063 |
+static JabberScramHash sha1_mech = { "-SHA-1", G_CHECKSUM_SHA1 };
|
|
|
875063 |
|
|
|
875063 |
#define assert_pbkdf2_equal(password, salt, count, expected) { \
|
|
|
875063 |
GString *p = g_string_new(password); \
|
|
|
875063 |
--
|
|
|
875063 |
2.20.1
|
|
|
875063 |
|