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

« back to all changes in this revision

Viewing changes to tests/crq_key_id.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, 2009 Free Software Foundation
 
2
 * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3
3
 *
4
4
 * Author: David Marín Carreño
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
 
62
62
  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
63
63
 
64
64
  gnutls_global_set_log_function (tls_log_func);
65
 
  gnutls_global_set_log_level (4711);
 
65
  if (debug)
 
66
    gnutls_global_set_log_level (4711);
66
67
 
67
68
  for (algorithm = GNUTLS_PK_RSA; algorithm <= GNUTLS_PK_DSA; algorithm++)
68
69
    {
81
82
        {
82
83
          fail ("gnutls_x509_privkey_generate (rsa): %d\n", ret);
83
84
        }
84
 
      else
 
85
      else if (debug)
85
86
        {
86
87
          success ("Key[%s] generation ok: %d\n",
87
88
                   gnutls_pk_algorithm_get_name (algorithm), ret);
149
150
          ret = memcmp (crq_key_id, pkey_key_id, crq_key_id_len);
150
151
          if (ret == 0)
151
152
            {
152
 
              success ("Key ids are identical. OK.\n");
 
153
              if (debug)
 
154
                success ("Key ids are identical. OK.\n");
153
155
            }
154
156
          else
155
157
            {
159
161
      else
160
162
        {
161
163
          fail ("Key_id lengths differ incorrectly: %d - %d\n",
162
 
                crq_key_id_len, pkey_key_id_len);
 
164
                (int) crq_key_id_len, (int) pkey_key_id_len);
163
165
        }
164
166
 
165
167