1 /* 2 3 silcske_payload.h 4 5 Author: Pekka Riikonen <priikone@silcnet.org> 6 7 Copyright (C) 2000 - 2005 Pekka Riikonen 8 9 The contents of this file are subject to one of the Licenses specified 10 in the COPYING file; You may not use this file except in compliance 11 with the License. 12 13 The software distributed under the License is distributed on an "AS IS" 14 basis, in the hope that it will be useful, but WITHOUT WARRANTY OF ANY 15 KIND, either expressed or implied. See the COPYING file for more 16 information. 17 18 */ 19 20 /****h* silcske/SKE Payloads 21 * 22 * DESCRIPTION 23 * 24 * This interface defines the implementation of the SKE Payloads, as 25 * defined by the SKE protocol. This interface is mainly used by the SKE 26 * library, however all structures are public and the interface can be used 27 * by the application if needed. Usually application does not need use this 28 * interface. 29 * 30 ***/ 31 32 #ifndef SILCSKE_PAYLOAD_H 33 #define SILCSKE_PAYLOAD_H 34 35 /****s* silcske/SilcSKEPayloads/SilcSKEStartPayload 36 * 37 * NAME 38 * 39 * typedef struct SilcSKEStartPayloadStruct SilcSKEStartPayload; 40 * 41 * DESCRIPTION 42 * 43 * This context is the actual Key Exchange Start Payload and is allocated 44 * by silc_ske_payload_start_decode. It is freed by calling the 45 * silc_ske_payload_start_free function. 46 * 47 ***/ 48 typedef struct SilcSKEStartPayloadStruct *SilcSKEStartPayload; 49 50 /****s* silcske/SilcSKEPayloads/SilcSKEKEPayload 51 * 52 * NAME 53 * 54 * typedef struct SilcSKEKEPayloadStruct SilcSKEKEPayload; 55 * 56 * DESCRIPTION 57 * 58 * This context is the actual Key Exchange Payload and is allocated 59 * by silc_ske_payload_ke_decode. It is freed by calling the 60 * silc_ske_payload_ke_free function. 61 * 62 ***/ 63 typedef struct SilcSKEKEPayloadStruct *SilcSKEKEPayload; 64 65 /* SILC Key Exchange Start Payload */ 66 struct SilcSKEStartPayloadStruct { 67 unsigned char flags; 68 SilcUInt16 len; 69 70 unsigned char *cookie; 71 SilcUInt16 cookie_len; 72 73 unsigned char *version; 74 SilcUInt16 version_len; 75 76 SilcUInt16 ke_grp_len; 77 unsigned char *ke_grp_list; 78 79 SilcUInt16 pkcs_alg_len; 80 unsigned char *pkcs_alg_list; 81 82 SilcUInt16 enc_alg_len; 83 unsigned char *enc_alg_list; 84 85 SilcUInt16 hash_alg_len; 86 unsigned char *hash_alg_list; 87 88 SilcUInt16 hmac_alg_len; 89 unsigned char *hmac_alg_list; 90 91 SilcUInt16 comp_alg_len; 92 unsigned char *comp_alg_list; 93 }; 94 95 /* SILC Key Exchange Payload */ 96 struct SilcSKEKEPayloadStruct { 97 SilcUInt16 pk_len; 98 unsigned char *pk_data; 99 SilcUInt16 pk_type; 100 101 SilcMPInt x; 102 103 SilcUInt16 sign_len; 104 unsigned char *sign_data; 105 }; 106 107 /* Prototypes */ 108 109 /****f* silcske/SilcSKEPayloads/silc_ske_payload_start_encode 110 * 111 * SYNOPSIS 112 * 113 * SilcSKEStatus silc_ske_payload_start_encode(SilcSKE ske, 114 * SilcSKEStartPayload payload, 115 * SilcBuffer *return_buffer); 116 * 117 * DESCRIPTION 118 * 119 * Utility function used to encode Key Exchange Start Payload from the 120 * `payload' structure. The encoded buffer is returned into the 121 * `return_buffer' and the caller must free it. 122 * 123 ***/ 124 SilcSKEStatus silc_ske_payload_start_encode(SilcSKE ske, 125 SilcSKEStartPayload payload, 126 SilcBuffer *return_buffer); 127 128 /****f* silcske/SilcSKEPayloads/silc_ske_payload_start_decode 129 * 130 * SYNOPSIS 131 * 132 * SilcSKEStatus 133 * silc_ske_payload_start_decode(SilcSKE ske, 134 * SilcBuffer buffer, 135 * SilcSKEStartPayload *return_payload); 136 * 137 * DESCRIPTION 138 * 139 * Utility function used to decode Key Exchange Start Payload from the 140 * `buffer' data buffer. The decoded payload is returned into the 141 * `return_payload' and the caller must free it. 142 * 143 ***/ 144 SilcSKEStatus 145 silc_ske_payload_start_decode(SilcSKE ske, 146 SilcBuffer buffer, 147 SilcSKEStartPayload *return_payload); 148 149 /****f* silcske/SilcSKEPayloads/silc_ske_payload_start_free 150 * 151 * SYNOPSIS 152 * 153 * void silc_ske_payload_start_free(SilcSKEStartPayload *payload); 154 * 155 * DESCRIPTION 156 * 157 * Frees the Key Exchange Start Payload indicated by `payload'. 158 * 159 ***/ 160 void silc_ske_payload_start_free(SilcSKEStartPayload payload); 161 162 /****f* silcske/SilcSKEPayloads/silc_ske_payload_ke_encode 163 * 164 * SYNOPSIS 165 * 166 * SilcSKEStatus silc_ske_payload_ke_encode(SilcSKE ske, 167 * SilcSKEKEPayload payload, 168 * SilcBuffer *return_buffer); 169 * 170 * DESCRIPTION 171 * 172 * Utility function used to encode Key Exchange Payload from the 173 * `payload' structure. The encoded buffer is returned into the 174 * `return_buffer' and the caller must free it. 175 * 176 ***/ 177 SilcSKEStatus silc_ske_payload_ke_encode(SilcSKE ske, 178 SilcSKEKEPayload payload, 179 SilcBuffer *return_buffer); 180 181 /****f* silcske/SilcSKEPayloads/silc_ske_payload_ke_decode 182 * 183 * SYNOPSIS 184 * 185 * SilcSKEStatus silc_ske_payload_ke_decode(SilcSKE ske, 186 * SilcBuffer buffer, 187 * SilcSKEKEPayload 188 * **return_payload); 189 * 190 * DESCRIPTION 191 * 192 * Utility function used to decode Key Exchange Payload from the 193 * `buffer' data buffer. The decoded payload is returned into the 194 * `return_payload' and the caller must free it. 195 * 196 ***/ 197 SilcSKEStatus silc_ske_payload_ke_decode(SilcSKE ske, 198 SilcBuffer buffer, 199 SilcSKEKEPayload *return_payload); 200 201 /****f* silcske/SilcSKEPayloads/silc_ske_payload_ke_free 202 * 203 * SYNOPSIS 204 * 205 * void silc_ske_payload_ke_free(SilcSKEKEPayload *payload); 206 * 207 * DESCRIPTION 208 * 209 * Frees the Key Exchange Payload indicated by `payload'. 210 * 211 ***/ 212 void silc_ske_payload_ke_free(SilcSKEKEPayload payload); 213 214 #endif /* SILCSKE_PAYLOAD_H */ 215