blob: 5e1e28dfff7f181fd9734f9e09c23ef301260e66 [file] [log] [blame]
Paul Bakker68884e32013-01-07 18:20:04 +01001/**
2 * \file ssl_ciphersuites.h
3 *
4 * \brief SSL Ciphersuites for PolarSSL
5 *
6 * Copyright (C) 2006-2013, Brainspark B.V.
7 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_SSL_CIPHERSUITES_H
28#define POLARSSL_SSL_CIPHERSUITES_H
29
30#include "cipher.h"
31#include "md.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
Paul Bakker41c83d32013-03-20 14:39:14 +010037/*
38 * Supported ciphersuites (Official IANA names)
39 */
40#define TLS_RSA_WITH_NULL_MD5 0x01 /**< Weak! */
41#define TLS_RSA_WITH_NULL_SHA 0x02 /**< Weak! */
42#define TLS_RSA_WITH_NULL_SHA256 0x3B /**< Weak! */
43#define TLS_RSA_WITH_DES_CBC_SHA 0x09 /**< Weak! Not in TLS 1.2 */
44#define TLS_DHE_RSA_WITH_DES_CBC_SHA 0x15 /**< Weak! Not in TLS 1.2 */
45
46#define TLS_RSA_WITH_RC4_128_MD5 0x04
47#define TLS_RSA_WITH_RC4_128_SHA 0x05
48
49#define TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0A
50#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x16
51
52#define TLS_RSA_WITH_AES_128_CBC_SHA 0x2F
53#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x33
54#define TLS_RSA_WITH_AES_256_CBC_SHA 0x35
55#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x39
56#define TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C /**< TLS 1.2 */
57#define TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D /**< TLS 1.2 */
58#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x67 /**< TLS 1.2 */
59#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x6B /**< TLS 1.2 */
60
61#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41
62#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x45
63#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84
64#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88
65#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA /**< TLS 1.2 */
66#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBE /**< TLS 1.2 */
67#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0 /**< TLS 1.2 */
68#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4 /**< TLS 1.2 */
69
70#define TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C
71#define TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D
72#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x9E
73#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x9F
74
75#define TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010
76#define TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011
77#define TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012
78#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013
79#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014
80
Paul Bakker68884e32013-01-07 18:20:04 +010081typedef enum {
82 POLARSSL_KEY_EXCHANGE_NONE = 0,
83 POLARSSL_KEY_EXCHANGE_RSA,
Paul Bakker41c83d32013-03-20 14:39:14 +010084 POLARSSL_KEY_EXCHANGE_DHE_RSA,
85 POLARSSL_KEY_EXCHANGE_ECDHE_RSA,
Paul Bakker68884e32013-01-07 18:20:04 +010086} key_exchange_type_t;
87
88typedef struct _ssl_ciphersuite_t ssl_ciphersuite_t;
89
Paul Bakker41c83d32013-03-20 14:39:14 +010090#define POLARSSL_CIPHERSUITE_WEAK 0x01 /*<! Weak ciphersuite flag */
91#define POLARSSL_CIPHERSUITE_EC 0x02 /*<! EC-based ciphersuite flag */
Paul Bakker68884e32013-01-07 18:20:04 +010092
93/**
94 * \brief This structure is used for storing ciphersuite information
95 */
96struct _ssl_ciphersuite_t
97{
98 int id;
99 const char * name;
100
101 cipher_type_t cipher;
102 md_type_t mac;
103 key_exchange_type_t key_exchange;
104
105 int min_major_ver;
106 int min_minor_ver;
107 int max_major_ver;
108 int max_minor_ver;
109
110 unsigned char flags;
111};
112
113const int *ssl_ciphersuites_list( void );
114
115const ssl_ciphersuite_t *ssl_ciphersuite_from_string( const char *ciphersuite_name );
116const ssl_ciphersuite_t *ssl_ciphersuite_from_id( int ciphersuite_id );
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif /* ssl_ciphersuites.h */