Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 1 | /** |
| 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 |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 37 | /* |
| 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! */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 42 | |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 43 | #define TLS_RSA_WITH_RC4_128_MD5 0x04 /**< Weak! */ |
| 44 | #define TLS_RSA_WITH_RC4_128_SHA 0x05 /**< Weak! */ |
| 45 | #define TLS_RSA_WITH_DES_CBC_SHA 0x09 /**< Weak! Not in TLS 1.2 */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 46 | |
| 47 | #define TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0A |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 48 | |
| 49 | #define TLS_DHE_RSA_WITH_DES_CBC_SHA 0x15 /**< Weak! Not in TLS 1.2 */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 50 | #define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x16 |
| 51 | |
Paul Bakker | a1bf92d | 2013-04-19 19:48:45 +0200 | [diff] [blame] | 52 | #define TLS_PSK_WITH_NULL_SHA 0x2C |
| 53 | #define TLS_DHE_PSK_WITH_NULL_SHA 0x2D |
| 54 | #define TLS_RSA_PSK_WITH_NULL_SHA 0x2E |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 55 | #define TLS_RSA_WITH_AES_128_CBC_SHA 0x2F |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 56 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 57 | #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x33 |
| 58 | #define TLS_RSA_WITH_AES_256_CBC_SHA 0x35 |
| 59 | #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x39 |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 60 | |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 61 | #define TLS_RSA_WITH_NULL_SHA256 0x3B /**< Weak! */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 62 | #define TLS_RSA_WITH_AES_128_CBC_SHA256 0x3C /**< TLS 1.2 */ |
| 63 | #define TLS_RSA_WITH_AES_256_CBC_SHA256 0x3D /**< TLS 1.2 */ |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 64 | |
| 65 | #define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x41 |
| 66 | #define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x45 |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 67 | |
| 68 | #define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x67 /**< TLS 1.2 */ |
| 69 | #define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x6B /**< TLS 1.2 */ |
| 70 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 71 | #define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x84 |
| 72 | #define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x88 |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 73 | |
| 74 | #define TLS_PSK_WITH_RC4_128_SHA 0x8A |
| 75 | #define TLS_PSK_WITH_3DES_EDE_CBC_SHA 0x8B |
| 76 | #define TLS_PSK_WITH_AES_128_CBC_SHA 0x8C |
| 77 | #define TLS_PSK_WITH_AES_256_CBC_SHA 0x8D |
| 78 | |
| 79 | #define TLS_DHE_PSK_WITH_RC4_128_SHA 0x8E |
| 80 | #define TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x8F |
| 81 | #define TLS_DHE_PSK_WITH_AES_128_CBC_SHA 0x90 |
| 82 | #define TLS_DHE_PSK_WITH_AES_256_CBC_SHA 0x91 |
| 83 | |
| 84 | #define TLS_RSA_PSK_WITH_RC4_128_SHA 0x92 |
| 85 | #define TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x93 |
| 86 | #define TLS_RSA_PSK_WITH_AES_128_CBC_SHA 0x94 |
| 87 | #define TLS_RSA_PSK_WITH_AES_256_CBC_SHA 0x95 |
| 88 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 89 | #define TLS_RSA_WITH_AES_128_GCM_SHA256 0x9C |
| 90 | #define TLS_RSA_WITH_AES_256_GCM_SHA384 0x9D |
| 91 | #define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x9E |
| 92 | #define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x9F |
| 93 | |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 94 | #define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBA /**< TLS 1.2 */ |
| 95 | #define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xBE /**< TLS 1.2 */ |
| 96 | |
| 97 | #define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC0 /**< TLS 1.2 */ |
| 98 | #define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0xC4 /**< TLS 1.2 */ |
| 99 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 100 | #define TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010 |
| 101 | #define TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011 |
| 102 | #define TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012 |
| 103 | #define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013 |
| 104 | #define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014 |
| 105 | |
Paul Bakker | a54e493 | 2013-03-20 15:31:54 +0100 | [diff] [blame] | 106 | #define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027 |
| 107 | #define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028 |
Paul Bakker | 0c5fac2 | 2013-04-19 21:10:51 +0200 | [diff] [blame^] | 108 | |
Paul Bakker | a54e493 | 2013-03-20 15:31:54 +0100 | [diff] [blame] | 109 | #define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F |
| 110 | #define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030 |
| 111 | |
Paul Bakker | 27714b1 | 2013-04-07 23:07:12 +0200 | [diff] [blame] | 112 | #define TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076 |
| 113 | #define TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077 |
| 114 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 115 | typedef enum { |
| 116 | POLARSSL_KEY_EXCHANGE_NONE = 0, |
| 117 | POLARSSL_KEY_EXCHANGE_RSA, |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 118 | POLARSSL_KEY_EXCHANGE_DHE_RSA, |
| 119 | POLARSSL_KEY_EXCHANGE_ECDHE_RSA, |
Paul Bakker | d4a56ec | 2013-04-16 18:05:29 +0200 | [diff] [blame] | 120 | POLARSSL_KEY_EXCHANGE_PSK, |
| 121 | POLARSSL_KEY_EXCHANGE_DHE_PSK, |
| 122 | POLARSSL_KEY_EXCHANGE_RSA_PSK, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 123 | } key_exchange_type_t; |
| 124 | |
| 125 | typedef struct _ssl_ciphersuite_t ssl_ciphersuite_t; |
| 126 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 127 | #define POLARSSL_CIPHERSUITE_WEAK 0x01 /*<! Weak ciphersuite flag */ |
| 128 | #define POLARSSL_CIPHERSUITE_EC 0x02 /*<! EC-based ciphersuite flag */ |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 129 | |
| 130 | /** |
| 131 | * \brief This structure is used for storing ciphersuite information |
| 132 | */ |
| 133 | struct _ssl_ciphersuite_t |
| 134 | { |
| 135 | int id; |
| 136 | const char * name; |
| 137 | |
| 138 | cipher_type_t cipher; |
| 139 | md_type_t mac; |
| 140 | key_exchange_type_t key_exchange; |
| 141 | |
| 142 | int min_major_ver; |
| 143 | int min_minor_ver; |
| 144 | int max_major_ver; |
| 145 | int max_minor_ver; |
| 146 | |
| 147 | unsigned char flags; |
| 148 | }; |
| 149 | |
| 150 | const int *ssl_ciphersuites_list( void ); |
| 151 | |
| 152 | const ssl_ciphersuite_t *ssl_ciphersuite_from_string( const char *ciphersuite_name ); |
| 153 | const ssl_ciphersuite_t *ssl_ciphersuite_from_id( int ciphersuite_id ); |
| 154 | |
| 155 | #ifdef __cplusplus |
| 156 | } |
| 157 | #endif |
| 158 | |
| 159 | #endif /* ssl_ciphersuites.h */ |