corrected memory leaks in tests.
[gnutls.git] / tests / gendh.c
blobf139677ea58b0dc5dc984089c4af09d6f522d0ce
1 /*
2 * Copyright (C) 2010, 2012 Free Software Foundation, Inc.
4 * Author: Simon Josefsson
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
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
27 #include <stdio.h>
29 #include "utils.h"
31 void
32 doit (void)
34 gnutls_dh_params_t dh_params = NULL;
35 int rc;
37 rc = gnutls_global_init ();
38 if (rc)
39 fail ("gnutls_global_init\n");
41 if (gnutls_dh_params_init (&dh_params) < 0)
42 fail ("Error in dh parameter initialization\n");
44 if (gnutls_dh_params_generate2 (dh_params, 1024) < 0)
45 fail ("Error in prime generation\n");
47 gnutls_dh_params_deinit(dh_params);
49 gnutls_global_deinit();
51 if (debug) success ("generated DH params OK\n");