summaryrefslogtreecommitdiff
path: root/tests/dtls
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-08 16:00:02 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-03-08 16:07:33 +0100
commit2d3b2de12224531236c18d8d1f4fece69a6d135e (patch)
tree10a3348659a706d3164ef27a7ff724a91182c949 /tests/dtls
parent18e54e57ce76d69cd5523a30b08c4a7b7bb7e747 (diff)
downloadgnutls-2d3b2de12224531236c18d8d1f4fece69a6d135e.tar.gz
tests: dtls-stress: use X.509 certificates instead of openpgptmp-openpgp-compat
This will allow the test tool to operate even after openpgp certificates are deprecated. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests/dtls')
-rw-r--r--tests/dtls/Makefile.am1
-rw-r--r--tests/dtls/dtls-stress.c67
2 files changed, 9 insertions, 59 deletions
diff --git a/tests/dtls/Makefile.am b/tests/dtls/Makefile.am
index 8f56408983..6c8f411121 100644
--- a/tests/dtls/Makefile.am
+++ b/tests/dtls/Makefile.am
@@ -30,6 +30,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/extra/includes \
-I$(top_builddir)/extra/includes \
-I$(top_srcdir)/lib \
+ -I$(top_srcdir)/tests \
-I$(top_srcdir)/doc/examples
AM_LDFLAGS = -no-install
diff --git a/tests/dtls/dtls-stress.c b/tests/dtls/dtls-stress.c
index c9493afffe..01e5ecad68 100644
--- a/tests/dtls/dtls-stress.c
+++ b/tests/dtls/dtls-stress.c
@@ -101,6 +101,7 @@
#include <errno.h>
#include <poll.h>
#include <time.h>
+#include <assert.h>
#include <sys/wait.h>
#if _POSIX_TIMERS && (_POSIX_TIMERS - 200112L) >= 0
@@ -232,56 +233,7 @@ static const char *filter_names_full[12]
"SFinished"
};
-static const unsigned char PUBKEY[] =
- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
- "\n"
- "mI0ETz0XRAEEAKXSU/tg2yGvoKf/r1pdzj7dnfPHeS+B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yqIPUVGRwQPlwpkkabRPNT3t/7KgDJvYzV9uu+cXCyfqErABEBAAEA\n"
- "A/4wX+brqkGZQTv8lateHn3PRHM3O34nPjgiNeo/SV9EKZg1e1PdRx9ZTAJrGK9y\n"
- "uZ03BKn7vZIy7fD4ufVzV/s/BaypVmvwjZud8fdMgsMQAJYtoMhozbOtUelCFpja\n"
- "I1xAbDBx1PAAbS8Sh022/0jvOGnZhvkgZMG90z7AEANUYQIAwzywU087TcJk8Bzd\n"
- "37JGWyE4f3iYFGA+r8BoIOrxvvgfUHKxdhG0gaT8SDeRAwNY6D43dCBZkG7Uel1F\n"
- "x9MlLQIA3Goaz58hEN0fdm4TM7A8crtMB+f8/h87EneBgMl+Yj/3sklhyahR6Itm\n"
- "lGuAAGTAOmD7i8OmS/a1ac5MtHAGtwH6A0B5GjaL8VnLQo4vFnuR7JuCQaLqGadV\n"
- "mBmKxVHElduLf/VauBQPD5KZA+egpg+laJ4JLVXMmKIZGqRzopcIWZnKiJ8EGAEC\n"
- "AAkFAk89F0QCGwwACgkQw2OGaR+Qtj0wbQQAlbEepeB7bs0G+VhULbA/5UBJOgRG\n"
- "PWlXyveezo/gOGpRhBjm06KlSRaP56vj+2lhMSF7nCUES/JWJwu7vhoz1Qrp+U2M\n"
- "yjIq8sRz5EK/TQceIYfCY5AwnPJwICN4pePbj2JJrL+9AoKiRRbU/DXzPvH0ud+y\n"
- "PlwPoX47dtDVBSA=\n" "=EVlv\n" "-----END PGP PRIVATE KEY BLOCK-----\n";
+#include "cert-common.h"
// }}}
@@ -736,13 +688,10 @@ static void await(int fd, int timeout)
static void cred_init(void)
{
- gnutls_datum_t key = { (unsigned char *)PUBKEY, sizeof(PUBKEY) };
- gnutls_datum_t sec = { (unsigned char *)PRIVKEY, sizeof(PRIVKEY) };
+ assert(gnutls_certificate_allocate_credentials(&cred)>=0);
- gnutls_certificate_allocate_credentials(&cred);
-
- gnutls_certificate_set_openpgp_key_mem(cred, &key, &sec,
- GNUTLS_OPENPGP_FMT_BASE64);
+ gnutls_certificate_set_x509_key_mem(cred, &cli_ca3_cert, &cli_ca3_key,
+ GNUTLS_X509_FMT_PEM);
}
static void session_init(int sock, int server)
@@ -751,7 +700,7 @@ static void session_init(int sock, int server)
GNUTLS_DATAGRAM | (server ? GNUTLS_SERVER : GNUTLS_CLIENT)
| GNUTLS_NONBLOCK * nonblock);
gnutls_priority_set_direct(session,
- "+CTYPE-OPENPGP:+CIPHER-ALL:+MAC-ALL:+ECDHE-RSA:+ANON-ECDH",
+ "NORMAL:+ECDHE-RSA:+ANON-ECDH",
0);
gnutls_transport_set_int(session, sock);
@@ -763,11 +712,11 @@ static void session_init(int sock, int server)
}
} else if (server) {
gnutls_anon_server_credentials_t acred;
- gnutls_anon_allocate_server_credentials(&acred);
+ assert(gnutls_anon_allocate_server_credentials(&acred)>=0);
gnutls_credentials_set(session, GNUTLS_CRD_ANON, acred);
} else {
gnutls_anon_client_credentials_t acred;
- gnutls_anon_allocate_client_credentials(&acred);
+ assert(gnutls_anon_allocate_client_credentials(&acred)>=0);
gnutls_credentials_set(session, GNUTLS_CRD_ANON, acred);
}