Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wtls_machine-decl.h
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2016 Kannel Group
5  * Copyright (c) 1998-2001 WapIT Ltd.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Kannel Group (http://www.kannel.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Kannel" and "Kannel Group" must not be used to
28  * endorse or promote products derived from this software without
29  * prior written permission. For written permission, please
30  * contact org@kannel.org.
31  *
32  * 5. Products derived from this software may not be called "Kannel",
33  * nor may "Kannel" appear in their name, without prior written
34  * permission of the Kannel Group.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Kannel Group. For more information on
51  * the Kannel Group, please see <http://www.kannel.org/>.
52  *
53  * Portions of this software are based upon software originally written at
54  * WapIT Ltd., Helsinki, Finland for the Kannel project.
55  */
56 
57 
58 /*
59  * wtls_machine-decl.h - macro call for generating WTLS server state machine. See
60  * the architecture document for guidance how to use and update it.
61  *
62  * By Nick Clarey <nclarey@3glab.com> (c) 3GLab Ltd.
63  * Nikos Balkanas, Inaccess Networks (2009)
64  *
65  * The WTLSMachine data structure preserves the state of the existing WTLS
66  * transaction. The fields which are included;
67  *
68  * Machine identification: address four-tuple
69  * Connection End : Server (1) or Client (2) This is always "server"
70  * (at least at the moment)
71  * Bulk Cipher Algorithm : The algorithm to be used for stream or block encryption
72  * Key Size : ?????
73  * IV Size : The base IV used to calculate a record level IV for block ciphers running
74  * in CBC mode for records sent by the server
75  * MAC Algorithm : The algorithm identifier used for message authentication.
76  * Master Secret : A shared secret between the two peers
77  * Client Random : A random value supplied by the client
78  * Server Random : A random value supplied by the server
79  * Sequence Number Mode : Off (0), Implicit (1) or Explicit (2)
80  * Key Refresh rate : New keys for MAC secret, IV and Encryption are calculated
81  * every "n", where n = 2^(RefreshRate)
82  * Compression Method : The algorithm to compress data prior to encryption
83  *
84  */
85 
86 #if !defined(MACHINE)
87 #error "wtls_machine-decl.h: Macro MACHINE is missing."
88 #elif !defined(ENUM)
89 #error "wtls_machine-decl.h: Macro ENUM is missing."
90 #elif !defined(ADDRTUPLE)
91 #error "wtls_machine-decl.h: Macro ADDRTUPLE is missing."
92 #elif !defined(INTEGER)
93 #error "wtls_machine-decl.h: Macro INTEGER is missing."
94 #elif !defined(OCTSTR)
95 #error "wtls_machine-decl.h: Macro OCTSTR is missing."
96 #elif !defined(PDULIST)
97 #error "wtls_machine-decl.h: Macro PDULIST is missing."
98 #endif
99 
100 /* Need to add server sent and client received packets for sequence numbering */
101 /* Last received packet maybe needs to be hashed according to Alert message in
102  case we need to send an alert. */
103 
104 MACHINE(ENUM(state)
105  ADDRTUPLE(addr_tuple) /* The source address/port and dest address/port */
106  INTEGER(bulk_cipher_algorithm) /* Bulk Cipher Algorithm identifier */
107  INTEGER(cipher_type) /* Cipher type */
108  INTEGER(mac_algorithm) /* MAC Algorithm identifier */
109  OCTSTR(client_random) /* The client's random number */
110  OCTSTR(server_random) /* The server's random number */
111  OCTSTR(master_secret) /* The master secret */
112  INTEGER (key_algorithm) /* Exchange key algorithm chosen */
113  INTEGER (key_size) /* The "key size". Which key size, I have no idea */
114  INTEGER (key_material_length) /* and what might that be ? */
115  INTEGER (is_exportable) /* exportable flag (?) */
116  INTEGER(iv_size) /* The IV size */
117  INTEGER(mac_size) /* MAC size */
118  INTEGER(mac_key_size) /* MAC key size */
119  INTEGER(sequence_number_mode) /* The sequence number mode */
120  INTEGER(key_refresh) /* How often we should refresh our keys */
121  INTEGER(last_refresh) /* Last client seqnum when keys were refreshed */
122  OCTSTR(compression_method) /* The compression algorithm */
123  INTEGER(encrypted) /* set if packets are encrypted */
124 
125  OCTSTR(client_write_MAC_secret) /* */
126  OCTSTR(client_write_enc_key) /* */
127  OCTSTR(client_write_IV) /* */
128  OCTSTR(server_write_MAC_secret) /* */
129  OCTSTR(server_write_enc_key) /* */
130  OCTSTR(server_write_IV) /* */
131  INTEGER(client_seq_num) /* incremented for each client msg */
132  INTEGER(server_seq_num) /* incremented for each server msg */
133 
134  OCTSTR(last_packet_checksum) /* The last received packet checksum */
135  PDULIST(last_received_packet) /* The last received packet checksum */
136  OCTSTR(handshake_data) /* All the handshake payloads, received or sent,
137  concatenated in order */
138  OCTSTR(packet_to_send) /* A packet we're preparing to send */
139  )
140 
141 #undef MACHINE
142 #undef ENUM
143 #undef ADDRTUPLE
144 #undef INTEGER
145 #undef OCTSTR
146 #undef PDULIST
#define INTEGER(name)
#define MACHINE(fields)
#define ADDRTUPLE(name)
#define OCTSTR(os)
Definition: bb_smscconn.c:733
#define ENUM(name)
Definition: wtls.h:94
OPEN NULL_STATE NULL_STATE OPENING OPEN NULL_STATE NULL_STATE OPEN wtls_machine last_refresh
#define PDULIST(name)
Definition: wtls.h:99
alert u SEC_Terminate_Req addr_tuple
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.