SSL/TLS Library

Dependents:  

CyaSSL is SSL/TLS library for embedded systems.

wolfssl.com

Committer:
wolfSSL
Date:
Sun Apr 20 12:40:57 2014 +0000
Revision:
0:9d17e4342598
CyaSSL SSL/TLS Library 2.9.4;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 0:9d17e4342598 1 /* ssl.h
wolfSSL 0:9d17e4342598 2 *
wolfSSL 0:9d17e4342598 3 * Copyright (C) 2006-2013 wolfSSL Inc.
wolfSSL 0:9d17e4342598 4 *
wolfSSL 0:9d17e4342598 5 * This file is part of CyaSSL.
wolfSSL 0:9d17e4342598 6 *
wolfSSL 0:9d17e4342598 7 * CyaSSL is free software; you can redistribute it and/or modify
wolfSSL 0:9d17e4342598 8 * it under the terms of the GNU General Public License as published by
wolfSSL 0:9d17e4342598 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 0:9d17e4342598 10 * (at your option) any later version.
wolfSSL 0:9d17e4342598 11 *
wolfSSL 0:9d17e4342598 12 * CyaSSL is distributed in the hope that it will be useful,
wolfSSL 0:9d17e4342598 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 0:9d17e4342598 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 0:9d17e4342598 15 * GNU General Public License for more details.
wolfSSL 0:9d17e4342598 16 *
wolfSSL 0:9d17e4342598 17 * You should have received a copy of the GNU General Public License
wolfSSL 0:9d17e4342598 18 * along with this program; if not, write to the Free Software
wolfSSL 0:9d17e4342598 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
wolfSSL 0:9d17e4342598 20 */
wolfSSL 0:9d17e4342598 21
wolfSSL 0:9d17e4342598 22
wolfSSL 0:9d17e4342598 23 /* CyaSSL API */
wolfSSL 0:9d17e4342598 24
wolfSSL 0:9d17e4342598 25 #ifndef CYASSL_SSL_H
wolfSSL 0:9d17e4342598 26 #define CYASSL_SSL_H
wolfSSL 0:9d17e4342598 27
wolfSSL 0:9d17e4342598 28
wolfSSL 0:9d17e4342598 29 /* for users not using preprocessor flags*/
wolfSSL 0:9d17e4342598 30 #include <cyassl/ctaocrypt/settings.h>
wolfSSL 0:9d17e4342598 31 #include <cyassl/version.h>
wolfSSL 0:9d17e4342598 32
wolfSSL 0:9d17e4342598 33
wolfSSL 0:9d17e4342598 34 #ifndef NO_FILESYSTEM
wolfSSL 0:9d17e4342598 35 #ifdef FREESCALE_MQX
wolfSSL 0:9d17e4342598 36 #include <fio.h>
wolfSSL 0:9d17e4342598 37 #else
wolfSSL 0:9d17e4342598 38 #include <stdio.h> /* ERR_printf */
wolfSSL 0:9d17e4342598 39 #endif
wolfSSL 0:9d17e4342598 40 #endif
wolfSSL 0:9d17e4342598 41
wolfSSL 0:9d17e4342598 42 #ifdef YASSL_PREFIX
wolfSSL 0:9d17e4342598 43 #include "prefix_ssl.h"
wolfSSL 0:9d17e4342598 44 #endif
wolfSSL 0:9d17e4342598 45
wolfSSL 0:9d17e4342598 46 #ifdef LIBCYASSL_VERSION_STRING
wolfSSL 0:9d17e4342598 47 #define CYASSL_VERSION LIBCYASSL_VERSION_STRING
wolfSSL 0:9d17e4342598 48 #endif
wolfSSL 0:9d17e4342598 49
wolfSSL 0:9d17e4342598 50 #ifdef _WIN32
wolfSSL 0:9d17e4342598 51 /* wincrypt.h clashes */
wolfSSL 0:9d17e4342598 52 #undef OCSP_REQUEST
wolfSSL 0:9d17e4342598 53 #undef OCSP_RESPONSE
wolfSSL 0:9d17e4342598 54 #endif
wolfSSL 0:9d17e4342598 55
wolfSSL 0:9d17e4342598 56
wolfSSL 0:9d17e4342598 57
wolfSSL 0:9d17e4342598 58 #ifdef __cplusplus
wolfSSL 0:9d17e4342598 59 extern "C" {
wolfSSL 0:9d17e4342598 60 #endif
wolfSSL 0:9d17e4342598 61
wolfSSL 0:9d17e4342598 62 typedef struct CYASSL CYASSL;
wolfSSL 0:9d17e4342598 63 typedef struct CYASSL_SESSION CYASSL_SESSION;
wolfSSL 0:9d17e4342598 64 typedef struct CYASSL_METHOD CYASSL_METHOD;
wolfSSL 0:9d17e4342598 65 typedef struct CYASSL_CTX CYASSL_CTX;
wolfSSL 0:9d17e4342598 66
wolfSSL 0:9d17e4342598 67 typedef struct CYASSL_X509 CYASSL_X509;
wolfSSL 0:9d17e4342598 68 typedef struct CYASSL_X509_NAME CYASSL_X509_NAME;
wolfSSL 0:9d17e4342598 69 typedef struct CYASSL_X509_CHAIN CYASSL_X509_CHAIN;
wolfSSL 0:9d17e4342598 70
wolfSSL 0:9d17e4342598 71 typedef struct CYASSL_CERT_MANAGER CYASSL_CERT_MANAGER;
wolfSSL 0:9d17e4342598 72 typedef struct CYASSL_SOCKADDR CYASSL_SOCKADDR;
wolfSSL 0:9d17e4342598 73
wolfSSL 0:9d17e4342598 74 /* redeclare guard */
wolfSSL 0:9d17e4342598 75 #define CYASSL_TYPES_DEFINED
wolfSSL 0:9d17e4342598 76
wolfSSL 0:9d17e4342598 77
wolfSSL 0:9d17e4342598 78 typedef struct CYASSL_RSA CYASSL_RSA;
wolfSSL 0:9d17e4342598 79 typedef struct CYASSL_DSA CYASSL_DSA;
wolfSSL 0:9d17e4342598 80 typedef struct CYASSL_CIPHER CYASSL_CIPHER;
wolfSSL 0:9d17e4342598 81 typedef struct CYASSL_X509_LOOKUP CYASSL_X509_LOOKUP;
wolfSSL 0:9d17e4342598 82 typedef struct CYASSL_X509_LOOKUP_METHOD CYASSL_X509_LOOKUP_METHOD;
wolfSSL 0:9d17e4342598 83 typedef struct CYASSL_X509_CRL CYASSL_X509_CRL;
wolfSSL 0:9d17e4342598 84 typedef struct CYASSL_BIO CYASSL_BIO;
wolfSSL 0:9d17e4342598 85 typedef struct CYASSL_BIO_METHOD CYASSL_BIO_METHOD;
wolfSSL 0:9d17e4342598 86 typedef struct CYASSL_X509_EXTENSION CYASSL_X509_EXTENSION;
wolfSSL 0:9d17e4342598 87 typedef struct CYASSL_ASN1_TIME CYASSL_ASN1_TIME;
wolfSSL 0:9d17e4342598 88 typedef struct CYASSL_ASN1_INTEGER CYASSL_ASN1_INTEGER;
wolfSSL 0:9d17e4342598 89 typedef struct CYASSL_ASN1_OBJECT CYASSL_ASN1_OBJECT;
wolfSSL 0:9d17e4342598 90 typedef struct CYASSL_ASN1_STRING CYASSL_ASN1_STRING;
wolfSSL 0:9d17e4342598 91 typedef struct CYASSL_dynlock_value CYASSL_dynlock_value;
wolfSSL 0:9d17e4342598 92
wolfSSL 0:9d17e4342598 93 #define CYASSL_ASN1_UTCTIME CYASSL_ASN1_TIME
wolfSSL 0:9d17e4342598 94
wolfSSL 0:9d17e4342598 95 typedef struct CYASSL_EVP_PKEY {
wolfSSL 0:9d17e4342598 96 int type; /* openssh dereference */
wolfSSL 0:9d17e4342598 97 int save_type; /* openssh dereference */
wolfSSL 0:9d17e4342598 98 int pkey_sz;
wolfSSL 0:9d17e4342598 99 union {
wolfSSL 0:9d17e4342598 100 char* ptr;
wolfSSL 0:9d17e4342598 101 } pkey;
wolfSSL 0:9d17e4342598 102 #ifdef HAVE_ECC
wolfSSL 0:9d17e4342598 103 int pkey_curve;
wolfSSL 0:9d17e4342598 104 #endif
wolfSSL 0:9d17e4342598 105 } CYASSL_EVP_PKEY;
wolfSSL 0:9d17e4342598 106
wolfSSL 0:9d17e4342598 107 typedef struct CYASSL_MD4_CTX {
wolfSSL 0:9d17e4342598 108 int buffer[32]; /* big enough to hold, check size in Init */
wolfSSL 0:9d17e4342598 109 } CYASSL_MD4_CTX;
wolfSSL 0:9d17e4342598 110
wolfSSL 0:9d17e4342598 111
wolfSSL 0:9d17e4342598 112 typedef struct CYASSL_COMP_METHOD {
wolfSSL 0:9d17e4342598 113 int type; /* stunnel dereference */
wolfSSL 0:9d17e4342598 114 } CYASSL_COMP_METHOD;
wolfSSL 0:9d17e4342598 115
wolfSSL 0:9d17e4342598 116
wolfSSL 0:9d17e4342598 117 typedef struct CYASSL_X509_STORE {
wolfSSL 0:9d17e4342598 118 int cache; /* stunnel dereference */
wolfSSL 0:9d17e4342598 119 CYASSL_CERT_MANAGER* cm;
wolfSSL 0:9d17e4342598 120 } CYASSL_X509_STORE;
wolfSSL 0:9d17e4342598 121
wolfSSL 0:9d17e4342598 122 typedef struct CYASSL_ALERT {
wolfSSL 0:9d17e4342598 123 int code;
wolfSSL 0:9d17e4342598 124 int level;
wolfSSL 0:9d17e4342598 125 } CYASSL_ALERT;
wolfSSL 0:9d17e4342598 126
wolfSSL 0:9d17e4342598 127 typedef struct CYASSL_ALERT_HISTORY {
wolfSSL 0:9d17e4342598 128 CYASSL_ALERT last_rx;
wolfSSL 0:9d17e4342598 129 CYASSL_ALERT last_tx;
wolfSSL 0:9d17e4342598 130 } CYASSL_ALERT_HISTORY;
wolfSSL 0:9d17e4342598 131
wolfSSL 0:9d17e4342598 132 typedef struct CYASSL_X509_REVOKED {
wolfSSL 0:9d17e4342598 133 CYASSL_ASN1_INTEGER* serialNumber; /* stunnel dereference */
wolfSSL 0:9d17e4342598 134 } CYASSL_X509_REVOKED;
wolfSSL 0:9d17e4342598 135
wolfSSL 0:9d17e4342598 136
wolfSSL 0:9d17e4342598 137 typedef struct CYASSL_X509_OBJECT {
wolfSSL 0:9d17e4342598 138 union {
wolfSSL 0:9d17e4342598 139 char* ptr;
wolfSSL 0:9d17e4342598 140 CYASSL_X509_CRL* crl; /* stunnel dereference */
wolfSSL 0:9d17e4342598 141 } data;
wolfSSL 0:9d17e4342598 142 } CYASSL_X509_OBJECT;
wolfSSL 0:9d17e4342598 143
wolfSSL 0:9d17e4342598 144
wolfSSL 0:9d17e4342598 145 typedef struct CYASSL_X509_STORE_CTX {
wolfSSL 0:9d17e4342598 146 CYASSL_X509_STORE* store; /* Store full of a CA cert chain */
wolfSSL 0:9d17e4342598 147 CYASSL_X509* current_cert; /* stunnel dereference */
wolfSSL 0:9d17e4342598 148 char* domain; /* subject CN domain name */
wolfSSL 0:9d17e4342598 149 void* ex_data; /* external data, for fortress build */
wolfSSL 0:9d17e4342598 150 void* userCtx; /* user ctx */
wolfSSL 0:9d17e4342598 151 int error; /* current error */
wolfSSL 0:9d17e4342598 152 int error_depth; /* cert depth for this error */
wolfSSL 0:9d17e4342598 153 int discardSessionCerts; /* so verify callback can flag for discard */
wolfSSL 0:9d17e4342598 154 } CYASSL_X509_STORE_CTX;
wolfSSL 0:9d17e4342598 155
wolfSSL 0:9d17e4342598 156
wolfSSL 0:9d17e4342598 157 /* Valid Alert types from page 16/17 */
wolfSSL 0:9d17e4342598 158 enum AlertDescription {
wolfSSL 0:9d17e4342598 159 close_notify = 0,
wolfSSL 0:9d17e4342598 160 unexpected_message = 10,
wolfSSL 0:9d17e4342598 161 bad_record_mac = 20,
wolfSSL 0:9d17e4342598 162 decompression_failure = 30,
wolfSSL 0:9d17e4342598 163 handshake_failure = 40,
wolfSSL 0:9d17e4342598 164 no_certificate = 41,
wolfSSL 0:9d17e4342598 165 bad_certificate = 42,
wolfSSL 0:9d17e4342598 166 unsupported_certificate = 43,
wolfSSL 0:9d17e4342598 167 certificate_revoked = 44,
wolfSSL 0:9d17e4342598 168 certificate_expired = 45,
wolfSSL 0:9d17e4342598 169 certificate_unknown = 46,
wolfSSL 0:9d17e4342598 170 illegal_parameter = 47,
wolfSSL 0:9d17e4342598 171 decrypt_error = 51,
wolfSSL 0:9d17e4342598 172 protocol_version = 70,
wolfSSL 0:9d17e4342598 173 no_renegotiation = 100,
wolfSSL 0:9d17e4342598 174 unrecognized_name = 112
wolfSSL 0:9d17e4342598 175 };
wolfSSL 0:9d17e4342598 176
wolfSSL 0:9d17e4342598 177
wolfSSL 0:9d17e4342598 178 enum AlertLevel {
wolfSSL 0:9d17e4342598 179 alert_warning = 1,
wolfSSL 0:9d17e4342598 180 alert_fatal = 2
wolfSSL 0:9d17e4342598 181 };
wolfSSL 0:9d17e4342598 182
wolfSSL 0:9d17e4342598 183
wolfSSL 0:9d17e4342598 184 CYASSL_API CYASSL_METHOD *CyaSSLv3_server_method(void);
wolfSSL 0:9d17e4342598 185 CYASSL_API CYASSL_METHOD *CyaSSLv3_client_method(void);
wolfSSL 0:9d17e4342598 186 CYASSL_API CYASSL_METHOD *CyaTLSv1_server_method(void);
wolfSSL 0:9d17e4342598 187 CYASSL_API CYASSL_METHOD *CyaTLSv1_client_method(void);
wolfSSL 0:9d17e4342598 188 CYASSL_API CYASSL_METHOD *CyaTLSv1_1_server_method(void);
wolfSSL 0:9d17e4342598 189 CYASSL_API CYASSL_METHOD *CyaTLSv1_1_client_method(void);
wolfSSL 0:9d17e4342598 190 CYASSL_API CYASSL_METHOD *CyaTLSv1_2_server_method(void);
wolfSSL 0:9d17e4342598 191 CYASSL_API CYASSL_METHOD *CyaTLSv1_2_client_method(void);
wolfSSL 0:9d17e4342598 192
wolfSSL 0:9d17e4342598 193 #ifdef CYASSL_DTLS
wolfSSL 0:9d17e4342598 194 CYASSL_API CYASSL_METHOD *CyaDTLSv1_client_method(void);
wolfSSL 0:9d17e4342598 195 CYASSL_API CYASSL_METHOD *CyaDTLSv1_server_method(void);
wolfSSL 0:9d17e4342598 196 CYASSL_API CYASSL_METHOD *CyaDTLSv1_2_client_method(void);
wolfSSL 0:9d17e4342598 197 CYASSL_API CYASSL_METHOD *CyaDTLSv1_2_server_method(void);
wolfSSL 0:9d17e4342598 198 #endif
wolfSSL 0:9d17e4342598 199
wolfSSL 0:9d17e4342598 200 #if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
wolfSSL 0:9d17e4342598 201
wolfSSL 0:9d17e4342598 202 CYASSL_API int CyaSSL_CTX_use_certificate_file(CYASSL_CTX*, const char*, int);
wolfSSL 0:9d17e4342598 203 CYASSL_API int CyaSSL_CTX_use_PrivateKey_file(CYASSL_CTX*, const char*, int);
wolfSSL 0:9d17e4342598 204 CYASSL_API int CyaSSL_CTX_load_verify_locations(CYASSL_CTX*, const char*,
wolfSSL 0:9d17e4342598 205 const char*);
wolfSSL 0:9d17e4342598 206 CYASSL_API int CyaSSL_CTX_use_certificate_chain_file(CYASSL_CTX *,
wolfSSL 0:9d17e4342598 207 const char *file);
wolfSSL 0:9d17e4342598 208 CYASSL_API int CyaSSL_CTX_use_RSAPrivateKey_file(CYASSL_CTX*, const char*, int);
wolfSSL 0:9d17e4342598 209
wolfSSL 0:9d17e4342598 210 CYASSL_API int CyaSSL_use_certificate_file(CYASSL*, const char*, int);
wolfSSL 0:9d17e4342598 211 CYASSL_API int CyaSSL_use_PrivateKey_file(CYASSL*, const char*, int);
wolfSSL 0:9d17e4342598 212 CYASSL_API int CyaSSL_use_certificate_chain_file(CYASSL*, const char *file);
wolfSSL 0:9d17e4342598 213 CYASSL_API int CyaSSL_use_RSAPrivateKey_file(CYASSL*, const char*, int);
wolfSSL 0:9d17e4342598 214
wolfSSL 0:9d17e4342598 215 #ifdef CYASSL_DER_LOAD
wolfSSL 0:9d17e4342598 216 CYASSL_API int CyaSSL_CTX_der_load_verify_locations(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 217 const char*, int);
wolfSSL 0:9d17e4342598 218 #endif
wolfSSL 0:9d17e4342598 219
wolfSSL 0:9d17e4342598 220 #ifdef HAVE_NTRU
wolfSSL 0:9d17e4342598 221 CYASSL_API int CyaSSL_CTX_use_NTRUPrivateKey_file(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 222 /* load NTRU private key blob */
wolfSSL 0:9d17e4342598 223 #endif
wolfSSL 0:9d17e4342598 224
wolfSSL 0:9d17e4342598 225 CYASSL_API int CyaSSL_PemCertToDer(const char*, unsigned char*, int);
wolfSSL 0:9d17e4342598 226
wolfSSL 0:9d17e4342598 227 #endif /* !NO_FILESYSTEM && !NO_CERTS */
wolfSSL 0:9d17e4342598 228
wolfSSL 0:9d17e4342598 229 CYASSL_API CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD*);
wolfSSL 0:9d17e4342598 230 CYASSL_API CYASSL* CyaSSL_new(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 231 CYASSL_API int CyaSSL_set_fd (CYASSL*, int);
wolfSSL 0:9d17e4342598 232 CYASSL_API int CyaSSL_get_fd(const CYASSL*);
wolfSSL 0:9d17e4342598 233 CYASSL_API void CyaSSL_set_using_nonblock(CYASSL*, int);
wolfSSL 0:9d17e4342598 234 CYASSL_API int CyaSSL_get_using_nonblock(CYASSL*);
wolfSSL 0:9d17e4342598 235 CYASSL_API int CyaSSL_connect(CYASSL*); /* please see note at top of README
wolfSSL 0:9d17e4342598 236 if you get an error from connect */
wolfSSL 0:9d17e4342598 237 CYASSL_API int CyaSSL_write(CYASSL*, const void*, int);
wolfSSL 0:9d17e4342598 238 CYASSL_API int CyaSSL_read(CYASSL*, void*, int);
wolfSSL 0:9d17e4342598 239 CYASSL_API int CyaSSL_peek(CYASSL*, void*, int);
wolfSSL 0:9d17e4342598 240 CYASSL_API int CyaSSL_accept(CYASSL*);
wolfSSL 0:9d17e4342598 241 CYASSL_API void CyaSSL_CTX_free(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 242 CYASSL_API void CyaSSL_free(CYASSL*);
wolfSSL 0:9d17e4342598 243 CYASSL_API int CyaSSL_shutdown(CYASSL*);
wolfSSL 0:9d17e4342598 244 CYASSL_API int CyaSSL_send(CYASSL*, const void*, int sz, int flags);
wolfSSL 0:9d17e4342598 245 CYASSL_API int CyaSSL_recv(CYASSL*, void*, int sz, int flags);
wolfSSL 0:9d17e4342598 246
wolfSSL 0:9d17e4342598 247 CYASSL_API void CyaSSL_CTX_set_quiet_shutdown(CYASSL_CTX*, int);
wolfSSL 0:9d17e4342598 248 CYASSL_API void CyaSSL_set_quiet_shutdown(CYASSL*, int);
wolfSSL 0:9d17e4342598 249
wolfSSL 0:9d17e4342598 250 CYASSL_API int CyaSSL_get_error(CYASSL*, int);
wolfSSL 0:9d17e4342598 251 CYASSL_API int CyaSSL_get_alert_history(CYASSL*, CYASSL_ALERT_HISTORY *);
wolfSSL 0:9d17e4342598 252
wolfSSL 0:9d17e4342598 253 CYASSL_API int CyaSSL_set_session(CYASSL* ssl,CYASSL_SESSION* session);
wolfSSL 0:9d17e4342598 254 CYASSL_API CYASSL_SESSION* CyaSSL_get_session(CYASSL* ssl);
wolfSSL 0:9d17e4342598 255 CYASSL_API void CyaSSL_flush_sessions(CYASSL_CTX *ctx, long tm);
wolfSSL 0:9d17e4342598 256 CYASSL_API int CyaSSL_SetServerID(CYASSL* ssl, const unsigned char*,
wolfSSL 0:9d17e4342598 257 int, int);
wolfSSL 0:9d17e4342598 258
wolfSSL 0:9d17e4342598 259 #ifdef SESSION_INDEX
wolfSSL 0:9d17e4342598 260 CYASSL_API int CyaSSL_GetSessionIndex(CYASSL* ssl);
wolfSSL 0:9d17e4342598 261 CYASSL_API int CyaSSL_GetSessionAtIndex(int index, CYASSL_SESSION* session);
wolfSSL 0:9d17e4342598 262 #endif /* SESSION_INDEX */
wolfSSL 0:9d17e4342598 263
wolfSSL 0:9d17e4342598 264 #if defined(SESSION_INDEX) && defined(SESSION_CERTS)
wolfSSL 0:9d17e4342598 265 CYASSL_API
wolfSSL 0:9d17e4342598 266 CYASSL_X509_CHAIN* CyaSSL_SESSION_get_peer_chain(CYASSL_SESSION* session);
wolfSSL 0:9d17e4342598 267 #endif /* SESSION_INDEX && SESSION_CERTS */
wolfSSL 0:9d17e4342598 268
wolfSSL 0:9d17e4342598 269 typedef int (*VerifyCallback)(int, CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 270 typedef int (*pem_password_cb)(char*, int, int, void*);
wolfSSL 0:9d17e4342598 271
wolfSSL 0:9d17e4342598 272 CYASSL_API void CyaSSL_CTX_set_verify(CYASSL_CTX*, int,
wolfSSL 0:9d17e4342598 273 VerifyCallback verify_callback);
wolfSSL 0:9d17e4342598 274 CYASSL_API void CyaSSL_set_verify(CYASSL*, int, VerifyCallback verify_callback);
wolfSSL 0:9d17e4342598 275 CYASSL_API void CyaSSL_SetCertCbCtx(CYASSL*, void*);
wolfSSL 0:9d17e4342598 276
wolfSSL 0:9d17e4342598 277 CYASSL_API int CyaSSL_pending(CYASSL*);
wolfSSL 0:9d17e4342598 278
wolfSSL 0:9d17e4342598 279 CYASSL_API void CyaSSL_load_error_strings(void);
wolfSSL 0:9d17e4342598 280 CYASSL_API int CyaSSL_library_init(void);
wolfSSL 0:9d17e4342598 281 CYASSL_API long CyaSSL_CTX_set_session_cache_mode(CYASSL_CTX*, long);
wolfSSL 0:9d17e4342598 282
wolfSSL 0:9d17e4342598 283 /* session cache persistence */
wolfSSL 0:9d17e4342598 284 CYASSL_API int CyaSSL_save_session_cache(const char*);
wolfSSL 0:9d17e4342598 285 CYASSL_API int CyaSSL_restore_session_cache(const char*);
wolfSSL 0:9d17e4342598 286 CYASSL_API int CyaSSL_memsave_session_cache(void*, int);
wolfSSL 0:9d17e4342598 287 CYASSL_API int CyaSSL_memrestore_session_cache(const void*, int);
wolfSSL 0:9d17e4342598 288 CYASSL_API int CyaSSL_get_session_cache_memsize(void);
wolfSSL 0:9d17e4342598 289
wolfSSL 0:9d17e4342598 290 /* certificate cache persistence, uses ctx since certs are per ctx */
wolfSSL 0:9d17e4342598 291 CYASSL_API int CyaSSL_CTX_save_cert_cache(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 292 CYASSL_API int CyaSSL_CTX_restore_cert_cache(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 293 CYASSL_API int CyaSSL_CTX_memsave_cert_cache(CYASSL_CTX*, void*, int, int*);
wolfSSL 0:9d17e4342598 294 CYASSL_API int CyaSSL_CTX_memrestore_cert_cache(CYASSL_CTX*, const void*, int);
wolfSSL 0:9d17e4342598 295 CYASSL_API int CyaSSL_CTX_get_cert_cache_memsize(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 296
wolfSSL 0:9d17e4342598 297 /* only supports full name from cipher_name[] delimited by : */
wolfSSL 0:9d17e4342598 298 CYASSL_API int CyaSSL_CTX_set_cipher_list(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 299 CYASSL_API int CyaSSL_set_cipher_list(CYASSL*, const char*);
wolfSSL 0:9d17e4342598 300
wolfSSL 0:9d17e4342598 301 /* Nonblocking DTLS helper functions */
wolfSSL 0:9d17e4342598 302 CYASSL_API int CyaSSL_dtls_get_current_timeout(CYASSL* ssl);
wolfSSL 0:9d17e4342598 303 CYASSL_API int CyaSSL_dtls_set_timeout_init(CYASSL* ssl, int);
wolfSSL 0:9d17e4342598 304 CYASSL_API int CyaSSL_dtls_set_timeout_max(CYASSL* ssl, int);
wolfSSL 0:9d17e4342598 305 CYASSL_API int CyaSSL_dtls_got_timeout(CYASSL* ssl);
wolfSSL 0:9d17e4342598 306 CYASSL_API int CyaSSL_dtls(CYASSL* ssl);
wolfSSL 0:9d17e4342598 307
wolfSSL 0:9d17e4342598 308 CYASSL_API int CyaSSL_dtls_set_peer(CYASSL*, void*, unsigned int);
wolfSSL 0:9d17e4342598 309 CYASSL_API int CyaSSL_dtls_get_peer(CYASSL*, void*, unsigned int*);
wolfSSL 0:9d17e4342598 310
wolfSSL 0:9d17e4342598 311 CYASSL_API int CyaSSL_ERR_GET_REASON(int err);
wolfSSL 0:9d17e4342598 312 CYASSL_API char* CyaSSL_ERR_error_string(unsigned long,char*);
wolfSSL 0:9d17e4342598 313 CYASSL_API void CyaSSL_ERR_error_string_n(unsigned long e, char* buf,
wolfSSL 0:9d17e4342598 314 unsigned long sz);
wolfSSL 0:9d17e4342598 315
wolfSSL 0:9d17e4342598 316 /* extras */
wolfSSL 0:9d17e4342598 317
wolfSSL 0:9d17e4342598 318 #define STACK_OF(x) x
wolfSSL 0:9d17e4342598 319
wolfSSL 0:9d17e4342598 320 CYASSL_API int CyaSSL_set_ex_data(CYASSL*, int, void*);
wolfSSL 0:9d17e4342598 321 CYASSL_API int CyaSSL_get_shutdown(const CYASSL*);
wolfSSL 0:9d17e4342598 322 CYASSL_API int CyaSSL_set_rfd(CYASSL*, int);
wolfSSL 0:9d17e4342598 323 CYASSL_API int CyaSSL_set_wfd(CYASSL*, int);
wolfSSL 0:9d17e4342598 324 CYASSL_API void CyaSSL_set_shutdown(CYASSL*, int);
wolfSSL 0:9d17e4342598 325 CYASSL_API int CyaSSL_set_session_id_context(CYASSL*, const unsigned char*,
wolfSSL 0:9d17e4342598 326 unsigned int);
wolfSSL 0:9d17e4342598 327 CYASSL_API void CyaSSL_set_connect_state(CYASSL*);
wolfSSL 0:9d17e4342598 328 CYASSL_API void CyaSSL_set_accept_state(CYASSL*);
wolfSSL 0:9d17e4342598 329 CYASSL_API int CyaSSL_session_reused(CYASSL*);
wolfSSL 0:9d17e4342598 330 CYASSL_API void CyaSSL_SESSION_free(CYASSL_SESSION* session);
wolfSSL 0:9d17e4342598 331 CYASSL_API int CyaSSL_is_init_finished(CYASSL*);
wolfSSL 0:9d17e4342598 332
wolfSSL 0:9d17e4342598 333 CYASSL_API const char* CyaSSL_get_version(CYASSL*);
wolfSSL 0:9d17e4342598 334 CYASSL_API int CyaSSL_get_current_cipher_suite(CYASSL* ssl);
wolfSSL 0:9d17e4342598 335 CYASSL_API CYASSL_CIPHER* CyaSSL_get_current_cipher(CYASSL*);
wolfSSL 0:9d17e4342598 336 CYASSL_API char* CyaSSL_CIPHER_description(CYASSL_CIPHER*, char*, int);
wolfSSL 0:9d17e4342598 337 CYASSL_API const char* CyaSSL_CIPHER_get_name(const CYASSL_CIPHER* cipher);
wolfSSL 0:9d17e4342598 338 CYASSL_API const char* CyaSSL_get_cipher(CYASSL*);
wolfSSL 0:9d17e4342598 339 CYASSL_API CYASSL_SESSION* CyaSSL_get1_session(CYASSL* ssl);
wolfSSL 0:9d17e4342598 340 /* what's ref count */
wolfSSL 0:9d17e4342598 341
wolfSSL 0:9d17e4342598 342 CYASSL_API void CyaSSL_X509_free(CYASSL_X509*);
wolfSSL 0:9d17e4342598 343 CYASSL_API void CyaSSL_OPENSSL_free(void*);
wolfSSL 0:9d17e4342598 344
wolfSSL 0:9d17e4342598 345 CYASSL_API int CyaSSL_OCSP_parse_url(char* url, char** host, char** port,
wolfSSL 0:9d17e4342598 346 char** path, int* ssl);
wolfSSL 0:9d17e4342598 347
wolfSSL 0:9d17e4342598 348 CYASSL_API CYASSL_METHOD* CyaSSLv23_client_method(void);
wolfSSL 0:9d17e4342598 349 CYASSL_API CYASSL_METHOD* CyaSSLv2_client_method(void);
wolfSSL 0:9d17e4342598 350 CYASSL_API CYASSL_METHOD* CyaSSLv2_server_method(void);
wolfSSL 0:9d17e4342598 351
wolfSSL 0:9d17e4342598 352 CYASSL_API void CyaSSL_MD4_Init(CYASSL_MD4_CTX*);
wolfSSL 0:9d17e4342598 353 CYASSL_API void CyaSSL_MD4_Update(CYASSL_MD4_CTX*, const void*, unsigned long);
wolfSSL 0:9d17e4342598 354 CYASSL_API void CyaSSL_MD4_Final(unsigned char*, CYASSL_MD4_CTX*);
wolfSSL 0:9d17e4342598 355
wolfSSL 0:9d17e4342598 356
wolfSSL 0:9d17e4342598 357 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new(CYASSL_BIO_METHOD*);
wolfSSL 0:9d17e4342598 358 CYASSL_API int CyaSSL_BIO_free(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 359 CYASSL_API int CyaSSL_BIO_free_all(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 360 CYASSL_API int CyaSSL_BIO_read(CYASSL_BIO*, void*, int);
wolfSSL 0:9d17e4342598 361 CYASSL_API int CyaSSL_BIO_write(CYASSL_BIO*, const void*, int);
wolfSSL 0:9d17e4342598 362 CYASSL_API CYASSL_BIO* CyaSSL_BIO_push(CYASSL_BIO*, CYASSL_BIO* append);
wolfSSL 0:9d17e4342598 363 CYASSL_API CYASSL_BIO* CyaSSL_BIO_pop(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 364 CYASSL_API int CyaSSL_BIO_flush(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 365 CYASSL_API int CyaSSL_BIO_pending(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 366
wolfSSL 0:9d17e4342598 367 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_buffer(void);
wolfSSL 0:9d17e4342598 368 CYASSL_API long CyaSSL_BIO_set_write_buffer_size(CYASSL_BIO*, long size);
wolfSSL 0:9d17e4342598 369 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_ssl(void);
wolfSSL 0:9d17e4342598 370 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new_socket(int sfd, int flag);
wolfSSL 0:9d17e4342598 371 CYASSL_API int CyaSSL_BIO_eof(CYASSL_BIO*);
wolfSSL 0:9d17e4342598 372
wolfSSL 0:9d17e4342598 373 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_s_mem(void);
wolfSSL 0:9d17e4342598 374 CYASSL_API CYASSL_BIO_METHOD* CyaSSL_BIO_f_base64(void);
wolfSSL 0:9d17e4342598 375 CYASSL_API void CyaSSL_BIO_set_flags(CYASSL_BIO*, int);
wolfSSL 0:9d17e4342598 376
wolfSSL 0:9d17e4342598 377 CYASSL_API int CyaSSL_BIO_get_mem_data(CYASSL_BIO* bio,const unsigned char** p);
wolfSSL 0:9d17e4342598 378 CYASSL_API CYASSL_BIO* CyaSSL_BIO_new_mem_buf(void* buf, int len);
wolfSSL 0:9d17e4342598 379
wolfSSL 0:9d17e4342598 380
wolfSSL 0:9d17e4342598 381 CYASSL_API long CyaSSL_BIO_set_ssl(CYASSL_BIO*, CYASSL*, int flag);
wolfSSL 0:9d17e4342598 382 CYASSL_API void CyaSSL_set_bio(CYASSL*, CYASSL_BIO* rd, CYASSL_BIO* wr);
wolfSSL 0:9d17e4342598 383
wolfSSL 0:9d17e4342598 384 CYASSL_API int CyaSSL_add_all_algorithms(void);
wolfSSL 0:9d17e4342598 385
wolfSSL 0:9d17e4342598 386 CYASSL_API void CyaSSL_RAND_screen(void);
wolfSSL 0:9d17e4342598 387 CYASSL_API const char* CyaSSL_RAND_file_name(char*, unsigned long);
wolfSSL 0:9d17e4342598 388 CYASSL_API int CyaSSL_RAND_write_file(const char*);
wolfSSL 0:9d17e4342598 389 CYASSL_API int CyaSSL_RAND_load_file(const char*, long);
wolfSSL 0:9d17e4342598 390 CYASSL_API int CyaSSL_RAND_egd(const char*);
wolfSSL 0:9d17e4342598 391 CYASSL_API int CyaSSL_RAND_seed(const void*, int);
wolfSSL 0:9d17e4342598 392 CYASSL_API void CyaSSL_RAND_add(const void*, int, double);
wolfSSL 0:9d17e4342598 393
wolfSSL 0:9d17e4342598 394 CYASSL_API CYASSL_COMP_METHOD* CyaSSL_COMP_zlib(void);
wolfSSL 0:9d17e4342598 395 CYASSL_API CYASSL_COMP_METHOD* CyaSSL_COMP_rle(void);
wolfSSL 0:9d17e4342598 396 CYASSL_API int CyaSSL_COMP_add_compression_method(int, void*);
wolfSSL 0:9d17e4342598 397
wolfSSL 0:9d17e4342598 398 CYASSL_API int CyaSSL_get_ex_new_index(long, void*, void*, void*, void*);
wolfSSL 0:9d17e4342598 399
wolfSSL 0:9d17e4342598 400 CYASSL_API void CyaSSL_set_id_callback(unsigned long (*f)(void));
wolfSSL 0:9d17e4342598 401 CYASSL_API void CyaSSL_set_locking_callback(void (*f)(int, int, const char*,
wolfSSL 0:9d17e4342598 402 int));
wolfSSL 0:9d17e4342598 403 CYASSL_API void CyaSSL_set_dynlock_create_callback(CYASSL_dynlock_value* (*f)
wolfSSL 0:9d17e4342598 404 (const char*, int));
wolfSSL 0:9d17e4342598 405 CYASSL_API void CyaSSL_set_dynlock_lock_callback(void (*f)(int,
wolfSSL 0:9d17e4342598 406 CYASSL_dynlock_value*, const char*, int));
wolfSSL 0:9d17e4342598 407 CYASSL_API void CyaSSL_set_dynlock_destroy_callback(void (*f)
wolfSSL 0:9d17e4342598 408 (CYASSL_dynlock_value*, const char*, int));
wolfSSL 0:9d17e4342598 409 CYASSL_API int CyaSSL_num_locks(void);
wolfSSL 0:9d17e4342598 410
wolfSSL 0:9d17e4342598 411 CYASSL_API CYASSL_X509* CyaSSL_X509_STORE_CTX_get_current_cert(
wolfSSL 0:9d17e4342598 412 CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 413 CYASSL_API int CyaSSL_X509_STORE_CTX_get_error(CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 414 CYASSL_API int CyaSSL_X509_STORE_CTX_get_error_depth(CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 415
wolfSSL 0:9d17e4342598 416 CYASSL_API char* CyaSSL_X509_NAME_oneline(CYASSL_X509_NAME*, char*, int);
wolfSSL 0:9d17e4342598 417 CYASSL_API CYASSL_X509_NAME* CyaSSL_X509_get_issuer_name(CYASSL_X509*);
wolfSSL 0:9d17e4342598 418 CYASSL_API CYASSL_X509_NAME* CyaSSL_X509_get_subject_name(CYASSL_X509*);
wolfSSL 0:9d17e4342598 419 CYASSL_API int CyaSSL_X509_ext_isSet_by_NID(CYASSL_X509*, int);
wolfSSL 0:9d17e4342598 420 CYASSL_API int CyaSSL_X509_ext_get_critical_by_NID(CYASSL_X509*, int);
wolfSSL 0:9d17e4342598 421 CYASSL_API int CyaSSL_X509_get_isCA(CYASSL_X509*);
wolfSSL 0:9d17e4342598 422 CYASSL_API int CyaSSL_X509_get_isSet_pathLength(CYASSL_X509*);
wolfSSL 0:9d17e4342598 423 CYASSL_API unsigned int CyaSSL_X509_get_pathLength(CYASSL_X509*);
wolfSSL 0:9d17e4342598 424 CYASSL_API unsigned int CyaSSL_X509_get_keyUsage(CYASSL_X509*);
wolfSSL 0:9d17e4342598 425 CYASSL_API unsigned char* CyaSSL_X509_get_authorityKeyID(
wolfSSL 0:9d17e4342598 426 CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 427 CYASSL_API unsigned char* CyaSSL_X509_get_subjectKeyID(
wolfSSL 0:9d17e4342598 428 CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 429 CYASSL_API int CyaSSL_X509_NAME_entry_count(CYASSL_X509_NAME*);
wolfSSL 0:9d17e4342598 430 CYASSL_API int CyaSSL_X509_NAME_get_text_by_NID(
wolfSSL 0:9d17e4342598 431 CYASSL_X509_NAME*, int, char*, int);
wolfSSL 0:9d17e4342598 432 CYASSL_API int CyaSSL_X509_verify_cert(CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 433 CYASSL_API const char* CyaSSL_X509_verify_cert_error_string(long);
wolfSSL 0:9d17e4342598 434 CYASSL_API int CyaSSL_X509_get_signature_type(CYASSL_X509*);
wolfSSL 0:9d17e4342598 435 CYASSL_API int CyaSSL_X509_get_signature(CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 436
wolfSSL 0:9d17e4342598 437 CYASSL_API int CyaSSL_X509_LOOKUP_add_dir(CYASSL_X509_LOOKUP*,const char*,long);
wolfSSL 0:9d17e4342598 438 CYASSL_API int CyaSSL_X509_LOOKUP_load_file(CYASSL_X509_LOOKUP*, const char*,
wolfSSL 0:9d17e4342598 439 long);
wolfSSL 0:9d17e4342598 440 CYASSL_API CYASSL_X509_LOOKUP_METHOD* CyaSSL_X509_LOOKUP_hash_dir(void);
wolfSSL 0:9d17e4342598 441 CYASSL_API CYASSL_X509_LOOKUP_METHOD* CyaSSL_X509_LOOKUP_file(void);
wolfSSL 0:9d17e4342598 442
wolfSSL 0:9d17e4342598 443 CYASSL_API CYASSL_X509_LOOKUP* CyaSSL_X509_STORE_add_lookup(CYASSL_X509_STORE*,
wolfSSL 0:9d17e4342598 444 CYASSL_X509_LOOKUP_METHOD*);
wolfSSL 0:9d17e4342598 445 CYASSL_API CYASSL_X509_STORE* CyaSSL_X509_STORE_new(void);
wolfSSL 0:9d17e4342598 446 CYASSL_API void CyaSSL_X509_STORE_free(CYASSL_X509_STORE*);
wolfSSL 0:9d17e4342598 447 CYASSL_API int CyaSSL_X509_STORE_add_cert(
wolfSSL 0:9d17e4342598 448 CYASSL_X509_STORE*, CYASSL_X509*);
wolfSSL 0:9d17e4342598 449 CYASSL_API int CyaSSL_X509_STORE_set_default_paths(CYASSL_X509_STORE*);
wolfSSL 0:9d17e4342598 450 CYASSL_API int CyaSSL_X509_STORE_get_by_subject(CYASSL_X509_STORE_CTX*,
wolfSSL 0:9d17e4342598 451 int, CYASSL_X509_NAME*, CYASSL_X509_OBJECT*);
wolfSSL 0:9d17e4342598 452 CYASSL_API CYASSL_X509_STORE_CTX* CyaSSL_X509_STORE_CTX_new(void);
wolfSSL 0:9d17e4342598 453 CYASSL_API int CyaSSL_X509_STORE_CTX_init(CYASSL_X509_STORE_CTX*,
wolfSSL 0:9d17e4342598 454 CYASSL_X509_STORE*, CYASSL_X509*, STACK_OF(CYASSL_X509)*);
wolfSSL 0:9d17e4342598 455 CYASSL_API void CyaSSL_X509_STORE_CTX_free(CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 456 CYASSL_API void CyaSSL_X509_STORE_CTX_cleanup(CYASSL_X509_STORE_CTX*);
wolfSSL 0:9d17e4342598 457
wolfSSL 0:9d17e4342598 458 CYASSL_API CYASSL_ASN1_TIME* CyaSSL_X509_CRL_get_lastUpdate(CYASSL_X509_CRL*);
wolfSSL 0:9d17e4342598 459 CYASSL_API CYASSL_ASN1_TIME* CyaSSL_X509_CRL_get_nextUpdate(CYASSL_X509_CRL*);
wolfSSL 0:9d17e4342598 460
wolfSSL 0:9d17e4342598 461 CYASSL_API CYASSL_EVP_PKEY* CyaSSL_X509_get_pubkey(CYASSL_X509*);
wolfSSL 0:9d17e4342598 462 CYASSL_API int CyaSSL_X509_CRL_verify(CYASSL_X509_CRL*, CYASSL_EVP_PKEY*);
wolfSSL 0:9d17e4342598 463 CYASSL_API void CyaSSL_X509_STORE_CTX_set_error(CYASSL_X509_STORE_CTX*,
wolfSSL 0:9d17e4342598 464 int);
wolfSSL 0:9d17e4342598 465 CYASSL_API void CyaSSL_X509_OBJECT_free_contents(CYASSL_X509_OBJECT*);
wolfSSL 0:9d17e4342598 466 CYASSL_API void CyaSSL_EVP_PKEY_free(CYASSL_EVP_PKEY*);
wolfSSL 0:9d17e4342598 467 CYASSL_API int CyaSSL_X509_cmp_current_time(const CYASSL_ASN1_TIME*);
wolfSSL 0:9d17e4342598 468 CYASSL_API int CyaSSL_sk_X509_REVOKED_num(CYASSL_X509_REVOKED*);
wolfSSL 0:9d17e4342598 469
wolfSSL 0:9d17e4342598 470 CYASSL_API CYASSL_X509_REVOKED* CyaSSL_X509_CRL_get_REVOKED(CYASSL_X509_CRL*);
wolfSSL 0:9d17e4342598 471 CYASSL_API CYASSL_X509_REVOKED* CyaSSL_sk_X509_REVOKED_value(
wolfSSL 0:9d17e4342598 472 CYASSL_X509_REVOKED*,int);
wolfSSL 0:9d17e4342598 473 CYASSL_API CYASSL_ASN1_INTEGER* CyaSSL_X509_get_serialNumber(CYASSL_X509*);
wolfSSL 0:9d17e4342598 474
wolfSSL 0:9d17e4342598 475 CYASSL_API int CyaSSL_ASN1_TIME_print(CYASSL_BIO*, const CYASSL_ASN1_TIME*);
wolfSSL 0:9d17e4342598 476
wolfSSL 0:9d17e4342598 477 CYASSL_API int CyaSSL_ASN1_INTEGER_cmp(const CYASSL_ASN1_INTEGER*,
wolfSSL 0:9d17e4342598 478 const CYASSL_ASN1_INTEGER*);
wolfSSL 0:9d17e4342598 479 CYASSL_API long CyaSSL_ASN1_INTEGER_get(const CYASSL_ASN1_INTEGER*);
wolfSSL 0:9d17e4342598 480
wolfSSL 0:9d17e4342598 481 CYASSL_API STACK_OF(CYASSL_X509_NAME)* CyaSSL_load_client_CA_file(const char*);
wolfSSL 0:9d17e4342598 482
wolfSSL 0:9d17e4342598 483 CYASSL_API void CyaSSL_CTX_set_client_CA_list(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 484 STACK_OF(CYASSL_X509_NAME)*);
wolfSSL 0:9d17e4342598 485 CYASSL_API void* CyaSSL_X509_STORE_CTX_get_ex_data(CYASSL_X509_STORE_CTX*, int);
wolfSSL 0:9d17e4342598 486 CYASSL_API int CyaSSL_get_ex_data_X509_STORE_CTX_idx(void);
wolfSSL 0:9d17e4342598 487 CYASSL_API void* CyaSSL_get_ex_data(const CYASSL*, int);
wolfSSL 0:9d17e4342598 488
wolfSSL 0:9d17e4342598 489 CYASSL_API void CyaSSL_CTX_set_default_passwd_cb_userdata(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 490 void* userdata);
wolfSSL 0:9d17e4342598 491 CYASSL_API void CyaSSL_CTX_set_default_passwd_cb(CYASSL_CTX*, pem_password_cb);
wolfSSL 0:9d17e4342598 492
wolfSSL 0:9d17e4342598 493
wolfSSL 0:9d17e4342598 494 CYASSL_API void CyaSSL_CTX_set_info_callback(CYASSL_CTX*, void (*)(void));
wolfSSL 0:9d17e4342598 495
wolfSSL 0:9d17e4342598 496 CYASSL_API unsigned long CyaSSL_ERR_peek_error(void);
wolfSSL 0:9d17e4342598 497 CYASSL_API int CyaSSL_GET_REASON(int);
wolfSSL 0:9d17e4342598 498
wolfSSL 0:9d17e4342598 499 CYASSL_API char* CyaSSL_alert_type_string_long(int);
wolfSSL 0:9d17e4342598 500 CYASSL_API char* CyaSSL_alert_desc_string_long(int);
wolfSSL 0:9d17e4342598 501 CYASSL_API char* CyaSSL_state_string_long(CYASSL*);
wolfSSL 0:9d17e4342598 502
wolfSSL 0:9d17e4342598 503 CYASSL_API CYASSL_RSA* CyaSSL_RSA_generate_key(int, unsigned long,
wolfSSL 0:9d17e4342598 504 void(*)(int, int, void*), void*);
wolfSSL 0:9d17e4342598 505 CYASSL_API void CyaSSL_CTX_set_tmp_rsa_callback(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 506 CYASSL_RSA*(*)(CYASSL*, int, int));
wolfSSL 0:9d17e4342598 507
wolfSSL 0:9d17e4342598 508 CYASSL_API int CyaSSL_PEM_def_callback(char*, int num, int w, void* key);
wolfSSL 0:9d17e4342598 509
wolfSSL 0:9d17e4342598 510 CYASSL_API long CyaSSL_CTX_sess_accept(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 511 CYASSL_API long CyaSSL_CTX_sess_connect(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 512 CYASSL_API long CyaSSL_CTX_sess_accept_good(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 513 CYASSL_API long CyaSSL_CTX_sess_connect_good(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 514 CYASSL_API long CyaSSL_CTX_sess_accept_renegotiate(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 515 CYASSL_API long CyaSSL_CTX_sess_connect_renegotiate(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 516 CYASSL_API long CyaSSL_CTX_sess_hits(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 517 CYASSL_API long CyaSSL_CTX_sess_cb_hits(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 518 CYASSL_API long CyaSSL_CTX_sess_cache_full(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 519 CYASSL_API long CyaSSL_CTX_sess_misses(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 520 CYASSL_API long CyaSSL_CTX_sess_timeouts(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 521 CYASSL_API long CyaSSL_CTX_sess_number(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 522 CYASSL_API long CyaSSL_CTX_sess_get_cache_size(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 523
wolfSSL 0:9d17e4342598 524 #define CYASSL_DEFAULT_CIPHER_LIST "" /* default all */
wolfSSL 0:9d17e4342598 525 #define CYASSL_RSA_F4 0x10001L
wolfSSL 0:9d17e4342598 526
wolfSSL 0:9d17e4342598 527 enum {
wolfSSL 0:9d17e4342598 528 OCSP_NOCERTS = 1,
wolfSSL 0:9d17e4342598 529 OCSP_NOINTERN = 2,
wolfSSL 0:9d17e4342598 530 OCSP_NOSIGS = 4,
wolfSSL 0:9d17e4342598 531 OCSP_NOCHAIN = 8,
wolfSSL 0:9d17e4342598 532 OCSP_NOVERIFY = 16,
wolfSSL 0:9d17e4342598 533 OCSP_NOEXPLICIT = 32,
wolfSSL 0:9d17e4342598 534 OCSP_NOCASIGN = 64,
wolfSSL 0:9d17e4342598 535 OCSP_NODELEGATED = 128,
wolfSSL 0:9d17e4342598 536 OCSP_NOCHECKS = 256,
wolfSSL 0:9d17e4342598 537 OCSP_TRUSTOTHER = 512,
wolfSSL 0:9d17e4342598 538 OCSP_RESPID_KEY = 1024,
wolfSSL 0:9d17e4342598 539 OCSP_NOTIME = 2048,
wolfSSL 0:9d17e4342598 540
wolfSSL 0:9d17e4342598 541 OCSP_CERTID = 2,
wolfSSL 0:9d17e4342598 542 OCSP_REQUEST = 4,
wolfSSL 0:9d17e4342598 543 OCSP_RESPONSE = 8,
wolfSSL 0:9d17e4342598 544 OCSP_BASICRESP = 16,
wolfSSL 0:9d17e4342598 545
wolfSSL 0:9d17e4342598 546 CYASSL_OCSP_URL_OVERRIDE = 1,
wolfSSL 0:9d17e4342598 547 CYASSL_OCSP_NO_NONCE = 2,
wolfSSL 0:9d17e4342598 548
wolfSSL 0:9d17e4342598 549 CYASSL_CRL_CHECKALL = 1,
wolfSSL 0:9d17e4342598 550
wolfSSL 0:9d17e4342598 551 ASN1_GENERALIZEDTIME = 4,
wolfSSL 0:9d17e4342598 552
wolfSSL 0:9d17e4342598 553 SSL_OP_MICROSOFT_SESS_ID_BUG = 1,
wolfSSL 0:9d17e4342598 554 SSL_OP_NETSCAPE_CHALLENGE_BUG = 2,
wolfSSL 0:9d17e4342598 555 SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 3,
wolfSSL 0:9d17e4342598 556 SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 4,
wolfSSL 0:9d17e4342598 557 SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 5,
wolfSSL 0:9d17e4342598 558 SSL_OP_MSIE_SSLV2_RSA_PADDING = 6,
wolfSSL 0:9d17e4342598 559 SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 7,
wolfSSL 0:9d17e4342598 560 SSL_OP_TLS_D5_BUG = 8,
wolfSSL 0:9d17e4342598 561 SSL_OP_TLS_BLOCK_PADDING_BUG = 9,
wolfSSL 0:9d17e4342598 562 SSL_OP_TLS_ROLLBACK_BUG = 10,
wolfSSL 0:9d17e4342598 563 SSL_OP_ALL = 11,
wolfSSL 0:9d17e4342598 564 SSL_OP_EPHEMERAL_RSA = 12,
wolfSSL 0:9d17e4342598 565 SSL_OP_NO_SSLv3 = 13,
wolfSSL 0:9d17e4342598 566 SSL_OP_NO_TLSv1 = 14,
wolfSSL 0:9d17e4342598 567 SSL_OP_PKCS1_CHECK_1 = 15,
wolfSSL 0:9d17e4342598 568 SSL_OP_PKCS1_CHECK_2 = 16,
wolfSSL 0:9d17e4342598 569 SSL_OP_NETSCAPE_CA_DN_BUG = 17,
wolfSSL 0:9d17e4342598 570 SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 18,
wolfSSL 0:9d17e4342598 571 SSL_OP_SINGLE_DH_USE = 19,
wolfSSL 0:9d17e4342598 572 SSL_OP_NO_TICKET = 20,
wolfSSL 0:9d17e4342598 573 SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 21,
wolfSSL 0:9d17e4342598 574 SSL_OP_NO_QUERY_MTU = 22,
wolfSSL 0:9d17e4342598 575 SSL_OP_COOKIE_EXCHANGE = 23,
wolfSSL 0:9d17e4342598 576 SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 24,
wolfSSL 0:9d17e4342598 577 SSL_OP_SINGLE_ECDH_USE = 25,
wolfSSL 0:9d17e4342598 578 SSL_OP_CIPHER_SERVER_PREFERENCE = 26,
wolfSSL 0:9d17e4342598 579
wolfSSL 0:9d17e4342598 580 SSL_MAX_SSL_SESSION_ID_LENGTH = 32,
wolfSSL 0:9d17e4342598 581
wolfSSL 0:9d17e4342598 582 EVP_R_BAD_DECRYPT = 2,
wolfSSL 0:9d17e4342598 583
wolfSSL 0:9d17e4342598 584 SSL_CB_LOOP = 4,
wolfSSL 0:9d17e4342598 585 SSL_ST_CONNECT = 5,
wolfSSL 0:9d17e4342598 586 SSL_ST_ACCEPT = 6,
wolfSSL 0:9d17e4342598 587 SSL_CB_ALERT = 7,
wolfSSL 0:9d17e4342598 588 SSL_CB_READ = 8,
wolfSSL 0:9d17e4342598 589 SSL_CB_HANDSHAKE_DONE = 9,
wolfSSL 0:9d17e4342598 590
wolfSSL 0:9d17e4342598 591 SSL_MODE_ENABLE_PARTIAL_WRITE = 2,
wolfSSL 0:9d17e4342598 592
wolfSSL 0:9d17e4342598 593 BIO_FLAGS_BASE64_NO_NL = 1,
wolfSSL 0:9d17e4342598 594 BIO_CLOSE = 1,
wolfSSL 0:9d17e4342598 595 BIO_NOCLOSE = 0,
wolfSSL 0:9d17e4342598 596
wolfSSL 0:9d17e4342598 597 NID_undef = 0,
wolfSSL 0:9d17e4342598 598
wolfSSL 0:9d17e4342598 599 X509_FILETYPE_PEM = 8,
wolfSSL 0:9d17e4342598 600 X509_LU_X509 = 9,
wolfSSL 0:9d17e4342598 601 X509_LU_CRL = 12,
wolfSSL 0:9d17e4342598 602
wolfSSL 0:9d17e4342598 603 X509_V_ERR_CRL_SIGNATURE_FAILURE = 13,
wolfSSL 0:9d17e4342598 604 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 14,
wolfSSL 0:9d17e4342598 605 X509_V_ERR_CRL_HAS_EXPIRED = 15,
wolfSSL 0:9d17e4342598 606 X509_V_ERR_CERT_REVOKED = 16,
wolfSSL 0:9d17e4342598 607 X509_V_ERR_CERT_CHAIN_TOO_LONG = 17,
wolfSSL 0:9d17e4342598 608 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = 18,
wolfSSL 0:9d17e4342598 609 X509_V_ERR_CERT_NOT_YET_VALID = 19,
wolfSSL 0:9d17e4342598 610 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 20,
wolfSSL 0:9d17e4342598 611 X509_V_ERR_CERT_HAS_EXPIRED = 21,
wolfSSL 0:9d17e4342598 612 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 22,
wolfSSL 0:9d17e4342598 613
wolfSSL 0:9d17e4342598 614 X509_V_OK = 0,
wolfSSL 0:9d17e4342598 615
wolfSSL 0:9d17e4342598 616 CRYPTO_LOCK = 1,
wolfSSL 0:9d17e4342598 617 CRYPTO_NUM_LOCKS = 10
wolfSSL 0:9d17e4342598 618 };
wolfSSL 0:9d17e4342598 619
wolfSSL 0:9d17e4342598 620 /* extras end */
wolfSSL 0:9d17e4342598 621
wolfSSL 0:9d17e4342598 622 #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
wolfSSL 0:9d17e4342598 623 /* CyaSSL extension, provide last error from SSL_get_error
wolfSSL 0:9d17e4342598 624 since not using thread storage error queue */
wolfSSL 0:9d17e4342598 625 CYASSL_API void CyaSSL_ERR_print_errors_fp(FILE*, int err);
wolfSSL 0:9d17e4342598 626 #endif
wolfSSL 0:9d17e4342598 627
wolfSSL 0:9d17e4342598 628 enum { /* ssl Constants */
wolfSSL 0:9d17e4342598 629 SSL_ERROR_NONE = 0, /* for most functions */
wolfSSL 0:9d17e4342598 630 SSL_FAILURE = 0, /* for some functions */
wolfSSL 0:9d17e4342598 631 SSL_SUCCESS = 1,
wolfSSL 0:9d17e4342598 632
wolfSSL 0:9d17e4342598 633 SSL_BAD_CERTTYPE = -8,
wolfSSL 0:9d17e4342598 634 SSL_BAD_STAT = -7,
wolfSSL 0:9d17e4342598 635 SSL_BAD_PATH = -6,
wolfSSL 0:9d17e4342598 636 SSL_BAD_FILETYPE = -5,
wolfSSL 0:9d17e4342598 637 SSL_BAD_FILE = -4,
wolfSSL 0:9d17e4342598 638 SSL_NOT_IMPLEMENTED = -3,
wolfSSL 0:9d17e4342598 639 SSL_UNKNOWN = -2,
wolfSSL 0:9d17e4342598 640 SSL_FATAL_ERROR = -1,
wolfSSL 0:9d17e4342598 641
wolfSSL 0:9d17e4342598 642 SSL_FILETYPE_ASN1 = 2,
wolfSSL 0:9d17e4342598 643 SSL_FILETYPE_PEM = 1,
wolfSSL 0:9d17e4342598 644 SSL_FILETYPE_DEFAULT = 2, /* ASN1 */
wolfSSL 0:9d17e4342598 645 SSL_FILETYPE_RAW = 3, /* NTRU raw key blob */
wolfSSL 0:9d17e4342598 646
wolfSSL 0:9d17e4342598 647 SSL_VERIFY_NONE = 0,
wolfSSL 0:9d17e4342598 648 SSL_VERIFY_PEER = 1,
wolfSSL 0:9d17e4342598 649 SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2,
wolfSSL 0:9d17e4342598 650 SSL_VERIFY_CLIENT_ONCE = 4,
wolfSSL 0:9d17e4342598 651
wolfSSL 0:9d17e4342598 652 SSL_SESS_CACHE_OFF = 30,
wolfSSL 0:9d17e4342598 653 SSL_SESS_CACHE_CLIENT = 31,
wolfSSL 0:9d17e4342598 654 SSL_SESS_CACHE_SERVER = 32,
wolfSSL 0:9d17e4342598 655 SSL_SESS_CACHE_BOTH = 33,
wolfSSL 0:9d17e4342598 656 SSL_SESS_CACHE_NO_AUTO_CLEAR = 34,
wolfSSL 0:9d17e4342598 657 SSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 35,
wolfSSL 0:9d17e4342598 658
wolfSSL 0:9d17e4342598 659 SSL_ERROR_WANT_READ = 2,
wolfSSL 0:9d17e4342598 660 SSL_ERROR_WANT_WRITE = 3,
wolfSSL 0:9d17e4342598 661 SSL_ERROR_WANT_CONNECT = 7,
wolfSSL 0:9d17e4342598 662 SSL_ERROR_WANT_ACCEPT = 8,
wolfSSL 0:9d17e4342598 663 SSL_ERROR_SYSCALL = 5,
wolfSSL 0:9d17e4342598 664 SSL_ERROR_WANT_X509_LOOKUP = 83,
wolfSSL 0:9d17e4342598 665 SSL_ERROR_ZERO_RETURN = 6,
wolfSSL 0:9d17e4342598 666 SSL_ERROR_SSL = 85,
wolfSSL 0:9d17e4342598 667
wolfSSL 0:9d17e4342598 668 SSL_SENT_SHUTDOWN = 1,
wolfSSL 0:9d17e4342598 669 SSL_RECEIVED_SHUTDOWN = 2,
wolfSSL 0:9d17e4342598 670 SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = 4,
wolfSSL 0:9d17e4342598 671 SSL_OP_NO_SSLv2 = 8,
wolfSSL 0:9d17e4342598 672
wolfSSL 0:9d17e4342598 673 SSL_R_SSL_HANDSHAKE_FAILURE = 101,
wolfSSL 0:9d17e4342598 674 SSL_R_TLSV1_ALERT_UNKNOWN_CA = 102,
wolfSSL 0:9d17e4342598 675 SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103,
wolfSSL 0:9d17e4342598 676 SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104,
wolfSSL 0:9d17e4342598 677
wolfSSL 0:9d17e4342598 678 PEM_BUFSIZE = 1024
wolfSSL 0:9d17e4342598 679 };
wolfSSL 0:9d17e4342598 680
wolfSSL 0:9d17e4342598 681
wolfSSL 0:9d17e4342598 682 #ifndef NO_PSK
wolfSSL 0:9d17e4342598 683 typedef unsigned int (*psk_client_callback)(CYASSL*, const char*, char*,
wolfSSL 0:9d17e4342598 684 unsigned int, unsigned char*, unsigned int);
wolfSSL 0:9d17e4342598 685 CYASSL_API void CyaSSL_CTX_set_psk_client_callback(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 686 psk_client_callback);
wolfSSL 0:9d17e4342598 687 CYASSL_API void CyaSSL_set_psk_client_callback(CYASSL*,psk_client_callback);
wolfSSL 0:9d17e4342598 688
wolfSSL 0:9d17e4342598 689 CYASSL_API const char* CyaSSL_get_psk_identity_hint(const CYASSL*);
wolfSSL 0:9d17e4342598 690 CYASSL_API const char* CyaSSL_get_psk_identity(const CYASSL*);
wolfSSL 0:9d17e4342598 691
wolfSSL 0:9d17e4342598 692 CYASSL_API int CyaSSL_CTX_use_psk_identity_hint(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 693 CYASSL_API int CyaSSL_use_psk_identity_hint(CYASSL*, const char*);
wolfSSL 0:9d17e4342598 694
wolfSSL 0:9d17e4342598 695 typedef unsigned int (*psk_server_callback)(CYASSL*, const char*,
wolfSSL 0:9d17e4342598 696 unsigned char*, unsigned int);
wolfSSL 0:9d17e4342598 697 CYASSL_API void CyaSSL_CTX_set_psk_server_callback(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 698 psk_server_callback);
wolfSSL 0:9d17e4342598 699 CYASSL_API void CyaSSL_set_psk_server_callback(CYASSL*,psk_server_callback);
wolfSSL 0:9d17e4342598 700
wolfSSL 0:9d17e4342598 701 #define PSK_TYPES_DEFINED
wolfSSL 0:9d17e4342598 702 #endif /* NO_PSK */
wolfSSL 0:9d17e4342598 703
wolfSSL 0:9d17e4342598 704
wolfSSL 0:9d17e4342598 705 /* extra begins */
wolfSSL 0:9d17e4342598 706
wolfSSL 0:9d17e4342598 707 enum { /* ERR Constants */
wolfSSL 0:9d17e4342598 708 ERR_TXT_STRING = 1
wolfSSL 0:9d17e4342598 709 };
wolfSSL 0:9d17e4342598 710
wolfSSL 0:9d17e4342598 711 CYASSL_API unsigned long CyaSSL_ERR_get_error_line_data(const char**, int*,
wolfSSL 0:9d17e4342598 712 const char**, int *);
wolfSSL 0:9d17e4342598 713
wolfSSL 0:9d17e4342598 714 CYASSL_API unsigned long CyaSSL_ERR_get_error(void);
wolfSSL 0:9d17e4342598 715 CYASSL_API void CyaSSL_ERR_clear_error(void);
wolfSSL 0:9d17e4342598 716
wolfSSL 0:9d17e4342598 717
wolfSSL 0:9d17e4342598 718 CYASSL_API int CyaSSL_RAND_status(void);
wolfSSL 0:9d17e4342598 719 CYASSL_API int CyaSSL_RAND_bytes(unsigned char* buf, int num);
wolfSSL 0:9d17e4342598 720 CYASSL_API CYASSL_METHOD *CyaSSLv23_server_method(void);
wolfSSL 0:9d17e4342598 721 CYASSL_API long CyaSSL_CTX_set_options(CYASSL_CTX*, long);
wolfSSL 0:9d17e4342598 722 #ifndef NO_CERTS
wolfSSL 0:9d17e4342598 723 CYASSL_API int CyaSSL_CTX_check_private_key(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 724 #endif /* !NO_CERTS */
wolfSSL 0:9d17e4342598 725
wolfSSL 0:9d17e4342598 726 CYASSL_API void CyaSSL_ERR_free_strings(void);
wolfSSL 0:9d17e4342598 727 CYASSL_API void CyaSSL_ERR_remove_state(unsigned long);
wolfSSL 0:9d17e4342598 728 CYASSL_API void CyaSSL_EVP_cleanup(void);
wolfSSL 0:9d17e4342598 729
wolfSSL 0:9d17e4342598 730 CYASSL_API void CyaSSL_cleanup_all_ex_data(void);
wolfSSL 0:9d17e4342598 731 CYASSL_API long CyaSSL_CTX_set_mode(CYASSL_CTX* ctx, long mode);
wolfSSL 0:9d17e4342598 732 CYASSL_API long CyaSSL_CTX_get_mode(CYASSL_CTX* ctx);
wolfSSL 0:9d17e4342598 733 CYASSL_API void CyaSSL_CTX_set_default_read_ahead(CYASSL_CTX* ctx, int m);
wolfSSL 0:9d17e4342598 734
wolfSSL 0:9d17e4342598 735 CYASSL_API long CyaSSL_CTX_sess_set_cache_size(CYASSL_CTX*, long);
wolfSSL 0:9d17e4342598 736
wolfSSL 0:9d17e4342598 737 CYASSL_API int CyaSSL_CTX_set_default_verify_paths(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 738 CYASSL_API int CyaSSL_CTX_set_session_id_context(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 739 const unsigned char*, unsigned int);
wolfSSL 0:9d17e4342598 740 CYASSL_API CYASSL_X509* CyaSSL_get_peer_certificate(CYASSL* ssl);
wolfSSL 0:9d17e4342598 741
wolfSSL 0:9d17e4342598 742 CYASSL_API int CyaSSL_want_read(CYASSL*);
wolfSSL 0:9d17e4342598 743 CYASSL_API int CyaSSL_want_write(CYASSL*);
wolfSSL 0:9d17e4342598 744
wolfSSL 0:9d17e4342598 745 CYASSL_API int CyaSSL_BIO_printf(CYASSL_BIO*, const char*, ...);
wolfSSL 0:9d17e4342598 746 CYASSL_API int CyaSSL_ASN1_UTCTIME_print(CYASSL_BIO*,
wolfSSL 0:9d17e4342598 747 const CYASSL_ASN1_UTCTIME*);
wolfSSL 0:9d17e4342598 748 CYASSL_API int CyaSSL_sk_num(CYASSL_X509_REVOKED*);
wolfSSL 0:9d17e4342598 749 CYASSL_API void* CyaSSL_sk_value(CYASSL_X509_REVOKED*, int);
wolfSSL 0:9d17e4342598 750
wolfSSL 0:9d17e4342598 751 /* stunnel 4.28 needs */
wolfSSL 0:9d17e4342598 752 CYASSL_API void* CyaSSL_CTX_get_ex_data(const CYASSL_CTX*, int);
wolfSSL 0:9d17e4342598 753 CYASSL_API int CyaSSL_CTX_set_ex_data(CYASSL_CTX*, int, void*);
wolfSSL 0:9d17e4342598 754 CYASSL_API void CyaSSL_CTX_sess_set_get_cb(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 755 CYASSL_SESSION*(*f)(CYASSL*, unsigned char*, int, int*));
wolfSSL 0:9d17e4342598 756 CYASSL_API void CyaSSL_CTX_sess_set_new_cb(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 757 int (*f)(CYASSL*, CYASSL_SESSION*));
wolfSSL 0:9d17e4342598 758 CYASSL_API void CyaSSL_CTX_sess_set_remove_cb(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 759 void (*f)(CYASSL_CTX*, CYASSL_SESSION*));
wolfSSL 0:9d17e4342598 760
wolfSSL 0:9d17e4342598 761 CYASSL_API int CyaSSL_i2d_SSL_SESSION(CYASSL_SESSION*,unsigned char**);
wolfSSL 0:9d17e4342598 762 CYASSL_API CYASSL_SESSION* CyaSSL_d2i_SSL_SESSION(CYASSL_SESSION**,
wolfSSL 0:9d17e4342598 763 const unsigned char**, long);
wolfSSL 0:9d17e4342598 764
wolfSSL 0:9d17e4342598 765 CYASSL_API long CyaSSL_SESSION_get_timeout(const CYASSL_SESSION*);
wolfSSL 0:9d17e4342598 766 CYASSL_API long CyaSSL_SESSION_get_time(const CYASSL_SESSION*);
wolfSSL 0:9d17e4342598 767 CYASSL_API int CyaSSL_CTX_get_ex_new_index(long, void*, void*, void*, void*);
wolfSSL 0:9d17e4342598 768
wolfSSL 0:9d17e4342598 769 /* extra ends */
wolfSSL 0:9d17e4342598 770
wolfSSL 0:9d17e4342598 771
wolfSSL 0:9d17e4342598 772 /* CyaSSL extensions */
wolfSSL 0:9d17e4342598 773
wolfSSL 0:9d17e4342598 774 /* call before SSL_connect, if verifying will add name check to
wolfSSL 0:9d17e4342598 775 date check and signature check */
wolfSSL 0:9d17e4342598 776 CYASSL_API int CyaSSL_check_domain_name(CYASSL* ssl, const char* dn);
wolfSSL 0:9d17e4342598 777
wolfSSL 0:9d17e4342598 778 /* need to call once to load library (session cache) */
wolfSSL 0:9d17e4342598 779 CYASSL_API int CyaSSL_Init(void);
wolfSSL 0:9d17e4342598 780 /* call when done to cleanup/free session cache mutex / resources */
wolfSSL 0:9d17e4342598 781 CYASSL_API int CyaSSL_Cleanup(void);
wolfSSL 0:9d17e4342598 782
wolfSSL 0:9d17e4342598 783 /* turn logging on, only if compiled in */
wolfSSL 0:9d17e4342598 784 CYASSL_API int CyaSSL_Debugging_ON(void);
wolfSSL 0:9d17e4342598 785 /* turn logging off */
wolfSSL 0:9d17e4342598 786 CYASSL_API void CyaSSL_Debugging_OFF(void);
wolfSSL 0:9d17e4342598 787
wolfSSL 0:9d17e4342598 788 /* do accept or connect depedning on side */
wolfSSL 0:9d17e4342598 789 CYASSL_API int CyaSSL_negotiate(CYASSL* ssl);
wolfSSL 0:9d17e4342598 790 /* turn on CyaSSL data compression */
wolfSSL 0:9d17e4342598 791 CYASSL_API int CyaSSL_set_compression(CYASSL* ssl);
wolfSSL 0:9d17e4342598 792
wolfSSL 0:9d17e4342598 793 CYASSL_API int CyaSSL_set_timeout(CYASSL*, unsigned int);
wolfSSL 0:9d17e4342598 794 CYASSL_API int CyaSSL_CTX_set_timeout(CYASSL_CTX*, unsigned int);
wolfSSL 0:9d17e4342598 795
wolfSSL 0:9d17e4342598 796 /* get CyaSSL peer X509_CHAIN */
wolfSSL 0:9d17e4342598 797 CYASSL_API CYASSL_X509_CHAIN* CyaSSL_get_peer_chain(CYASSL* ssl);
wolfSSL 0:9d17e4342598 798 /* peer chain count */
wolfSSL 0:9d17e4342598 799 CYASSL_API int CyaSSL_get_chain_count(CYASSL_X509_CHAIN* chain);
wolfSSL 0:9d17e4342598 800 /* index cert length */
wolfSSL 0:9d17e4342598 801 CYASSL_API int CyaSSL_get_chain_length(CYASSL_X509_CHAIN*, int idx);
wolfSSL 0:9d17e4342598 802 /* index cert */
wolfSSL 0:9d17e4342598 803 CYASSL_API unsigned char* CyaSSL_get_chain_cert(CYASSL_X509_CHAIN*, int idx);
wolfSSL 0:9d17e4342598 804 /* index cert in X509 */
wolfSSL 0:9d17e4342598 805 CYASSL_API CYASSL_X509* CyaSSL_get_chain_X509(CYASSL_X509_CHAIN*, int idx);
wolfSSL 0:9d17e4342598 806 /* free X509 */
wolfSSL 0:9d17e4342598 807 CYASSL_API void CyaSSL_FreeX509(CYASSL_X509*);
wolfSSL 0:9d17e4342598 808 /* get index cert in PEM */
wolfSSL 0:9d17e4342598 809 CYASSL_API int CyaSSL_get_chain_cert_pem(CYASSL_X509_CHAIN*, int idx,
wolfSSL 0:9d17e4342598 810 unsigned char* buffer, int inLen, int* outLen);
wolfSSL 0:9d17e4342598 811 CYASSL_API const unsigned char* CyaSSL_get_sessionID(const CYASSL_SESSION* s);
wolfSSL 0:9d17e4342598 812 CYASSL_API int CyaSSL_X509_get_serial_number(CYASSL_X509*,unsigned char*,int*);
wolfSSL 0:9d17e4342598 813 CYASSL_API char* CyaSSL_X509_get_subjectCN(CYASSL_X509*);
wolfSSL 0:9d17e4342598 814 CYASSL_API const unsigned char* CyaSSL_X509_get_der(CYASSL_X509*, int*);
wolfSSL 0:9d17e4342598 815 CYASSL_API const unsigned char* CyaSSL_X509_notBefore(CYASSL_X509*);
wolfSSL 0:9d17e4342598 816 CYASSL_API const unsigned char* CyaSSL_X509_notAfter(CYASSL_X509*);
wolfSSL 0:9d17e4342598 817 CYASSL_API int CyaSSL_X509_version(CYASSL_X509*);
wolfSSL 0:9d17e4342598 818 CYASSL_API
wolfSSL 0:9d17e4342598 819
wolfSSL 0:9d17e4342598 820 CYASSL_API int CyaSSL_cmp_peer_cert_to_file(CYASSL*, const char*);
wolfSSL 0:9d17e4342598 821
wolfSSL 0:9d17e4342598 822 CYASSL_API char* CyaSSL_X509_get_next_altname(CYASSL_X509*);
wolfSSL 0:9d17e4342598 823
wolfSSL 0:9d17e4342598 824 CYASSL_API CYASSL_X509*
wolfSSL 0:9d17e4342598 825 CyaSSL_X509_d2i(CYASSL_X509** x509, const unsigned char* in, int len);
wolfSSL 0:9d17e4342598 826 #ifndef NO_FILESYSTEM
wolfSSL 0:9d17e4342598 827 #ifndef NO_STDIO_FILESYSTEM
wolfSSL 0:9d17e4342598 828 CYASSL_API CYASSL_X509*
wolfSSL 0:9d17e4342598 829 CyaSSL_X509_d2i_fp(CYASSL_X509** x509, FILE* file);
wolfSSL 0:9d17e4342598 830 #endif
wolfSSL 0:9d17e4342598 831 CYASSL_API CYASSL_X509*
wolfSSL 0:9d17e4342598 832 CyaSSL_X509_load_certificate_file(const char* fname, int format);
wolfSSL 0:9d17e4342598 833 #endif
wolfSSL 0:9d17e4342598 834
wolfSSL 0:9d17e4342598 835 #ifdef CYASSL_SEP
wolfSSL 0:9d17e4342598 836 CYASSL_API unsigned char*
wolfSSL 0:9d17e4342598 837 CyaSSL_X509_get_device_type(CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 838 CYASSL_API unsigned char*
wolfSSL 0:9d17e4342598 839 CyaSSL_X509_get_hw_type(CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 840 CYASSL_API unsigned char*
wolfSSL 0:9d17e4342598 841 CyaSSL_X509_get_hw_serial_number(CYASSL_X509*, unsigned char*, int*);
wolfSSL 0:9d17e4342598 842 #endif
wolfSSL 0:9d17e4342598 843
wolfSSL 0:9d17e4342598 844 /* connect enough to get peer cert */
wolfSSL 0:9d17e4342598 845 CYASSL_API int CyaSSL_connect_cert(CYASSL* ssl);
wolfSSL 0:9d17e4342598 846
wolfSSL 0:9d17e4342598 847 /* XXX This should be #ifndef NO_DH */
wolfSSL 0:9d17e4342598 848 #ifndef NO_CERTS
wolfSSL 0:9d17e4342598 849 /* server Diffie-Hellman parameters */
wolfSSL 0:9d17e4342598 850 CYASSL_API int CyaSSL_SetTmpDH(CYASSL*, const unsigned char* p, int pSz,
wolfSSL 0:9d17e4342598 851 const unsigned char* g, int gSz);
wolfSSL 0:9d17e4342598 852 CYASSL_API int CyaSSL_SetTmpDH_buffer(CYASSL*, const unsigned char* b, long sz,
wolfSSL 0:9d17e4342598 853 int format);
wolfSSL 0:9d17e4342598 854 CYASSL_API int CyaSSL_SetTmpEC_DHE_Sz(CYASSL*, unsigned short);
wolfSSL 0:9d17e4342598 855 #ifndef NO_FILESYSTEM
wolfSSL 0:9d17e4342598 856 CYASSL_API int CyaSSL_SetTmpDH_file(CYASSL*, const char* f, int format);
wolfSSL 0:9d17e4342598 857 #endif
wolfSSL 0:9d17e4342598 858
wolfSSL 0:9d17e4342598 859 /* server ctx Diffie-Hellman parameters */
wolfSSL 0:9d17e4342598 860 CYASSL_API int CyaSSL_CTX_SetTmpDH(CYASSL_CTX*, const unsigned char* p,
wolfSSL 0:9d17e4342598 861 int pSz, const unsigned char* g, int gSz);
wolfSSL 0:9d17e4342598 862 CYASSL_API int CyaSSL_CTX_SetTmpDH_buffer(CYASSL_CTX*, const unsigned char* b,
wolfSSL 0:9d17e4342598 863 long sz, int format);
wolfSSL 0:9d17e4342598 864 CYASSL_API int CyaSSL_CTX_SetTmpEC_DHE_Sz(CYASSL_CTX*, unsigned short);
wolfSSL 0:9d17e4342598 865
wolfSSL 0:9d17e4342598 866 #ifndef NO_FILESYSTEM
wolfSSL 0:9d17e4342598 867 CYASSL_API int CyaSSL_CTX_SetTmpDH_file(CYASSL_CTX*, const char* f,
wolfSSL 0:9d17e4342598 868 int format);
wolfSSL 0:9d17e4342598 869 #endif
wolfSSL 0:9d17e4342598 870 #endif
wolfSSL 0:9d17e4342598 871
wolfSSL 0:9d17e4342598 872 /* keyblock size in bytes or -1 */
wolfSSL 0:9d17e4342598 873 /* need to call CyaSSL_KeepArrays before handshake to save keys */
wolfSSL 0:9d17e4342598 874 CYASSL_API int CyaSSL_get_keyblock_size(CYASSL*);
wolfSSL 0:9d17e4342598 875 CYASSL_API int CyaSSL_get_keys(CYASSL*,unsigned char** ms, unsigned int* msLen,
wolfSSL 0:9d17e4342598 876 unsigned char** sr, unsigned int* srLen,
wolfSSL 0:9d17e4342598 877 unsigned char** cr, unsigned int* crLen);
wolfSSL 0:9d17e4342598 878
wolfSSL 0:9d17e4342598 879 /* Computes EAP-TLS and EAP-TTLS keying material from the master_secret. */
wolfSSL 0:9d17e4342598 880 CYASSL_API int CyaSSL_make_eap_keys(CYASSL*, void* key, unsigned int len,
wolfSSL 0:9d17e4342598 881 const char* label);
wolfSSL 0:9d17e4342598 882
wolfSSL 0:9d17e4342598 883
wolfSSL 0:9d17e4342598 884 #ifndef _WIN32
wolfSSL 0:9d17e4342598 885 #ifndef NO_WRITEV
wolfSSL 0:9d17e4342598 886 #ifdef __PPU
wolfSSL 0:9d17e4342598 887 #include <sys/types.h>
wolfSSL 0:9d17e4342598 888 #include <sys/socket.h>
wolfSSL 0:9d17e4342598 889 #elif !defined(CYASSL_MDK_ARM)
wolfSSL 0:9d17e4342598 890 #include <sys/uio.h>
wolfSSL 0:9d17e4342598 891 #endif
wolfSSL 0:9d17e4342598 892 /* allow writev style writing */
wolfSSL 0:9d17e4342598 893 CYASSL_API int CyaSSL_writev(CYASSL* ssl, const struct iovec* iov,
wolfSSL 0:9d17e4342598 894 int iovcnt);
wolfSSL 0:9d17e4342598 895 #endif
wolfSSL 0:9d17e4342598 896 #endif
wolfSSL 0:9d17e4342598 897
wolfSSL 0:9d17e4342598 898
wolfSSL 0:9d17e4342598 899 #ifndef NO_CERTS
wolfSSL 0:9d17e4342598 900 /* SSL_CTX versions */
wolfSSL 0:9d17e4342598 901 CYASSL_API int CyaSSL_CTX_UnloadCAs(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 902 CYASSL_API int CyaSSL_CTX_load_verify_buffer(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 903 const unsigned char*, long, int);
wolfSSL 0:9d17e4342598 904 CYASSL_API int CyaSSL_CTX_use_certificate_buffer(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 905 const unsigned char*, long, int);
wolfSSL 0:9d17e4342598 906 CYASSL_API int CyaSSL_CTX_use_PrivateKey_buffer(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 907 const unsigned char*, long, int);
wolfSSL 0:9d17e4342598 908 CYASSL_API int CyaSSL_CTX_use_certificate_chain_buffer(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 909 const unsigned char*, long);
wolfSSL 0:9d17e4342598 910
wolfSSL 0:9d17e4342598 911 /* SSL versions */
wolfSSL 0:9d17e4342598 912 CYASSL_API int CyaSSL_use_certificate_buffer(CYASSL*, const unsigned char*,
wolfSSL 0:9d17e4342598 913 long, int);
wolfSSL 0:9d17e4342598 914 CYASSL_API int CyaSSL_use_PrivateKey_buffer(CYASSL*, const unsigned char*,
wolfSSL 0:9d17e4342598 915 long, int);
wolfSSL 0:9d17e4342598 916 CYASSL_API int CyaSSL_use_certificate_chain_buffer(CYASSL*,
wolfSSL 0:9d17e4342598 917 const unsigned char*, long);
wolfSSL 0:9d17e4342598 918 CYASSL_API int CyaSSL_UnloadCertsKeys(CYASSL*);
wolfSSL 0:9d17e4342598 919 #endif
wolfSSL 0:9d17e4342598 920
wolfSSL 0:9d17e4342598 921 CYASSL_API int CyaSSL_CTX_set_group_messages(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 922 CYASSL_API int CyaSSL_set_group_messages(CYASSL*);
wolfSSL 0:9d17e4342598 923
wolfSSL 0:9d17e4342598 924 /* I/O callbacks */
wolfSSL 0:9d17e4342598 925 typedef int (*CallbackIORecv)(CYASSL *ssl, char *buf, int sz, void *ctx);
wolfSSL 0:9d17e4342598 926 typedef int (*CallbackIOSend)(CYASSL *ssl, char *buf, int sz, void *ctx);
wolfSSL 0:9d17e4342598 927
wolfSSL 0:9d17e4342598 928 CYASSL_API void CyaSSL_SetIORecv(CYASSL_CTX*, CallbackIORecv);
wolfSSL 0:9d17e4342598 929 CYASSL_API void CyaSSL_SetIOSend(CYASSL_CTX*, CallbackIOSend);
wolfSSL 0:9d17e4342598 930
wolfSSL 0:9d17e4342598 931 CYASSL_API void CyaSSL_SetIOReadCtx( CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 932 CYASSL_API void CyaSSL_SetIOWriteCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 933
wolfSSL 0:9d17e4342598 934 CYASSL_API void* CyaSSL_GetIOReadCtx( CYASSL* ssl);
wolfSSL 0:9d17e4342598 935 CYASSL_API void* CyaSSL_GetIOWriteCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 936
wolfSSL 0:9d17e4342598 937 CYASSL_API void CyaSSL_SetIOReadFlags( CYASSL* ssl, int flags);
wolfSSL 0:9d17e4342598 938 CYASSL_API void CyaSSL_SetIOWriteFlags(CYASSL* ssl, int flags);
wolfSSL 0:9d17e4342598 939
wolfSSL 0:9d17e4342598 940 #ifdef HAVE_NETX
wolfSSL 0:9d17e4342598 941 CYASSL_API void CyaSSL_SetIO_NetX(CYASSL* ssl, NX_TCP_SOCKET* nxsocket,
wolfSSL 0:9d17e4342598 942 ULONG waitoption);
wolfSSL 0:9d17e4342598 943 #endif
wolfSSL 0:9d17e4342598 944
wolfSSL 0:9d17e4342598 945 typedef int (*CallbackGenCookie)(CYASSL* ssl, unsigned char* buf, int sz,
wolfSSL 0:9d17e4342598 946 void* ctx);
wolfSSL 0:9d17e4342598 947 CYASSL_API void CyaSSL_CTX_SetGenCookie(CYASSL_CTX*, CallbackGenCookie);
wolfSSL 0:9d17e4342598 948 CYASSL_API void CyaSSL_SetCookieCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 949 CYASSL_API void* CyaSSL_GetCookieCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 950
wolfSSL 0:9d17e4342598 951
wolfSSL 0:9d17e4342598 952 /* I/O Callback default errors */
wolfSSL 0:9d17e4342598 953 enum IOerrors {
wolfSSL 0:9d17e4342598 954 CYASSL_CBIO_ERR_GENERAL = -1, /* general unexpected err */
wolfSSL 0:9d17e4342598 955 CYASSL_CBIO_ERR_WANT_READ = -2, /* need to call read again */
wolfSSL 0:9d17e4342598 956 CYASSL_CBIO_ERR_WANT_WRITE = -2, /* need to call write again */
wolfSSL 0:9d17e4342598 957 CYASSL_CBIO_ERR_CONN_RST = -3, /* connection reset */
wolfSSL 0:9d17e4342598 958 CYASSL_CBIO_ERR_ISR = -4, /* interrupt */
wolfSSL 0:9d17e4342598 959 CYASSL_CBIO_ERR_CONN_CLOSE = -5, /* connection closed or epipe */
wolfSSL 0:9d17e4342598 960 CYASSL_CBIO_ERR_TIMEOUT = -6 /* socket timeout */
wolfSSL 0:9d17e4342598 961 };
wolfSSL 0:9d17e4342598 962
wolfSSL 0:9d17e4342598 963
wolfSSL 0:9d17e4342598 964 /* CA cache callbacks */
wolfSSL 0:9d17e4342598 965 enum {
wolfSSL 0:9d17e4342598 966 CYASSL_SSLV3 = 0,
wolfSSL 0:9d17e4342598 967 CYASSL_TLSV1 = 1,
wolfSSL 0:9d17e4342598 968 CYASSL_TLSV1_1 = 2,
wolfSSL 0:9d17e4342598 969 CYASSL_TLSV1_2 = 3,
wolfSSL 0:9d17e4342598 970 CYASSL_USER_CA = 1, /* user added as trusted */
wolfSSL 0:9d17e4342598 971 CYASSL_CHAIN_CA = 2 /* added to cache from trusted chain */
wolfSSL 0:9d17e4342598 972 };
wolfSSL 0:9d17e4342598 973
wolfSSL 0:9d17e4342598 974 CYASSL_API int CyaSSL_GetObjectSize(void); /* object size based on build */
wolfSSL 0:9d17e4342598 975 CYASSL_API int CyaSSL_SetVersion(CYASSL* ssl, int version);
wolfSSL 0:9d17e4342598 976 CYASSL_API int CyaSSL_KeyPemToDer(const unsigned char*, int sz, unsigned char*,
wolfSSL 0:9d17e4342598 977 int, const char*);
wolfSSL 0:9d17e4342598 978 CYASSL_API int CyaSSL_CertPemToDer(const unsigned char*, int sz, unsigned char*,
wolfSSL 0:9d17e4342598 979 int, int);
wolfSSL 0:9d17e4342598 980
wolfSSL 0:9d17e4342598 981 typedef void (*CallbackCACache)(unsigned char* der, int sz, int type);
wolfSSL 0:9d17e4342598 982 typedef void (*CbMissingCRL)(const char* url);
wolfSSL 0:9d17e4342598 983 typedef int (*CbOCSPIO)(void*, const char*, int,
wolfSSL 0:9d17e4342598 984 unsigned char*, int, unsigned char**);
wolfSSL 0:9d17e4342598 985 typedef void (*CbOCSPRespFree)(void*,unsigned char*);
wolfSSL 0:9d17e4342598 986
wolfSSL 0:9d17e4342598 987 /* User Atomic Record Layer CallBacks */
wolfSSL 0:9d17e4342598 988 typedef int (*CallbackMacEncrypt)(CYASSL* ssl, unsigned char* macOut,
wolfSSL 0:9d17e4342598 989 const unsigned char* macIn, unsigned int macInSz, int macContent,
wolfSSL 0:9d17e4342598 990 int macVerify, unsigned char* encOut, const unsigned char* encIn,
wolfSSL 0:9d17e4342598 991 unsigned int encSz, void* ctx);
wolfSSL 0:9d17e4342598 992 CYASSL_API void CyaSSL_CTX_SetMacEncryptCb(CYASSL_CTX*, CallbackMacEncrypt);
wolfSSL 0:9d17e4342598 993 CYASSL_API void CyaSSL_SetMacEncryptCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 994 CYASSL_API void* CyaSSL_GetMacEncryptCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 995
wolfSSL 0:9d17e4342598 996 typedef int (*CallbackDecryptVerify)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 997 unsigned char* decOut, const unsigned char* decIn,
wolfSSL 0:9d17e4342598 998 unsigned int decSz, int content, int verify, unsigned int* padSz,
wolfSSL 0:9d17e4342598 999 void* ctx);
wolfSSL 0:9d17e4342598 1000 CYASSL_API void CyaSSL_CTX_SetDecryptVerifyCb(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 1001 CallbackDecryptVerify);
wolfSSL 0:9d17e4342598 1002 CYASSL_API void CyaSSL_SetDecryptVerifyCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1003 CYASSL_API void* CyaSSL_GetDecryptVerifyCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1004
wolfSSL 0:9d17e4342598 1005 CYASSL_API const unsigned char* CyaSSL_GetMacSecret(CYASSL*, int);
wolfSSL 0:9d17e4342598 1006 CYASSL_API const unsigned char* CyaSSL_GetClientWriteKey(CYASSL*);
wolfSSL 0:9d17e4342598 1007 CYASSL_API const unsigned char* CyaSSL_GetClientWriteIV(CYASSL*);
wolfSSL 0:9d17e4342598 1008 CYASSL_API const unsigned char* CyaSSL_GetServerWriteKey(CYASSL*);
wolfSSL 0:9d17e4342598 1009 CYASSL_API const unsigned char* CyaSSL_GetServerWriteIV(CYASSL*);
wolfSSL 0:9d17e4342598 1010 CYASSL_API int CyaSSL_GetKeySize(CYASSL*);
wolfSSL 0:9d17e4342598 1011 CYASSL_API int CyaSSL_GetIVSize(CYASSL*);
wolfSSL 0:9d17e4342598 1012 CYASSL_API int CyaSSL_GetSide(CYASSL*);
wolfSSL 0:9d17e4342598 1013 CYASSL_API int CyaSSL_IsTLSv1_1(CYASSL*);
wolfSSL 0:9d17e4342598 1014 CYASSL_API int CyaSSL_GetBulkCipher(CYASSL*);
wolfSSL 0:9d17e4342598 1015 CYASSL_API int CyaSSL_GetCipherBlockSize(CYASSL*);
wolfSSL 0:9d17e4342598 1016 CYASSL_API int CyaSSL_GetAeadMacSize(CYASSL*);
wolfSSL 0:9d17e4342598 1017 CYASSL_API int CyaSSL_GetHmacSize(CYASSL*);
wolfSSL 0:9d17e4342598 1018 CYASSL_API int CyaSSL_GetHmacType(CYASSL*);
wolfSSL 0:9d17e4342598 1019 CYASSL_API int CyaSSL_GetCipherType(CYASSL*);
wolfSSL 0:9d17e4342598 1020 CYASSL_API int CyaSSL_SetTlsHmacInner(CYASSL*, unsigned char*,
wolfSSL 0:9d17e4342598 1021 unsigned int, int, int);
wolfSSL 0:9d17e4342598 1022
wolfSSL 0:9d17e4342598 1023 /* Atomic User Needs */
wolfSSL 0:9d17e4342598 1024 enum {
wolfSSL 0:9d17e4342598 1025 CYASSL_SERVER_END = 0,
wolfSSL 0:9d17e4342598 1026 CYASSL_CLIENT_END = 1,
wolfSSL 0:9d17e4342598 1027 CYASSL_BLOCK_TYPE = 2,
wolfSSL 0:9d17e4342598 1028 CYASSL_STREAM_TYPE = 3,
wolfSSL 0:9d17e4342598 1029 CYASSL_AEAD_TYPE = 4,
wolfSSL 0:9d17e4342598 1030 CYASSL_TLS_HMAC_INNER_SZ = 13 /* SEQ_SZ + ENUM + VERSION_SZ + LEN_SZ */
wolfSSL 0:9d17e4342598 1031 };
wolfSSL 0:9d17e4342598 1032
wolfSSL 0:9d17e4342598 1033 /* for GetBulkCipher and internal use */
wolfSSL 0:9d17e4342598 1034 enum BulkCipherAlgorithm {
wolfSSL 0:9d17e4342598 1035 cyassl_cipher_null,
wolfSSL 0:9d17e4342598 1036 cyassl_rc4,
wolfSSL 0:9d17e4342598 1037 cyassl_rc2,
wolfSSL 0:9d17e4342598 1038 cyassl_des,
wolfSSL 0:9d17e4342598 1039 cyassl_triple_des, /* leading 3 (3des) not valid identifier */
wolfSSL 0:9d17e4342598 1040 cyassl_des40,
wolfSSL 0:9d17e4342598 1041 cyassl_idea,
wolfSSL 0:9d17e4342598 1042 cyassl_aes,
wolfSSL 0:9d17e4342598 1043 cyassl_aes_gcm,
wolfSSL 0:9d17e4342598 1044 cyassl_aes_ccm,
wolfSSL 0:9d17e4342598 1045 cyassl_camellia,
wolfSSL 0:9d17e4342598 1046 cyassl_hc128, /* CyaSSL extensions */
wolfSSL 0:9d17e4342598 1047 cyassl_rabbit
wolfSSL 0:9d17e4342598 1048 };
wolfSSL 0:9d17e4342598 1049
wolfSSL 0:9d17e4342598 1050
wolfSSL 0:9d17e4342598 1051 /* Public Key Callback support */
wolfSSL 0:9d17e4342598 1052 typedef int (*CallbackEccSign)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1053 const unsigned char* in, unsigned int inSz,
wolfSSL 0:9d17e4342598 1054 unsigned char* out, unsigned int* outSz,
wolfSSL 0:9d17e4342598 1055 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1056 void* ctx);
wolfSSL 0:9d17e4342598 1057 CYASSL_API void CyaSSL_CTX_SetEccSignCb(CYASSL_CTX*, CallbackEccSign);
wolfSSL 0:9d17e4342598 1058 CYASSL_API void CyaSSL_SetEccSignCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1059 CYASSL_API void* CyaSSL_GetEccSignCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1060
wolfSSL 0:9d17e4342598 1061 typedef int (*CallbackEccVerify)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1062 const unsigned char* sig, unsigned int sigSz,
wolfSSL 0:9d17e4342598 1063 const unsigned char* hash, unsigned int hashSz,
wolfSSL 0:9d17e4342598 1064 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1065 int* result, void* ctx);
wolfSSL 0:9d17e4342598 1066 CYASSL_API void CyaSSL_CTX_SetEccVerifyCb(CYASSL_CTX*, CallbackEccVerify);
wolfSSL 0:9d17e4342598 1067 CYASSL_API void CyaSSL_SetEccVerifyCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1068 CYASSL_API void* CyaSSL_GetEccVerifyCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1069
wolfSSL 0:9d17e4342598 1070 typedef int (*CallbackRsaSign)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1071 const unsigned char* in, unsigned int inSz,
wolfSSL 0:9d17e4342598 1072 unsigned char* out, unsigned int* outSz,
wolfSSL 0:9d17e4342598 1073 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1074 void* ctx);
wolfSSL 0:9d17e4342598 1075 CYASSL_API void CyaSSL_CTX_SetRsaSignCb(CYASSL_CTX*, CallbackRsaSign);
wolfSSL 0:9d17e4342598 1076 CYASSL_API void CyaSSL_SetRsaSignCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1077 CYASSL_API void* CyaSSL_GetRsaSignCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1078
wolfSSL 0:9d17e4342598 1079 typedef int (*CallbackRsaVerify)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1080 unsigned char* sig, unsigned int sigSz,
wolfSSL 0:9d17e4342598 1081 unsigned char** out,
wolfSSL 0:9d17e4342598 1082 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1083 void* ctx);
wolfSSL 0:9d17e4342598 1084 CYASSL_API void CyaSSL_CTX_SetRsaVerifyCb(CYASSL_CTX*, CallbackRsaVerify);
wolfSSL 0:9d17e4342598 1085 CYASSL_API void CyaSSL_SetRsaVerifyCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1086 CYASSL_API void* CyaSSL_GetRsaVerifyCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1087
wolfSSL 0:9d17e4342598 1088 /* RSA Public Encrypt cb */
wolfSSL 0:9d17e4342598 1089 typedef int (*CallbackRsaEnc)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1090 const unsigned char* in, unsigned int inSz,
wolfSSL 0:9d17e4342598 1091 unsigned char* out, unsigned int* outSz,
wolfSSL 0:9d17e4342598 1092 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1093 void* ctx);
wolfSSL 0:9d17e4342598 1094 CYASSL_API void CyaSSL_CTX_SetRsaEncCb(CYASSL_CTX*, CallbackRsaEnc);
wolfSSL 0:9d17e4342598 1095 CYASSL_API void CyaSSL_SetRsaEncCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1096 CYASSL_API void* CyaSSL_GetRsaEncCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1097
wolfSSL 0:9d17e4342598 1098 /* RSA Private Decrypt cb */
wolfSSL 0:9d17e4342598 1099 typedef int (*CallbackRsaDec)(CYASSL* ssl,
wolfSSL 0:9d17e4342598 1100 unsigned char* in, unsigned int inSz,
wolfSSL 0:9d17e4342598 1101 unsigned char** out,
wolfSSL 0:9d17e4342598 1102 const unsigned char* keyDer, unsigned int keySz,
wolfSSL 0:9d17e4342598 1103 void* ctx);
wolfSSL 0:9d17e4342598 1104 CYASSL_API void CyaSSL_CTX_SetRsaDecCb(CYASSL_CTX*, CallbackRsaDec);
wolfSSL 0:9d17e4342598 1105 CYASSL_API void CyaSSL_SetRsaDecCtx(CYASSL* ssl, void *ctx);
wolfSSL 0:9d17e4342598 1106 CYASSL_API void* CyaSSL_GetRsaDecCtx(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1107
wolfSSL 0:9d17e4342598 1108
wolfSSL 0:9d17e4342598 1109 #ifndef NO_CERTS
wolfSSL 0:9d17e4342598 1110 CYASSL_API void CyaSSL_CTX_SetCACb(CYASSL_CTX*, CallbackCACache);
wolfSSL 0:9d17e4342598 1111
wolfSSL 0:9d17e4342598 1112 CYASSL_API CYASSL_CERT_MANAGER* CyaSSL_CertManagerNew(void);
wolfSSL 0:9d17e4342598 1113 CYASSL_API void CyaSSL_CertManagerFree(CYASSL_CERT_MANAGER*);
wolfSSL 0:9d17e4342598 1114
wolfSSL 0:9d17e4342598 1115 CYASSL_API int CyaSSL_CertManagerLoadCA(CYASSL_CERT_MANAGER*, const char* f,
wolfSSL 0:9d17e4342598 1116 const char* d);
wolfSSL 0:9d17e4342598 1117 CYASSL_API int CyaSSL_CertManagerUnloadCAs(CYASSL_CERT_MANAGER* cm);
wolfSSL 0:9d17e4342598 1118 CYASSL_API int CyaSSL_CertManagerVerify(CYASSL_CERT_MANAGER*, const char* f,
wolfSSL 0:9d17e4342598 1119 int format);
wolfSSL 0:9d17e4342598 1120 CYASSL_API int CyaSSL_CertManagerVerifyBuffer(CYASSL_CERT_MANAGER* cm,
wolfSSL 0:9d17e4342598 1121 const unsigned char* buff, long sz, int format);
wolfSSL 0:9d17e4342598 1122 CYASSL_API int CyaSSL_CertManagerCheckCRL(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1123 unsigned char*, int sz);
wolfSSL 0:9d17e4342598 1124 CYASSL_API int CyaSSL_CertManagerEnableCRL(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1125 int options);
wolfSSL 0:9d17e4342598 1126 CYASSL_API int CyaSSL_CertManagerDisableCRL(CYASSL_CERT_MANAGER*);
wolfSSL 0:9d17e4342598 1127 CYASSL_API int CyaSSL_CertManagerLoadCRL(CYASSL_CERT_MANAGER*, const char*,
wolfSSL 0:9d17e4342598 1128 int, int);
wolfSSL 0:9d17e4342598 1129 CYASSL_API int CyaSSL_CertManagerSetCRL_Cb(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1130 CbMissingCRL);
wolfSSL 0:9d17e4342598 1131 CYASSL_API int CyaSSL_CertManagerCheckOCSP(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1132 unsigned char*, int sz);
wolfSSL 0:9d17e4342598 1133 CYASSL_API int CyaSSL_CertManagerEnableOCSP(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1134 int options);
wolfSSL 0:9d17e4342598 1135 CYASSL_API int CyaSSL_CertManagerDisableOCSP(CYASSL_CERT_MANAGER*);
wolfSSL 0:9d17e4342598 1136 CYASSL_API int CyaSSL_CertManagerSetOCSPOverrideURL(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1137 const char*);
wolfSSL 0:9d17e4342598 1138 CYASSL_API int CyaSSL_CertManagerSetOCSP_Cb(CYASSL_CERT_MANAGER*,
wolfSSL 0:9d17e4342598 1139 CbOCSPIO, CbOCSPRespFree, void*);
wolfSSL 0:9d17e4342598 1140
wolfSSL 0:9d17e4342598 1141 CYASSL_API int CyaSSL_EnableCRL(CYASSL* ssl, int options);
wolfSSL 0:9d17e4342598 1142 CYASSL_API int CyaSSL_DisableCRL(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1143 CYASSL_API int CyaSSL_LoadCRL(CYASSL*, const char*, int, int);
wolfSSL 0:9d17e4342598 1144 CYASSL_API int CyaSSL_SetCRL_Cb(CYASSL*, CbMissingCRL);
wolfSSL 0:9d17e4342598 1145 CYASSL_API int CyaSSL_EnableOCSP(CYASSL*, int options);
wolfSSL 0:9d17e4342598 1146 CYASSL_API int CyaSSL_DisableOCSP(CYASSL*);
wolfSSL 0:9d17e4342598 1147 CYASSL_API int CyaSSL_SetOCSP_OverrideURL(CYASSL*, const char*);
wolfSSL 0:9d17e4342598 1148 CYASSL_API int CyaSSL_SetOCSP_Cb(CYASSL*, CbOCSPIO, CbOCSPRespFree, void*);
wolfSSL 0:9d17e4342598 1149
wolfSSL 0:9d17e4342598 1150 CYASSL_API int CyaSSL_CTX_EnableCRL(CYASSL_CTX* ctx, int options);
wolfSSL 0:9d17e4342598 1151 CYASSL_API int CyaSSL_CTX_DisableCRL(CYASSL_CTX* ctx);
wolfSSL 0:9d17e4342598 1152 CYASSL_API int CyaSSL_CTX_LoadCRL(CYASSL_CTX*, const char*, int, int);
wolfSSL 0:9d17e4342598 1153 CYASSL_API int CyaSSL_CTX_SetCRL_Cb(CYASSL_CTX*, CbMissingCRL);
wolfSSL 0:9d17e4342598 1154 CYASSL_API int CyaSSL_CTX_EnableOCSP(CYASSL_CTX*, int options);
wolfSSL 0:9d17e4342598 1155 CYASSL_API int CyaSSL_CTX_DisableOCSP(CYASSL_CTX*);
wolfSSL 0:9d17e4342598 1156 CYASSL_API int CyaSSL_CTX_SetOCSP_OverrideURL(CYASSL_CTX*, const char*);
wolfSSL 0:9d17e4342598 1157 CYASSL_API int CyaSSL_CTX_SetOCSP_Cb(CYASSL_CTX*,
wolfSSL 0:9d17e4342598 1158 CbOCSPIO, CbOCSPRespFree, void*);
wolfSSL 0:9d17e4342598 1159 #endif /* !NO_CERTS */
wolfSSL 0:9d17e4342598 1160
wolfSSL 0:9d17e4342598 1161 /* end of handshake frees temporary arrays, if user needs for get_keys or
wolfSSL 0:9d17e4342598 1162 psk hints, call KeepArrays before handshake and then FreeArrays when done
wolfSSL 0:9d17e4342598 1163 if don't want to wait for object free */
wolfSSL 0:9d17e4342598 1164 CYASSL_API void CyaSSL_KeepArrays(CYASSL*);
wolfSSL 0:9d17e4342598 1165 CYASSL_API void CyaSSL_FreeArrays(CYASSL*);
wolfSSL 0:9d17e4342598 1166
wolfSSL 0:9d17e4342598 1167
wolfSSL 0:9d17e4342598 1168 /* cavium additions */
wolfSSL 0:9d17e4342598 1169 CYASSL_API int CyaSSL_UseCavium(CYASSL*, int devId);
wolfSSL 0:9d17e4342598 1170 CYASSL_API int CyaSSL_CTX_UseCavium(CYASSL_CTX*, int devId);
wolfSSL 0:9d17e4342598 1171
wolfSSL 0:9d17e4342598 1172 /* TLS Extensions */
wolfSSL 0:9d17e4342598 1173
wolfSSL 0:9d17e4342598 1174 /* Server Name Indication */
wolfSSL 0:9d17e4342598 1175 #ifdef HAVE_SNI
wolfSSL 0:9d17e4342598 1176 /* SNI types */
wolfSSL 0:9d17e4342598 1177 enum {
wolfSSL 0:9d17e4342598 1178 CYASSL_SNI_HOST_NAME = 0
wolfSSL 0:9d17e4342598 1179 };
wolfSSL 0:9d17e4342598 1180
wolfSSL 0:9d17e4342598 1181 CYASSL_API int CyaSSL_UseSNI(CYASSL* ssl, unsigned char type, const void* data,
wolfSSL 0:9d17e4342598 1182 unsigned short size);
wolfSSL 0:9d17e4342598 1183 CYASSL_API int CyaSSL_CTX_UseSNI(CYASSL_CTX* ctx, unsigned char type,
wolfSSL 0:9d17e4342598 1184 const void* data, unsigned short size);
wolfSSL 0:9d17e4342598 1185
wolfSSL 0:9d17e4342598 1186 #ifndef NO_CYASSL_SERVER
wolfSSL 0:9d17e4342598 1187 /* SNI options */
wolfSSL 0:9d17e4342598 1188 enum {
wolfSSL 0:9d17e4342598 1189 CYASSL_SNI_CONTINUE_ON_MISMATCH = 0x01, /* do not abort on mismatch flag */
wolfSSL 0:9d17e4342598 1190 CYASSL_SNI_ANSWER_ON_MISMATCH = 0x02 /* fake match on mismatch flag */
wolfSSL 0:9d17e4342598 1191 };
wolfSSL 0:9d17e4342598 1192
wolfSSL 0:9d17e4342598 1193 CYASSL_API void CyaSSL_SNI_SetOptions(CYASSL* ssl, unsigned char type,
wolfSSL 0:9d17e4342598 1194 unsigned char options);
wolfSSL 0:9d17e4342598 1195 CYASSL_API void CyaSSL_CTX_SNI_SetOptions(CYASSL_CTX* ctx, unsigned char type,
wolfSSL 0:9d17e4342598 1196 unsigned char options);
wolfSSL 0:9d17e4342598 1197
wolfSSL 0:9d17e4342598 1198 /* SNI status */
wolfSSL 0:9d17e4342598 1199 enum {
wolfSSL 0:9d17e4342598 1200 CYASSL_SNI_NO_MATCH = 0,
wolfSSL 0:9d17e4342598 1201 CYASSL_SNI_FAKE_MATCH = 1, /* if CYASSL_SNI_ANSWER_ON_MISMATCH is enabled */
wolfSSL 0:9d17e4342598 1202 CYASSL_SNI_REAL_MATCH = 2
wolfSSL 0:9d17e4342598 1203 };
wolfSSL 0:9d17e4342598 1204
wolfSSL 0:9d17e4342598 1205 CYASSL_API unsigned char CyaSSL_SNI_Status(CYASSL* ssl, unsigned char type);
wolfSSL 0:9d17e4342598 1206
wolfSSL 0:9d17e4342598 1207 CYASSL_API unsigned short CyaSSL_SNI_GetRequest(CYASSL *ssl, unsigned char type,
wolfSSL 0:9d17e4342598 1208 void** data);
wolfSSL 0:9d17e4342598 1209
wolfSSL 0:9d17e4342598 1210 CYASSL_API int CyaSSL_SNI_GetFromBuffer(
wolfSSL 0:9d17e4342598 1211 const unsigned char* clientHello, unsigned int helloSz,
wolfSSL 0:9d17e4342598 1212 unsigned char type, unsigned char* sni, unsigned int* inOutSz);
wolfSSL 0:9d17e4342598 1213
wolfSSL 0:9d17e4342598 1214 #endif /* NO_CYASSL_SERVER */
wolfSSL 0:9d17e4342598 1215 #endif /* HAVE_SNI */
wolfSSL 0:9d17e4342598 1216
wolfSSL 0:9d17e4342598 1217 /* Maximum Fragment Length */
wolfSSL 0:9d17e4342598 1218 #ifdef HAVE_MAX_FRAGMENT
wolfSSL 0:9d17e4342598 1219 /* Fragment lengths */
wolfSSL 0:9d17e4342598 1220 enum {
wolfSSL 0:9d17e4342598 1221 CYASSL_MFL_2_9 = 1, /* 512 bytes */
wolfSSL 0:9d17e4342598 1222 CYASSL_MFL_2_10 = 2, /* 1024 bytes */
wolfSSL 0:9d17e4342598 1223 CYASSL_MFL_2_11 = 3, /* 2048 bytes */
wolfSSL 0:9d17e4342598 1224 CYASSL_MFL_2_12 = 4, /* 4096 bytes */
wolfSSL 0:9d17e4342598 1225 CYASSL_MFL_2_13 = 5 /* 8192 bytes *//* CyaSSL ONLY!!! */
wolfSSL 0:9d17e4342598 1226 };
wolfSSL 0:9d17e4342598 1227
wolfSSL 0:9d17e4342598 1228 #ifndef NO_CYASSL_CLIENT
wolfSSL 0:9d17e4342598 1229
wolfSSL 0:9d17e4342598 1230 CYASSL_API int CyaSSL_UseMaxFragment(CYASSL* ssl, unsigned char mfl);
wolfSSL 0:9d17e4342598 1231 CYASSL_API int CyaSSL_CTX_UseMaxFragment(CYASSL_CTX* ctx, unsigned char mfl);
wolfSSL 0:9d17e4342598 1232
wolfSSL 0:9d17e4342598 1233 #endif /* NO_CYASSL_CLIENT */
wolfSSL 0:9d17e4342598 1234 #endif /* HAVE_MAX_FRAGMENT */
wolfSSL 0:9d17e4342598 1235
wolfSSL 0:9d17e4342598 1236 /* Truncated HMAC */
wolfSSL 0:9d17e4342598 1237 #ifdef HAVE_TRUNCATED_HMAC
wolfSSL 0:9d17e4342598 1238 #ifndef NO_CYASSL_CLIENT
wolfSSL 0:9d17e4342598 1239
wolfSSL 0:9d17e4342598 1240 CYASSL_API int CyaSSL_UseTruncatedHMAC(CYASSL* ssl);
wolfSSL 0:9d17e4342598 1241 CYASSL_API int CyaSSL_CTX_UseTruncatedHMAC(CYASSL_CTX* ctx);
wolfSSL 0:9d17e4342598 1242
wolfSSL 0:9d17e4342598 1243 #endif /* NO_CYASSL_CLIENT */
wolfSSL 0:9d17e4342598 1244 #endif /* HAVE_TRUNCATED_HMAC */
wolfSSL 0:9d17e4342598 1245
wolfSSL 0:9d17e4342598 1246 /* Elliptic Curves */
wolfSSL 0:9d17e4342598 1247 #ifdef HAVE_SUPPORTED_CURVES
wolfSSL 0:9d17e4342598 1248
wolfSSL 0:9d17e4342598 1249 enum {
wolfSSL 0:9d17e4342598 1250 CYASSL_ECC_SECP160R1 = 0x10,
wolfSSL 0:9d17e4342598 1251 CYASSL_ECC_SECP192R1 = 0x13,
wolfSSL 0:9d17e4342598 1252 CYASSL_ECC_SECP224R1 = 0x15,
wolfSSL 0:9d17e4342598 1253 CYASSL_ECC_SECP256R1 = 0x17,
wolfSSL 0:9d17e4342598 1254 CYASSL_ECC_SECP384R1 = 0x18,
wolfSSL 0:9d17e4342598 1255 CYASSL_ECC_SECP521R1 = 0x19
wolfSSL 0:9d17e4342598 1256 };
wolfSSL 0:9d17e4342598 1257
wolfSSL 0:9d17e4342598 1258 #ifndef NO_CYASSL_CLIENT
wolfSSL 0:9d17e4342598 1259
wolfSSL 0:9d17e4342598 1260 CYASSL_API int CyaSSL_UseSupportedCurve(CYASSL* ssl, unsigned short name);
wolfSSL 0:9d17e4342598 1261 CYASSL_API int CyaSSL_CTX_UseSupportedCurve(CYASSL_CTX* ctx,
wolfSSL 0:9d17e4342598 1262 unsigned short name);
wolfSSL 0:9d17e4342598 1263
wolfSSL 0:9d17e4342598 1264 #endif /* NO_CYASSL_CLIENT */
wolfSSL 0:9d17e4342598 1265 #endif /* HAVE_SUPPORTED_CURVES */
wolfSSL 0:9d17e4342598 1266
wolfSSL 0:9d17e4342598 1267
wolfSSL 0:9d17e4342598 1268 #define CYASSL_CRL_MONITOR 0x01 /* monitor this dir flag */
wolfSSL 0:9d17e4342598 1269 #define CYASSL_CRL_START_MON 0x02 /* start monitoring flag */
wolfSSL 0:9d17e4342598 1270
wolfSSL 0:9d17e4342598 1271 #ifdef CYASSL_CALLBACKS
wolfSSL 0:9d17e4342598 1272
wolfSSL 0:9d17e4342598 1273 /* used internally by CyaSSL while OpenSSL types aren't */
wolfSSL 0:9d17e4342598 1274 #include <cyassl/callbacks.h>
wolfSSL 0:9d17e4342598 1275
wolfSSL 0:9d17e4342598 1276 typedef int (*HandShakeCallBack)(HandShakeInfo*);
wolfSSL 0:9d17e4342598 1277 typedef int (*TimeoutCallBack)(TimeoutInfo*);
wolfSSL 0:9d17e4342598 1278
wolfSSL 0:9d17e4342598 1279 /* CyaSSL connect extension allowing HandShakeCallBack and/or TimeoutCallBack
wolfSSL 0:9d17e4342598 1280 for diagnostics */
wolfSSL 0:9d17e4342598 1281 CYASSL_API int CyaSSL_connect_ex(CYASSL*, HandShakeCallBack, TimeoutCallBack,
wolfSSL 0:9d17e4342598 1282 Timeval);
wolfSSL 0:9d17e4342598 1283 CYASSL_API int CyaSSL_accept_ex(CYASSL*, HandShakeCallBack, TimeoutCallBack,
wolfSSL 0:9d17e4342598 1284 Timeval);
wolfSSL 0:9d17e4342598 1285
wolfSSL 0:9d17e4342598 1286 #endif /* CYASSL_CALLBACKS */
wolfSSL 0:9d17e4342598 1287
wolfSSL 0:9d17e4342598 1288
wolfSSL 0:9d17e4342598 1289 #ifdef CYASSL_HAVE_WOLFSCEP
wolfSSL 0:9d17e4342598 1290 CYASSL_API void CyaSSL_wolfSCEP(void);
wolfSSL 0:9d17e4342598 1291 #endif /* CYASSL_HAVE_WOLFSCEP */
wolfSSL 0:9d17e4342598 1292
wolfSSL 0:9d17e4342598 1293 #ifdef CYASSL_HAVE_CERT_SERVICE
wolfSSL 0:9d17e4342598 1294 CYASSL_API void CyaSSL_cert_service(void);
wolfSSL 0:9d17e4342598 1295 #endif
wolfSSL 0:9d17e4342598 1296
wolfSSL 0:9d17e4342598 1297
wolfSSL 0:9d17e4342598 1298 #ifdef __cplusplus
wolfSSL 0:9d17e4342598 1299 } /* extern "C" */
wolfSSL 0:9d17e4342598 1300 #endif
wolfSSL 0:9d17e4342598 1301
wolfSSL 0:9d17e4342598 1302
wolfSSL 0:9d17e4342598 1303 #endif /* CYASSL_SSL_H */
wolfSSL 0:9d17e4342598 1304