rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /******************************************************************************* |
| 37 | * Filename: |
| 38 | * --------- |
| 39 | * ssl_structs.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * MAUI |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * This file contains structs of SSL API. |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | *============================================================================== |
| 54 | * HISTORY |
| 55 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 56 | *------------------------------------------------------------------------------ |
| 57 | * removed! |
| 58 | * |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * |
| 79 | *------------------------------------------------------------------------------ |
| 80 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 81 | *============================================================================== |
| 82 | *******************************************************************************/ |
| 83 | #ifndef _SSL_STRUCTS_H |
| 84 | #define _SSL_STRUCTS_H |
| 85 | |
| 86 | #include "kal_general_types.h" |
| 87 | #include "ssl_consts.h" |
| 88 | #include "ssl_enums.h" |
| 89 | |
| 90 | /* SSL context, created by sec_ssl_ctx_new() and its properties can be |
| 91 | * customized by other SSL context APIs. |
| 92 | * The members in the structure is used by SSL library internally, |
| 93 | * so application should not understand the detail in the structure. |
| 94 | */ |
| 95 | typedef struct ssl_ctx ssl_ctx; |
| 96 | |
| 97 | |
| 98 | /* SSL connection context, created by sec_ssl_new() and its properties can be |
| 99 | * customized by other SSL connection context APIs. |
| 100 | * The members in the structure is used by SSL library internally, |
| 101 | * so application should not understand the detail in the structure. |
| 102 | */ |
| 103 | typedef struct ssl_conn ssl_conn; |
| 104 | |
| 105 | |
| 106 | /*************************************************************************** |
| 107 | * <GROUP Structures> |
| 108 | * |
| 109 | * Data structure holding a certificate in DER. |
| 110 | * Ref. sec_ssl_get_peer_certificate(), sec_ssl_extract_cert(). |
| 111 | ***************************************************************************/ |
| 112 | typedef struct |
| 113 | { |
| 114 | kal_uint32 length; /* The size of the certificate in bytes. */ |
| 115 | kal_uint8* data; /* Data of the certficate in DER format. */ |
| 116 | } sec_cert_struct; |
| 117 | |
| 118 | |
| 119 | /*************************************************************************** |
| 120 | * <GROUP Structures> |
| 121 | * |
| 122 | * This is a structure passed to the certificate varify callback set by |
| 123 | * sec_ssl_ctx_set_cert_verify_callback(). |
| 124 | * Ref. sec_ssl_cert_verify_callback(). |
| 125 | ***************************************************************************/ |
| 126 | typedef struct sec_x509_store_ctx |
| 127 | { |
| 128 | ssl_conn *conn_ctx; /* SSL connection of the SSL connection. */ |
| 129 | sec_cert_struct **cert_chain; /* Certificate chain sent from peer. */ |
| 130 | kal_uint32 warnings[SEC_MAX_CERT_CHAIN_LEN]; /* Warning list of each cert in cert_chain. */ |
| 131 | kal_int32 error; /* Certificate validation result. */ |
| 132 | } sec_x509_store_ctx; |
| 133 | |
| 134 | |
| 135 | /*************************************************************************** |
| 136 | * <GROUP Structures> |
| 137 | * |
| 138 | * Data structure holding session record |
| 139 | ***************************************************************************/ |
| 140 | typedef struct { |
| 141 | kal_uint32 length; /* Size of session record in data field. */ |
| 142 | kal_uint8 *data; /* Session record. */ |
| 143 | } sec_sess_rec; |
| 144 | |
| 145 | |
| 146 | /*************************************************************************** |
| 147 | * <GROUP Structures> |
| 148 | * |
| 149 | * Collection of data structure holding a negotiated ciphersuite. |
| 150 | * Ref. sec_ssl_get_curr_cipher_info(). |
| 151 | ***************************************************************************/ |
| 152 | typedef struct |
| 153 | { |
| 154 | sec_proto_ver_enum version; /* SSL version. */ |
| 155 | sec_bulk_enc_algo_enum enc_alg; /* Bulk encryption algorithm. */ |
| 156 | sec_key_xchg_algo_enum key_alg; /* Key exchange algorithm. */ |
| 157 | sec_auth_algo_enum auth_alg; /* Authentication algorithm. */ |
| 158 | sec_hash_algo_enum hash_alg; /* Hash algorithm. */ |
| 159 | } sec_cipher_info_struct; |
| 160 | |
| 161 | |
| 162 | /*************************************************************************** |
| 163 | * Collection of data structure holding a negotiated ciphersuite. |
| 164 | * Dummy definition for SSL context constructors. |
| 165 | * Ref. sec_ssl_ctx_new(). |
| 166 | ***************************************************************************/ |
| 167 | typedef kal_uint8 ssl_method; |
| 168 | |
| 169 | |
| 170 | /*************************************************************************** |
| 171 | * <GROUP Structures> |
| 172 | * |
| 173 | * Data structure holding certificate types for client authentication. |
| 174 | * Ref. sec_ssl_get_certreq_auth_names(). |
| 175 | ***************************************************************************/ |
| 176 | typedef struct |
| 177 | { |
| 178 | kal_uint8 len; /* Number of effective auth types in types field. */ |
| 179 | kal_uint8 types[SEC_MAX_CERT_TYPES]; /* Certificate types in certificate |
| 180 | request from server. */ |
| 181 | } sec_cert_types; |
| 182 | |
| 183 | |
| 184 | /*************************************************************************** |
| 185 | * <GROUP Structures> |
| 186 | * |
| 187 | * Data structure holding authority names for client authentication. |
| 188 | * Ref. sec_ssl_get_certreq_auth_names(). |
| 189 | ***************************************************************************/ |
| 190 | typedef struct |
| 191 | { |
| 192 | kal_uint16 len; /* number of bytes in name field */ |
| 193 | kal_uint8* name; /* auth names in certificate request from server */ |
| 194 | } sec_auth_names; |
| 195 | |
| 196 | |
| 197 | #endif /* !_OSSL_SSL_STRUCTS_H */ |
| 198 | |
| 199 | |