~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to tests/netconf-psk.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2008 Free Software Foundation
 
2
 * Copyright (C) 2008, 2010 Free Software Foundation, Inc.
3
3
 *
4
4
 * Author: Simon Josefsson
5
5
 *
6
 
 * This file is part of GNUTLS.
 
6
 * This file is part of GnuTLS.
7
7
 *
8
 
 * GNUTLS is free software; you can redistribute it and/or modify it
 
8
 * GnuTLS is free software; you can redistribute it and/or modify it
9
9
 * under the terms of the GNU General Public License as published by
10
10
 * the Free Software Foundation; either version 3 of the License, or
11
11
 * (at your option) any later version.
12
12
 *
13
 
 * GNUTLS is distributed in the hope that it will be useful, but
 
13
 * GnuTLS is distributed in the hope that it will be useful, but
14
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
16
 * General Public License for more details.
17
17
 *
18
18
 * You should have received a copy of the GNU General Public License
19
 
 * along with GNUTLS; if not, write to the Free Software Foundation,
 
19
 * along with GnuTLS; if not, write to the Free Software Foundation,
20
20
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21
21
 */
22
22
 
51
51
  gnutls_global_init ();
52
52
 
53
53
  gnutls_global_set_log_function (tls_log_func);
54
 
  gnutls_global_set_log_level (2);
 
54
  if (debug)
 
55
    gnutls_global_set_log_level (2);
55
56
 
56
57
  if (gnutls_psk_netconf_derive_key ("password", "psk_identity",
57
58
                                     "psk_identity_hint", &key) == 0)
58
 
    success ("success: gnutls_psk_netconf_derive_key\n");
 
59
    {
 
60
      if (debug)
 
61
        success ("success: gnutls_psk_netconf_derive_key\n");
 
62
    }
59
63
  else
60
64
    fail ("gnutls_psk_netconf_derive_key failure\n");
61
65
 
63
67
    hexprint (key.data, key.size);
64
68
 
65
69
  if (key.size == 20 && memcmp (key.data, known, 20) == 0)
66
 
    success ("success: match.\n");
 
70
    {
 
71
      if (debug)
 
72
        success ("success: match.\n");
 
73
    }
67
74
  else
68
75
    fail ("FAIL: key differ.\n");
69
76