summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2019-12-18 14:29:21 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2019-12-19 20:13:06 +0100
commit9c3d0063689702d3f91db346247f28ce93a1c637 (patch)
tree72d64141bc1c090bdcfb2b357616629e35c92950 /tests
parent321a017fa467d200a9a8a446febfb5abda2519fe (diff)
downloadgnutls-9c3d0063689702d3f91db346247f28ce93a1c637.tar.gz
Export profile ID/name handling functions
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/gnutls-ids.c45
-rw-r--r--tests/gnutls-strcodes.c7
3 files changed, 53 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d3ae2a5df7..2e46290410 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -179,7 +179,7 @@ ctests += mini-record-2 simple gnutls_hmac_fast set_pkcs12_cred cert certuniquei
fallback-scsv pkcs8-key-decode urls dtls-rehandshake-cert rfc7633-ok \
key-usage-rsa key-usage-ecdhe-rsa mini-session-verify-function auto-verify \
record-timeouts mini-dtls-hello-verify-48 set-default-prio \
- tls12-anon-upgrade tlsext-decoding rsa-psk-cb \
+ tls12-anon-upgrade tlsext-decoding rsa-psk-cb gnutls-ids \
rehandshake-switch-cert rehandshake-switch-cert-allow rehandshake-switch-cert-client \
rehandshake-switch-cert-client-allow handshake-versions dtls-handshake-versions \
dtls-max-record tls12-max-record alpn-server-prec ocsp-filename-memleak \
diff --git a/tests/gnutls-ids.c b/tests/gnutls-ids.c
new file mode 100644
index 0000000000..f1ee91232f
--- /dev/null
+++ b/tests/gnutls-ids.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 Red Hat
+ *
+ * Author: 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 <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <gnutls/gnutls.h>
+#include <gnutls/dane.h>
+#include <assert.h>
+
+#include "utils.h"
+
+void doit(void)
+{
+ assert(gnutls_certificate_verification_profile_get_id("very weak") == GNUTLS_PROFILE_VERY_WEAK);
+ assert(gnutls_certificate_verification_profile_get_id("low") == GNUTLS_PROFILE_LOW);
+ assert(gnutls_certificate_verification_profile_get_id("legacy") == GNUTLS_PROFILE_LEGACY);
+ assert(gnutls_certificate_verification_profile_get_id("MedIum") == GNUTLS_PROFILE_MEDIUM);
+ assert(gnutls_certificate_verification_profile_get_id("ultra") == GNUTLS_PROFILE_ULTRA);
+ assert(gnutls_certificate_verification_profile_get_id("future") == GNUTLS_PROFILE_FUTURE);
+ assert(gnutls_certificate_verification_profile_get_id("xxx") == GNUTLS_PROFILE_UNKNOWN);
+}
diff --git a/tests/gnutls-strcodes.c b/tests/gnutls-strcodes.c
index 294fcac203..0d3f14b600 100644
--- a/tests/gnutls-strcodes.c
+++ b/tests/gnutls-strcodes.c
@@ -115,6 +115,13 @@ void doit(void)
check_non_null(gnutls_sec_param_get_name(i));
}
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_VERY_WEAK));
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_LOW));
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_LEGACY));
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_MEDIUM));
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_HIGH));
+ check_non_null(gnutls_certificate_verification_profile_get_name(GNUTLS_PROFILE_ULTRA));
+
for (i=GNUTLS_ECC_CURVE_INVALID+1;i<=GNUTLS_ECC_CURVE_MAX;i++) {
if (_gnutls_ecc_curve_is_supported(i) == 0)
continue;