From: Nikos Mavrogiannopoulos Date: Fri, 20 Feb 2015 16:09:57 +0000 (+0100) Subject: tests: added check for gnutls_record_get_state() X-Git-Tag: gnutls_3_4_0~308 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=602335ab8a0313610b14655dce4c7aa6fc8ddea2;p=thirdparty%2Fgnutls.git tests: added check for gnutls_record_get_state() --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 318910ccc1..e9aec3bcd6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -88,7 +88,7 @@ ctests = mini-record-2 simple gc set_pkcs12_cred certder certuniqueid \ mini-rehandshake-2 custom-urls set_x509_key_mem set_x509_key_file \ mini-chain-unsorted x509-verify-with-crl mini-dtls-mtu \ mini-dtls-record-asym openpgp-callback key-import-export \ - mini-dtls-fork mini-dtls-pthread + mini-dtls-fork mini-dtls-pthread mini-key-material mini_dtls_pthread_LDADD = $(LDADD) -lpthread diff --git a/tests/mini-key-material.c b/tests/mini-key-material.c new file mode 100644 index 0000000000..c268357bb9 --- /dev/null +++ b/tests/mini-key-material.c @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2013 Nikos Mavrogiannopoulos + * + * This file is part of GnuTLS. + * + * GnuTLS is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuTLS is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GnuTLS; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#if defined(_WIN32) || !defined(ENABLE_ALPN) + +int main(int argc, char **argv) +{ + exit(77); +} + +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +static void terminate(void); + +/* This program tests whether the gnutls_record_get_state() works as + * expected. + */ + +static void server_log_func(int level, const char *str) +{ + fprintf(stderr, "server|<%d>| %s", level, str); +} + +static void client_log_func(int level, const char *str) +{ + fprintf(stderr, "client|<%d>| %s", level, str); +} + +/* These are global */ +static pid_t child; + +/* A very basic DTLS client, with anonymous authentication, that negotiates SRTP + */ + +static void dump(const char *name, uint8_t *data, unsigned data_size) +{ + unsigned i; + + fprintf(stderr, "%s", name); + for (i=0;i