blob: 7ec31ae0be5d375d28e55fae9e6576e3867b7fab [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 Bakkera54e4932013-03-20 15:31:54 +010081#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027
82#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028
83#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F
84#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030
85
Paul Bakker27714b12013-04-07 23:07:12 +020086#define TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076
87#define TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077
88
Paul Bakker68884e32013-01-07 18:20:04 +010089typedef enum {
90 POLARSSL_KEY_EXCHANGE_NONE = 0,
91 POLARSSL_KEY_EXCHANGE_RSA,
Paul Bakker41c83d32013-03-20 14:39:14 +010092 POLARSSL_KEY_EXCHANGE_DHE_RSA,
93 POLARSSL_KEY_EXCHANGE_ECDHE_RSA,
Paul Bakker68884e32013-01-07 18:20:04 +010094} key_exchange_type_t;
95
96typedef struct _ssl_ciphersuite_t ssl_ciphersuite_t;
97
Paul Bakker41c83d32013-03-20 14:39:14 +010098#define POLARSSL_CIPHERSUITE_WEAK 0x01 /*<! Weak ciphersuite flag */
99#define POLARSSL_CIPHERSUITE_EC 0x02 /*<! EC-based ciphersuite flag */
Paul Bakker68884e32013-01-07 18:20:04 +0100100
101/**
102 * \brief This structure is used for storing ciphersuite information
103 */
104struct _ssl_ciphersuite_t
105{
106 int id;
107 const char * name;
108
109 cipher_type_t cipher;
110 md_type_t mac;
111 key_exchange_type_t key_exchange;
112
113 int min_major_ver;
114 int min_minor_ver;
115 int max_major_ver;
116 int max_minor_ver;
117
118 unsigned char flags;
119};
120
121const int *ssl_ciphersuites_list( void );
122
123const ssl_ciphersuite_t *ssl_ciphersuite_from_string( const char *ciphersuite_name );
124const ssl_ciphersuite_t *ssl_ciphersuite_from_id( int ciphersuite_id );
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* ssl_ciphersuites.h */