3 * Release $Name: MATRIXSSL_1_8_8_OPEN $
5 * Public common header file
8 * Copyright (c) PeerSec Networks, 2002-2009. All Rights Reserved.
9 * The latest version of this code is available at http://www.matrixssl.org
11 * This software is open source; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This General Public License does NOT permit incorporating this software
17 * into proprietary programs. If you are unable to comply with the GPL, a
18 * commercial license for this software may be purchased from PeerSec Networks
19 * at http://www.peersec.com
21 * This program is distributed in WITHOUT ANY WARRANTY; without even the
22 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 * See the GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 * http://www.gnu.org/copyleft/gpl.html
30 /******************************************************************************/
32 #ifndef _h_MATRIXCOMMON
33 #define _h_MATRIXCOMMON
39 #include "src/matrixConfig.h"
41 /******************************************************************************/
43 Platform integer sizes
46 typedef unsigned int uint32
;
48 /******************************************************************************/
54 #define min(a,b) (((a) < (b)) ? (a) : (b))
58 #define max(a,b) (((a) > (b)) ? (a) : (b))
62 /******************************************************************************/
64 Flags for matrixSslNewSession
66 #define SSL_FLAGS_SERVER 0x1
67 #define SSL_FLAGS_CLIENT_AUTH 0x200
69 /******************************************************************************/
71 matrixSslSetSessionOption defines
73 #define SSL_OPTION_DELETE_SESSION 0
76 /******************************************************************************/
78 Typdefs required for public apis. From an end user perspective, the
79 sslBuf_t and sslCertInfo_t types have internal fields that are public,
80 but ssl_t, sslKeys_t, sslCert_t,and sslSessionId_t do not. Defining
81 those as 'int32' requires it to be treated as an opaque data type to be
84 #ifndef _h_EXPORT_SYMBOLS
87 typedef int32 sslKeys_t
;
88 typedef int32 sslSessionId_t
;
89 typedef int32 sslCert_t
;
91 /******************************************************************************/
93 Explicitly import MATRIXPUBLIC apis on Windows. If we're being included
94 from an internal header, we export them instead!
97 #define MATRIXPUBLIC extern __declspec(dllimport)
99 #else /* h_EXPORT_SYMOBOLS */
101 #define MATRIXPUBLIC extern __declspec(dllexport)
103 #endif /* h_EXPORT_SYMOBOLS */
105 #define MATRIXPUBLIC extern
108 /******************************************************************************/
114 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
115 |.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|
121 len = (end - start) = 0
125 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
126 |.|.|a|b|c|d|e|f|g|h|i|j|.|.|.|.|
132 len = (end - start) = 10
134 Read from start pointer
138 unsigned char *buf
; /* Pointer to the start of the buffer */
139 unsigned char *start
; /* Pointer to start of valid data */
140 unsigned char *end
; /* Pointer to first byte of invalid data */
141 int32 size
; /* Size of buffer in bytes */
145 /******************************************************************************/
147 Information provided to user callback for validating certificates.
148 Register callback with call to matrixSslSetCertValidator
157 } sslDistinguishedName_t
;
159 typedef struct sslSubjectAltNameEntry
{
161 unsigned char name
[16];
164 struct sslSubjectAltNameEntry
*next
;
165 } sslSubjectAltName_t
;
167 typedef struct sslCertInfo
{
169 unsigned char *serialNumber
;
170 int32 serialNumberLen
;
175 sslSubjectAltName_t
*subjectAltName
;
176 sslDistinguishedName_t subject
;
177 sslDistinguishedName_t issuer
;
178 struct sslCertInfo
*next
;
181 /******************************************************************************/
187 #endif /* _h_MATRIXCOMMON */
189 /******************************************************************************/