cya_u
Fork of CyaSSL-forEncrypt by
ssl.h@2:d0516dc143b1, 2017-05-10 (annotated)
- Committer:
- vbahl2
- Date:
- Wed May 10 18:20:47 2017 +0000
- Revision:
- 2:d0516dc143b1
- Parent:
- 0:5045d2638c29
updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
toddouska | 0:5045d2638c29 | 1 | /* ssl.h |
toddouska | 0:5045d2638c29 | 2 | * |
toddouska | 0:5045d2638c29 | 3 | * Copyright (C) 2006-2009 Sawtooth Consulting Ltd. |
toddouska | 0:5045d2638c29 | 4 | * |
toddouska | 0:5045d2638c29 | 5 | * This file is part of CyaSSL. |
toddouska | 0:5045d2638c29 | 6 | * |
toddouska | 0:5045d2638c29 | 7 | * CyaSSL is free software; you can redistribute it and/or modify |
toddouska | 0:5045d2638c29 | 8 | * it under the terms of the GNU General Public License as published by |
toddouska | 0:5045d2638c29 | 9 | * the Free Software Foundation; either version 2 of the License, or |
toddouska | 0:5045d2638c29 | 10 | * (at your option) any later version. |
toddouska | 0:5045d2638c29 | 11 | * |
toddouska | 0:5045d2638c29 | 12 | * CyaSSL is distributed in the hope that it will be useful, |
toddouska | 0:5045d2638c29 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
toddouska | 0:5045d2638c29 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
toddouska | 0:5045d2638c29 | 15 | * GNU General Public License for more details. |
toddouska | 0:5045d2638c29 | 16 | * |
toddouska | 0:5045d2638c29 | 17 | * You should have received a copy of the GNU General Public License |
toddouska | 0:5045d2638c29 | 18 | * along with this program; if not, write to the Free Software |
toddouska | 0:5045d2638c29 | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
toddouska | 0:5045d2638c29 | 20 | */ |
toddouska | 0:5045d2638c29 | 21 | |
toddouska | 0:5045d2638c29 | 22 | |
toddouska | 0:5045d2638c29 | 23 | /* ssl.h defines openssl compatibility layer |
toddouska | 0:5045d2638c29 | 24 | * |
toddouska | 0:5045d2638c29 | 25 | */ |
toddouska | 0:5045d2638c29 | 26 | |
toddouska | 0:5045d2638c29 | 27 | |
toddouska | 0:5045d2638c29 | 28 | |
toddouska | 0:5045d2638c29 | 29 | #ifndef CYASSL_OPENSSL_H_ |
toddouska | 0:5045d2638c29 | 30 | #define CYASSL_OPENSSL_H_ |
toddouska | 0:5045d2638c29 | 31 | |
toddouska | 0:5045d2638c29 | 32 | #include "os_settings.h" /* for users not using preprocessor flags */ |
toddouska | 0:5045d2638c29 | 33 | |
toddouska | 0:5045d2638c29 | 34 | #ifndef NO_FILESYTEM |
toddouska | 0:5045d2638c29 | 35 | #include <stdio.h> /* ERR_print fp */ |
toddouska | 0:5045d2638c29 | 36 | #endif |
toddouska | 0:5045d2638c29 | 37 | |
toddouska | 0:5045d2638c29 | 38 | #ifdef YASSL_PREFIX |
toddouska | 0:5045d2638c29 | 39 | #include "prefix_ssl.h" |
toddouska | 0:5045d2638c29 | 40 | #endif |
toddouska | 0:5045d2638c29 | 41 | |
toddouska | 0:5045d2638c29 | 42 | #undef X509_NAME /* wincrypt.h clash */ |
toddouska | 0:5045d2638c29 | 43 | |
toddouska | 0:5045d2638c29 | 44 | #ifdef __cplusplus |
toddouska | 0:5045d2638c29 | 45 | extern "C" { |
toddouska | 0:5045d2638c29 | 46 | #endif |
toddouska | 0:5045d2638c29 | 47 | |
toddouska | 0:5045d2638c29 | 48 | |
toddouska | 0:5045d2638c29 | 49 | |
toddouska | 0:5045d2638c29 | 50 | typedef struct SSL SSL; |
toddouska | 0:5045d2638c29 | 51 | typedef struct SSL_SESSION SSL_SESSION; |
toddouska | 0:5045d2638c29 | 52 | typedef struct SSL_METHOD SSL_METHOD; |
toddouska | 0:5045d2638c29 | 53 | typedef struct SSL_CTX SSL_CTX; |
toddouska | 0:5045d2638c29 | 54 | |
toddouska | 0:5045d2638c29 | 55 | typedef struct X509 X509; |
toddouska | 0:5045d2638c29 | 56 | typedef struct X509_NAME X509_NAME; |
toddouska | 0:5045d2638c29 | 57 | typedef struct X509_CHAIN X509_CHAIN; |
toddouska | 0:5045d2638c29 | 58 | |
toddouska | 0:5045d2638c29 | 59 | |
toddouska | 0:5045d2638c29 | 60 | /* redeclare guard */ |
toddouska | 0:5045d2638c29 | 61 | #define SSL_TYPES_DEFINED |
toddouska | 0:5045d2638c29 | 62 | |
toddouska | 0:5045d2638c29 | 63 | |
toddouska | 0:5045d2638c29 | 64 | |
toddouska | 0:5045d2638c29 | 65 | |
toddouska | 0:5045d2638c29 | 66 | typedef struct EVP_PKEY EVP_PKEY; |
toddouska | 0:5045d2638c29 | 67 | typedef struct RSA RSA; |
toddouska | 0:5045d2638c29 | 68 | typedef struct BIO BIO; |
toddouska | 0:5045d2638c29 | 69 | typedef struct BIO_METHOD BIO_METHOD; |
toddouska | 0:5045d2638c29 | 70 | typedef struct SSL_CIPHER SSL_CIPHER; |
toddouska | 0:5045d2638c29 | 71 | typedef struct X509_LOOKUP X509_LOOKUP; |
toddouska | 0:5045d2638c29 | 72 | typedef struct X509_LOOKUP_METHOD X509_LOOKUP_METHOD; |
toddouska | 0:5045d2638c29 | 73 | typedef struct X509_CRL X509_CRL; |
toddouska | 0:5045d2638c29 | 74 | typedef struct X509_EXTENSION X509_EXTENSION; |
toddouska | 0:5045d2638c29 | 75 | typedef struct ASN1_TIME ASN1_TIME; |
toddouska | 0:5045d2638c29 | 76 | typedef struct ASN1_INTEGER ASN1_INTEGER; |
toddouska | 0:5045d2638c29 | 77 | typedef struct ASN1_OBJECT ASN1_OBJECT; |
toddouska | 0:5045d2638c29 | 78 | typedef struct ASN1_STRING ASN1_STRING; |
toddouska | 0:5045d2638c29 | 79 | typedef struct CRYPTO_dynlock_value CRYPTO_dynlock_value; |
toddouska | 0:5045d2638c29 | 80 | |
toddouska | 0:5045d2638c29 | 81 | #define ASN1_UTCTIME ASN1_TIME |
toddouska | 0:5045d2638c29 | 82 | |
toddouska | 0:5045d2638c29 | 83 | typedef struct MD4_CTX { |
toddouska | 0:5045d2638c29 | 84 | int buffer[32]; /* big enough to hold, check size in Init */ |
toddouska | 0:5045d2638c29 | 85 | } MD4_CTX; |
toddouska | 0:5045d2638c29 | 86 | |
toddouska | 0:5045d2638c29 | 87 | |
toddouska | 0:5045d2638c29 | 88 | typedef struct COMP_METHOD { |
toddouska | 0:5045d2638c29 | 89 | int type; /* stunnel dereference */ |
toddouska | 0:5045d2638c29 | 90 | } COMP_METHOD; |
toddouska | 0:5045d2638c29 | 91 | |
toddouska | 0:5045d2638c29 | 92 | |
toddouska | 0:5045d2638c29 | 93 | typedef struct X509_STORE { |
toddouska | 0:5045d2638c29 | 94 | int cache; /* stunnel dereference */ |
toddouska | 0:5045d2638c29 | 95 | } X509_STORE; |
toddouska | 0:5045d2638c29 | 96 | |
toddouska | 0:5045d2638c29 | 97 | |
toddouska | 0:5045d2638c29 | 98 | typedef struct X509_REVOKED { |
toddouska | 0:5045d2638c29 | 99 | ASN1_INTEGER* serialNumber; /* stunnel dereference */ |
toddouska | 0:5045d2638c29 | 100 | } X509_REVOKED; |
toddouska | 0:5045d2638c29 | 101 | |
toddouska | 0:5045d2638c29 | 102 | |
toddouska | 0:5045d2638c29 | 103 | typedef struct X509_OBJECT { |
toddouska | 0:5045d2638c29 | 104 | union { |
toddouska | 0:5045d2638c29 | 105 | char* ptr; |
toddouska | 0:5045d2638c29 | 106 | X509_CRL* crl; /* stunnel dereference */ |
toddouska | 0:5045d2638c29 | 107 | } data; |
toddouska | 0:5045d2638c29 | 108 | } X509_OBJECT; |
toddouska | 0:5045d2638c29 | 109 | |
toddouska | 0:5045d2638c29 | 110 | |
toddouska | 0:5045d2638c29 | 111 | /* in cyassl_int.h too, change there !! */ |
toddouska | 0:5045d2638c29 | 112 | typedef struct X509_STORE_CTX { |
toddouska | 0:5045d2638c29 | 113 | int error; |
toddouska | 0:5045d2638c29 | 114 | int error_depth; |
toddouska | 0:5045d2638c29 | 115 | X509* current_cert; /* stunnel dereference */ |
toddouska | 0:5045d2638c29 | 116 | char* domain; /* subject CN domain name */ |
toddouska | 0:5045d2638c29 | 117 | /* in cyassl_int.h too, change there !! */ |
toddouska | 0:5045d2638c29 | 118 | } X509_STORE_CTX; |
toddouska | 0:5045d2638c29 | 119 | |
toddouska | 0:5045d2638c29 | 120 | |
toddouska | 0:5045d2638c29 | 121 | SSL_METHOD *SSLv3_server_method(void); |
toddouska | 0:5045d2638c29 | 122 | SSL_METHOD *SSLv3_client_method(void); |
toddouska | 0:5045d2638c29 | 123 | SSL_METHOD *TLSv1_server_method(void); |
toddouska | 0:5045d2638c29 | 124 | SSL_METHOD *TLSv1_client_method(void); |
toddouska | 0:5045d2638c29 | 125 | SSL_METHOD *TLSv1_1_server_method(void); |
toddouska | 0:5045d2638c29 | 126 | SSL_METHOD *TLSv1_1_client_method(void); |
toddouska | 0:5045d2638c29 | 127 | SSL_METHOD *TLSv1_2_server_method(void); |
toddouska | 0:5045d2638c29 | 128 | SSL_METHOD *TLSv1_2_client_method(void); |
toddouska | 0:5045d2638c29 | 129 | |
toddouska | 0:5045d2638c29 | 130 | #ifdef CYASSL_DTLS |
toddouska | 0:5045d2638c29 | 131 | SSL_METHOD *DTLSv1_client_method(void); |
toddouska | 0:5045d2638c29 | 132 | SSL_METHOD *DTLSv1_server_method(void); |
toddouska | 0:5045d2638c29 | 133 | #endif |
toddouska | 0:5045d2638c29 | 134 | |
toddouska | 0:5045d2638c29 | 135 | #ifndef NO_FILESYSTEM |
toddouska | 0:5045d2638c29 | 136 | |
toddouska | 0:5045d2638c29 | 137 | int SSL_CTX_use_certificate_file(SSL_CTX*, const char*, int); |
toddouska | 0:5045d2638c29 | 138 | int SSL_CTX_use_PrivateKey_file(SSL_CTX*, const char*, int); |
toddouska | 0:5045d2638c29 | 139 | int SSL_CTX_load_verify_locations(SSL_CTX*, const char*, const char*); |
toddouska | 0:5045d2638c29 | 140 | int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); |
toddouska | 0:5045d2638c29 | 141 | int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX*, const char*, int); |
toddouska | 0:5045d2638c29 | 142 | |
toddouska | 0:5045d2638c29 | 143 | #ifdef CYASSL_DER_LOAD |
toddouska | 0:5045d2638c29 | 144 | int CyaSSL_CTX_load_verify_locations(SSL_CTX*, const char*, int); |
toddouska | 0:5045d2638c29 | 145 | #endif |
toddouska | 0:5045d2638c29 | 146 | |
toddouska | 0:5045d2638c29 | 147 | #ifdef HAVE_NTRU |
toddouska | 0:5045d2638c29 | 148 | int CyaSSL_CTX_use_NTRUPrivateKey_file(SSL_CTX*, const char*); /* load NTRU |
toddouska | 0:5045d2638c29 | 149 | private key blob */ |
toddouska | 0:5045d2638c29 | 150 | #endif |
toddouska | 0:5045d2638c29 | 151 | |
toddouska | 0:5045d2638c29 | 152 | int CyaSSL_PemCertToDer(const char*, unsigned char*, int); |
toddouska | 0:5045d2638c29 | 153 | |
toddouska | 0:5045d2638c29 | 154 | #endif /* NO_FILESYSTEM */ |
toddouska | 0:5045d2638c29 | 155 | |
toddouska | 0:5045d2638c29 | 156 | SSL_CTX* SSL_CTX_new(SSL_METHOD*); |
toddouska | 0:5045d2638c29 | 157 | SSL* SSL_new(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 158 | int SSL_set_fd (SSL*, int); |
toddouska | 0:5045d2638c29 | 159 | int SSL_get_fd(const SSL*); |
toddouska | 0:5045d2638c29 | 160 | int SSL_connect(SSL*); /* please see note at top of README |
toddouska | 0:5045d2638c29 | 161 | if you get an error from connect */ |
toddouska | 0:5045d2638c29 | 162 | int SSL_write(SSL*, const void*, int); |
toddouska | 0:5045d2638c29 | 163 | int SSL_read(SSL*, void*, int); |
toddouska | 0:5045d2638c29 | 164 | int SSL_accept(SSL*); |
toddouska | 0:5045d2638c29 | 165 | void SSL_CTX_free(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 166 | void SSL_free(SSL*); |
toddouska | 0:5045d2638c29 | 167 | int SSL_shutdown(SSL*); |
toddouska | 0:5045d2638c29 | 168 | |
toddouska | 0:5045d2638c29 | 169 | void SSL_CTX_set_quiet_shutdown(SSL_CTX*, int); |
toddouska | 0:5045d2638c29 | 170 | |
toddouska | 0:5045d2638c29 | 171 | int SSL_get_error(SSL*, int); |
toddouska | 0:5045d2638c29 | 172 | |
toddouska | 0:5045d2638c29 | 173 | int SSL_set_session(SSL *ssl, SSL_SESSION *session); |
toddouska | 0:5045d2638c29 | 174 | SSL_SESSION* SSL_get_session(SSL* ssl); |
toddouska | 0:5045d2638c29 | 175 | void SSL_flush_sessions(SSL_CTX *ctx, long tm); |
toddouska | 0:5045d2638c29 | 176 | |
toddouska | 0:5045d2638c29 | 177 | |
toddouska | 0:5045d2638c29 | 178 | typedef int (*VerifyCallback)(int, X509_STORE_CTX*); |
toddouska | 0:5045d2638c29 | 179 | typedef int (*pem_password_cb)(char*, int, int, void*); |
toddouska | 0:5045d2638c29 | 180 | |
toddouska | 0:5045d2638c29 | 181 | void SSL_CTX_set_verify(SSL_CTX*, int, VerifyCallback verify_callback); |
toddouska | 0:5045d2638c29 | 182 | |
toddouska | 0:5045d2638c29 | 183 | |
toddouska | 0:5045d2638c29 | 184 | int SSL_pending(SSL*); |
toddouska | 0:5045d2638c29 | 185 | |
toddouska | 0:5045d2638c29 | 186 | |
toddouska | 0:5045d2638c29 | 187 | void SSL_load_error_strings(void); |
toddouska | 0:5045d2638c29 | 188 | int SSL_library_init(void); |
toddouska | 0:5045d2638c29 | 189 | long SSL_CTX_set_session_cache_mode(SSL_CTX*, long); |
toddouska | 0:5045d2638c29 | 190 | |
toddouska | 0:5045d2638c29 | 191 | /* only supports full name from cipher_name[] delimited by : */ |
toddouska | 0:5045d2638c29 | 192 | int SSL_CTX_set_cipher_list(SSL_CTX*, const char*); |
toddouska | 0:5045d2638c29 | 193 | |
toddouska | 0:5045d2638c29 | 194 | char* ERR_error_string(unsigned long,char*); |
toddouska | 0:5045d2638c29 | 195 | void ERR_error_string_n(unsigned long e, char *buf, size_t len); |
toddouska | 0:5045d2638c29 | 196 | |
toddouska | 0:5045d2638c29 | 197 | |
toddouska | 0:5045d2638c29 | 198 | /* extras */ |
toddouska | 0:5045d2638c29 | 199 | |
toddouska | 0:5045d2638c29 | 200 | #define STACK_OF(x) x |
toddouska | 0:5045d2638c29 | 201 | |
toddouska | 0:5045d2638c29 | 202 | int SSL_set_ex_data(SSL*, int, void*); |
toddouska | 0:5045d2638c29 | 203 | int SSL_get_shutdown(const SSL*); |
toddouska | 0:5045d2638c29 | 204 | int SSL_set_rfd(SSL*, int); |
toddouska | 0:5045d2638c29 | 205 | int SSL_set_wfd(SSL*, int); |
toddouska | 0:5045d2638c29 | 206 | void SSL_set_shutdown(SSL*, int); |
toddouska | 0:5045d2638c29 | 207 | int SSL_set_session_id_context(SSL*, const unsigned char*, unsigned int); |
toddouska | 0:5045d2638c29 | 208 | void SSL_set_connect_state(SSL*); |
toddouska | 0:5045d2638c29 | 209 | void SSL_set_accept_state(SSL*); |
toddouska | 0:5045d2638c29 | 210 | int SSL_session_reused(SSL*); |
toddouska | 0:5045d2638c29 | 211 | void SSL_SESSION_free(SSL_SESSION* session); |
toddouska | 0:5045d2638c29 | 212 | |
toddouska | 0:5045d2638c29 | 213 | const char* SSL_get_version(SSL*); |
toddouska | 0:5045d2638c29 | 214 | SSL_CIPHER* SSL_get_current_cipher(SSL*); |
toddouska | 0:5045d2638c29 | 215 | char* SSL_CIPHER_description(SSL_CIPHER*, char*, int); |
toddouska | 0:5045d2638c29 | 216 | const char* SSL_CIPHER_get_name(const SSL_CIPHER* cipher); |
toddouska | 0:5045d2638c29 | 217 | SSL_SESSION* SSL_get1_session(SSL* ssl); /* what's ref count */ |
toddouska | 0:5045d2638c29 | 218 | |
toddouska | 0:5045d2638c29 | 219 | void X509_free(X509*); |
toddouska | 0:5045d2638c29 | 220 | void OPENSSL_free(void*); |
toddouska | 0:5045d2638c29 | 221 | |
toddouska | 0:5045d2638c29 | 222 | int OCSP_parse_url(char* url, char** host, char** port, char** path, int* ssl); |
toddouska | 0:5045d2638c29 | 223 | |
toddouska | 0:5045d2638c29 | 224 | SSL_METHOD* SSLv23_client_method(void); |
toddouska | 0:5045d2638c29 | 225 | SSL_METHOD* SSLv2_client_method(void); |
toddouska | 0:5045d2638c29 | 226 | SSL_METHOD* SSLv2_server_method(void); |
toddouska | 0:5045d2638c29 | 227 | |
toddouska | 0:5045d2638c29 | 228 | void MD4_Init(MD4_CTX*); |
toddouska | 0:5045d2638c29 | 229 | void MD4_Update(MD4_CTX*, const void*, size_t); |
toddouska | 0:5045d2638c29 | 230 | void MD4_Final(unsigned char*, MD4_CTX*); |
toddouska | 0:5045d2638c29 | 231 | |
toddouska | 0:5045d2638c29 | 232 | BIO* BIO_new(BIO_METHOD*); |
toddouska | 0:5045d2638c29 | 233 | int BIO_free(BIO*); |
toddouska | 0:5045d2638c29 | 234 | int BIO_free_all(BIO*); |
toddouska | 0:5045d2638c29 | 235 | int BIO_read(BIO*, void*, int); |
toddouska | 0:5045d2638c29 | 236 | int BIO_write(BIO*, const void*, int); |
toddouska | 0:5045d2638c29 | 237 | BIO* BIO_push(BIO*, BIO* append); |
toddouska | 0:5045d2638c29 | 238 | BIO* BIO_pop(BIO*); |
toddouska | 0:5045d2638c29 | 239 | int BIO_flush(BIO*); |
toddouska | 0:5045d2638c29 | 240 | int BIO_pending(BIO*); |
toddouska | 0:5045d2638c29 | 241 | |
toddouska | 0:5045d2638c29 | 242 | BIO_METHOD* BIO_f_buffer(void); |
toddouska | 0:5045d2638c29 | 243 | long BIO_set_write_buffer_size(BIO*, long size); |
toddouska | 0:5045d2638c29 | 244 | BIO_METHOD* BIO_f_ssl(void); |
toddouska | 0:5045d2638c29 | 245 | BIO* BIO_new_socket(int sfd, int flag); |
toddouska | 0:5045d2638c29 | 246 | void SSL_set_bio(SSL*, BIO* rd, BIO* wr); |
toddouska | 0:5045d2638c29 | 247 | int BIO_eof(BIO*); |
toddouska | 0:5045d2638c29 | 248 | long BIO_set_ssl(BIO*, SSL*, int flag); |
toddouska | 0:5045d2638c29 | 249 | |
toddouska | 0:5045d2638c29 | 250 | BIO_METHOD* BIO_s_mem(void); |
toddouska | 0:5045d2638c29 | 251 | BIO_METHOD* BIO_f_base64(void); |
toddouska | 0:5045d2638c29 | 252 | void BIO_set_flags(BIO*, int); |
toddouska | 0:5045d2638c29 | 253 | |
toddouska | 0:5045d2638c29 | 254 | void OpenSSL_add_all_algorithms(void); |
toddouska | 0:5045d2638c29 | 255 | int SSLeay_add_ssl_algorithms(void); |
toddouska | 0:5045d2638c29 | 256 | int SSLeay_add_all_algorithms(void); |
toddouska | 0:5045d2638c29 | 257 | |
toddouska | 0:5045d2638c29 | 258 | void RAND_screen(void); |
toddouska | 0:5045d2638c29 | 259 | const char* RAND_file_name(char*, size_t); |
toddouska | 0:5045d2638c29 | 260 | int RAND_write_file(const char*); |
toddouska | 0:5045d2638c29 | 261 | int RAND_load_file(const char*, long); |
toddouska | 0:5045d2638c29 | 262 | int RAND_egd(const char*); |
toddouska | 0:5045d2638c29 | 263 | |
toddouska | 0:5045d2638c29 | 264 | COMP_METHOD* COMP_zlib(void); |
toddouska | 0:5045d2638c29 | 265 | COMP_METHOD* COMP_rle(void); |
toddouska | 0:5045d2638c29 | 266 | int SSL_COMP_add_compression_method(int, void*); |
toddouska | 0:5045d2638c29 | 267 | |
toddouska | 0:5045d2638c29 | 268 | int SSL_get_ex_new_index(long, void*, void*, void*, void*); |
toddouska | 0:5045d2638c29 | 269 | |
toddouska | 0:5045d2638c29 | 270 | void CRYPTO_set_id_callback(unsigned long (*f)(void)); |
toddouska | 0:5045d2638c29 | 271 | void CRYPTO_set_locking_callback(void (*f)(int, int, const char*, int)); |
toddouska | 0:5045d2638c29 | 272 | void CRYPTO_set_dynlock_create_callback(CRYPTO_dynlock_value* (*f)(const char*, |
toddouska | 0:5045d2638c29 | 273 | int)); |
toddouska | 0:5045d2638c29 | 274 | void CRYPTO_set_dynlock_lock_callback(void (*f)(int, CRYPTO_dynlock_value*, |
toddouska | 0:5045d2638c29 | 275 | const char*, int)); |
toddouska | 0:5045d2638c29 | 276 | void CRYPTO_set_dynlock_destroy_callback(void (*f)(CRYPTO_dynlock_value*, |
toddouska | 0:5045d2638c29 | 277 | const char*, int)); |
toddouska | 0:5045d2638c29 | 278 | |
toddouska | 0:5045d2638c29 | 279 | X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*); |
toddouska | 0:5045d2638c29 | 280 | int X509_STORE_CTX_get_error(X509_STORE_CTX*); |
toddouska | 0:5045d2638c29 | 281 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*); |
toddouska | 0:5045d2638c29 | 282 | |
toddouska | 0:5045d2638c29 | 283 | char* X509_NAME_oneline(X509_NAME*, char*, int); |
toddouska | 0:5045d2638c29 | 284 | X509_NAME* X509_get_issuer_name(X509*); |
toddouska | 0:5045d2638c29 | 285 | X509_NAME* X509_get_subject_name(X509*); |
toddouska | 0:5045d2638c29 | 286 | const char* X509_verify_cert_error_string(long); |
toddouska | 0:5045d2638c29 | 287 | |
toddouska | 0:5045d2638c29 | 288 | int X509_LOOKUP_add_dir(X509_LOOKUP*, const char*, long); |
toddouska | 0:5045d2638c29 | 289 | int X509_LOOKUP_load_file(X509_LOOKUP*, const char*, long); |
toddouska | 0:5045d2638c29 | 290 | X509_LOOKUP_METHOD* X509_LOOKUP_hash_dir(void); |
toddouska | 0:5045d2638c29 | 291 | X509_LOOKUP_METHOD* X509_LOOKUP_file(void); |
toddouska | 0:5045d2638c29 | 292 | |
toddouska | 0:5045d2638c29 | 293 | X509_LOOKUP* X509_STORE_add_lookup(X509_STORE*, X509_LOOKUP_METHOD*); |
toddouska | 0:5045d2638c29 | 294 | X509_STORE* X509_STORE_new(void); |
toddouska | 0:5045d2638c29 | 295 | int X509_STORE_get_by_subject(X509_STORE_CTX*, int, X509_NAME*, |
toddouska | 0:5045d2638c29 | 296 | X509_OBJECT*); |
toddouska | 0:5045d2638c29 | 297 | int X509_STORE_CTX_init(X509_STORE_CTX*, X509_STORE*, X509*, STACK_OF(X509)*); |
toddouska | 0:5045d2638c29 | 298 | void X509_STORE_CTX_cleanup(X509_STORE_CTX*); |
toddouska | 0:5045d2638c29 | 299 | |
toddouska | 0:5045d2638c29 | 300 | ASN1_TIME* X509_CRL_get_lastUpdate(X509_CRL*); |
toddouska | 0:5045d2638c29 | 301 | ASN1_TIME* X509_CRL_get_nextUpdate(X509_CRL*); |
toddouska | 0:5045d2638c29 | 302 | |
toddouska | 0:5045d2638c29 | 303 | EVP_PKEY* X509_get_pubkey(X509*); |
toddouska | 0:5045d2638c29 | 304 | int X509_CRL_verify(X509_CRL*, EVP_PKEY*); |
toddouska | 0:5045d2638c29 | 305 | void X509_STORE_CTX_set_error(X509_STORE_CTX*, int); |
toddouska | 0:5045d2638c29 | 306 | void X509_OBJECT_free_contents(X509_OBJECT*); |
toddouska | 0:5045d2638c29 | 307 | void EVP_PKEY_free(EVP_PKEY*); |
toddouska | 0:5045d2638c29 | 308 | int X509_cmp_current_time(const ASN1_TIME*); |
toddouska | 0:5045d2638c29 | 309 | int sk_X509_REVOKED_num(X509_REVOKED*); |
toddouska | 0:5045d2638c29 | 310 | |
toddouska | 0:5045d2638c29 | 311 | X509_REVOKED* X509_CRL_get_REVOKED(X509_CRL*); |
toddouska | 0:5045d2638c29 | 312 | X509_REVOKED* sk_X509_REVOKED_value(X509_REVOKED*, int); |
toddouska | 0:5045d2638c29 | 313 | |
toddouska | 0:5045d2638c29 | 314 | ASN1_INTEGER* X509_get_serialNumber(X509*); |
toddouska | 0:5045d2638c29 | 315 | |
toddouska | 0:5045d2638c29 | 316 | int ASN1_TIME_print(BIO*, const ASN1_TIME*); |
toddouska | 0:5045d2638c29 | 317 | |
toddouska | 0:5045d2638c29 | 318 | int ASN1_INTEGER_cmp(const ASN1_INTEGER*, const ASN1_INTEGER*); |
toddouska | 0:5045d2638c29 | 319 | long ASN1_INTEGER_get(const ASN1_INTEGER*); |
toddouska | 0:5045d2638c29 | 320 | |
toddouska | 0:5045d2638c29 | 321 | STACK_OF(X509_NAME)* SSL_load_client_CA_file(const char*); |
toddouska | 0:5045d2638c29 | 322 | |
toddouska | 0:5045d2638c29 | 323 | void SSL_CTX_set_client_CA_list(SSL_CTX*, STACK_OF(X509_NAME)*); |
toddouska | 0:5045d2638c29 | 324 | void* X509_STORE_CTX_get_ex_data(X509_STORE_CTX*, int); |
toddouska | 0:5045d2638c29 | 325 | int SSL_get_ex_data_X509_STORE_CTX_idx(void); |
toddouska | 0:5045d2638c29 | 326 | void* SSL_get_ex_data(const SSL*, int); |
toddouska | 0:5045d2638c29 | 327 | |
toddouska | 0:5045d2638c29 | 328 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX*, void* userdata); |
toddouska | 0:5045d2638c29 | 329 | void SSL_CTX_set_default_passwd_cb(SSL_CTX*, pem_password_cb); |
toddouska | 0:5045d2638c29 | 330 | |
toddouska | 0:5045d2638c29 | 331 | |
toddouska | 0:5045d2638c29 | 332 | long SSL_CTX_set_timeout(SSL_CTX*, long); |
toddouska | 0:5045d2638c29 | 333 | void SSL_CTX_set_info_callback(SSL_CTX*, void (*)()); |
toddouska | 0:5045d2638c29 | 334 | |
toddouska | 0:5045d2638c29 | 335 | unsigned long ERR_peek_error(void); |
toddouska | 0:5045d2638c29 | 336 | int ERR_GET_REASON(int); |
toddouska | 0:5045d2638c29 | 337 | |
toddouska | 0:5045d2638c29 | 338 | char* SSL_alert_type_string_long(int); |
toddouska | 0:5045d2638c29 | 339 | char* SSL_alert_desc_string_long(int); |
toddouska | 0:5045d2638c29 | 340 | char* SSL_state_string_long(SSL*); |
toddouska | 0:5045d2638c29 | 341 | |
toddouska | 0:5045d2638c29 | 342 | void RSA_free(RSA*); |
toddouska | 0:5045d2638c29 | 343 | RSA* RSA_generate_key(int, unsigned long, void(*)(int, int, void*), void*); |
toddouska | 0:5045d2638c29 | 344 | void SSL_CTX_set_tmp_rsa_callback(SSL_CTX*, RSA*(*)(SSL*, int, int)); |
toddouska | 0:5045d2638c29 | 345 | |
toddouska | 0:5045d2638c29 | 346 | int PEM_def_callback(char*, int num, int w, void* key); |
toddouska | 0:5045d2638c29 | 347 | |
toddouska | 0:5045d2638c29 | 348 | long SSL_CTX_sess_accept(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 349 | long SSL_CTX_sess_connect(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 350 | long SSL_CTX_sess_accept_good(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 351 | long SSL_CTX_sess_connect_good(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 352 | long SSL_CTX_sess_accept_renegotiate(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 353 | long SSL_CTX_sess_connect_renegotiate(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 354 | long SSL_CTX_sess_hits(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 355 | long SSL_CTX_sess_cb_hits(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 356 | long SSL_CTX_sess_cache_full(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 357 | long SSL_CTX_sess_misses(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 358 | long SSL_CTX_sess_timeouts(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 359 | long SSL_CTX_sess_number(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 360 | long SSL_CTX_sess_get_cache_size(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 361 | |
toddouska | 0:5045d2638c29 | 362 | |
toddouska | 0:5045d2638c29 | 363 | #define SSL_DEFAULT_CIPHER_LIST "" /* default all */ |
toddouska | 0:5045d2638c29 | 364 | #define RSA_F4 0x10001L |
toddouska | 0:5045d2638c29 | 365 | |
toddouska | 0:5045d2638c29 | 366 | enum { |
toddouska | 0:5045d2638c29 | 367 | OCSP_NOCERTS = 1, |
toddouska | 0:5045d2638c29 | 368 | OCSP_NOINTERN = 2, |
toddouska | 0:5045d2638c29 | 369 | OCSP_NOSIGS = 4, |
toddouska | 0:5045d2638c29 | 370 | OCSP_NOCHAIN = 8, |
toddouska | 0:5045d2638c29 | 371 | OCSP_NOVERIFY = 16, |
toddouska | 0:5045d2638c29 | 372 | OCSP_NOEXPLICIT = 32, |
toddouska | 0:5045d2638c29 | 373 | OCSP_NOCASIGN = 64, |
toddouska | 0:5045d2638c29 | 374 | OCSP_NODELEGATED = 128, |
toddouska | 0:5045d2638c29 | 375 | OCSP_NOCHECKS = 256, |
toddouska | 0:5045d2638c29 | 376 | OCSP_TRUSTOTHER = 512, |
toddouska | 0:5045d2638c29 | 377 | OCSP_RESPID_KEY = 1024, |
toddouska | 0:5045d2638c29 | 378 | OCSP_NOTIME = 2048, |
toddouska | 0:5045d2638c29 | 379 | |
toddouska | 0:5045d2638c29 | 380 | OCSP_CERTID = 2, |
toddouska | 0:5045d2638c29 | 381 | OCSP_REQUEST = 4, |
toddouska | 0:5045d2638c29 | 382 | OCSP_RESPONSE = 8, |
toddouska | 0:5045d2638c29 | 383 | OCSP_BASICRESP = 16, |
toddouska | 0:5045d2638c29 | 384 | |
toddouska | 0:5045d2638c29 | 385 | ASN1_GENERALIZEDTIME = 4, |
toddouska | 0:5045d2638c29 | 386 | |
toddouska | 0:5045d2638c29 | 387 | SSL_OP_MICROSOFT_SESS_ID_BUG = 1, |
toddouska | 0:5045d2638c29 | 388 | SSL_OP_NETSCAPE_CHALLENGE_BUG = 2, |
toddouska | 0:5045d2638c29 | 389 | SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 3, |
toddouska | 0:5045d2638c29 | 390 | SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 4, |
toddouska | 0:5045d2638c29 | 391 | SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 5, |
toddouska | 0:5045d2638c29 | 392 | SSL_OP_MSIE_SSLV2_RSA_PADDING = 6, |
toddouska | 0:5045d2638c29 | 393 | SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 7, |
toddouska | 0:5045d2638c29 | 394 | SSL_OP_TLS_D5_BUG = 8, |
toddouska | 0:5045d2638c29 | 395 | SSL_OP_TLS_BLOCK_PADDING_BUG = 9, |
toddouska | 0:5045d2638c29 | 396 | SSL_OP_TLS_ROLLBACK_BUG = 10, |
toddouska | 0:5045d2638c29 | 397 | SSL_OP_ALL = 11, |
toddouska | 0:5045d2638c29 | 398 | SSL_OP_EPHEMERAL_RSA = 12, |
toddouska | 0:5045d2638c29 | 399 | SSL_OP_NO_SSLv3 = 13, |
toddouska | 0:5045d2638c29 | 400 | SSL_OP_NO_TLSv1 = 14, |
toddouska | 0:5045d2638c29 | 401 | SSL_OP_PKCS1_CHECK_1 = 15, |
toddouska | 0:5045d2638c29 | 402 | SSL_OP_PKCS1_CHECK_2 = 16, |
toddouska | 0:5045d2638c29 | 403 | SSL_OP_NETSCAPE_CA_DN_BUG = 17, |
toddouska | 0:5045d2638c29 | 404 | SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 18, |
toddouska | 0:5045d2638c29 | 405 | SSL_OP_SINGLE_DH_USE = 19, |
toddouska | 0:5045d2638c29 | 406 | SSL_OP_NO_TICKET = 20, |
toddouska | 0:5045d2638c29 | 407 | SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 21, |
toddouska | 0:5045d2638c29 | 408 | SSL_OP_NO_QUERY_MTU = 22, |
toddouska | 0:5045d2638c29 | 409 | SSL_OP_COOKIE_EXCHANGE = 23, |
toddouska | 0:5045d2638c29 | 410 | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 24, |
toddouska | 0:5045d2638c29 | 411 | SSL_OP_SINGLE_ECDH_USE = 25, |
toddouska | 0:5045d2638c29 | 412 | SSL_OP_CIPHER_SERVER_PREFERENCE = 26, |
toddouska | 0:5045d2638c29 | 413 | |
toddouska | 0:5045d2638c29 | 414 | SSL_MAX_SSL_SESSION_ID_LENGTH = 32, |
toddouska | 0:5045d2638c29 | 415 | |
toddouska | 0:5045d2638c29 | 416 | EVP_R_BAD_DECRYPT = 2, |
toddouska | 0:5045d2638c29 | 417 | |
toddouska | 0:5045d2638c29 | 418 | SSL_CB_LOOP = 4, |
toddouska | 0:5045d2638c29 | 419 | SSL_ST_CONNECT = 5, |
toddouska | 0:5045d2638c29 | 420 | SSL_ST_ACCEPT = 6, |
toddouska | 0:5045d2638c29 | 421 | SSL_CB_ALERT = 7, |
toddouska | 0:5045d2638c29 | 422 | SSL_CB_READ = 8, |
toddouska | 0:5045d2638c29 | 423 | SSL_CB_HANDSHAKE_DONE = 9, |
toddouska | 0:5045d2638c29 | 424 | |
toddouska | 0:5045d2638c29 | 425 | SSL_MODE_ENABLE_PARTIAL_WRITE = 2, |
toddouska | 0:5045d2638c29 | 426 | |
toddouska | 0:5045d2638c29 | 427 | BIO_FLAGS_BASE64_NO_NL = 1, |
toddouska | 0:5045d2638c29 | 428 | BIO_CLOSE = 1, |
toddouska | 0:5045d2638c29 | 429 | BIO_NOCLOSE = 0, |
toddouska | 0:5045d2638c29 | 430 | |
toddouska | 0:5045d2638c29 | 431 | NID_undef = 0, |
toddouska | 0:5045d2638c29 | 432 | |
toddouska | 0:5045d2638c29 | 433 | X509_FILETYPE_PEM = 8, |
toddouska | 0:5045d2638c29 | 434 | X509_LU_X509 = 9, |
toddouska | 0:5045d2638c29 | 435 | X509_LU_CRL = 12, |
toddouska | 0:5045d2638c29 | 436 | |
toddouska | 0:5045d2638c29 | 437 | X509_V_ERR_CRL_SIGNATURE_FAILURE = 13, |
toddouska | 0:5045d2638c29 | 438 | X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 14, |
toddouska | 0:5045d2638c29 | 439 | X509_V_ERR_CRL_HAS_EXPIRED = 15, |
toddouska | 0:5045d2638c29 | 440 | X509_V_ERR_CERT_REVOKED = 16, |
toddouska | 0:5045d2638c29 | 441 | X509_V_ERR_CERT_CHAIN_TOO_LONG = 17, |
toddouska | 0:5045d2638c29 | 442 | X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = 18, |
toddouska | 0:5045d2638c29 | 443 | X509_V_ERR_CERT_NOT_YET_VALID = 19, |
toddouska | 0:5045d2638c29 | 444 | X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 20, |
toddouska | 0:5045d2638c29 | 445 | X509_V_ERR_CERT_HAS_EXPIRED = 21, |
toddouska | 0:5045d2638c29 | 446 | X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 22, |
toddouska | 0:5045d2638c29 | 447 | |
toddouska | 0:5045d2638c29 | 448 | X509_V_OK = 0, |
toddouska | 0:5045d2638c29 | 449 | |
toddouska | 0:5045d2638c29 | 450 | CRYPTO_LOCK = 1, |
toddouska | 0:5045d2638c29 | 451 | CRYPTO_NUM_LOCKS = 10, |
toddouska | 0:5045d2638c29 | 452 | |
toddouska | 0:5045d2638c29 | 453 | }; |
toddouska | 0:5045d2638c29 | 454 | |
toddouska | 0:5045d2638c29 | 455 | /* extras end */ |
toddouska | 0:5045d2638c29 | 456 | |
toddouska | 0:5045d2638c29 | 457 | #ifndef NO_FILESYSTEM |
toddouska | 0:5045d2638c29 | 458 | /* CyaSSL extension, provide last error from SSL_get_error |
toddouska | 0:5045d2638c29 | 459 | since not using thread storage error queue */ |
toddouska | 0:5045d2638c29 | 460 | void ERR_print_errors_fp(FILE*, int err); |
toddouska | 0:5045d2638c29 | 461 | #endif |
toddouska | 0:5045d2638c29 | 462 | |
toddouska | 0:5045d2638c29 | 463 | enum { /* ssl Constants */ |
toddouska | 0:5045d2638c29 | 464 | SSL_ERROR_NONE = 0, /* for most functions */ |
toddouska | 0:5045d2638c29 | 465 | SSL_FAILURE = 0, /* for some functions */ |
toddouska | 0:5045d2638c29 | 466 | SSL_SUCCESS = 1, |
toddouska | 0:5045d2638c29 | 467 | |
toddouska | 0:5045d2638c29 | 468 | SSL_BAD_CERTTYPE = -8, |
toddouska | 0:5045d2638c29 | 469 | SSL_BAD_STAT = -7, |
toddouska | 0:5045d2638c29 | 470 | SSL_BAD_PATH = -6, |
toddouska | 0:5045d2638c29 | 471 | SSL_BAD_FILETYPE = -5, |
toddouska | 0:5045d2638c29 | 472 | SSL_BAD_FILE = -4, |
toddouska | 0:5045d2638c29 | 473 | SSL_NOT_IMPLEMENTED = -3, |
toddouska | 0:5045d2638c29 | 474 | SSL_UNKNOWN = -2, |
toddouska | 0:5045d2638c29 | 475 | SSL_FATAL_ERROR = -1, |
toddouska | 0:5045d2638c29 | 476 | |
toddouska | 0:5045d2638c29 | 477 | SSL_FILETYPE_ASN1 = 2, |
toddouska | 0:5045d2638c29 | 478 | SSL_FILETYPE_PEM = 1, |
toddouska | 0:5045d2638c29 | 479 | SSL_FILETYPE_DEFAULT = 2, /* ASN1 */ |
toddouska | 0:5045d2638c29 | 480 | SSL_FILETYPE_RAW = 3, /* NTRU raw key blob */ |
toddouska | 0:5045d2638c29 | 481 | |
toddouska | 0:5045d2638c29 | 482 | SSL_VERIFY_NONE = 0, |
toddouska | 0:5045d2638c29 | 483 | SSL_VERIFY_PEER = 1, |
toddouska | 0:5045d2638c29 | 484 | SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2, |
toddouska | 0:5045d2638c29 | 485 | SSL_VERIFY_CLIENT_ONCE = 4, |
toddouska | 0:5045d2638c29 | 486 | |
toddouska | 0:5045d2638c29 | 487 | SSL_SESS_CACHE_OFF = 30, |
toddouska | 0:5045d2638c29 | 488 | SSL_SESS_CACHE_CLIENT = 31, |
toddouska | 0:5045d2638c29 | 489 | SSL_SESS_CACHE_SERVER = 32, |
toddouska | 0:5045d2638c29 | 490 | SSL_SESS_CACHE_BOTH = 33, |
toddouska | 0:5045d2638c29 | 491 | SSL_SESS_CACHE_NO_AUTO_CLEAR = 34, |
toddouska | 0:5045d2638c29 | 492 | SSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 35, |
toddouska | 0:5045d2638c29 | 493 | |
toddouska | 0:5045d2638c29 | 494 | SSL_ERROR_WANT_READ = 2, |
toddouska | 0:5045d2638c29 | 495 | SSL_ERROR_WANT_WRITE = 3, |
toddouska | 0:5045d2638c29 | 496 | SSL_ERROR_WANT_CONNECT = 7, |
toddouska | 0:5045d2638c29 | 497 | SSL_ERROR_WANT_ACCEPT = 8, |
toddouska | 0:5045d2638c29 | 498 | SSL_ERROR_SYSCALL = 5, |
toddouska | 0:5045d2638c29 | 499 | SSL_ERROR_WANT_X509_LOOKUP = 83, |
toddouska | 0:5045d2638c29 | 500 | SSL_ERROR_ZERO_RETURN = 6, |
toddouska | 0:5045d2638c29 | 501 | SSL_ERROR_SSL = 85, |
toddouska | 0:5045d2638c29 | 502 | |
toddouska | 0:5045d2638c29 | 503 | SSL_SENT_SHUTDOWN = 1, |
toddouska | 0:5045d2638c29 | 504 | SSL_RECEIVED_SHUTDOWN = 2, |
toddouska | 0:5045d2638c29 | 505 | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = 4, |
toddouska | 0:5045d2638c29 | 506 | SSL_OP_NO_SSLv2 = 8, |
toddouska | 0:5045d2638c29 | 507 | |
toddouska | 0:5045d2638c29 | 508 | SSL_R_SSL_HANDSHAKE_FAILURE = 101, |
toddouska | 0:5045d2638c29 | 509 | SSL_R_TLSV1_ALERT_UNKNOWN_CA = 102, |
toddouska | 0:5045d2638c29 | 510 | SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103, |
toddouska | 0:5045d2638c29 | 511 | SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104, |
toddouska | 0:5045d2638c29 | 512 | |
toddouska | 0:5045d2638c29 | 513 | PEM_BUFSIZE = 1024, |
toddouska | 0:5045d2638c29 | 514 | }; |
toddouska | 0:5045d2638c29 | 515 | |
toddouska | 0:5045d2638c29 | 516 | |
toddouska | 0:5045d2638c29 | 517 | #ifndef NO_PSK |
toddouska | 0:5045d2638c29 | 518 | typedef unsigned int (*psk_client_callback)(SSL*, const char*, char*, |
toddouska | 0:5045d2638c29 | 519 | unsigned int, unsigned char*, unsigned int); |
toddouska | 0:5045d2638c29 | 520 | void SSL_CTX_set_psk_client_callback(SSL_CTX*, psk_client_callback); |
toddouska | 0:5045d2638c29 | 521 | void SSL_set_psk_client_callback(SSL*, psk_client_callback); |
toddouska | 0:5045d2638c29 | 522 | |
toddouska | 0:5045d2638c29 | 523 | const char* SSL_get_psk_identity_hint(const SSL*); |
toddouska | 0:5045d2638c29 | 524 | const char* SSL_get_psk_identity(const SSL*); |
toddouska | 0:5045d2638c29 | 525 | |
toddouska | 0:5045d2638c29 | 526 | int SSL_CTX_use_psk_identity_hint(SSL_CTX*, const char*); |
toddouska | 0:5045d2638c29 | 527 | int SSL_use_psk_identity_hint(SSL*, const char*); |
toddouska | 0:5045d2638c29 | 528 | |
toddouska | 0:5045d2638c29 | 529 | typedef unsigned int (*psk_server_callback)(SSL*, const char*, |
toddouska | 0:5045d2638c29 | 530 | unsigned char*, unsigned int); |
toddouska | 0:5045d2638c29 | 531 | void SSL_CTX_set_psk_server_callback(SSL_CTX*, psk_server_callback); |
toddouska | 0:5045d2638c29 | 532 | void SSL_set_psk_server_callback(SSL*, psk_server_callback); |
toddouska | 0:5045d2638c29 | 533 | |
toddouska | 0:5045d2638c29 | 534 | #define PSK_TYPES_DEFINED |
toddouska | 0:5045d2638c29 | 535 | #endif /* NO_PSK */ |
toddouska | 0:5045d2638c29 | 536 | |
toddouska | 0:5045d2638c29 | 537 | |
toddouska | 0:5045d2638c29 | 538 | /* extra begins */ |
toddouska | 0:5045d2638c29 | 539 | |
toddouska | 0:5045d2638c29 | 540 | enum { /* ERR Constants */ |
toddouska | 0:5045d2638c29 | 541 | ERR_TXT_STRING = 1, |
toddouska | 0:5045d2638c29 | 542 | }; |
toddouska | 0:5045d2638c29 | 543 | |
toddouska | 0:5045d2638c29 | 544 | unsigned long ERR_get_error_line_data(const char**, int*, const char**, int *); |
toddouska | 0:5045d2638c29 | 545 | |
toddouska | 0:5045d2638c29 | 546 | unsigned long ERR_get_error(void); |
toddouska | 0:5045d2638c29 | 547 | void ERR_clear_error(void); |
toddouska | 0:5045d2638c29 | 548 | |
toddouska | 0:5045d2638c29 | 549 | |
toddouska | 0:5045d2638c29 | 550 | int RAND_status(void); |
toddouska | 0:5045d2638c29 | 551 | int RAND_bytes(unsigned char* buf, int num); |
toddouska | 0:5045d2638c29 | 552 | SSL_METHOD *SSLv23_server_method(void); |
toddouska | 0:5045d2638c29 | 553 | long SSL_CTX_set_options(SSL_CTX*, long); |
toddouska | 0:5045d2638c29 | 554 | int SSL_CTX_check_private_key(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 555 | |
toddouska | 0:5045d2638c29 | 556 | |
toddouska | 0:5045d2638c29 | 557 | void ERR_free_strings(void); |
toddouska | 0:5045d2638c29 | 558 | void ERR_remove_state(unsigned long); |
toddouska | 0:5045d2638c29 | 559 | void EVP_cleanup(void); |
toddouska | 0:5045d2638c29 | 560 | |
toddouska | 0:5045d2638c29 | 561 | void CRYPTO_cleanup_all_ex_data(void); |
toddouska | 0:5045d2638c29 | 562 | long SSL_CTX_set_mode(SSL_CTX* ctx, long mode); |
toddouska | 0:5045d2638c29 | 563 | long SSL_CTX_get_mode(SSL_CTX* ctx); |
toddouska | 0:5045d2638c29 | 564 | void SSL_CTX_set_default_read_ahead(SSL_CTX* ctx, int m); |
toddouska | 0:5045d2638c29 | 565 | |
toddouska | 0:5045d2638c29 | 566 | long SSL_CTX_sess_set_cache_size(SSL_CTX*, long); |
toddouska | 0:5045d2638c29 | 567 | |
toddouska | 0:5045d2638c29 | 568 | int SSL_CTX_set_default_verify_paths(SSL_CTX*); |
toddouska | 0:5045d2638c29 | 569 | int SSL_CTX_set_session_id_context(SSL_CTX*, const unsigned char*, |
toddouska | 0:5045d2638c29 | 570 | unsigned int); |
toddouska | 0:5045d2638c29 | 571 | |
toddouska | 0:5045d2638c29 | 572 | X509* SSL_get_peer_certificate(SSL* ssl); |
toddouska | 0:5045d2638c29 | 573 | |
toddouska | 0:5045d2638c29 | 574 | int SSL_want_read(SSL*); |
toddouska | 0:5045d2638c29 | 575 | int SSL_want_write(SSL*); |
toddouska | 0:5045d2638c29 | 576 | |
toddouska | 0:5045d2638c29 | 577 | int BIO_printf(BIO*, const char*, ...); |
toddouska | 0:5045d2638c29 | 578 | int ASN1_UTCTIME_print(BIO*, const ASN1_UTCTIME*); |
toddouska | 0:5045d2638c29 | 579 | |
toddouska | 0:5045d2638c29 | 580 | int sk_num(X509_REVOKED*); |
toddouska | 0:5045d2638c29 | 581 | void* sk_value(X509_REVOKED*, int); |
toddouska | 0:5045d2638c29 | 582 | |
toddouska | 0:5045d2638c29 | 583 | /* stunnel 4.28 needs */ |
toddouska | 0:5045d2638c29 | 584 | void* SSL_CTX_get_ex_data(const SSL_CTX*, int); |
toddouska | 0:5045d2638c29 | 585 | int SSL_CTX_set_ex_data(SSL_CTX*, int, void*); |
toddouska | 0:5045d2638c29 | 586 | void SSL_CTX_sess_set_get_cb(SSL_CTX*, SSL_SESSION*(*f)(SSL*, unsigned char*, |
toddouska | 0:5045d2638c29 | 587 | int, int*)); |
toddouska | 0:5045d2638c29 | 588 | void SSL_CTX_sess_set_new_cb(SSL_CTX*, int (*f)(SSL*, SSL_SESSION*)); |
toddouska | 0:5045d2638c29 | 589 | void SSL_CTX_sess_set_remove_cb(SSL_CTX*, void (*f)(SSL_CTX*, SSL_SESSION*)); |
toddouska | 0:5045d2638c29 | 590 | |
toddouska | 0:5045d2638c29 | 591 | int i2d_SSL_SESSION(SSL_SESSION*, unsigned char**); |
toddouska | 0:5045d2638c29 | 592 | SSL_SESSION* d2i_SSL_SESSION(SSL_SESSION**,const unsigned char**, long); |
toddouska | 0:5045d2638c29 | 593 | |
toddouska | 0:5045d2638c29 | 594 | long SSL_SESSION_get_timeout(const SSL_SESSION*); |
toddouska | 0:5045d2638c29 | 595 | long SSL_SESSION_get_time(const SSL_SESSION*); |
toddouska | 0:5045d2638c29 | 596 | int SSL_CTX_get_ex_new_index(long, void*, void*, void*, void*); |
toddouska | 0:5045d2638c29 | 597 | |
toddouska | 0:5045d2638c29 | 598 | /* extra ends */ |
toddouska | 0:5045d2638c29 | 599 | |
toddouska | 0:5045d2638c29 | 600 | |
toddouska | 0:5045d2638c29 | 601 | /* CyaSSL extensions */ |
toddouska | 0:5045d2638c29 | 602 | |
toddouska | 0:5045d2638c29 | 603 | /* call before SSL_connect, if verifying will add name check to |
toddouska | 0:5045d2638c29 | 604 | date check and signature check */ |
toddouska | 0:5045d2638c29 | 605 | int CyaSSL_check_domain_name(SSL* ssl, const char* dn); |
toddouska | 0:5045d2638c29 | 606 | |
toddouska | 0:5045d2638c29 | 607 | int InitCyaSSL(void); /* need to call once to load library (session cache) */ |
toddouska | 0:5045d2638c29 | 608 | int FreeCyaSSL(void); /* call when done to free session cache mutex */ |
toddouska | 0:5045d2638c29 | 609 | |
toddouska | 0:5045d2638c29 | 610 | int CyaSSL_Debugging_ON(void); /* turn logging on, only if compiled in */ |
toddouska | 0:5045d2638c29 | 611 | void CyaSSL_Debugging_OFF(void); /* turn logging off */ |
toddouska | 0:5045d2638c29 | 612 | |
toddouska | 0:5045d2638c29 | 613 | int CyaSSL_set_compression(SSL* ssl); /* turn on CyaSSL data compression */ |
toddouska | 0:5045d2638c29 | 614 | |
toddouska | 0:5045d2638c29 | 615 | int CyaSSL_CTX_use_NTRUPrivateKey_file(SSL_CTX*, const char*); /* load NTRU |
toddouska | 0:5045d2638c29 | 616 | private key blob */ |
toddouska | 0:5045d2638c29 | 617 | X509_CHAIN* CyaSSL_get_peer_chain(SSL* ssl); /* get CyaSSL peer X509_CHAIN */ |
toddouska | 0:5045d2638c29 | 618 | int CyaSSL_get_chain_count(X509_CHAIN* chain); /* peer chain count */ |
toddouska | 0:5045d2638c29 | 619 | int CyaSSL_get_chain_length(X509_CHAIN*, int idx); /* index cert length */ |
toddouska | 0:5045d2638c29 | 620 | unsigned char* CyaSSL_get_chain_cert(X509_CHAIN*, int idx); /* index cert */ |
toddouska | 0:5045d2638c29 | 621 | int CyaSSL_get_chain_cert_pem(X509_CHAIN*, int idx, unsigned char* buffer, |
toddouska | 0:5045d2638c29 | 622 | int inLen, int* outLen); /* get index cert in PEM */ |
toddouska | 0:5045d2638c29 | 623 | const unsigned char* CyaSSL_get_sessionID(const SSL_SESSION* session); |
toddouska | 0:5045d2638c29 | 624 | |
toddouska | 0:5045d2638c29 | 625 | #ifndef _WIN32 |
toddouska | 0:5045d2638c29 | 626 | #ifndef NO_WRITEV |
toddouska | 0:5045d2638c29 | 627 | #include <sys/uio.h> |
toddouska | 0:5045d2638c29 | 628 | /* allow writev style writing */ |
toddouska | 0:5045d2638c29 | 629 | int CyaSSL_writev(SSL* ssl, const struct iovec* iov, int iovcnt); |
toddouska | 0:5045d2638c29 | 630 | #endif |
toddouska | 0:5045d2638c29 | 631 | #endif |
toddouska | 0:5045d2638c29 | 632 | |
toddouska | 0:5045d2638c29 | 633 | #if defined(NO_FILESYSTEM) || defined(MICRIUM) |
toddouska | 0:5045d2638c29 | 634 | |
toddouska | 0:5045d2638c29 | 635 | int CyaSSL_CTX_load_verify_buffer(SSL_CTX*, const unsigned char*, long, int); |
toddouska | 0:5045d2638c29 | 636 | int CyaSSL_CTX_use_certificate_buffer(SSL_CTX*, const unsigned char*, long,int); |
toddouska | 0:5045d2638c29 | 637 | int CyaSSL_CTX_use_PrivateKey_buffer(SSL_CTX*, const unsigned char*, long, int); |
toddouska | 0:5045d2638c29 | 638 | int CyaSSL_CTX_use_certificate_chain_buffer(SSL_CTX*,const unsigned char*,long); |
toddouska | 0:5045d2638c29 | 639 | |
toddouska | 0:5045d2638c29 | 640 | #endif /* NO_FILESYSTEM || MICRIUM */ |
toddouska | 0:5045d2638c29 | 641 | |
toddouska | 0:5045d2638c29 | 642 | |
toddouska | 0:5045d2638c29 | 643 | /* I/O callbacks */ |
toddouska | 0:5045d2638c29 | 644 | typedef int (*CallbackIORecv)(char *buf, int sz, void *ctx); |
toddouska | 0:5045d2638c29 | 645 | typedef int (*CallbackIOSend)(char *buf, int sz, void *ctx); |
toddouska | 0:5045d2638c29 | 646 | |
toddouska | 0:5045d2638c29 | 647 | void CyaSSL_SetIORecv(SSL_CTX*, CallbackIORecv); |
toddouska | 0:5045d2638c29 | 648 | void CyaSSL_SetIOSend(SSL_CTX*, CallbackIOSend); |
toddouska | 0:5045d2638c29 | 649 | |
toddouska | 0:5045d2638c29 | 650 | void CyaSSL_SetIOReadCtx(SSL* ssl, void *ctx); |
toddouska | 0:5045d2638c29 | 651 | void CyaSSL_SetIOWriteCtx(SSL* ssl, void *ctx); |
toddouska | 0:5045d2638c29 | 652 | |
toddouska | 0:5045d2638c29 | 653 | |
toddouska | 0:5045d2638c29 | 654 | #ifdef CYASSL_CALLBACKS |
toddouska | 0:5045d2638c29 | 655 | |
toddouska | 0:5045d2638c29 | 656 | /* used internally by CyaSSL while OpenSSL types aren't */ |
toddouska | 0:5045d2638c29 | 657 | #include "cyassl_callbacks.h" |
toddouska | 0:5045d2638c29 | 658 | |
toddouska | 0:5045d2638c29 | 659 | typedef int (*HandShakeCallBack)(HandShakeInfo*); |
toddouska | 0:5045d2638c29 | 660 | typedef int (*TimeoutCallBack)(TimeoutInfo*); |
toddouska | 0:5045d2638c29 | 661 | |
toddouska | 0:5045d2638c29 | 662 | /* CyaSSL connect extension allowing HandShakeCallBack and/or TimeoutCallBack |
toddouska | 0:5045d2638c29 | 663 | for diagnostics */ |
toddouska | 0:5045d2638c29 | 664 | int CyaSSL_connect_ex(SSL*, HandShakeCallBack, TimeoutCallBack, Timeval); |
toddouska | 0:5045d2638c29 | 665 | int CyaSSL_accept_ex(SSL*, HandShakeCallBack, TimeoutCallBack, Timeval); |
toddouska | 0:5045d2638c29 | 666 | |
toddouska | 0:5045d2638c29 | 667 | #endif /* CYASSL_CALLBACKS */ |
toddouska | 0:5045d2638c29 | 668 | |
toddouska | 0:5045d2638c29 | 669 | |
toddouska | 0:5045d2638c29 | 670 | #ifdef __cplusplus |
toddouska | 0:5045d2638c29 | 671 | } /* extern "C" */ |
toddouska | 0:5045d2638c29 | 672 | #endif |
toddouska | 0:5045d2638c29 | 673 | |
toddouska | 0:5045d2638c29 | 674 | |
toddouska | 0:5045d2638c29 | 675 | #endif /* CyaSSL_openssl_h__ */ |