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! */ |
| 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 Bakker | a54e493 | 2013-03-20 15:31:54 +0100 | [diff] [blame^] | 81 | #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 Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 86 | typedef enum { |
| 87 | POLARSSL_KEY_EXCHANGE_NONE = 0, |
| 88 | POLARSSL_KEY_EXCHANGE_RSA, |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 89 | POLARSSL_KEY_EXCHANGE_DHE_RSA, |
| 90 | POLARSSL_KEY_EXCHANGE_ECDHE_RSA, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 91 | } key_exchange_type_t; |
| 92 | |
| 93 | typedef struct _ssl_ciphersuite_t ssl_ciphersuite_t; |
| 94 | |
Paul Bakker | 41c83d3 | 2013-03-20 14:39:14 +0100 | [diff] [blame] | 95 | #define POLARSSL_CIPHERSUITE_WEAK 0x01 /*<! Weak ciphersuite flag */ |
| 96 | #define POLARSSL_CIPHERSUITE_EC 0x02 /*<! EC-based ciphersuite flag */ |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * \brief This structure is used for storing ciphersuite information |
| 100 | */ |
| 101 | struct _ssl_ciphersuite_t |
| 102 | { |
| 103 | int id; |
| 104 | const char * name; |
| 105 | |
| 106 | cipher_type_t cipher; |
| 107 | md_type_t mac; |
| 108 | key_exchange_type_t key_exchange; |
| 109 | |
| 110 | int min_major_ver; |
| 111 | int min_minor_ver; |
| 112 | int max_major_ver; |
| 113 | int max_minor_ver; |
| 114 | |
| 115 | unsigned char flags; |
| 116 | }; |
| 117 | |
| 118 | const int *ssl_ciphersuites_list( void ); |
| 119 | |
| 120 | const ssl_ciphersuite_t *ssl_ciphersuite_from_string( const char *ciphersuite_name ); |
| 121 | const ssl_ciphersuite_t *ssl_ciphersuite_from_id( int ciphersuite_id ); |
| 122 | |
| 123 | #ifdef __cplusplus |
| 124 | } |
| 125 | #endif |
| 126 | |
| 127 | #endif /* ssl_ciphersuites.h */ |