00001 /* ==================================================================== 00002 * The Kannel Software License, Version 1.0 00003 * 00004 * Copyright (c) 2001-2008 Kannel Group 00005 * Copyright (c) 1998-2001 WapIT Ltd. 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Kannel Group (http://www.kannel.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Kannel" and "Kannel Group" must not be used to 00028 * endorse or promote products derived from this software without 00029 * prior written permission. For written permission, please 00030 * contact org@kannel.org. 00031 * 00032 * 5. Products derived from this software may not be called "Kannel", 00033 * nor may "Kannel" appear in their name, without prior written 00034 * permission of the Kannel Group. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS 00040 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 00041 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00042 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00043 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00044 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 00045 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00046 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00047 * ==================================================================== 00048 * 00049 * This software consists of voluntary contributions made by many 00050 * individuals on behalf of the Kannel Group. For more information on 00051 * the Kannel Group, please see <http://www.kannel.org/>. 00052 * 00053 * Portions of this software are based upon software originally written at 00054 * WapIT Ltd., Helsinki, Finland for the Kannel project. 00055 */ 00056 00057 00058 /* 00059 * wtls_machine-decl.h - macro call for generating WTLS server state machine. See 00060 * the architecture document for guidance how to use and update it. 00061 * 00062 * By Nick Clarey <nclarey@3glab.com> (c) 3GLab Ltd. 00063 * 00064 * The WTLSMachine data structure preserves the state of the existing WTLS 00065 * transaction. The fields which are included; 00066 * 00067 * Machine identification: address four-tuple 00068 * Connection End : Server (1) or Client (2) This is always "server" 00069 * (at least at the moment) 00070 * Bulk Cipher Algorithm : The algorithm to be used for stream or block encryption 00071 * Key Size : ????? 00072 * IV Size : The base IV used to calculate a record level IV for block ciphers running 00073 * in CBC mode for records sent by the server 00074 * MAC Algorithm : The algorithm identifier used for message authentication. 00075 * Master Secret : A shared secret between the two peers 00076 * Client Random : A random value supplied by the client 00077 * Server Random : A random value supplied by the server 00078 * Sequence Number Mode : Off (0), Implicit (1) or Explicit (2) 00079 * Key Refresh rate : New keys for MAC secret, IV and Encryption are calculated 00080 * every "n", where n = 2^(RefreshRate) 00081 * Compression Method : The algorithm to compress data prior to encryption 00082 * 00083 */ 00084 00085 #if !defined(MACHINE) 00086 #error "wtls_machine-decl.h: Macro MACHINE is missing." 00087 #elif !defined(ENUM) 00088 #error "wtls_machine-decl.h: Macro ENUM is missing." 00089 #elif !defined(ADDRTUPLE) 00090 #error "wtls_machine-decl.h: Macro ADDRTUPLE is missing." 00091 #elif !defined(INTEGER) 00092 #error "wtls_machine-decl.h: Macro INTEGER is missing." 00093 #elif !defined(OCTSTR) 00094 #error "wtls_machine-decl.h: Macro OCTSTR is missing." 00095 #elif !defined(PDULIST) 00096 #error "wtls_machine-decl.h: Macro PDULIST is missing." 00097 #endif 00098 00099 /* Need to add server sent and client received packets for sequence numbering */ 00100 /* Last received packet maybe needs to be hashed according to Alert message in 00101 case we need to send an alert. */ 00102 00103 MACHINE(ENUM(state) 00104 ADDRTUPLE(addr_tuple) /* The source address/port and dest address/port */ 00105 INTEGER(bulk_cipher_algorithm) /* Bulk Cipher Algorithm identifier */ 00106 INTEGER(cipher_type) /* Cipher type */ 00107 INTEGER(mac_algorithm) /* MAC Algorithm identifier */ 00108 OCTSTR(client_random) /* The client's random number */ 00109 OCTSTR(server_random) /* The server's random number */ 00110 OCTSTR(master_secret) /* The master secret */ 00111 INTEGER (key_size) /* The "key size". Which key size, I have no idea */ 00112 INTEGER (key_material_length) /* and what might that be ? */ 00113 INTEGER (is_exportable) /* exportable flag (?) */ 00114 INTEGER(iv_size) /* The IV size */ 00115 INTEGER(mac_size) /* MAC size */ 00116 INTEGER(mac_key_size) /* MAC key size */ 00117 INTEGER(sequence_number_mode) /* The sequence number mode */ 00118 INTEGER(key_refresh) /* How often we should refresh our keys */ 00119 OCTSTR(compression_method) /* The compression algorithm */ 00120 INTEGER(encrypted) /* set if packets are encrypted */ 00121 00122 OCTSTR(client_write_MAC_secret) /* */ 00123 OCTSTR(client_write_enc_key) /* */ 00124 OCTSTR(client_write_IV) /* */ 00125 OCTSTR(server_write_MAC_secret) /* */ 00126 OCTSTR(server_write_enc_key) /* */ 00127 OCTSTR(server_write_IV) /* */ 00128 INTEGER(client_seq_num) /* incremented for each client msg */ 00129 INTEGER(server_seq_num) /* incremented for each server msg */ 00130 00131 OCTSTR(last_packet_checksum) /* The last received packet checksum */ 00132 PDULIST(last_received_packet) /* The last received packet checksum */ 00133 OCTSTR(handshake_data) /* All the handshake payloads, received or sent, 00134 concatenated in order */ 00135 OCTSTR(packet_to_send) /* A packet we're preparing to send */ 00136 ) 00137 00138 #undef MACHINE 00139 #undef ENUM 00140 #undef ADDRTUPLE 00141 #undef INTEGER 00142 #undef OCTSTR 00143 #undef PDULIST