2 * Copyright (C) 2014 Red Hat
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
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.
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.
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
32 #include <gnutls/gnutls.h>
34 int main(int argc, char *argv[])
41 printf("%d: %s\n", ret, gnutls_strerror(ret));
45 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_EC, 160);
46 if (p != GNUTLS_SEC_PARAM_LOW) {
47 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
51 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_EC, 192);
52 if (p != GNUTLS_SEC_PARAM_LEGACY) {
53 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
57 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_EC, 256);
58 if (p != GNUTLS_SEC_PARAM_HIGH) {
59 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
63 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_EC, 384);
64 if (p != GNUTLS_SEC_PARAM_HIGH) {
65 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
69 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_RSA, 1024);
71 if (p != GNUTLS_SEC_PARAM_LEGACY) {
73 if (p != GNUTLS_SEC_PARAM_LOW) {
75 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
79 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_RSA, 2048);
80 if (p != GNUTLS_SEC_PARAM_MEDIUM) {
81 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
85 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_DH, 1024);
87 if (p != GNUTLS_SEC_PARAM_LEGACY) {
89 if (p != GNUTLS_SEC_PARAM_LOW) {
91 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
95 p = gnutls_pk_bits_to_sec_param(GNUTLS_PK_DH, 2048);
96 if (p != GNUTLS_SEC_PARAM_MEDIUM) {
97 fprintf(stderr, "%d: error in sec param, p:%u\n", __LINE__, (unsigned)p);
101 gnutls_global_deinit();