cyassl re-port with cellular comms, PSK test

Dependencies:   VodafoneUSBModem_bleedingedge2 mbed-rtos mbed-src

Committer:
ashleymills
Date:
Fri Apr 26 16:59:36 2013 +0000
Revision:
1:b211d97b0068
Parent:
0:e979170e02e7
nothing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:e979170e02e7 1 /* ssl.h
ashleymills 0:e979170e02e7 2 *
ashleymills 0:e979170e02e7 3 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
ashleymills 0:e979170e02e7 4 *
ashleymills 0:e979170e02e7 5 * This file is part of CyaSSL.
ashleymills 0:e979170e02e7 6 *
ashleymills 0:e979170e02e7 7 * CyaSSL is free software; you can redistribute it and/or modify
ashleymills 0:e979170e02e7 8 * it under the terms of the GNU General Public License as published by
ashleymills 0:e979170e02e7 9 * the Free Software Foundation; either version 2 of the License, or
ashleymills 0:e979170e02e7 10 * (at your option) any later version.
ashleymills 0:e979170e02e7 11 *
ashleymills 0:e979170e02e7 12 * CyaSSL is distributed in the hope that it will be useful,
ashleymills 0:e979170e02e7 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ashleymills 0:e979170e02e7 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ashleymills 0:e979170e02e7 15 * GNU General Public License for more details.
ashleymills 0:e979170e02e7 16 *
ashleymills 0:e979170e02e7 17 * You should have received a copy of the GNU General Public License
ashleymills 0:e979170e02e7 18 * along with this program; if not, write to the Free Software
ashleymills 0:e979170e02e7 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
ashleymills 0:e979170e02e7 20 */
ashleymills 0:e979170e02e7 21
ashleymills 0:e979170e02e7 22
ashleymills 0:e979170e02e7 23 /* CyaSSL API */
ashleymills 0:e979170e02e7 24
ashleymills 0:e979170e02e7 25 #ifndef CYASSL_SSL_H
ashleymills 0:e979170e02e7 26 #define CYASSL_SSL_H
ashleymills 0:e979170e02e7 27
ashleymills 0:e979170e02e7 28 /* for users not using preprocessor flags*/
ashleymills 0:e979170e02e7 29 #include <cyassl/ctaocrypt/settings.h>
ashleymills 0:e979170e02e7 30 #include <cyassl/version.h>
ashleymills 0:e979170e02e7 31
ashleymills 0:e979170e02e7 32 #ifndef NO_FILESYSTEM
ashleymills 0:e979170e02e7 33 #ifdef FREESCALE_MQX
ashleymills 0:e979170e02e7 34 #include <fio.h>
ashleymills 0:e979170e02e7 35 #else
ashleymills 0:e979170e02e7 36 #include <stdio.h> /* ERR_printf */
ashleymills 0:e979170e02e7 37 #endif
ashleymills 0:e979170e02e7 38 #endif
ashleymills 0:e979170e02e7 39
ashleymills 0:e979170e02e7 40 #ifdef YASSL_PREFIX
ashleymills 0:e979170e02e7 41 #include "prefix_ssl.h"
ashleymills 0:e979170e02e7 42 #endif
ashleymills 0:e979170e02e7 43
ashleymills 0:e979170e02e7 44 #ifdef LIBCYASSL_VERSION_STRING
ashleymills 0:e979170e02e7 45 #define CYASSL_VERSION LIBCYASSL_VERSION_STRING
ashleymills 0:e979170e02e7 46 #endif
ashleymills 0:e979170e02e7 47
ashleymills 0:e979170e02e7 48 #ifdef _WIN32
ashleymills 0:e979170e02e7 49 /* wincrypt.h clashes */
ashleymills 0:e979170e02e7 50 #undef OCSP_REQUEST
ashleymills 0:e979170e02e7 51 #undef OCSP_RESPONSE
ashleymills 0:e979170e02e7 52 #endif
ashleymills 0:e979170e02e7 53
ashleymills 0:e979170e02e7 54
ashleymills 0:e979170e02e7 55
ashleymills 0:e979170e02e7 56 #ifdef __cplusplus
ashleymills 0:e979170e02e7 57 extern "C" {
ashleymills 0:e979170e02e7 58 #endif
ashleymills 0:e979170e02e7 59
ashleymills 0:e979170e02e7 60
ashleymills 0:e979170e02e7 61 typedef struct CYASSL CYASSL;
ashleymills 0:e979170e02e7 62 typedef struct CYASSL_SESSION CYASSL_SESSION;
ashleymills 0:e979170e02e7 63 typedef struct CYASSL_METHOD CYASSL_METHOD;
ashleymills 0:e979170e02e7 64 typedef struct CYASSL_CTX CYASSL_CTX;
ashleymills 0:e979170e02e7 65
ashleymills 0:e979170e02e7 66 typedef struct CYASSL_X509 CYASSL_X509;
ashleymills 0:e979170e02e7 67 typedef struct CYASSL_X509_NAME CYASSL_X509_NAME;
ashleymills 0:e979170e02e7 68 typedef struct CYASSL_X509_CHAIN CYASSL_X509_CHAIN;
ashleymills 0:e979170e02e7 69
ashleymills 0:e979170e02e7 70 typedef struct CYASSL_CERT_MANAGER CYASSL_CERT_MANAGER;
ashleymills 0:e979170e02e7 71 typedef struct CYASSL_SOCKADDR CYASSL_SOCKADDR;
ashleymills 0:e979170e02e7 72
ashleymills 0:e979170e02e7 73 /* redeclare guard */
ashleymills 0:e979170e02e7 74 #define CYASSL_TYPES_DEFINED
ashleymills 0:e979170e02e7 75
ashleymills 0:e979170e02e7 76
ashleymills 0:e979170e02e7 77 typedef struct CYASSL_RSA CYASSL_RSA;
ashleymills 0:e979170e02e7 78 typedef struct CYASSL_DSA CYASSL_DSA;
ashleymills 0:e979170e02e7 79 typedef struct CYASSL_CIPHER CYASSL_CIPHER;
ashleymills 0:e979170e02e7 80 typedef struct CYASSL_X509_LOOKUP CYASSL_X509_LOOKUP;
ashleymills 0:e979170e02e7 81 typedef struct CYASSL_X509_LOOKUP_METHOD CYASSL_X509_LOOKUP_METHOD;
ashleymills 0:e979170e02e7 82 typedef struct CYASSL_X509_CRL CYASSL_X509_CRL;
ashleymills 0:e979170e02e7 83 typedef struct CYASSL_BIO CYASSL_BIO;
ashleymills 0:e979170e02e7 84 typedef struct CYASSL_BIO_METHOD CYASSL_BIO_METHOD;
ashleymills 0:e979170e02e7 85 typedef struct CYASSL_X509_EXTENSION CYASSL_X509_EXTENSION;
ashleymills 0:e979170e02e7 86 typedef struct CYASSL_ASN1_TIME CYASSL_ASN1_TIME;
ashleymills 0:e979170e02e7 87 typedef struct CYASSL_ASN1_INTEGER CYASSL_ASN1_INTEGER;
ashleymills 0:e979170e02e7 88 typedef struct CYASSL_ASN1_OBJECT CYASSL_ASN1_OBJECT;
ashleymills 0:e979170e02e7 89 typedef struct CYASSL_ASN1_STRING CYASSL_ASN1_STRING;
ashleymills 0:e979170e02e7 90 typedef struct CYASSL_dynlock_value CYASSL_dynlock_value;
ashleymills 0:e979170e02e7 91
ashleymills 0:e979170e02e7 92 #define CYASSL_ASN1_UTCTIME CYASSL_ASN1_TIME
ashleymills 0:e979170e02e7 93
ashleymills 0:e979170e02e7 94 typedef struct CYASSL_EVP_PKEY {
ashleymills 0:e979170e02e7 95 int type; /* openssh dereference */
ashleymills 0:e979170e02e7 96 int save_type; /* openssh dereference */
ashleymills 0:e979170e02e7 97 } CYASSL_EVP_PKEY;
ashleymills 0:e979170e02e7 98
ashleymills 0:e979170e02e7 99 typedef struct CYASSL_MD4_CTX {
ashleymills 0:e979170e02e7 100 int buffer[32]; /* big enough to hold, check size in Init */
ashleymills 0:e979170e02e7 101 } CYASSL_MD4_CTX;
ashleymills 0:e979170e02e7 102
ashleymills 0:e979170e02e7 103
ashleymills 0:e979170e02e7 104 typedef struct CYASSL_COMP_METHOD {
ashleymills 0:e979170e02e7 105 int type; /* stunnel dereference */
ashleymills 0:e979170e02e7 106 } CYASSL_COMP_METHOD;
ashleymills 0:e979170e02e7 107
ashleymills 0:e979170e02e7 108
ashleymills 0:e979170e02e7 109 typedef struct CYASSL_X509_STORE {
ashleymills 0:e979170e02e7 110 int cache; /* stunnel dereference */
ashleymills 0:e979170e02e7 111 } CYASSL_X509_STORE;
ashleymills 0:e979170e02e7 112
ashleymills 0:e979170e02e7 113
ashleymills 0:e979170e02e7 114 typedef struct CYASSL_X509_REVOKED {
ashleymills 0:e979170e02e7 115 CYASSL_ASN1_INTEGER* serialNumber; /* stunnel dereference */
ashleymills 0:e979170e02e7 116 } CYASSL_X509_REVOKED;
ashleymills 0:e979170e02e7 117
ashleymills 0:e979170e02e7 118
ashleymills 0:e979170e02e7 119 typedef struct CYASSL_X509_OBJECT {
ashleymills 0:e979170e02e7 120 union {
ashleymills 0:e979170e02e7 121 char* ptr;
ashleymills 0:e979170e02e7 122 CYASSL_X509_CRL* crl; /* stunnel dereference */
ashleymills 0:e979170e02e7 123 } data;
ashleymills 0:e979170e02e7 124 } CYASSL_X509_OBJECT;
ashleymills 0:e979170e02e7 125
ashleymills 0:e979170e02e7 126
ashleymills 0:e979170e02e7 127 /* in internal.h too, change there !! */
ashleymills 0:e979170e02e7 128 typedef struct CYASSL_X509_STORE_CTX {
ashleymills 0:e979170e02e7 129 int error;
ashleymills 0:e979170e02e7 130 int error_depth;
ashleymills 0:e979170e02e7 131 CYASSL_X509* current_cert; /* stunnel dereference */
ashleymills 0:e979170e02e7 132 char* domain; /* subject CN domain name */
ashleymills 0:e979170e02e7 133 void* ex_data; /* external data, for fortress build */
ashleymills 0:e979170e02e7 134 /* in internal.h too, change there !! */
ashleymills 0:e979170e02e7 135 } CYASSL_X509_STORE_CTX;
ashleymills 0:e979170e02e7 136
ashleymills 0:e979170e02e7 137
ashleymills 0:e979170e02e7 138 CYASSL_API CYASSL_METHOD *CyaSSLv3_server_method(void);
ashleymills 0:e979170e02e7 139 CYASSL_API CYASSL_METHOD *CyaSSLv3_client_method(void);
ashleymills 0:e979170e02e7 140 CYASSL_API CYASSL_METHOD *CyaTLSv1_server_method(void);
ashleymills 0:e979170e02e7 141 CYASSL_API CYASSL_METHOD *CyaTLSv1_client_method(void);
ashleymills 0:e979170e02e7 142 CYASSL_API CYASSL_METHOD *CyaTLSv1_1_server_method(void);
ashleymills 0:e979170e02e7 143 CYASSL_API CYASSL_METHOD *CyaTLSv1_1_client_method(void);
ashleymills 0:e979170e02e7 144 CYASSL_API CYASSL_METHOD *CyaTLSv1_2_server_method(void);
ashleymills 0:e979170e02e7 145 CYASSL_API CYASSL_METHOD *CyaTLSv1_2_client_method(void);
ashleymills 0:e979170e02e7 146
ashleymills 0:e979170e02e7 147 #ifdef CYASSL_DTLS
ashleymills 0:e979170e02e7 148 CYASSL_API CYASSL_METHOD *CyaDTLSv1_client_method(void);
ashleymills 0:e979170e02e7 149 CYASSL_API CYASSL_METHOD *CyaDTLSv1_server_method(void);
ashleymills 0:e979170e02e7 150 #endif
ashleymills 0:e979170e02e7 151
ashleymills 0:e979170e02e7 152 #if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
ashleymills 0:e979170e02e7 153
ashleymills 0:e979170e02e7 154 CYASSL_API int CyaSSL_CTX_use_certificate_file(CYASSL_CTX*, const char*, int);
ashleymills 0:e979170e02e7 155 CYASSL_API int CyaSSL_CTX_use_PrivateKey_file(CYASSL_CTX*, const char*, int);
ashleymills 0:e979170e02e7 156 CYASSL_API int CyaSSL_CTX_load_verify_locations(CYASSL_CTX*, const char*,
ashleymills 0:e979170e02e7 157 const char*);
ashleymills 0:e979170e02e7 158 CYASSL_API int CyaSSL_CTX_use_certificate_chain_file(CYASSL_CTX *,
ashleymills 0:e979170e02e7 159 const char *file);
ashleymills 0:e979170e02e7 160 CYASSL_API int CyaSSL_CTX_use_RSAPrivateKey_file(CYASSL_CTX*, const char*, int);
ashleymills 0:e979170e02e7 161
ashleymills 0:e979170e02e7 162 CYASSL_API int CyaSSL_use_certificate_file(CYASSL*, const char*, int);
ashleymills 0:e979170e02e7 163 CYASSL_API int CyaSSL_use_PrivateKey_file(CYASSL*, const char*, int);
ashleymills 0:e979170e02e7 164 CYASSL_API int CyaSSL_use_certificate_chain_file(CYASSL*, const char *file);
ashleymills 0:e979170e02e7 165 CYASSL_API int CyaSSL_use_RSAPrivateKey_file(CYASSL*, const char*, int);
ashleymills 0:e979170e02e7 166
ashleymills 0:e979170e02e7 167 #ifdef CYASSL_DER_LOAD
ashleymills 0:e979170e02e7 168 CYASSL_API int CyaSSL_CTX_der_load_verify_locations(CYASSL_CTX*,
ashleymills 0:e979170e02e7 169 const char*, int);
ashleymills 0:e979170e02e7 170 #endif
ashleymills 0:e979170e02e7 171
ashleymills 0:e979170e02e7 172 #ifdef HAVE_NTRU
ashleymills 0:e979170e02e7 173 CYASSL_API int CyaSSL_CTX_use_NTRUPrivateKey_file(CYASSL_CTX*, const char*);
ashleymills 0:e979170e02e7 174 /* load NTRU private key blob */
ashleymills 0:e979170e02e7 175 #endif
ashleymills 0:e979170e02e7 176
ashleymills 0:e979170e02e7 177 CYASSL_API int CyaSSL_PemCertToDer(const char*, unsigned char*, int);
ashleymills 0:e979170e02e7 178
ashleymills 0:e979170e02e7 179 #endif /* !NO_FILESYSTEM && !NO_CERTS */
ashleymills 0:e979170e02e7 180
ashleymills 0:e979170e02e7 181 CYASSL_API CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD*);
ashleymills 0:e979170e02e7 182 CYASSL_API CYASSL* CyaSSL_new(CYASSL_CTX*);
ashleymills 0:e979170e02e7 183 CYASSL_API int CyaSSL_set_fd (CYASSL*, int);
ashleymills 0:e979170e02e7 184 CYASSL_API int CyaSSL_get_fd(const CYASSL*);
ashleymills 0:e979170e02e7 185 CYASSL_API void CyaSSL_set_using_nonblock(CYASSL*, int);
ashleymills 0:e979170e02e7 186 CYASSL_API int CyaSSL_get_using_nonblock(CYASSL*);
ashleymills 0:e979170e02e7 187 CYASSL_API int CyaSSL_connect(CYASSL*); /* please see note at top of README
ashleymills 0:e979170e02e7 188 if you get an error from connect */
ashleymills 0:e979170e02e7 189 CYASSL_API int CyaSSL_write(CYASSL*, const void*, int);
ashleymills 0:e979170e02e7 190 CYASSL_API int CyaSSL_read(CYASSL*, void*, int);
ashleymills 0:e979170e02e7 191 CYASSL_API int CyaSSL_peek(CYASSL*, void*, int);
ashleymills 0:e979170e02e7 192 CYASSL_API int CyaSSL_accept(CYASSL*);
ashleymills 0:e979170e02e7 193 CYASSL_API void CyaSSL_CTX_free(CYASSL_CTX*);
ashleymills 0:e979170e02e7 194 CYASSL_API void CyaSSL_free(CYASSL*);
ashleymills 0:e979170e02e7 195 CYASSL_API int CyaSSL_shutdown(CYASSL*);
ashleymills 0:e979170e02e7 196 CYASSL_API int CyaSSL_send(CYASSL*, const void*, int sz, int flags);
ashleymills 0:e979170e02e7 197 CYASSL_API int CyaSSL_recv(CYASSL*, void*, int sz, int flags);
ashleymills 0:e979170e02e7 198
ashleymills 0:e979170e02e7 199 CYASSL_API void CyaSSL_CTX_set_quiet_shutdown(CYASSL_CTX*, int);
ashleymills 0:e979170e02e7 200 CYASSL_API void CyaSSL_set_quiet_shutdown(CYASSL*, int);
ashleymills 0:e979170e02e7 201
ashleymills 0:e979170e02e7 202 CYASSL_API int CyaSSL_get_error(CYASSL*, int);
ashleymills 0:e979170e02e7 203
ashleymills 0:e979170e02e7 204 CYASSL_API int CyaSSL_set_session(CYASSL* ssl,CYASSL_SESSION* session);
ashleymills 0:e979170e02e7 205 CYASSL_API CYASSL_SESSION* CyaSSL_get_session(CYASSL* ssl);
ashleymills 0:e979170e02e7 206 CYASSL_API void CyaSSL_flush_sessions(CYASSL_CTX *ctx, long tm);
ashleymills 0:e979170e02e7 207
ashleymills 0:e979170e02e7 208
ashleymills 0:e979170e02e7 209 typedef int (*VerifyCallback)(int, CYASSL_X509_STORE_CTX*);
ashleymills 0:e979170e02e7 210 typedef int (*pem_password_cb)(char*, int, int, void*);
ashleymills 0:e979170e02e7 211
ashleymills 0:e979170e02e7 212 CYASSL_API void CyaSSL_CTX_set_verify(CYASSL_CTX*, int,
ashleymills 0:e979170e02e7 213 VerifyCallback verify_callback);
ashleymills 0:e979170e02e7 214 CYASSL_API void CyaSSL_set_verify(CYASSL*, int, VerifyCallback verify_callback);
ashleymills 0:e979170e02e7 215
ashleymills 0:e979170e02e7 216 CYASSL_API int CyaSSL_pending(CYASSL*);
ashleymills 0:e979170e02e7 217
ashleymills 0:e979170e02e7 218 CYASSL_API void CyaSSL_load_error_strings(void);
ashleymills 0:e979170e02e7 219 CYASSL_API int CyaSSL_library_init(void);
ashleymills 0:e979170e02e7 220 CYASSL_API long CyaSSL_CTX_set_session_cache_mode(CYASSL_CTX*, long);
ashleymills 0:e979170e02e7 221
ashleymills 0:e979170e02e7 222 /* only supports full name from cipher_name[] delimited by : */
ashleymills 0:e979170e02e7 223 CYASSL_API int CyaSSL_CTX_set_cipher_list(CYASSL_CTX*, const char*);
ashleymills 0:e979170e02e7 224 CYASSL_API int CyaSSL_set_cipher_list(CYASSL*, const char*);
ashleymills 0:e979170e02e7 225
ashleymills 0:e979170e02e7 226 /* Nonblocking DTLS helper functions */
ashleymills 0:e979170e02e7 227 CYASSL_API int CyaSSL_dtls_get_current_timeout(CYASSL* ssl);
ashleymills 0:e979170e02e7 228 CYASSL_API int CyaSSL_dtls_got_timeout(CYASSL* ssl);
ashleymills 0:e979170e02e7 229 CYASSL_API int CyaSSL_dtls(CYASSL* ssl);
ashleymills 0:e979170e02e7 230
ashleymills 0:e979170e02e7 231 CYASSL_API int CyaSSL_dtls_set_peer(CYASSL*, void*, unsigned int);
ashleymills 0:e979170e02e7 232 CYASSL_API int CyaSSL_dtls_get_peer(CYASSL*, void*, unsigned int*);
ashleymills 0:e979170e02e7 233
ashleymills 0:e979170e02e7 234 CYASSL_API int CyaSSL_ERR_GET_REASON(int err);
ashleymills 0:e979170e02e7 235 CYASSL_API char* CyaSSL_ERR_error_string(unsigned long,char*);
ashleymills 0:e979170e02e7 236 CYASSL_API void CyaSSL_ERR_error_string_n(unsigned long e, char* buf,
ashleymills 0:e979170e02e7 237 unsigned long sz);
ashleymills 0:e979170e02e7 238
ashleymills 0:e979170e02e7 239 /* extras */
ashleymills 0:e979170e02e7 240
ashleymills 0:e979170e02e7 241 #define STACK_OF(x) x
ashleymills 0:e979170e02e7 242
ashleymills 0:e979170e02e7 243 CYASSL_API int CyaSSL_set_ex_data(CYASSL*, int, void*);
ashleymills 0:e979170e02e7 244 CYASSL_API int CyaSSL_get_shutdown(const CYASSL*);
ashleymills 0:e979170e02e7 245 CYASSL_API int CyaSSL_set_rfd(CYASSL*, int);
ashleymills 0:e979170e02e7 246 CYASSL_API int CyaSSL_set_wfd(CYASSL*, int);
ashleymills 0:e979170e02e7 247 CYASSL_API void CyaSSL_set_shutdown(CYASSL*, int);
ashleymills 0:e979170e02e7 248 CYASSL_API int CyaSSL_set_session_id_context(CYASSL*, const unsigned char*,
ashleymills 0:e979170e02e7 249 unsigned int);
ashleymills 0:e979170e02e7 250 CYASSL_API void CyaSSL_set_connect_state(CYASSL*);
ashleymills 0:e979170e02e7 251 CYASSL_API void CyaSSL_set_accept_state(CYASSL*);
ashleymills 0:e979170e02e7 252 CYASSL_API int CyaSSL_session_reused(CYASSL*);
ashleymills 0:e979170e02e7 253 CYASSL_API void CyaSSL_SESSION_free(CYASSL_SESSION* session);
ashleymills 0:e979170e02e7 254 CYASSL_API int CyaSSL_is_init_finished(CYASSL*);
ashleymills 0:e979170e02e7 255
ashleymills 0:e979170e02e7 256 CYASSL_API const char* CyaSSL_get_version(CYASSL*);
ashleymills 0:e979170e02e7 257 CYASSL_API CYASSL_CIPHER* CyaSSL_get_current_cipher(CYASSL*);
ashleymills 0:e979170e02e7 258 CYASSL_API char* CyaSSL_CIPHER_description(CYASSL_CIPHER*, char*, int);
ashleymills 0:e979170e02e7 259 CYASSL_API const char* CyaSSL_CIPHER_get_name(const CYASSL_CIPHER* cipher);
ashleymills 0:e979170e02e7 260 CYASSL_API const char* CyaSSL_get_cipher(CYASSL*);
ashleymills 0:e979170e02e7 261 CYASSL_API CYASSL_SESSION* CyaSSL_get1_session(CYASSL* ssl);
ashleymills 0:e979170e02e7 262 /* what's ref count */
ashleymills 0:e979170e02e7 263
ashleymills 0:e979170e02e7 264 CYASSL_API void CyaSSL_X509_free(CYASSL_X509*);
ashleymills 0:e979170e02e7 265 CYASSL_API void CyaSSL_OPENSSL_free(void*);
ashleymills 0:e979170e02e7 266
ashleymills 0:e979170e02e7 267 CYASSL_API int CyaSSL_OCSP_parse_url(char* url, char** host, char** port,
ashleymills 0:e979170e02e7 268 char** path, int* ssl);
ashleymills 0:e979170e02e7 269
ashleymills 0:e979170e02e7 270 CYASSL_API CYASSL_METHOD* CyaSSLv23_client_method(void);
ashleymills 0:e979170e02e7 271 CYASSL_API CYASSL_METHOD* CyaSSLv2_client_method(void);
ashleymills 0:e979170e02e7 272 CYASSL_API CYASSL_METHOD* CyaSSLv2_server_method(void);
ashleymills 0:e979170e02e7 273
ashleymills 0:e979170e02e7 274 CYASSL_API void CyaSSL_MD4_Init(CYASSL_MD4_CTX*);
ashleymills 0:e979170e02e7 275 CYASSL_API void CyaSSL_MD4_Update(CYASSL_MD4_CTX*, const void*, unsigned long);
ashleymills 0:e979170e02e7 276 CYASSL_API void CyaSSL_MD4_Final(unsigned char*, CYASSL_MD4_CTX*);
ashleymills 0:e979170e02e7 277
ashleymills 0:e979170e02e7 278
ashleymills 0:e979170e02e7 279 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new(CYASSL_BIO_METHOD*);
ashleymills 0:e979170e02e7 280 CYASSL_API int CyaSSL_BIO_free(CYASSL_BIO*);
ashleymills 0:e979170e02e7 281 CYASSL_API int CyaSSL_BIO_free_all(CYASSL_BIO*);
ashleymills 0:e979170e02e7 282 CYASSL_API int CyaSSL_BIO_read(CYASSL_BIO*, void*, int);
ashleymills 0:e979170e02e7 283 CYASSL_API int CyaSSL_BIO_write(CYASSL_BIO*, const void*, int);
ashleymills 0:e979170e02e7 284 CYASSL_API CYASSL_BIO* CyaSSL_BIO_push(CYASSL_BIO*, CYASSL_BIO* append);
ashleymills 0:e979170e02e7 285 CYASSL_API CYASSL_BIO* CyaSSL_BIO_pop(CYASSL_BIO*);
ashleymills 0:e979170e02e7 286 CYASSL_API int CyaSSL_BIO_flush(CYASSL_BIO*);
ashleymills 0:e979170e02e7 287 CYASSL_API int CyaSSL_BIO_pending(CYASSL_BIO*);
ashleymills 0:e979170e02e7 288
ashleymills 0:e979170e02e7 289 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_buffer(void);
ashleymills 0:e979170e02e7 290 CYASSL_API long CyaSSL_BIO_set_write_buffer_size(CYASSL_BIO*, long size);
ashleymills 0:e979170e02e7 291 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_ssl(void);
ashleymills 0:e979170e02e7 292 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new_socket(int sfd, int flag);
ashleymills 0:e979170e02e7 293 CYASSL_API int CyaSSL_BIO_eof(CYASSL_BIO*);
ashleymills 0:e979170e02e7 294
ashleymills 0:e979170e02e7 295 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_s_mem(void);
ashleymills 0:e979170e02e7 296 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_base64(void);
ashleymills 0:e979170e02e7 297 CYASSL_API void CyaSSL_BIO_set_flags(CYASSL_BIO*, int);
ashleymills 0:e979170e02e7 298
ashleymills 0:e979170e02e7 299 CYASSL_API int CyaSSL_BIO_get_mem_data(CYASSL_BIO* bio,const unsigned char** p);
ashleymills 0:e979170e02e7 300 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new_mem_buf(void* buf, int len);
ashleymills 0:e979170e02e7 301
ashleymills 0:e979170e02e7 302
ashleymills 0:e979170e02e7 303 CYASSL_API long CyaSSL_BIO_set_ssl(CYASSL_BIO*, CYASSL*, int flag);
ashleymills 0:e979170e02e7 304 CYASSL_API void CyaSSL_set_bio(CYASSL*, CYASSL_BIO* rd, CYASSL_BIO* wr);
ashleymills 0:e979170e02e7 305
ashleymills 0:e979170e02e7 306 CYASSL_API int CyaSSL_add_all_algorithms(void);
ashleymills 0:e979170e02e7 307
ashleymills 0:e979170e02e7 308 CYASSL_API void CyaSSL_RAND_screen(void);
ashleymills 0:e979170e02e7 309 CYASSL_API const char* CyaSSL_RAND_file_name(char*, unsigned long);
ashleymills 0:e979170e02e7 310 CYASSL_API int CyaSSL_RAND_write_file(const char*);
ashleymills 0:e979170e02e7 311 CYASSL_API int CyaSSL_RAND_load_file(const char*, long);
ashleymills 0:e979170e02e7 312 CYASSL_API int CyaSSL_RAND_egd(const char*);
ashleymills 0:e979170e02e7 313 CYASSL_API int CyaSSL_RAND_seed(const void*, int);
ashleymills 0:e979170e02e7 314 CYASSL_API void CyaSSL_RAND_add(const void*, int, double);
ashleymills 0:e979170e02e7 315
ashleymills 0:e979170e02e7 316 CYASSL_API CYASSL_COMP_METHOD* CyaSSL_COMP_zlib(void);
ashleymills 0:e979170e02e7 317 CYASSL_API CYASSL_COMP_METHOD* CyaSSL_COMP_rle(void);
ashleymills 0:e979170e02e7 318 CYASSL_API int CyaSSL_COMP_add_compression_method(int, void*);
ashleymills 0:e979170e02e7 319
ashleymills 0:e979170e02e7 320 CYASSL_API int CyaSSL_get_ex_new_index(long, void*, void*, void*, void*);
ashleymills 0:e979170e02e7 321
ashleymills 0:e979170e02e7 322 CYASSL_API void CyaSSL_set_id_callback(unsigned long (*f)(void));
ashleymills 0:e979170e02e7 323 CYASSL_API void CyaSSL_set_locking_callback(void (*f)(int, int, const char*,
ashleymills 0:e979170e02e7 324 int));
ashleymills 0:e979170e02e7 325 CYASSL_API void CyaSSL_set_dynlock_create_callback(CYASSL_dynlock_value* (*f)
ashleymills 0:e979170e02e7 326 (const char*, int));
ashleymills 0:e979170e02e7 327 CYASSL_API void CyaSSL_set_dynlock_lock_callback(void (*f)(int,
ashleymills 0:e979170e02e7 328 CYASSL_dynlock_value*, const char*, int));
ashleymills 0:e979170e02e7 329 CYASSL_API void CyaSSL_set_dynlock_destroy_callback(void (*f)
ashleymills 0:e979170e02e7 330 (CYASSL_dynlock_value*, const char*, int));
ashleymills 0:e979170e02e7 331 CYASSL_API int CyaSSL_num_locks(void);
ashleymills 0:e979170e02e7 332
ashleymills 0:e979170e02e7 333 CYASSL_API CYASSL_X509* CyaSSL_X509_STORE_CTX_get_current_cert(
ashleymills 0:e979170e02e7 334 CYASSL_X509_STORE_CTX*);
ashleymills 0:e979170e02e7 335 CYASSL_API int CyaSSL_X509_STORE_CTX_get_error(CYASSL_X509_STORE_CTX*);
ashleymills 0:e979170e02e7 336 CYASSL_API int CyaSSL_X509_STORE_CTX_get_error_depth(CYASSL_X509_STORE_CTX*);
ashleymills 0:e979170e02e7 337
ashleymills 0:e979170e02e7 338 CYASSL_API char* CyaSSL_X509_NAME_oneline(CYASSL_X509_NAME*, char*, int);
ashleymills 0:e979170e02e7 339 CYASSL_API CYASSL_X509_NAME* CyaSSL_X509_get_issuer_name(CYASSL_X509*);
ashleymills 0:e979170e02e7 340 CYASSL_API CYASSL_X509_NAME* CyaSSL_X509_get_subject_name(CYASSL_X509*);
ashleymills 0:e979170e02e7 341 CYASSL_API const char* CyaSSL_X509_verify_cert_error_string(long);
ashleymills 0:e979170e02e7 342
ashleymills 0:e979170e02e7 343 CYASSL_API int CyaSSL_X509_LOOKUP_add_dir(CYASSL_X509_LOOKUP*,const char*,long);
ashleymills 0:e979170e02e7 344 CYASSL_API int CyaSSL_X509_LOOKUP_load_file(CYASSL_X509_LOOKUP*, const char*,
ashleymills 0:e979170e02e7 345 long);
ashleymills 0:e979170e02e7 346 CYASSL_API CYASSL_X509_LOOKUP_METHOD* CyaSSL_X509_LOOKUP_hash_dir(void);
ashleymills 0:e979170e02e7 347 CYASSL_API CYASSL_X509_LOOKUP_METHOD* CyaSSL_X509_LOOKUP_file(void);
ashleymills 0:e979170e02e7 348
ashleymills 0:e979170e02e7 349 CYASSL_API CYASSL_X509_LOOKUP* CyaSSL_X509_STORE_add_lookup(CYASSL_X509_STORE*,
ashleymills 0:e979170e02e7 350 CYASSL_X509_LOOKUP_METHOD*);
ashleymills 0:e979170e02e7 351 CYASSL_API CYASSL_X509_STORE* CyaSSL_X509_STORE_new(void);
ashleymills 0:e979170e02e7 352 CYASSL_API int CyaSSL_X509_STORE_get_by_subject(CYASSL_X509_STORE_CTX*,
ashleymills 0:e979170e02e7 353 int, CYASSL_X509_NAME*, CYASSL_X509_OBJECT*);
ashleymills 0:e979170e02e7 354 CYASSL_API int CyaSSL_X509_STORE_CTX_init(CYASSL_X509_STORE_CTX*,
ashleymills 0:e979170e02e7 355 CYASSL_X509_STORE*, CYASSL_X509*, STACK_OF(CYASSL_X509)*);
ashleymills 0:e979170e02e7 356 CYASSL_API void CyaSSL_X509_STORE_CTX_cleanup(CYASSL_X509_STORE_CTX*);
ashleymills 0:e979170e02e7 357
ashleymills 0:e979170e02e7 358 CYASSL_API CYASSL_ASN1_TIME* CyaSSL_X509_CRL_get_lastUpdate(CYASSL_X509_CRL*);
ashleymills 0:e979170e02e7 359 CYASSL_API CYASSL_ASN1_TIME* CyaSSL_X509_CRL_get_nextUpdate(CYASSL_X509_CRL*);
ashleymills 0:e979170e02e7 360
ashleymills 0:e979170e02e7 361 CYASSL_API CYASSL_EVP_PKEY* CyaSSL_X509_get_pubkey(CYASSL_X509*);
ashleymills 0:e979170e02e7 362 CYASSL_API int CyaSSL_X509_CRL_verify(CYASSL_X509_CRL*, CYASSL_EVP_PKEY*);
ashleymills 0:e979170e02e7 363 CYASSL_API void CyaSSL_X509_STORE_CTX_set_error(CYASSL_X509_STORE_CTX*,
ashleymills 0:e979170e02e7 364 int);
ashleymills 0:e979170e02e7 365 CYASSL_API void CyaSSL_X509_OBJECT_free_contents(CYASSL_X509_OBJECT*);
ashleymills 0:e979170e02e7 366 CYASSL_API void CyaSSL_EVP_PKEY_free(CYASSL_EVP_PKEY*);
ashleymills 0:e979170e02e7 367 CYASSL_API int CyaSSL_X509_cmp_current_time(const CYASSL_ASN1_TIME*);
ashleymills 0:e979170e02e7 368 CYASSL_API int CyaSSL_sk_X509_REVOKED_num(CYASSL_X509_REVOKED*);
ashleymills 0:e979170e02e7 369
ashleymills 0:e979170e02e7 370 CYASSL_API CYASSL_X509_REVOKED* CyaSSL_X509_CRL_get_REVOKED(CYASSL_X509_CRL*);
ashleymills 0:e979170e02e7 371 CYASSL_API CYASSL_X509_REVOKED* CyaSSL_sk_X509_REVOKED_value(
ashleymills 0:e979170e02e7 372 CYASSL_X509_REVOKED*,int);
ashleymills 0:e979170e02e7 373 CYASSL_API CYASSL_ASN1_INTEGER* CyaSSL_X509_get_serialNumber(CYASSL_X509*);
ashleymills 0:e979170e02e7 374
ashleymills 0:e979170e02e7 375 CYASSL_API int CyaSSL_ASN1_TIME_print(CYASSL_BIO*, const CYASSL_ASN1_TIME*);
ashleymills 0:e979170e02e7 376
ashleymills 0:e979170e02e7 377 CYASSL_API int CyaSSL_ASN1_INTEGER_cmp(const CYASSL_ASN1_INTEGER*,
ashleymills 0:e979170e02e7 378 const CYASSL_ASN1_INTEGER*);
ashleymills 0:e979170e02e7 379 CYASSL_API long CyaSSL_ASN1_INTEGER_get(const CYASSL_ASN1_INTEGER*);
ashleymills 0:e979170e02e7 380
ashleymills 0:e979170e02e7 381 CYASSL_API STACK_OF(CYASSL_X509_NAME)* CyaSSL_load_client_CA_file(const char*);
ashleymills 0:e979170e02e7 382
ashleymills 0:e979170e02e7 383 CYASSL_API void CyaSSL_CTX_set_client_CA_list(CYASSL_CTX*,
ashleymills 0:e979170e02e7 384 STACK_OF(CYASSL_X509_NAME)*);
ashleymills 0:e979170e02e7 385 CYASSL_API void* CyaSSL_X509_STORE_CTX_get_ex_data(CYASSL_X509_STORE_CTX*, int);
ashleymills 0:e979170e02e7 386 CYASSL_API int CyaSSL_get_ex_data_X509_STORE_CTX_idx(void);
ashleymills 0:e979170e02e7 387 CYASSL_API void* CyaSSL_get_ex_data(const CYASSL*, int);
ashleymills 0:e979170e02e7 388
ashleymills 0:e979170e02e7 389 CYASSL_API void CyaSSL_CTX_set_default_passwd_cb_userdata(CYASSL_CTX*,
ashleymills 0:e979170e02e7 390 void* userdata);
ashleymills 0:e979170e02e7 391 CYASSL_API void CyaSSL_CTX_set_default_passwd_cb(CYASSL_CTX*, pem_password_cb);
ashleymills 0:e979170e02e7 392
ashleymills 0:e979170e02e7 393
ashleymills 0:e979170e02e7 394 CYASSL_API void CyaSSL_CTX_set_info_callback(CYASSL_CTX*, void (*)(void));
ashleymills 0:e979170e02e7 395
ashleymills 0:e979170e02e7 396 CYASSL_API unsigned long CyaSSL_ERR_peek_error(void);
ashleymills 0:e979170e02e7 397 CYASSL_API int CyaSSL_GET_REASON(int);
ashleymills 0:e979170e02e7 398
ashleymills 0:e979170e02e7 399 CYASSL_API char* CyaSSL_alert_type_string_long(int);
ashleymills 0:e979170e02e7 400 CYASSL_API char* CyaSSL_alert_desc_string_long(int);
ashleymills 0:e979170e02e7 401 CYASSL_API char* CyaSSL_state_string_long(CYASSL*);
ashleymills 0:e979170e02e7 402
ashleymills 0:e979170e02e7 403 CYASSL_API CYASSL_RSA* CyaSSL_RSA_generate_key(int, unsigned long,
ashleymills 0:e979170e02e7 404 void(*)(int, int, void*), void*);
ashleymills 0:e979170e02e7 405 CYASSL_API void CyaSSL_CTX_set_tmp_rsa_callback(CYASSL_CTX*,
ashleymills 0:e979170e02e7 406 CYASSL_RSA*(*)(CYASSL*, int, int));
ashleymills 0:e979170e02e7 407
ashleymills 0:e979170e02e7 408 CYASSL_API int CyaSSL_PEM_def_callback(char*, int num, int w, void* key);
ashleymills 0:e979170e02e7 409
ashleymills 0:e979170e02e7 410 CYASSL_API long CyaSSL_CTX_sess_accept(CYASSL_CTX*);
ashleymills 0:e979170e02e7 411 CYASSL_API long CyaSSL_CTX_sess_connect(CYASSL_CTX*);
ashleymills 0:e979170e02e7 412 CYASSL_API long CyaSSL_CTX_sess_accept_good(CYASSL_CTX*);
ashleymills 0:e979170e02e7 413 CYASSL_API long CyaSSL_CTX_sess_connect_good(CYASSL_CTX*);
ashleymills 0:e979170e02e7 414 CYASSL_API long CyaSSL_CTX_sess_accept_renegotiate(CYASSL_CTX*);
ashleymills 0:e979170e02e7 415 CYASSL_API long CyaSSL_CTX_sess_connect_renegotiate(CYASSL_CTX*);
ashleymills 0:e979170e02e7 416 CYASSL_API long CyaSSL_CTX_sess_hits(CYASSL_CTX*);
ashleymills 0:e979170e02e7 417 CYASSL_API long CyaSSL_CTX_sess_cb_hits(CYASSL_CTX*);
ashleymills 0:e979170e02e7 418 CYASSL_API long CyaSSL_CTX_sess_cache_full(CYASSL_CTX*);
ashleymills 0:e979170e02e7 419 CYASSL_API long CyaSSL_CTX_sess_misses(CYASSL_CTX*);
ashleymills 0:e979170e02e7 420 CYASSL_API long CyaSSL_CTX_sess_timeouts(CYASSL_CTX*);
ashleymills 0:e979170e02e7 421 CYASSL_API long CyaSSL_CTX_sess_number(CYASSL_CTX*);
ashleymills 0:e979170e02e7 422 CYASSL_API long CyaSSL_CTX_sess_get_cache_size(CYASSL_CTX*);
ashleymills 0:e979170e02e7 423
ashleymills 0:e979170e02e7 424
ashleymills 0:e979170e02e7 425 #define CYASSL_DEFAULT_CIPHER_LIST "" /* default all */
ashleymills 0:e979170e02e7 426 #define CYASSL_RSA_F4 0x10001L
ashleymills 0:e979170e02e7 427
ashleymills 0:e979170e02e7 428 enum {
ashleymills 0:e979170e02e7 429 OCSP_NOCERTS = 1,
ashleymills 0:e979170e02e7 430 OCSP_NOINTERN = 2,
ashleymills 0:e979170e02e7 431 OCSP_NOSIGS = 4,
ashleymills 0:e979170e02e7 432 OCSP_NOCHAIN = 8,
ashleymills 0:e979170e02e7 433 OCSP_NOVERIFY = 16,
ashleymills 0:e979170e02e7 434 OCSP_NOEXPLICIT = 32,
ashleymills 0:e979170e02e7 435 OCSP_NOCASIGN = 64,
ashleymills 0:e979170e02e7 436 OCSP_NODELEGATED = 128,
ashleymills 0:e979170e02e7 437 OCSP_NOCHECKS = 256,
ashleymills 0:e979170e02e7 438 OCSP_TRUSTOTHER = 512,
ashleymills 0:e979170e02e7 439 OCSP_RESPID_KEY = 1024,
ashleymills 0:e979170e02e7 440 OCSP_NOTIME = 2048,
ashleymills 0:e979170e02e7 441
ashleymills 0:e979170e02e7 442 OCSP_CERTID = 2,
ashleymills 0:e979170e02e7 443 OCSP_REQUEST = 4,
ashleymills 0:e979170e02e7 444 OCSP_RESPONSE = 8,
ashleymills 0:e979170e02e7 445 OCSP_BASICRESP = 16,
ashleymills 0:e979170e02e7 446
ashleymills 0:e979170e02e7 447 CYASSL_CRL_CHECKALL = 1,
ashleymills 0:e979170e02e7 448
ashleymills 0:e979170e02e7 449 ASN1_GENERALIZEDTIME = 4,
ashleymills 0:e979170e02e7 450
ashleymills 0:e979170e02e7 451 SSL_OP_MICROSOFT_SESS_ID_BUG = 1,
ashleymills 0:e979170e02e7 452 SSL_OP_NETSCAPE_CHALLENGE_BUG = 2,
ashleymills 0:e979170e02e7 453 SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 3,
ashleymills 0:e979170e02e7 454 SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 4,
ashleymills 0:e979170e02e7 455 SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 5,
ashleymills 0:e979170e02e7 456 SSL_OP_MSIE_SSLV2_RSA_PADDING = 6,
ashleymills 0:e979170e02e7 457 SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 7,
ashleymills 0:e979170e02e7 458 SSL_OP_TLS_D5_BUG = 8,
ashleymills 0:e979170e02e7 459 SSL_OP_TLS_BLOCK_PADDING_BUG = 9,
ashleymills 0:e979170e02e7 460 SSL_OP_TLS_ROLLBACK_BUG = 10,
ashleymills 0:e979170e02e7 461 SSL_OP_ALL = 11,
ashleymills 0:e979170e02e7 462 SSL_OP_EPHEMERAL_RSA = 12,
ashleymills 0:e979170e02e7 463 SSL_OP_NO_SSLv3 = 13,
ashleymills 0:e979170e02e7 464 SSL_OP_NO_TLSv1 = 14,
ashleymills 0:e979170e02e7 465 SSL_OP_PKCS1_CHECK_1 = 15,
ashleymills 0:e979170e02e7 466 SSL_OP_PKCS1_CHECK_2 = 16,
ashleymills 0:e979170e02e7 467 SSL_OP_NETSCAPE_CA_DN_BUG = 17,
ashleymills 0:e979170e02e7 468 SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 18,
ashleymills 0:e979170e02e7 469 SSL_OP_SINGLE_DH_USE = 19,
ashleymills 0:e979170e02e7 470 SSL_OP_NO_TICKET = 20,
ashleymills 0:e979170e02e7 471 SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 21,
ashleymills 0:e979170e02e7 472 SSL_OP_NO_QUERY_MTU = 22,
ashleymills 0:e979170e02e7 473 SSL_OP_COOKIE_EXCHANGE = 23,
ashleymills 0:e979170e02e7 474 SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 24,
ashleymills 0:e979170e02e7 475 SSL_OP_SINGLE_ECDH_USE = 25,
ashleymills 0:e979170e02e7 476 SSL_OP_CIPHER_SERVER_PREFERENCE = 26,
ashleymills 0:e979170e02e7 477
ashleymills 0:e979170e02e7 478 SSL_MAX_SSL_SESSION_ID_LENGTH = 32,
ashleymills 0:e979170e02e7 479
ashleymills 0:e979170e02e7 480 EVP_R_BAD_DECRYPT = 2,
ashleymills 0:e979170e02e7 481
ashleymills 0:e979170e02e7 482 SSL_CB_LOOP = 4,
ashleymills 0:e979170e02e7 483 SSL_ST_CONNECT = 5,
ashleymills 0:e979170e02e7 484 SSL_ST_ACCEPT = 6,
ashleymills 0:e979170e02e7 485 SSL_CB_ALERT = 7,
ashleymills 0:e979170e02e7 486 SSL_CB_READ = 8,
ashleymills 0:e979170e02e7 487 SSL_CB_HANDSHAKE_DONE = 9,
ashleymills 0:e979170e02e7 488
ashleymills 0:e979170e02e7 489 SSL_MODE_ENABLE_PARTIAL_WRITE = 2,
ashleymills 0:e979170e02e7 490
ashleymills 0:e979170e02e7 491 BIO_FLAGS_BASE64_NO_NL = 1,
ashleymills 0:e979170e02e7 492 BIO_CLOSE = 1,
ashleymills 0:e979170e02e7 493 BIO_NOCLOSE = 0,
ashleymills 0:e979170e02e7 494
ashleymills 0:e979170e02e7 495 NID_undef = 0,
ashleymills 0:e979170e02e7 496
ashleymills 0:e979170e02e7 497 X509_FILETYPE_PEM = 8,
ashleymills 0:e979170e02e7 498 X509_LU_X509 = 9,
ashleymills 0:e979170e02e7 499 X509_LU_CRL = 12,
ashleymills 0:e979170e02e7 500
ashleymills 0:e979170e02e7 501 X509_V_ERR_CRL_SIGNATURE_FAILURE = 13,
ashleymills 0:e979170e02e7 502 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 14,
ashleymills 0:e979170e02e7 503 X509_V_ERR_CRL_HAS_EXPIRED = 15,
ashleymills 0:e979170e02e7 504 X509_V_ERR_CERT_REVOKED = 16,
ashleymills 0:e979170e02e7 505 X509_V_ERR_CERT_CHAIN_TOO_LONG = 17,
ashleymills 0:e979170e02e7 506 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = 18,
ashleymills 0:e979170e02e7 507 X509_V_ERR_CERT_NOT_YET_VALID = 19,
ashleymills 0:e979170e02e7 508 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 20,
ashleymills 0:e979170e02e7 509 X509_V_ERR_CERT_HAS_EXPIRED = 21,
ashleymills 0:e979170e02e7 510 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 22,
ashleymills 0:e979170e02e7 511
ashleymills 0:e979170e02e7 512 X509_V_OK = 0,
ashleymills 0:e979170e02e7 513
ashleymills 0:e979170e02e7 514 CRYPTO_LOCK = 1,
ashleymills 0:e979170e02e7 515 CRYPTO_NUM_LOCKS = 10
ashleymills 0:e979170e02e7 516 };
ashleymills 0:e979170e02e7 517
ashleymills 0:e979170e02e7 518 /* extras end */
ashleymills 0:e979170e02e7 519
ashleymills 0:e979170e02e7 520 #ifndef NO_FILESYSTEM
ashleymills 0:e979170e02e7 521 /* CyaSSL extension, provide last error from SSL_get_error
ashleymills 0:e979170e02e7 522 since not using thread storage error queue */
ashleymills 0:e979170e02e7 523 CYASSL_API void CyaSSL_ERR_print_errors_fp(FILE*, int err);
ashleymills 0:e979170e02e7 524 #endif
ashleymills 0:e979170e02e7 525
ashleymills 0:e979170e02e7 526 enum { /* ssl Constants */
ashleymills 0:e979170e02e7 527 SSL_ERROR_NONE = 0, /* for most functions */
ashleymills 0:e979170e02e7 528 SSL_FAILURE = 0, /* for some functions */
ashleymills 0:e979170e02e7 529 SSL_SUCCESS = 1,
ashleymills 0:e979170e02e7 530
ashleymills 0:e979170e02e7 531 SSL_BAD_CERTTYPE = -8,
ashleymills 0:e979170e02e7 532 SSL_BAD_STAT = -7,
ashleymills 0:e979170e02e7 533 SSL_BAD_PATH = -6,
ashleymills 0:e979170e02e7 534 SSL_BAD_FILETYPE = -5,
ashleymills 0:e979170e02e7 535 SSL_BAD_FILE = -4,
ashleymills 0:e979170e02e7 536 SSL_NOT_IMPLEMENTED = -3,
ashleymills 0:e979170e02e7 537 SSL_UNKNOWN = -2,
ashleymills 0:e979170e02e7 538 SSL_FATAL_ERROR = -1,
ashleymills 0:e979170e02e7 539
ashleymills 0:e979170e02e7 540 SSL_FILETYPE_ASN1 = 2,
ashleymills 0:e979170e02e7 541 SSL_FILETYPE_PEM = 1,
ashleymills 0:e979170e02e7 542 SSL_FILETYPE_DEFAULT = 2, /* ASN1 */
ashleymills 0:e979170e02e7 543 SSL_FILETYPE_RAW = 3, /* NTRU raw key blob */
ashleymills 0:e979170e02e7 544
ashleymills 0:e979170e02e7 545 SSL_VERIFY_NONE = 0,
ashleymills 0:e979170e02e7 546 SSL_VERIFY_PEER = 1,
ashleymills 0:e979170e02e7 547 SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2,
ashleymills 0:e979170e02e7 548 SSL_VERIFY_CLIENT_ONCE = 4,
ashleymills 0:e979170e02e7 549
ashleymills 0:e979170e02e7 550 SSL_SESS_CACHE_OFF = 30,
ashleymills 0:e979170e02e7 551 SSL_SESS_CACHE_CLIENT = 31,
ashleymills 0:e979170e02e7 552 SSL_SESS_CACHE_SERVER = 32,
ashleymills 0:e979170e02e7 553 SSL_SESS_CACHE_BOTH = 33,
ashleymills 0:e979170e02e7 554 SSL_SESS_CACHE_NO_AUTO_CLEAR = 34,
ashleymills 0:e979170e02e7 555 SSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 35,
ashleymills 0:e979170e02e7 556
ashleymills 0:e979170e02e7 557 SSL_ERROR_WANT_READ = 2,
ashleymills 0:e979170e02e7 558 SSL_ERROR_WANT_WRITE = 3,
ashleymills 0:e979170e02e7 559 SSL_ERROR_WANT_CONNECT = 7,
ashleymills 0:e979170e02e7 560 SSL_ERROR_WANT_ACCEPT = 8,
ashleymills 0:e979170e02e7 561 SSL_ERROR_SYSCALL = 5,
ashleymills 0:e979170e02e7 562 SSL_ERROR_WANT_X509_LOOKUP = 83,
ashleymills 0:e979170e02e7 563 SSL_ERROR_ZERO_RETURN = 6,
ashleymills 0:e979170e02e7 564 SSL_ERROR_SSL = 85,
ashleymills 0:e979170e02e7 565
ashleymills 0:e979170e02e7 566 SSL_SENT_SHUTDOWN = 1,
ashleymills 0:e979170e02e7 567 SSL_RECEIVED_SHUTDOWN = 2,
ashleymills 0:e979170e02e7 568 SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = 4,
ashleymills 0:e979170e02e7 569 SSL_OP_NO_SSLv2 = 8,
ashleymills 0:e979170e02e7 570
ashleymills 0:e979170e02e7 571 SSL_R_SSL_HANDSHAKE_FAILURE = 101,
ashleymills 0:e979170e02e7 572 SSL_R_TLSV1_ALERT_UNKNOWN_CA = 102,
ashleymills 0:e979170e02e7 573 SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103,
ashleymills 0:e979170e02e7 574 SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104,
ashleymills 0:e979170e02e7 575
ashleymills 0:e979170e02e7 576 PEM_BUFSIZE = 1024
ashleymills 0:e979170e02e7 577 };
ashleymills 0:e979170e02e7 578
ashleymills 0:e979170e02e7 579
ashleymills 0:e979170e02e7 580 #ifndef NO_PSK
ashleymills 0:e979170e02e7 581 typedef unsigned int (*psk_client_callback)(CYASSL*, const char*, char*,
ashleymills 0:e979170e02e7 582 unsigned int, unsigned char*, unsigned int);
ashleymills 0:e979170e02e7 583 CYASSL_API void CyaSSL_CTX_set_psk_client_callback(CYASSL_CTX*,
ashleymills 0:e979170e02e7 584 psk_client_callback);
ashleymills 0:e979170e02e7 585 CYASSL_API void CyaSSL_set_psk_client_callback(CYASSL*,psk_client_callback);
ashleymills 0:e979170e02e7 586
ashleymills 0:e979170e02e7 587 CYASSL_API const char* CyaSSL_get_psk_identity_hint(const CYASSL*);
ashleymills 0:e979170e02e7 588 CYASSL_API const char* CyaSSL_get_psk_identity(const CYASSL*);
ashleymills 0:e979170e02e7 589
ashleymills 0:e979170e02e7 590 CYASSL_API int CyaSSL_CTX_use_psk_identity_hint(CYASSL_CTX*, const char*);
ashleymills 0:e979170e02e7 591 CYASSL_API int CyaSSL_use_psk_identity_hint(CYASSL*, const char*);
ashleymills 0:e979170e02e7 592
ashleymills 0:e979170e02e7 593 typedef unsigned int (*psk_server_callback)(CYASSL*, const char*,
ashleymills 0:e979170e02e7 594 unsigned char*, unsigned int);
ashleymills 0:e979170e02e7 595 CYASSL_API void CyaSSL_CTX_set_psk_server_callback(CYASSL_CTX*,
ashleymills 0:e979170e02e7 596 psk_server_callback);
ashleymills 0:e979170e02e7 597 CYASSL_API void CyaSSL_set_psk_server_callback(CYASSL*,psk_server_callback);
ashleymills 0:e979170e02e7 598
ashleymills 0:e979170e02e7 599 #define PSK_TYPES_DEFINED
ashleymills 0:e979170e02e7 600 #endif /* NO_PSK */
ashleymills 0:e979170e02e7 601
ashleymills 0:e979170e02e7 602
ashleymills 0:e979170e02e7 603 /* extra begins */
ashleymills 0:e979170e02e7 604
ashleymills 0:e979170e02e7 605 enum { /* ERR Constants */
ashleymills 0:e979170e02e7 606 ERR_TXT_STRING = 1
ashleymills 0:e979170e02e7 607 };
ashleymills 0:e979170e02e7 608
ashleymills 0:e979170e02e7 609 CYASSL_API unsigned long CyaSSL_ERR_get_error_line_data(const char**, int*,
ashleymills 0:e979170e02e7 610 const char**, int *);
ashleymills 0:e979170e02e7 611
ashleymills 0:e979170e02e7 612 CYASSL_API unsigned long CyaSSL_ERR_get_error(void);
ashleymills 0:e979170e02e7 613 CYASSL_API void CyaSSL_ERR_clear_error(void);
ashleymills 0:e979170e02e7 614
ashleymills 0:e979170e02e7 615
ashleymills 0:e979170e02e7 616 CYASSL_API int CyaSSL_RAND_status(void);
ashleymills 0:e979170e02e7 617 CYASSL_API int CyaSSL_RAND_bytes(unsigned char* buf, int num);
ashleymills 0:e979170e02e7 618 CYASSL_API CYASSL_METHOD *CyaSSLv23_server_method(void);
ashleymills 0:e979170e02e7 619 CYASSL_API long CyaSSL_CTX_set_options(CYASSL_CTX*, long);
ashleymills 0:e979170e02e7 620 #ifndef NO_CERTS
ashleymills 0:e979170e02e7 621 CYASSL_API int CyaSSL_CTX_check_private_key(CYASSL_CTX*);
ashleymills 0:e979170e02e7 622 #endif /* !NO_CERTS */
ashleymills 0:e979170e02e7 623
ashleymills 0:e979170e02e7 624 CYASSL_API void CyaSSL_ERR_free_strings(void);
ashleymills 0:e979170e02e7 625 CYASSL_API void CyaSSL_ERR_remove_state(unsigned long);
ashleymills 0:e979170e02e7 626 CYASSL_API void CyaSSL_EVP_cleanup(void);
ashleymills 0:e979170e02e7 627
ashleymills 0:e979170e02e7 628 CYASSL_API void CyaSSL_cleanup_all_ex_data(void);
ashleymills 0:e979170e02e7 629 CYASSL_API long CyaSSL_CTX_set_mode(CYASSL_CTX* ctx, long mode);
ashleymills 0:e979170e02e7 630 CYASSL_API long CyaSSL_CTX_get_mode(CYASSL_CTX* ctx);
ashleymills 0:e979170e02e7 631 CYASSL_API void CyaSSL_CTX_set_default_read_ahead(CYASSL_CTX* ctx, int m);
ashleymills 0:e979170e02e7 632
ashleymills 0:e979170e02e7 633 CYASSL_API long CyaSSL_CTX_sess_set_cache_size(CYASSL_CTX*, long);
ashleymills 0:e979170e02e7 634
ashleymills 0:e979170e02e7 635 CYASSL_API int CyaSSL_CTX_set_default_verify_paths(CYASSL_CTX*);
ashleymills 0:e979170e02e7 636 CYASSL_API int CyaSSL_CTX_set_session_id_context(CYASSL_CTX*,
ashleymills 0:e979170e02e7 637 const unsigned char*, unsigned int);
ashleymills 0:e979170e02e7 638 CYASSL_API CYASSL_X509* CyaSSL_get_peer_certificate(CYASSL* ssl);
ashleymills 0:e979170e02e7 639
ashleymills 0:e979170e02e7 640 CYASSL_API int CyaSSL_want_read(CYASSL*);
ashleymills 0:e979170e02e7 641 CYASSL_API int CyaSSL_want_write(CYASSL*);
ashleymills 0:e979170e02e7 642
ashleymills 0:e979170e02e7 643 CYASSL_API int CyaSSL_BIO_printf(CYASSL_BIO*, const char*, ...);
ashleymills 0:e979170e02e7 644 CYASSL_API int CyaSSL_ASN1_UTCTIME_print(CYASSL_BIO*,
ashleymills 0:e979170e02e7 645 const CYASSL_ASN1_UTCTIME*);
ashleymills 0:e979170e02e7 646 CYASSL_API int CyaSSL_sk_num(CYASSL_X509_REVOKED*);
ashleymills 0:e979170e02e7 647 CYASSL_API void* CyaSSL_sk_value(CYASSL_X509_REVOKED*, int);
ashleymills 0:e979170e02e7 648
ashleymills 0:e979170e02e7 649 /* stunnel 4.28 needs */
ashleymills 0:e979170e02e7 650 CYASSL_API void* CyaSSL_CTX_get_ex_data(const CYASSL_CTX*, int);
ashleymills 0:e979170e02e7 651 CYASSL_API int CyaSSL_CTX_set_ex_data(CYASSL_CTX*, int, void*);
ashleymills 0:e979170e02e7 652 CYASSL_API void CyaSSL_CTX_sess_set_get_cb(CYASSL_CTX*,
ashleymills 0:e979170e02e7 653 CYASSL_SESSION*(*f)(CYASSL*, unsigned char*, int, int*));
ashleymills 0:e979170e02e7 654 CYASSL_API void CyaSSL_CTX_sess_set_new_cb(CYASSL_CTX*,
ashleymills 0:e979170e02e7 655 int (*f)(CYASSL*, CYASSL_SESSION*));
ashleymills 0:e979170e02e7 656 CYASSL_API void CyaSSL_CTX_sess_set_remove_cb(CYASSL_CTX*,
ashleymills 0:e979170e02e7 657 void (*f)(CYASSL_CTX*, CYASSL_SESSION*));
ashleymills 0:e979170e02e7 658
ashleymills 0:e979170e02e7 659 CYASSL_API int CyaSSL_i2d_SSL_SESSION(CYASSL_SESSION*,unsigned char**);
ashleymills 0:e979170e02e7 660 CYASSL_API CYASSL_SESSION* CyaSSL_d2i_SSL_SESSION(CYASSL_SESSION**,
ashleymills 0:e979170e02e7 661 const unsigned char**, long);
ashleymills 0:e979170e02e7 662
ashleymills 0:e979170e02e7 663 CYASSL_API long CyaSSL_SESSION_get_timeout(const CYASSL_SESSION*);
ashleymills 0:e979170e02e7 664 CYASSL_API long CyaSSL_SESSION_get_time(const CYASSL_SESSION*);
ashleymills 0:e979170e02e7 665 CYASSL_API int CyaSSL_CTX_get_ex_new_index(long, void*, void*, void*, void*);
ashleymills 0:e979170e02e7 666
ashleymills 0:e979170e02e7 667 /* extra ends */
ashleymills 0:e979170e02e7 668
ashleymills 0:e979170e02e7 669
ashleymills 0:e979170e02e7 670 /* CyaSSL extensions */
ashleymills 0:e979170e02e7 671
ashleymills 0:e979170e02e7 672 /* call before SSL_connect, if verifying will add name check to
ashleymills 0:e979170e02e7 673 date check and signature check */
ashleymills 0:e979170e02e7 674 CYASSL_API int CyaSSL_check_domain_name(CYASSL* ssl, const char* dn);
ashleymills 0:e979170e02e7 675
ashleymills 0:e979170e02e7 676 /* need to call once to load library (session cache) */
ashleymills 0:e979170e02e7 677 CYASSL_API int CyaSSL_Init(void);
ashleymills 0:e979170e02e7 678 /* call when done to cleanup/free session cache mutex / resources */
ashleymills 0:e979170e02e7 679 CYASSL_API int CyaSSL_Cleanup(void);
ashleymills 0:e979170e02e7 680
ashleymills 0:e979170e02e7 681 /* turn logging on, only if compiled in */
ashleymills 0:e979170e02e7 682 CYASSL_API int CyaSSL_Debugging_ON(void);
ashleymills 0:e979170e02e7 683 /* turn logging off */
ashleymills 0:e979170e02e7 684 CYASSL_API void CyaSSL_Debugging_OFF(void);
ashleymills 0:e979170e02e7 685
ashleymills 0:e979170e02e7 686 /* do accept or connect depedning on side */
ashleymills 0:e979170e02e7 687 CYASSL_API int CyaSSL_negotiate(CYASSL* ssl);
ashleymills 0:e979170e02e7 688 /* turn on CyaSSL data compression */
ashleymills 0:e979170e02e7 689 CYASSL_API int CyaSSL_set_compression(CYASSL* ssl);
ashleymills 0:e979170e02e7 690
ashleymills 0:e979170e02e7 691 CYASSL_API int CyaSSL_set_timeout(CYASSL*, unsigned int);
ashleymills 0:e979170e02e7 692 CYASSL_API int CyaSSL_CTX_set_timeout(CYASSL_CTX*, unsigned int);
ashleymills 0:e979170e02e7 693
ashleymills 0:e979170e02e7 694 /* get CyaSSL peer X509_CHAIN */
ashleymills 0:e979170e02e7 695 CYASSL_API CYASSL_X509_CHAIN* CyaSSL_get_peer_chain(CYASSL* ssl);
ashleymills 0:e979170e02e7 696 /* peer chain count */
ashleymills 0:e979170e02e7 697 CYASSL_API int CyaSSL_get_chain_count(CYASSL_X509_CHAIN* chain);
ashleymills 0:e979170e02e7 698 /* index cert length */
ashleymills 0:e979170e02e7 699 CYASSL_API int CyaSSL_get_chain_length(CYASSL_X509_CHAIN*, int idx);
ashleymills 0:e979170e02e7 700 /* index cert */
ashleymills 0:e979170e02e7 701 CYASSL_API unsigned char* CyaSSL_get_chain_cert(CYASSL_X509_CHAIN*, int idx);
ashleymills 0:e979170e02e7 702 /* get index cert in PEM */
ashleymills 0:e979170e02e7 703 CYASSL_API int CyaSSL_get_chain_cert_pem(CYASSL_X509_CHAIN*, int idx,
ashleymills 0:e979170e02e7 704 unsigned char* buffer, int inLen, int* outLen);
ashleymills 0:e979170e02e7 705 CYASSL_API const unsigned char* CyaSSL_get_sessionID(const CYASSL_SESSION* s);
ashleymills 0:e979170e02e7 706 CYASSL_API int CyaSSL_X509_get_serial_number(CYASSL_X509*,unsigned char*,int*);
ashleymills 0:e979170e02e7 707 CYASSL_API char* CyaSSL_X509_get_subjectCN(CYASSL_X509*);
ashleymills 0:e979170e02e7 708 CYASSL_API const unsigned char* CyaSSL_X509_get_der(CYASSL_X509*, int*);
ashleymills 0:e979170e02e7 709
ashleymills 0:e979170e02e7 710 CYASSL_API int CyaSSL_cmp_peer_cert_to_file(CYASSL*, const char*);
ashleymills 0:e979170e02e7 711
ashleymills 0:e979170e02e7 712 CYASSL_API char* CyaSSL_X509_get_next_altname(CYASSL_X509*);
ashleymills 0:e979170e02e7 713
ashleymills 0:e979170e02e7 714 /* connect enough to get peer cert */
ashleymills 0:e979170e02e7 715 CYASSL_API int CyaSSL_connect_cert(CYASSL* ssl);
ashleymills 0:e979170e02e7 716
ashleymills 0:e979170e02e7 717 /* XXX This should be #ifndef NO_DH */
ashleymills 0:e979170e02e7 718 #ifndef NO_CERTS
ashleymills 0:e979170e02e7 719 /* server Diffie-Hellman parameters */
ashleymills 0:e979170e02e7 720 CYASSL_API int CyaSSL_SetTmpDH(CYASSL*, const unsigned char* p, int pSz,
ashleymills 0:e979170e02e7 721 const unsigned char* g, int gSz);
ashleymills 0:e979170e02e7 722 CYASSL_API int CyaSSL_SetTmpDH_buffer(CYASSL*, const unsigned char* b, long sz,
ashleymills 0:e979170e02e7 723 int format);
ashleymills 0:e979170e02e7 724 CYASSL_API int CyaSSL_SetTmpEC_DHE_Sz(CYASSL*, unsigned short);
ashleymills 0:e979170e02e7 725 #ifndef NO_FILESYSTEM
ashleymills 0:e979170e02e7 726 CYASSL_API int CyaSSL_SetTmpDH_file(CYASSL*, const char* f, int format);
ashleymills 0:e979170e02e7 727 #endif
ashleymills 0:e979170e02e7 728
ashleymills 0:e979170e02e7 729 /* server ctx Diffie-Hellman parameters */
ashleymills 0:e979170e02e7 730 CYASSL_API int CyaSSL_CTX_SetTmpDH(CYASSL_CTX*, const unsigned char* p,
ashleymills 0:e979170e02e7 731 int pSz, const unsigned char* g, int gSz);
ashleymills 0:e979170e02e7 732 CYASSL_API int CyaSSL_CTX_SetTmpDH_buffer(CYASSL_CTX*, const unsigned char* b,
ashleymills 0:e979170e02e7 733 long sz, int format);
ashleymills 0:e979170e02e7 734 CYASSL_API int CyaSSL_CTX_SetTmpEC_DHE_Sz(CYASSL_CTX*, unsigned short);
ashleymills 0:e979170e02e7 735 #ifndef NO_FILESYSTEM
ashleymills 0:e979170e02e7 736 CYASSL_API int CyaSSL_CTX_SetTmpDH_file(CYASSL_CTX*, const char* f,
ashleymills 0:e979170e02e7 737 int format);
ashleymills 0:e979170e02e7 738 #endif
ashleymills 0:e979170e02e7 739 #endif
ashleymills 0:e979170e02e7 740
ashleymills 0:e979170e02e7 741 /* keyblock size in bytes or -1 */
ashleymills 0:e979170e02e7 742 /* need to call CyaSSL_KeepArrays before handshake to save keys */
ashleymills 0:e979170e02e7 743 CYASSL_API int CyaSSL_get_keyblock_size(CYASSL*);
ashleymills 0:e979170e02e7 744 CYASSL_API int CyaSSL_get_keys(CYASSL*,unsigned char** ms, unsigned int* msLen,
ashleymills 0:e979170e02e7 745 unsigned char** sr, unsigned int* srLen,
ashleymills 0:e979170e02e7 746 unsigned char** cr, unsigned int* crLen);
ashleymills 0:e979170e02e7 747
ashleymills 0:e979170e02e7 748 #ifndef _WIN32
ashleymills 0:e979170e02e7 749 #ifndef NO_WRITEV
ashleymills 0:e979170e02e7 750 #ifdef __PPU
ashleymills 0:e979170e02e7 751 #include <sys/types.h>
ashleymills 0:e979170e02e7 752 #include <sys/socket.h>
ashleymills 0:e979170e02e7 753 #else
ashleymills 0:e979170e02e7 754 #include <sys/uio.h>
ashleymills 0:e979170e02e7 755 #endif
ashleymills 0:e979170e02e7 756 /* allow writev style writing */
ashleymills 0:e979170e02e7 757 CYASSL_API int CyaSSL_writev(CYASSL* ssl, const struct iovec* iov,
ashleymills 0:e979170e02e7 758 int iovcnt);
ashleymills 0:e979170e02e7 759 #endif
ashleymills 0:e979170e02e7 760 #endif
ashleymills 0:e979170e02e7 761
ashleymills 0:e979170e02e7 762
ashleymills 0:e979170e02e7 763 #ifndef NO_CERTS
ashleymills 0:e979170e02e7 764 /* SSL_CTX versions */
ashleymills 0:e979170e02e7 765 CYASSL_API int CyaSSL_CTX_load_verify_buffer(CYASSL_CTX*,
ashleymills 0:e979170e02e7 766 const unsigned char*, long, int);
ashleymills 0:e979170e02e7 767 CYASSL_API int CyaSSL_CTX_use_certificate_buffer(CYASSL_CTX*,
ashleymills 0:e979170e02e7 768 const unsigned char*, long, int);
ashleymills 0:e979170e02e7 769 CYASSL_API int CyaSSL_CTX_use_PrivateKey_buffer(CYASSL_CTX*,
ashleymills 0:e979170e02e7 770 const unsigned char*, long, int);
ashleymills 0:e979170e02e7 771 CYASSL_API int CyaSSL_CTX_use_certificate_chain_buffer(CYASSL_CTX*,
ashleymills 0:e979170e02e7 772 const unsigned char*, long);
ashleymills 0:e979170e02e7 773
ashleymills 0:e979170e02e7 774 /* SSL versions */
ashleymills 0:e979170e02e7 775 CYASSL_API int CyaSSL_use_certificate_buffer(CYASSL*, const unsigned char*,
ashleymills 0:e979170e02e7 776 long, int);
ashleymills 0:e979170e02e7 777 CYASSL_API int CyaSSL_use_PrivateKey_buffer(CYASSL*, const unsigned char*,
ashleymills 0:e979170e02e7 778 long, int);
ashleymills 0:e979170e02e7 779 CYASSL_API int CyaSSL_use_certificate_chain_buffer(CYASSL*,
ashleymills 0:e979170e02e7 780 const unsigned char*, long);
ashleymills 0:e979170e02e7 781 #endif
ashleymills 0:e979170e02e7 782
ashleymills 0:e979170e02e7 783 CYASSL_API int CyaSSL_CTX_set_group_messages(CYASSL_CTX*);
ashleymills 0:e979170e02e7 784 CYASSL_API int CyaSSL_set_group_messages(CYASSL*);
ashleymills 0:e979170e02e7 785
ashleymills 0:e979170e02e7 786 /* I/O callbacks */
ashleymills 0:e979170e02e7 787 typedef int (*CallbackIORecv)(CYASSL *ssl, char *buf, int sz, void *ctx);
ashleymills 0:e979170e02e7 788 typedef int (*CallbackIOSend)(CYASSL *ssl, char *buf, int sz, void *ctx);
ashleymills 0:e979170e02e7 789
ashleymills 0:e979170e02e7 790 CYASSL_API void CyaSSL_SetIORecv(CYASSL_CTX*, CallbackIORecv);
ashleymills 0:e979170e02e7 791 CYASSL_API void CyaSSL_SetIOSend(CYASSL_CTX*, CallbackIOSend);
ashleymills 0:e979170e02e7 792
ashleymills 0:e979170e02e7 793 CYASSL_API void CyaSSL_SetIOReadCtx( CYASSL* ssl, void *ctx);
ashleymills 0:e979170e02e7 794 CYASSL_API void CyaSSL_SetIOWriteCtx(CYASSL* ssl, void *ctx);
ashleymills 0:e979170e02e7 795
ashleymills 0:e979170e02e7 796 CYASSL_API void CyaSSL_SetIOReadFlags( CYASSL* ssl, int flags);
ashleymills 0:e979170e02e7 797 CYASSL_API void CyaSSL_SetIOWriteFlags(CYASSL* ssl, int flags);
ashleymills 0:e979170e02e7 798
ashleymills 0:e979170e02e7 799 typedef int (*CallbackIOOcsp)(void*, const char*, int,
ashleymills 0:e979170e02e7 800 unsigned char*, int, unsigned char**);
ashleymills 0:e979170e02e7 801 typedef void (*CallbackIOOcspRespFree)(void*,unsigned char*);
ashleymills 0:e979170e02e7 802 #ifdef HAVE_OCSP
ashleymills 0:e979170e02e7 803 CYASSL_API void CyaSSL_SetIOOcsp(CYASSL_CTX *ocsp, CallbackIOOcsp cb);
ashleymills 0:e979170e02e7 804 CYASSL_API void CyaSSL_SetIOOcspRespFree(CYASSL_CTX *ocsp,
ashleymills 0:e979170e02e7 805 CallbackIOOcspRespFree cb);
ashleymills 0:e979170e02e7 806 CYASSL_API void CyaSSL_SetIOOcspCtx(CYASSL_CTX *ocsp, void *octx);
ashleymills 0:e979170e02e7 807 #endif
ashleymills 0:e979170e02e7 808
ashleymills 0:e979170e02e7 809 /* CA cache callbacks */
ashleymills 0:e979170e02e7 810 enum {
ashleymills 0:e979170e02e7 811 CYASSL_SSLV3 = 0,
ashleymills 0:e979170e02e7 812 CYASSL_TLSV1 = 1,
ashleymills 0:e979170e02e7 813 CYASSL_TLSV1_1 = 2,
ashleymills 0:e979170e02e7 814 CYASSL_TLSV1_2 = 3,
ashleymills 0:e979170e02e7 815 CYASSL_USER_CA = 1, /* user added as trusted */
ashleymills 0:e979170e02e7 816 CYASSL_CHAIN_CA = 2 /* added to cache from trusted chain */
ashleymills 0:e979170e02e7 817 };
ashleymills 0:e979170e02e7 818
ashleymills 0:e979170e02e7 819 CYASSL_API int CyaSSL_GetObjectSize(void); /* object size based on build */
ashleymills 0:e979170e02e7 820 CYASSL_API int CyaSSL_SetVersion(CYASSL* ssl, int version);
ashleymills 0:e979170e02e7 821 CYASSL_API int CyaSSL_KeyPemToDer(const unsigned char*, int sz, unsigned char*,
ashleymills 0:e979170e02e7 822 int, const char*);
ashleymills 0:e979170e02e7 823
ashleymills 0:e979170e02e7 824 typedef void (*CallbackCACache)(unsigned char* der, int sz, int type);
ashleymills 0:e979170e02e7 825 typedef void (*CbMissingCRL)(const char* url);
ashleymills 0:e979170e02e7 826
ashleymills 0:e979170e02e7 827
ashleymills 0:e979170e02e7 828 #ifndef NO_CERTS
ashleymills 0:e979170e02e7 829 CYASSL_API void CyaSSL_CTX_SetCACb(CYASSL_CTX*, CallbackCACache);
ashleymills 0:e979170e02e7 830
ashleymills 0:e979170e02e7 831 CYASSL_API CYASSL_CERT_MANAGER* CyaSSL_CertManagerNew(void);
ashleymills 0:e979170e02e7 832 CYASSL_API void CyaSSL_CertManagerFree(CYASSL_CERT_MANAGER*);
ashleymills 0:e979170e02e7 833
ashleymills 0:e979170e02e7 834 CYASSL_API int CyaSSL_CertManagerLoadCA(CYASSL_CERT_MANAGER*, const char* f,
ashleymills 0:e979170e02e7 835 const char* d);
ashleymills 0:e979170e02e7 836 CYASSL_API int CyaSSL_CertManagerVerify(CYASSL_CERT_MANAGER*, const char* f,
ashleymills 0:e979170e02e7 837 int format);
ashleymills 0:e979170e02e7 838 CYASSL_API int CyaSSL_CertManagerVerifyBuffer(CYASSL_CERT_MANAGER* cm,
ashleymills 0:e979170e02e7 839 const unsigned char* buff, int sz, int format);
ashleymills 0:e979170e02e7 840 CYASSL_API int CyaSSL_CertManagerCheckCRL(CYASSL_CERT_MANAGER*,
ashleymills 0:e979170e02e7 841 unsigned char*, int sz);
ashleymills 0:e979170e02e7 842 CYASSL_API int CyaSSL_CertManagerEnableCRL(CYASSL_CERT_MANAGER*,
ashleymills 0:e979170e02e7 843 int options);
ashleymills 0:e979170e02e7 844 CYASSL_API int CyaSSL_CertManagerDisableCRL(CYASSL_CERT_MANAGER*);
ashleymills 0:e979170e02e7 845 CYASSL_API int CyaSSL_CertManagerLoadCRL(CYASSL_CERT_MANAGER*, const char*,
ashleymills 0:e979170e02e7 846 int, int);
ashleymills 0:e979170e02e7 847 CYASSL_API int CyaSSL_CertManagerSetCRL_Cb(CYASSL_CERT_MANAGER*,
ashleymills 0:e979170e02e7 848 CbMissingCRL);
ashleymills 0:e979170e02e7 849
ashleymills 0:e979170e02e7 850 CYASSL_API int CyaSSL_EnableCRL(CYASSL* ssl, int options);
ashleymills 0:e979170e02e7 851 CYASSL_API int CyaSSL_DisableCRL(CYASSL* ssl);
ashleymills 0:e979170e02e7 852 CYASSL_API int CyaSSL_LoadCRL(CYASSL*, const char*, int, int);
ashleymills 0:e979170e02e7 853 CYASSL_API int CyaSSL_SetCRL_Cb(CYASSL*, CbMissingCRL);
ashleymills 0:e979170e02e7 854
ashleymills 0:e979170e02e7 855 CYASSL_API int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options);
ashleymills 0:e979170e02e7 856 CYASSL_API int CyaSSL_CTX_DisableCRL(CYASSL_CTX* ctx);
ashleymills 0:e979170e02e7 857 CYASSL_API int CyaSSL_CTX_LoadCRL(CYASSL_CTX*, const char*, int, int);
ashleymills 0:e979170e02e7 858 CYASSL_API int CyaSSL_CTX_SetCRL_Cb(CYASSL_CTX*, CbMissingCRL);
ashleymills 0:e979170e02e7 859 #endif /* !NO_CERTS */
ashleymills 0:e979170e02e7 860
ashleymills 0:e979170e02e7 861 /* end of handshake frees temporary arrays, if user needs for get_keys or
ashleymills 0:e979170e02e7 862 psk hints, call KeepArrays before handshake and then FreeArrays when done
ashleymills 0:e979170e02e7 863 if don't want to wait for object free */
ashleymills 0:e979170e02e7 864 CYASSL_API void CyaSSL_KeepArrays(CYASSL*);
ashleymills 0:e979170e02e7 865 CYASSL_API void CyaSSL_FreeArrays(CYASSL*);
ashleymills 0:e979170e02e7 866
ashleymills 0:e979170e02e7 867
ashleymills 0:e979170e02e7 868 /* cavium additions */
ashleymills 0:e979170e02e7 869 CYASSL_API int CyaSSL_UseCavium(CYASSL*, int devId);
ashleymills 0:e979170e02e7 870 CYASSL_API int CyaSSL_CTX_UseCavium(CYASSL_CTX*, int devId);
ashleymills 0:e979170e02e7 871
ashleymills 0:e979170e02e7 872
ashleymills 0:e979170e02e7 873 #define CYASSL_CRL_MONITOR 0x01 /* monitor this dir flag */
ashleymills 0:e979170e02e7 874 #define CYASSL_CRL_START_MON 0x02 /* start monitoring flag */
ashleymills 0:e979170e02e7 875
ashleymills 0:e979170e02e7 876 #ifdef CYASSL_CALLBACKS
ashleymills 0:e979170e02e7 877
ashleymills 0:e979170e02e7 878 /* used internally by CyaSSL while OpenSSL types aren't */
ashleymills 0:e979170e02e7 879 #include <cyassl/callbacks.h>
ashleymills 0:e979170e02e7 880
ashleymills 0:e979170e02e7 881 typedef int (*HandShakeCallBack)(HandShakeInfo*);
ashleymills 0:e979170e02e7 882 typedef int (*TimeoutCallBack)(TimeoutInfo*);
ashleymills 0:e979170e02e7 883
ashleymills 0:e979170e02e7 884 /* CyaSSL connect extension allowing HandShakeCallBack and/or TimeoutCallBack
ashleymills 0:e979170e02e7 885 for diagnostics */
ashleymills 0:e979170e02e7 886 CYASSL_API int CyaSSL_connect_ex(CYASSL*, HandShakeCallBack, TimeoutCallBack,
ashleymills 0:e979170e02e7 887 Timeval);
ashleymills 0:e979170e02e7 888 CYASSL_API int CyaSSL_accept_ex(CYASSL*, HandShakeCallBack, TimeoutCallBack,
ashleymills 0:e979170e02e7 889 Timeval);
ashleymills 0:e979170e02e7 890
ashleymills 0:e979170e02e7 891 #endif /* CYASSL_CALLBACKS */
ashleymills 0:e979170e02e7 892
ashleymills 0:e979170e02e7 893
ashleymills 0:e979170e02e7 894 CYASSL_API long CyaSSL_CTX_OCSP_set_options(CYASSL_CTX*, long);
ashleymills 0:e979170e02e7 895 CYASSL_API int CyaSSL_CTX_OCSP_set_override_url(CYASSL_CTX*, const char*);
ashleymills 0:e979170e02e7 896
ashleymills 0:e979170e02e7 897 /* OCSP Options */
ashleymills 0:e979170e02e7 898 #define CYASSL_OCSP_ENABLE 0x0001 /* Enable OCSP lookups */
ashleymills 0:e979170e02e7 899 #define CYASSL_OCSP_URL_OVERRIDE 0x0002 /* Use the override URL instead of URL
ashleymills 0:e979170e02e7 900 * in certificate */
ashleymills 0:e979170e02e7 901 #define CYASSL_OCSP_NO_NONCE 0x0004 /* Disables the request nonce. */
ashleymills 0:e979170e02e7 902
ashleymills 0:e979170e02e7 903
ashleymills 0:e979170e02e7 904 #ifdef __cplusplus
ashleymills 0:e979170e02e7 905 } /* extern "C" */
ashleymills 0:e979170e02e7 906 #endif
ashleymills 0:e979170e02e7 907
ashleymills 0:e979170e02e7 908
ashleymills 0:e979170e02e7 909 #endif /* CYASSL_SSL_H */
ashleymills 0:e979170e02e7 910