1 /*
2 * Copyright (C) 2004-2012 Free Software Foundation, Inc.
3 *
4 * Author: Nikos Mavrogiannopoulos, Simon Josefsson
5 *
6 * This file is part of GnuTLS.
7 *
8 * GnuTLS is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * GnuTLS is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
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,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 /* Parts copied from GnuTLS example programs. */
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #ifndef _WIN32
33 # include <sys/types.h>
34 # include <netinet/in.h>
35 # include <sys/socket.h>
36 # include <arpa/inet.h>
37 # include <unistd.h>
38 #endif
39 #include <gnutls/gnutls.h>
40 #include <gnutls/x509.h>
41 #include <gnutls/abstract.h>
42
43 #include "utils.h"
44
45 #include "x509sign-verify-common.h"
46
doit(void)47 void doit(void)
48 {
49 unsigned rsa_size1, rsa_size2;
50 global_init();
51 gnutls_global_set_log_function(tls_log_func);
52 if (debug)
53 gnutls_global_set_log_level(6);
54
55 if (gnutls_fips140_mode_enabled()) {
56 rsa_size1 = 2048; /* minimum allowed */
57 rsa_size2 = 2048; /* minimum allowed */
58 } else {
59 rsa_size1 = 512;
60 rsa_size2 = 1024;
61 }
62
63 test_sig(GNUTLS_PK_RSA, GNUTLS_DIG_SHA1, rsa_size1);
64 test_sig(GNUTLS_PK_RSA, GNUTLS_DIG_SHA256, rsa_size2);
65 test_sig(GNUTLS_PK_RSA_PSS, GNUTLS_DIG_SHA256, rsa_size2);
66
67 gnutls_global_deinit();
68 }
69