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