|
Packit Service |
4684c1 |
/*
|
|
Packit Service |
4684c1 |
* Copyright (C) 2017-2018 Red Hat, Inc.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* Author: Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* This file is part of GnuTLS.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* GnuTLS is free software; you can redistribute it and/or modify it
|
|
Packit Service |
4684c1 |
* under the terms of the GNU General Public License as published by
|
|
Packit Service |
4684c1 |
* the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
4684c1 |
* (at your option) any later version.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* GnuTLS is distributed in the hope that it will be useful, but
|
|
Packit Service |
4684c1 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4684c1 |
* General Public License for more details.
|
|
Packit Service |
4684c1 |
*
|
|
Packit Service |
4684c1 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
4684c1 |
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifdef HAVE_CONFIG_H
|
|
Packit Service |
4684c1 |
#include <config.h>
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* This program tests the ciphersuite negotiation for various key exchange
|
|
Packit Service |
4684c1 |
* methods and options under TLS1.3. */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include <stdio.h>
|
|
Packit Service |
4684c1 |
#include <stdlib.h>
|
|
Packit Service |
4684c1 |
#include <string.h>
|
|
Packit Service |
4684c1 |
#include <errno.h>
|
|
Packit Service |
4684c1 |
#include <gnutls/gnutls.h>
|
|
Packit Service |
4684c1 |
#include "utils.h"
|
|
Packit Service |
4684c1 |
#include "cert-common.h"
|
|
Packit Service |
4684c1 |
#include "eagain-common.h"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include "cipher-neg-common.c"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
/* We remove the ECDHE and DHE key exchanges as they impose additional
|
|
Packit Service |
4684c1 |
* rules in the sorting of groups.
|
|
Packit Service |
4684c1 |
*/
|
|
Packit Service |
4684c1 |
#define SPRIO "NORMAL:-VERS-ALL:+VERS-TLS1.3"
|
|
Packit Service |
4684c1 |
#define CPRIO "NORMAL:-VERS-ALL:+VERS-TLS1.3"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
test_case_st tests[] = {
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "server TLS 1.3: NULL (server - exp fallback)",
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_NULL,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+VERS-TLS1.2:-CIPHER-ALL:+NULL:+CIPHER-ALL:%SERVER_PRECEDENCE:-GROUP-ALL:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+VERS-TLS1.2:+NULL:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.2)-(ECDHE-SECP256R1)-(ECDSA-SHA256)-(NULL)-(SHA1)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "client TLS 1.3: NULL (client)",
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_NULL,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+VERS-TLS1.2:+NULL:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+NULL:+CIPHER-ALL:+VERS-TLS1.2:-GROUP-ALL:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.2)-(ECDHE-SECP256R1)-(ECDSA-SHA256)-(NULL)-(SHA1)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "server TLS 1.3: AES-128-GCM with SECP256R1 (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_GCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_SECP256R1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+AES-128-GCM:+CIPHER-ALL:%SERVER_PRECEDENCE:-GROUP-ALL:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+AES-128-GCM:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: AES-128-GCM with X25519 (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_GCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_X25519,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+AES-128-GCM:+CIPHER-ALL:%SERVER_PRECEDENCE:-GROUP-ALL:+GROUP-X25519:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+AES-128-GCM:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-X25519)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "client TLS 1.3: AES-128-GCM with SECP256R1 (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_GCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_SECP256R1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+AES-128-GCM:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+AES-128-GCM:+CIPHER-ALL:-VERS-ALL:+VERS-TLS1.3:-GROUP-ALL:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: AES-128-GCM with X25519 (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_GCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_X25519,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+AES-128-GCM:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-SECP384R1:+GROUP-SECP521R1:+GROUP-SECP256R1:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+AES-128-GCM:+CIPHER-ALL:-VERS-ALL:+VERS-TLS1.3:-GROUP-ALL:+GROUP-X25519:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-X25519)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "server TLS 1.3: AES-128-CCM and FFDHE2048 (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_CCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_FFDHE2048,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+AES-128-CCM:+CIPHER-ALL:%SERVER_PRECEDENCE:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+AES-128-CCM",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(DHE-FFDHE2048)-(RSA-PSS-RSAE-SHA256)-(AES-128-CCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: AES-128-CCM and FFDHE 2048 (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_CCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_FFDHE2048,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+AES-128-CCM:+CIPHER-ALL:%SERVER_PRECEDENCE:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+AES-128-CCM:+VERS-TLS1.3",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(DHE-FFDHE2048)-(RSA-PSS-RSAE-SHA256)-(AES-128-CCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "client TLS 1.3: AES-128-CCM and FFDHE 2048 (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_CCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_FFDHE2048,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+AES-128-CCM",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+AES-128-CCM:+CIPHER-ALL:-VERS-ALL:+VERS-TLS1.3:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(DHE-FFDHE2048)-(RSA-PSS-RSAE-SHA256)-(AES-128-CCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: AES-128-CCM and FFDHE 2048 (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_AES_128_CCM,
|
|
Packit Service |
4684c1 |
.group = GNUTLS_GROUP_FFDHE2048,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+AES-128-CCM:+VERS-TLS1.3",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+AES-128-CCM:+CIPHER-ALL:-VERS-ALL:+VERS-TLS1.3:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(DHE-FFDHE2048)-(RSA-PSS-RSAE-SHA256)-(AES-128-CCM)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "server TLS 1.3: CHACHA20-POLY (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_CHACHA20_POLY1305,
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+CHACHA20-POLY1305:+CIPHER-ALL:%SERVER_PRECEDENCE",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+CHACHA20-POLY1305",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(CHACHA20-POLY1305)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: CHACHA20-POLY (server)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_CHACHA20_POLY1305,
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":-CIPHER-ALL:+CHACHA20-POLY1305:+CIPHER-ALL:%SERVER_PRECEDENCE",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":+CHACHA20-POLY1305:+VERS-TLS1.3",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(CHACHA20-POLY1305)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "client TLS 1.3: CHACHA20-POLY (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_CHACHA20_POLY1305,
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+CHACHA20-POLY1305",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+CHACHA20-POLY1305:+CIPHER-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(CHACHA20-POLY1305)",
|
|
Packit Service |
4684c1 |
},
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
.name = "both TLS 1.3: CHACHA20-POLY (client)",
|
|
Packit Service |
4684c1 |
.cipher = GNUTLS_CIPHER_CHACHA20_POLY1305,
|
|
Packit Service |
4684c1 |
.not_on_fips = 1,
|
|
Packit Service |
4684c1 |
.server_prio = SPRIO":+CHACHA20-POLY1305",
|
|
Packit Service |
4684c1 |
.client_prio = CPRIO":-CIPHER-ALL:+CHACHA20-POLY1305:+CIPHER-ALL",
|
|
Packit Service |
4684c1 |
.desc = "(TLS1.3)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(CHACHA20-POLY1305)",
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
};
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
void doit(void)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
unsigned i;
|
|
Packit Service |
4684c1 |
global_init();
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
for (i=0;i
|
|
Packit Service |
4684c1 |
try(&tests[i]);
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
gnutls_global_deinit();
|
|
Packit Service |
4684c1 |
}
|