]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Added some TLS constants
authorMartin Willi <martin@revosec.ch>
Thu, 21 Jan 2010 14:11:38 +0000 (15:11 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 3 Aug 2010 13:39:24 +0000 (15:39 +0200)
src/charon/plugins/eap_tls/Makefile.am
src/charon/plugins/eap_tls/tls/tls.c [new file with mode: 0644]
src/charon/plugins/eap_tls/tls/tls.h [new file with mode: 0644]

index 236e50d837adee29becc0cac5da59d4f2a914b7d..694b869e5e5f5e0bbe2f3f29aafb1a6fc97babf7 100644 (file)
@@ -6,5 +6,5 @@ AM_CFLAGS = -rdynamic
 plugin_LTLIBRARIES = libstrongswan-eap-tls.la
 
 libstrongswan_eap_tls_la_SOURCES = eap_tls_plugin.h eap_tls_plugin.c \
-       eap_tls.h eap_tls.c
+       eap_tls.h eap_tls.c tls/tls.h tls/tls.c
 libstrongswan_eap_tls_la_LDFLAGS = -module -avoid-version
diff --git a/src/charon/plugins/eap_tls/tls/tls.c b/src/charon/plugins/eap_tls/tls/tls.c
new file mode 100644 (file)
index 0000000..930ae78
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "tls.h"
+
+ENUM(tls_version_names, SSL_2_0, TLS_1_2,
+       "SSLv2",
+       "SSLv3",
+       "TLS 1.0",
+       "TLS 1.1",
+       "TLS 1.2",
+);
+
+ENUM(tls_content_type_names, TLS_CHANGE_CIPHER_SPEC, TLS_APPLICATION_DATA,
+       "ChangeCipherSpec",
+       "Alert",
+       "Handshake",
+       "ApplicationData",
+);
+
+ENUM_BEGIN(tls_handshake_type_names, TLS_HELLO_REQUEST, TLS_SERVER_HELLO,
+       "HelloRequest",
+       "ClientHello",
+       "ServerHello");
+ENUM_NEXT(tls_handshake_type_names, TLS_CERTIFICATE, TLS_CLIENT_KEY_EXCHANGE, TLS_SERVER_HELLO,
+       "Certificate",
+       "ServerKeyExchange",
+       "CertificateRequest",
+       "ServerHelloDone",
+       "CertificateVerify",
+       "ClientKeyExchange");
+ENUM_NEXT(tls_handshake_type_names, TLS_FINISHED, TLS_FINISHED, TLS_CLIENT_KEY_EXCHANGE,
+       "Finished");
+ENUM_END(tls_handshake_type_names, TLS_FINISHED);
diff --git a/src/charon/plugins/eap_tls/tls/tls.h b/src/charon/plugins/eap_tls/tls/tls.h
new file mode 100644 (file)
index 0000000..d7a3317
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2010 Martin Willi
+ * Copyright (C) 2010 revosec AG
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+/**
+ * @defgroup tlsgroup tls
+ * @{ @ingroup eap_tls
+ *
+ * @defgroup tls tls
+ * @{ @ingroup tls
+ */
+
+#ifndef TLS_H_
+#define TLS_H_
+
+typedef enum tls_version_t tls_version_t;
+typedef enum tls_content_type_t tls_content_type_t;
+typedef enum tls_handshake_type_t tls_handshake_type_t;
+typedef enum tls_cipher_suite_t tls_cipher_suite_t;
+
+#include <library.h>
+
+/**
+ * TLS/SSL version numbers
+ */
+enum tls_version_t {
+       SSL_2_0 = 0x0200,
+       SSL_3_0 = 0x0300,
+       TLS_1_0 = 0x0301,
+       TLS_1_1 = 0x0302,
+       TLS_1_2 = 0x0303,
+};
+
+/**
+ * Enum names for tls_version_t
+ */
+extern enum_name_t *tls_version_names;
+
+/**
+ * TLS higher level content type
+ */
+enum tls_content_type_t {
+       TLS_CHANGE_CIPHER_SPEC = 20,
+       TLS_ALERT = 21,
+       TLS_HANDSHAKE = 22,
+       TLS_APPLICATION_DATA = 23,
+};
+
+/**
+ * Enum names for tls_content_type_t
+ */
+extern enum_name_t *tls_content_type_names;
+
+/**
+ * TLS handshake subtype
+ */
+enum tls_handshake_type_t {
+       TLS_HELLO_REQUEST = 0,
+       TLS_CLIENT_HELLO = 1,
+       TLS_SERVER_HELLO = 2,
+       TLS_CERTIFICATE = 11,
+       TLS_SERVER_KEY_EXCHANGE = 12,
+       TLS_CERTIFICATE_REQUEST = 13,
+       TLS_SERVER_HELLO_DONE = 14,
+       TLS_CERTIFICATE_VERIFY = 15,
+       TLS_CLIENT_KEY_EXCHANGE = 16,
+       TLS_FINISHED = 20,
+};
+
+/**
+ * Enum names for tls_handshake_type_t
+ */
+extern enum_name_t *tls_handshake_type_names;
+
+enum tls_cipher_suite_t {
+       TLS_NULL_WITH_NULL_NULL =                               0x00,
+       TLS_RSA_WITH_NULL_MD5 =                                 0x01,
+       TLS_RSA_WITH_NULL_SHA =                                 0x02,
+       TLS_RSA_WITH_NULL_SHA256 =                              0x3B,
+       TLS_RSA_WITH_RC4_128_MD5 =                              0x04,
+       TLS_RSA_WITH_RC4_128_SHA =                              0x05,
+       TLS_RSA_WITH_3DES_EDE_CBC_SHA =                 0x0A,
+       TLS_RSA_WITH_AES_128_CBC_SHA =                  0x2F,
+       TLS_RSA_WITH_AES_256_CBC_SHA =                  0x35,
+       TLS_RSA_WITH_AES_128_CBC_SHA256 =               0x3C,
+       TLS_RSA_WITH_AES_256_CBC_SHA256 =               0x3D,
+       TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA =              0x0D,
+       TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA =              0x10,
+       TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA =             0x13,
+       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA =             0x16,
+       TLS_DH_DSS_WITH_AES_128_CBC_SHA =               0x30,
+       TLS_DH_RSA_WITH_AES_128_CBC_SHA =               0x31,
+       TLS_DHE_DSS_WITH_AES_128_CBC_SHA =              0x32,
+       TLS_DHE_RSA_WITH_AES_128_CBC_SHA =              0x33,
+       TLS_DH_DSS_WITH_AES_256_CBC_SHA =               0x36,
+       TLS_DH_RSA_WITH_AES_256_CBC_SHA =               0x37,
+       TLS_DHE_DSS_WITH_AES_256_CBC_SHA =              0x38,
+       TLS_DHE_RSA_WITH_AES_256_CBC_SHA =              0x39,
+       TLS_DH_DSS_WITH_AES_128_CBC_SHA256 =    0x3E,
+       TLS_DH_RSA_WITH_AES_128_CBC_SHA256 =    0x3F,
+       TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 =   0x40,
+       TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 =   0x67,
+       TLS_DH_DSS_WITH_AES_256_CBC_SHA256 =    0x68,
+       TLS_DH_RSA_WITH_AES_256_CBC_SHA256 =    0x69,
+       TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 =   0x6A,
+       TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 =   0x6B,
+       TLS_DH_ANON_WITH_RC4_128_MD5 =                  0x18,
+       TLS_DH_ANON_WITH_3DES_EDE_CBC_SHA =             0x1B,
+       TLS_DH_ANON_WITH_AES_128_CBC_SHA =              0x34,
+       TLS_DH_ANON_WITH_AES_256_CBC_SHA =              0x3A,
+       TLS_DH_ANON_WITH_AES_128_CBC_SHA256 =   0x6C,
+       TLS_DH_ANON_WITH_AES_256_CBC_SHA256 =   0x6D,
+};
+
+#endif /** TLS_H_ @}*/