/pidgin/main: 3c9fc84490a9: Remove the ciphertest plugin since t...
Gary Kramlich <[email protected]> Thu, 18 Aug 2016 11:05:26 -0400
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: 3c9fc84490a9a47a13808a1097daa29810a38749 Author: Gary Kramlich <[email protected]> Date: 2016-08-12 21:36 -0500 Branch: default URL: https://hg.pidgin.im/pidgin/main/rev/3c9fc84490a9 Description: Remove the ciphertest plugin since the same tests are run in unittests diffstat: libpurple/plugins/Makefile.am | 4 - libpurple/plugins/ciphertest.c | 615 ----------------------------------------- 2 files changed, 0 insertions(+), 619 deletions(-) diffs (truncated from 655 to 300 lines): diff --git a/libpurple/plugins/Makefile.am b/libpurple/plugins/Makefile.am --- a/libpurple/plugins/Makefile.am +++ b/libpurple/plugins/Makefile.am @@ -13,7 +13,6 @@ autoaccept_la_LDFLAGS = -module buddynote_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ caesarcipher_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ caesarcipher_consumer_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ -ciphertest_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ codeinline_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ debug_example_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ helloworld_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ @@ -47,7 +46,6 @@ plugin_LTLIBRARIES = \ noinst_LTLIBRARIES = \ caesarcipher.la \ caesarcipher_consumer.la \ - ciphertest.la \ codeinline.la \ debug_example.la \ helloworld.la \ @@ -62,7 +60,6 @@ autoaccept_la_SOURCES = autoaccept buddynote_la_SOURCES = buddynote.c caesarcipher_la_SOURCES = caesarcipher.c caesarcipher.h caesarcipher_consumer_la_SOURCES = caesarcipher_consumer.c -ciphertest_la_SOURCES = ciphertest.c codeinline_la_SOURCES = codeinline.c debug_example_la_SOURCES = debug_example.c helloworld_la_SOURCES = helloworld.c @@ -82,7 +79,6 @@ autoaccept_la_LIBADD = @PURPLE_L buddynote_la_LIBADD = @PURPLE_LIBS@ caesarcipher_la_LIBADD = @PURPLE_LIBS@ caesarcipher_consumer_la_LIBADD = @PURPLE_LIBS@ -ciphertest_la_LIBADD = @PURPLE_LIBS@ codeinline_la_LIBADD = @PURPLE_LIBS@ idle_la_LIBADD = @PURPLE_LIBS@ joinpart_la_LIBADD = @PURPLE_LIBS@ diff --git a/libpurple/plugins/ciphertest.c b/libpurple/plugins/ciphertest.c deleted file mode 100644 --- a/libpurple/plugins/ciphertest.c +++ /dev/null @@ -1,615 +0,0 @@ -/* - * A plugin to test the ciphers that ship with purple - * - * Copyright (C) 2004, Gary Kramlich <[email protected]> - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifndef PURPLE_PLUGINS -#define PURPLE_PLUGINS -#endif - -#include "internal.h" - -#include <glib.h> -#include <string.h> - -#include "debug.h" -#include "plugins.h" -#include "version.h" -#include "util.h" - -#include "ciphers/aescipher.h" -#include "ciphers/md5hash.h" -#include "ciphers/pbkdf2cipher.h" -#include "ciphers/sha1hash.h" -#include "ciphers/sha256hash.h" - -struct test { - const gchar *question; - const gchar *answer; -}; - -/************************************************************************** - * MD5 Stuff - **************************************************************************/ -struct test md5_tests[8] = { - { "", "d41d8cd98f00b204e9800998ecf8427e"}, - { "a", "0cc175b9c0f1b6a831c399e269772661"}, - { "abc", "900150983cd24fb0d6963f7d28e17f72"}, - { "message digest", "f96b697d7cb7938d525a2f31aaf161d0"}, - { "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"}, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789", "d174ab98d277d9f5a5611c2c9f419d9f"}, - {"123456789012345678901234567" - "890123456789012345678901234" - "56789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"}, - { NULL, NULL } -}; - -static void -cipher_test_md5(void) { - PurpleHash *hash; - gchar digest[33]; - gboolean ret; - gint i = 0; - - hash = purple_md5_hash_new(); - if(!hash) { - purple_debug_info("cipher-test", - "could not find md5 cipher, not testing\n"); - return; - } - - purple_debug_info("cipher-test", "Running md5 tests\n"); - - while(md5_tests[i].answer) { - purple_debug_info("cipher-test", "Test %02d:\n", i); - purple_debug_info("cipher-test", "Testing '%s'\n", md5_tests[i].question); - - purple_hash_append(hash, (guchar *)md5_tests[i].question, - strlen(md5_tests[i].question)); - - ret = purple_hash_digest_to_str(hash, digest, sizeof(digest)); - - if(!ret) { - purple_debug_info("cipher-test", "failed\n"); - } else { - purple_debug_info("cipher-test", "\tGot: %s\n", digest); - purple_debug_info("cipher-test", "\tWanted: %s\n", - md5_tests[i].answer); - } - - purple_hash_reset(hash); - i++; - } - - g_object_unref(hash); - - purple_debug_info("cipher-test", "md5 tests completed\n\n"); -} - -/************************************************************************** - * SHA-1 stuff - **************************************************************************/ -struct test sha1_tests[5] = { - {"a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"}, - {"abc", "a9993e364706816aba3e25717850c26c9cd0d89d"} , - {"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "84983e441c3bd26ebaae4aa1f95129e5e54670f1"} , - {NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f"}, - {NULL, NULL} -}; - -static void -cipher_test_sha1(void) { - PurpleHash *hash; - gchar digest[41]; - gint i = 0; - gboolean ret; - - hash = purple_sha1_hash_new(); - if(!hash) { - purple_debug_info("cipher-test", - "could not find sha1 cipher, not testing\n"); - return; - } - - purple_debug_info("cipher-test", "Running sha1 tests\n"); - - while(sha1_tests[i].answer) { - purple_debug_info("cipher-test", "Test %02d:\n", i); - purple_debug_info("cipher-test", "Testing '%s'\n", - (sha1_tests[i].question != NULL) ? - sha1_tests[i].question : "'a'x1000, 1000 times"); - - if(sha1_tests[i].question) { - purple_hash_append(hash, (guchar *)sha1_tests[i].question, - strlen(sha1_tests[i].question)); - } else { - gint j; - guchar buff[1000]; - - memset(buff, 'a', 1000); - - for(j = 0; j < 1000; j++) - purple_hash_append(hash, buff, 1000); - } - - ret = purple_hash_digest_to_str(hash, digest, sizeof(digest)); - - if(!ret) { - purple_debug_info("cipher-test", "failed\n"); - } else { - purple_debug_info("cipher-test", "\tGot: %s\n", digest); - purple_debug_info("cipher-test", "\tWanted: %s\n", - sha1_tests[i].answer); - } - - purple_hash_reset(hash); - i++; - } - - g_object_unref(hash); - - purple_debug_info("cipher-test", "sha1 tests completed\n\n"); -} - -static void -cipher_test_digest(void) -{ - const gchar *nonce = "dcd98b7102dd2f0e8b11d0f600bfb0c093"; - const gchar *client_nonce = "0a4f113b"; - const gchar *username = "Mufasa"; - const gchar *realm = "[email protected]"; - const gchar *password = "Circle Of Life"; - const gchar *algorithm = "md5"; - const gchar *nonce_count = "00000001"; - const gchar *method = "GET"; - const gchar *qop = "auth"; - const gchar *digest_uri = "/dir/index.html"; - const gchar *entity = NULL; - - gchar *session_key; - - purple_debug_info("cipher-test", "Running HTTP Digest tests\n"); - - session_key = purple_http_digest_calculate_session_key( - algorithm, username, realm, password, - nonce, client_nonce); - - if (session_key == NULL) - { - purple_debug_info("cipher-test", - "purple_cipher_http_digest_calculate_session_key failed.\n"); - } - else - { - gchar *response; - - purple_debug_info("cipher-test", "\tsession_key: Got: %s\n", session_key); - purple_debug_info("cipher-test", "\tsession_key: Wanted: %s\n", "939e7578ed9e3c518a452acee763bce9"); - - response = purple_http_digest_calculate_response( - algorithm, method, digest_uri, qop, entity, - nonce, nonce_count, client_nonce, session_key); - - g_free(session_key); - - if (response == NULL) - { - purple_debug_info("cipher-test", - "purple_cipher_http_digest_calculate_session_key failed.\n"); - } - else - { - purple_debug_info("cipher-test", "\tresponse: Got: %s\n", response); - purple_debug_info("cipher-test", "\tresponse: Wanted: %s\n", "6629fae49393a05397450978507c4ef1"); - g_free(response); - } - } - - purple_debug_info("cipher-test", "HTTP Digest tests completed\n\n"); -} - -/************************************************************************** - * PBKDF2 stuff - **************************************************************************/ - -#ifdef HAVE_NSS -# include <nss.h> -# include <secmod.h> -# include <pk11func.h> -# include <prerror.h> -# include <secerr.h> -#endif - -typedef struct { - const gchar *hash; - const guint iter_count; - const gchar *passphrase; - const gchar *salt; - const guint out_len; - const gchar *answer; -} pbkdf2_test; - -pbkdf2_test pbkdf2_tests[] = { - { "sha256", 1, "password", "salt", 32, "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b"}, - { "sha1", 1, "password", "salt", 32, "0c60c80f961f0e71f3a9b524af6012062fe037a6e0f0eb94fe8fc46bdc637164"}, - { "sha1", 1000, "ala ma kota", "", 16, "924dba137b5bcf6d0de84998f3d8e1f9"}, - { "sha1", 1, "", "", 32, "1e437a1c79d75be61e91141dae20affc4892cc99abcc3fe753887bccc8920176"}, - { "sha256", 100, "some password", "and salt", 1, "c7"}, - { "sha1", 10000, "pretty long password W Szczebrzeszynie chrzaszcz brzmi w trzcinie i Szczebrzeszyn z tego slynie", "Grzegorz Brzeczyszczykiewicz", 32, "8cb0cb164f2554733ae02f5751b0e84a88fb385446e85a3991bdcdf1ea11795c"}, _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits