diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-11-14 13:19:48 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-11-14 13:19:48 +0100 |
commit | 114b746458e5c07f872ce5c608b4afe92652f932 (patch) | |
tree | 38d05ad8acbd83bf96a816ecc671ed557a42e6c6 /tests/pkcs12-decode | |
parent | 732c5997e411634f1eca36a889bf9925715b085f (diff) | |
download | gnutls-114b746458e5c07f872ce5c608b4afe92652f932.tar.gz |
Move pkcs12_s2k.c test to top-level to avoid -I/etc flag duplication.
Diffstat (limited to 'tests/pkcs12-decode')
-rw-r--r-- | tests/pkcs12-decode/Makefile.am | 22 | ||||
-rw-r--r-- | tests/pkcs12-decode/pkcs12_s2k.c | 100 |
2 files changed, 2 insertions, 120 deletions
diff --git a/tests/pkcs12-decode/Makefile.am b/tests/pkcs12-decode/Makefile.am index 5e604e7dd1..aaea92a125 100644 --- a/tests/pkcs12-decode/Makefile.am +++ b/tests/pkcs12-decode/Makefile.am @@ -23,24 +23,6 @@ EXTRA_DIST = client.p12 noclient.p12 unclient.p12 pkcs12_2certs.p12 dist_check_SCRIPTS = pkcs12 -TESTS = pkcs12 pkcs12_s2k +TESTS = pkcs12 -check_PROGRAMS = pkcs12_s2k - -AM_CPPFLAGS = \ - -I$(top_srcdir)/gl \ - -I$(top_builddir)/gl \ - -I$(top_srcdir)/lib/includes \ - -I$(top_builddir)/lib/includes \ - -I$(srcdir)/.. \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/doc/examples - -AM_LDFLAGS = -no-install -LDADD = ../../lib/libgnutls.la ../../gl/libgnu.la ../libutils.la - -if ENABLE_MINITASN1 - -AM_CPPFLAGS += -I$(top_srcdir)/lib/minitasn1 - -endif +TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) diff --git a/tests/pkcs12-decode/pkcs12_s2k.c b/tests/pkcs12-decode/pkcs12_s2k.c deleted file mode 100644 index 03d1c66be9..0000000000 --- a/tests/pkcs12-decode/pkcs12_s2k.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2007 Free Software Foundation - * - * Author: Simon Josefsson - * - * This file is part of GNUTLS. - * - * GNUTLS 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 3 of the License, or - * (at your option) any later version. - * - * GNUTLS 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 GNUTLS; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdio.h> - -#include <utils.h> -#include "../../lib/gnutls_int.h" -#include "../../lib/x509/x509_int.h" -#include "../../lib/debug.h" - -static void -tls_log_func (int level, const char *str) -{ - fprintf (stderr, "|<%d>| %s", level, str); -} - -char *salt[3] = { "salt1", "ltsa22", "balt33" }; -char *pw[3] = { "secret1", "verysecret2", "veryverysecret3" }; - -char *values[] = { -/* 1.0 */ - "85a3c676a66f0960f4807144a28c8d61a0001b81846f301a1ac164289879972f", -/* 1.2 */ - "e659da7d5989733a3d268e0bf7752c35c116e5c75919449a98f6812f82a15b16", -/* 1.2 */ - "878b8a88bf6166ce803b7498822205b1ac82870d3aec20807148779375a61f1e", -/* 2.0 */ - "1c845be764371d633c7fd1056967a9940385e110e85b58f826d39ae8561a0019", -/* 2.1 */ - "de8dd3ffd59b65d3d5f59a1f71d7add582741f7752a786c045953e727e4465c0", -/* 2.2 */ - "9dd7f19e5e6aee5c5008b5deefd35889ab7519356f13478ecdee593c5ed689b1", -/* 3.0 */ - "1c165e5a291a1539f3dbcf82a3e6ed566eb9d50ad4b0b3b57b599b08f0531236", -/* 3.1 */ - "5c9abee3cde31656eedfc131b7c2f8061032a3c705961ee2306a826c8b4b1a76", -/* 3.2 */ "a9c94e0acdaeaea54d1b1b681c3b64916396a352dea7ffe635fb2c11d8502e98" -}; - -void -doit (void) -{ - int rc, i, j, x; - char key[32]; - char tmp[1024]; - - gnutls_global_init (); - - gnutls_global_set_log_function (tls_log_func); - gnutls_global_set_log_level (99); - - x = 0; - for (i = 1; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - rc = - _gnutls_pkcs12_string_to_key (i, salt[j], strlen (salt[j]), - j + i + 15, pw[j], sizeof (key), - key); - if (rc < 0) - fail ("_gnutls_pkcs12_string_to_key failed[0]\n"); - - if (strcmp - (_gnutls_bin2hex (key, sizeof (key), tmp, sizeof (tmp)), - values[x]) != 0) - fail ("_gnutls_pkcs12_string_to_key failed[1]\n"); - - printf ("ij: %d.%d: %s\n", i, j, - _gnutls_bin2hex (key, sizeof (key), tmp, sizeof (tmp))); - x++; - } - } - printf ("\n"); - - success ("_gnutls_pkcs12_string_to_key ok\n"); -} |