Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:54:50 2016 +0000
Revision:
1:d96dbedaebdb
Parent:
0:6c56fb4bc5f0
Removed extra directories for other platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 /*
nexpaq 0:6c56fb4bc5f0 2 * Copyright (c) 2007, Cameron Rich
nexpaq 0:6c56fb4bc5f0 3 *
nexpaq 0:6c56fb4bc5f0 4 * All rights reserved.
nexpaq 0:6c56fb4bc5f0 5 *
nexpaq 0:6c56fb4bc5f0 6 * Redistribution and use in source and binary forms, with or without
nexpaq 0:6c56fb4bc5f0 7 * modification, are permitted provided that the following conditions are met:
nexpaq 0:6c56fb4bc5f0 8 *
nexpaq 0:6c56fb4bc5f0 9 * * Redistributions of source code must retain the above copyright notice,
nexpaq 0:6c56fb4bc5f0 10 * this list of conditions and the following disclaimer.
nexpaq 0:6c56fb4bc5f0 11 * * Redistributions in binary form must reproduce the above copyright notice,
nexpaq 0:6c56fb4bc5f0 12 * this list of conditions and the following disclaimer in the documentation
nexpaq 0:6c56fb4bc5f0 13 * and/or other materials provided with the distribution.
nexpaq 0:6c56fb4bc5f0 14 * * Neither the name of the axTLS project nor the names of its contributors
nexpaq 0:6c56fb4bc5f0 15 * may be used to endorse or promote products derived from this software
nexpaq 0:6c56fb4bc5f0 16 * without specific prior written permission.
nexpaq 0:6c56fb4bc5f0 17 *
nexpaq 0:6c56fb4bc5f0 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
nexpaq 0:6c56fb4bc5f0 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
nexpaq 0:6c56fb4bc5f0 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
nexpaq 0:6c56fb4bc5f0 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
nexpaq 0:6c56fb4bc5f0 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
nexpaq 0:6c56fb4bc5f0 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
nexpaq 0:6c56fb4bc5f0 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
nexpaq 0:6c56fb4bc5f0 25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
nexpaq 0:6c56fb4bc5f0 26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
nexpaq 0:6c56fb4bc5f0 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
nexpaq 0:6c56fb4bc5f0 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nexpaq 0:6c56fb4bc5f0 29 */
nexpaq 0:6c56fb4bc5f0 30
nexpaq 0:6c56fb4bc5f0 31 /*
nexpaq 0:6c56fb4bc5f0 32 * Enable a subset of openssl compatible functions. We don't aim to be 100%
nexpaq 0:6c56fb4bc5f0 33 * compatible - just to be able to do basic ports etc.
nexpaq 0:6c56fb4bc5f0 34 *
nexpaq 0:6c56fb4bc5f0 35 * Only really tested on mini_httpd, so I'm not too sure how extensive this
nexpaq 0:6c56fb4bc5f0 36 * port is.
nexpaq 0:6c56fb4bc5f0 37 */
nexpaq 0:6c56fb4bc5f0 38
nexpaq 0:6c56fb4bc5f0 39 #include "config.h"
nexpaq 0:6c56fb4bc5f0 40
nexpaq 0:6c56fb4bc5f0 41 #ifdef CONFIG_OPENSSL_COMPATIBLE
nexpaq 0:6c56fb4bc5f0 42 #include <stdlib.h>
nexpaq 0:6c56fb4bc5f0 43 #include <string.h>
nexpaq 0:6c56fb4bc5f0 44 #include <stdarg.h>
nexpaq 0:6c56fb4bc5f0 45 #include "os_port.h"
nexpaq 0:6c56fb4bc5f0 46 #include "ssl.h"
nexpaq 0:6c56fb4bc5f0 47
nexpaq 0:6c56fb4bc5f0 48 #define OPENSSL_CTX_ATTR ((OPENSSL_CTX *)ssl_ctx->bonus_attr)
nexpaq 0:6c56fb4bc5f0 49
nexpaq 0:6c56fb4bc5f0 50 static char *key_password = NULL;
nexpaq 0:6c56fb4bc5f0 51
nexpaq 0:6c56fb4bc5f0 52 void *SSLv23_server_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 53 void *SSLv3_server_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 54 void *TLSv1_server_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 55 void *SSLv23_client_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 56 void *SSLv3_client_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 57 void *TLSv1_client_method(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 58
nexpaq 0:6c56fb4bc5f0 59 typedef void * (*ssl_func_type_t)(void);
nexpaq 0:6c56fb4bc5f0 60 typedef void * (*bio_func_type_t)(void);
nexpaq 0:6c56fb4bc5f0 61
nexpaq 0:6c56fb4bc5f0 62 typedef struct
nexpaq 0:6c56fb4bc5f0 63 {
nexpaq 0:6c56fb4bc5f0 64 ssl_func_type_t ssl_func_type;
nexpaq 0:6c56fb4bc5f0 65 } OPENSSL_CTX;
nexpaq 0:6c56fb4bc5f0 66
nexpaq 0:6c56fb4bc5f0 67 SSL_CTX * SSL_CTX_new(ssl_func_type_t meth)
nexpaq 0:6c56fb4bc5f0 68 {
nexpaq 0:6c56fb4bc5f0 69 SSL_CTX *ssl_ctx = ssl_ctx_new(0, 5);
nexpaq 0:6c56fb4bc5f0 70 ssl_ctx->bonus_attr = malloc(sizeof(OPENSSL_CTX));
nexpaq 0:6c56fb4bc5f0 71 OPENSSL_CTX_ATTR->ssl_func_type = meth;
nexpaq 0:6c56fb4bc5f0 72 return ssl_ctx;
nexpaq 0:6c56fb4bc5f0 73 }
nexpaq 0:6c56fb4bc5f0 74
nexpaq 0:6c56fb4bc5f0 75 void SSL_CTX_free(SSL_CTX * ssl_ctx)
nexpaq 0:6c56fb4bc5f0 76 {
nexpaq 0:6c56fb4bc5f0 77 free(ssl_ctx->bonus_attr);
nexpaq 0:6c56fb4bc5f0 78 ssl_ctx_free(ssl_ctx);
nexpaq 0:6c56fb4bc5f0 79 }
nexpaq 0:6c56fb4bc5f0 80
nexpaq 0:6c56fb4bc5f0 81 SSL * SSL_new(SSL_CTX *ssl_ctx)
nexpaq 0:6c56fb4bc5f0 82 {
nexpaq 0:6c56fb4bc5f0 83 SSL *ssl;
nexpaq 0:6c56fb4bc5f0 84 ssl_func_type_t ssl_func_type;
nexpaq 0:6c56fb4bc5f0 85
nexpaq 0:6c56fb4bc5f0 86 ssl = ssl_new(ssl_ctx, -1); /* fd is set later */
nexpaq 0:6c56fb4bc5f0 87 ssl_func_type = OPENSSL_CTX_ATTR->ssl_func_type;
nexpaq 0:6c56fb4bc5f0 88
nexpaq 0:6c56fb4bc5f0 89 #ifdef CONFIG_SSL_ENABLE_CLIENT
nexpaq 0:6c56fb4bc5f0 90 if (ssl_func_type == SSLv23_client_method ||
nexpaq 0:6c56fb4bc5f0 91 ssl_func_type == SSLv3_client_method ||
nexpaq 0:6c56fb4bc5f0 92 ssl_func_type == TLSv1_client_method)
nexpaq 0:6c56fb4bc5f0 93 {
nexpaq 0:6c56fb4bc5f0 94 SET_SSL_FLAG(SSL_IS_CLIENT);
nexpaq 0:6c56fb4bc5f0 95 }
nexpaq 0:6c56fb4bc5f0 96 else
nexpaq 0:6c56fb4bc5f0 97 #endif
nexpaq 0:6c56fb4bc5f0 98 {
nexpaq 0:6c56fb4bc5f0 99 ssl->next_state = HS_CLIENT_HELLO;
nexpaq 0:6c56fb4bc5f0 100 }
nexpaq 0:6c56fb4bc5f0 101
nexpaq 0:6c56fb4bc5f0 102 return ssl;
nexpaq 0:6c56fb4bc5f0 103 }
nexpaq 0:6c56fb4bc5f0 104
nexpaq 0:6c56fb4bc5f0 105 int SSL_set_fd(SSL *s, int fd)
nexpaq 0:6c56fb4bc5f0 106 {
nexpaq 0:6c56fb4bc5f0 107 s->client_fd = fd;
nexpaq 0:6c56fb4bc5f0 108 return 1; /* always succeeds */
nexpaq 0:6c56fb4bc5f0 109 }
nexpaq 0:6c56fb4bc5f0 110
nexpaq 0:6c56fb4bc5f0 111 int SSL_accept(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 112 {
nexpaq 0:6c56fb4bc5f0 113 while (ssl_read(ssl, NULL) == SSL_OK)
nexpaq 0:6c56fb4bc5f0 114 {
nexpaq 0:6c56fb4bc5f0 115 if (ssl->next_state == HS_CLIENT_HELLO)
nexpaq 0:6c56fb4bc5f0 116 return 1; /* we're done */
nexpaq 0:6c56fb4bc5f0 117 }
nexpaq 0:6c56fb4bc5f0 118
nexpaq 0:6c56fb4bc5f0 119 return -1;
nexpaq 0:6c56fb4bc5f0 120 }
nexpaq 0:6c56fb4bc5f0 121
nexpaq 0:6c56fb4bc5f0 122 #ifdef CONFIG_SSL_ENABLE_CLIENT
nexpaq 0:6c56fb4bc5f0 123 int SSL_connect(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 124 {
nexpaq 0:6c56fb4bc5f0 125 return do_client_connect(ssl) == SSL_OK ? 1 : -1;
nexpaq 0:6c56fb4bc5f0 126 }
nexpaq 0:6c56fb4bc5f0 127 #endif
nexpaq 0:6c56fb4bc5f0 128
nexpaq 0:6c56fb4bc5f0 129 void SSL_free(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 130 {
nexpaq 0:6c56fb4bc5f0 131 ssl_free(ssl);
nexpaq 0:6c56fb4bc5f0 132 }
nexpaq 0:6c56fb4bc5f0 133
nexpaq 0:6c56fb4bc5f0 134 int SSL_read(SSL *ssl, void *buf, int num)
nexpaq 0:6c56fb4bc5f0 135 {
nexpaq 0:6c56fb4bc5f0 136 uint8_t *read_buf;
nexpaq 0:6c56fb4bc5f0 137 int ret;
nexpaq 0:6c56fb4bc5f0 138
nexpaq 0:6c56fb4bc5f0 139 while ((ret = ssl_read(ssl, &read_buf)) == SSL_OK);
nexpaq 0:6c56fb4bc5f0 140
nexpaq 0:6c56fb4bc5f0 141 if (ret > SSL_OK)
nexpaq 0:6c56fb4bc5f0 142 {
nexpaq 0:6c56fb4bc5f0 143 memcpy(buf, read_buf, ret > num ? num : ret);
nexpaq 0:6c56fb4bc5f0 144 }
nexpaq 0:6c56fb4bc5f0 145
nexpaq 0:6c56fb4bc5f0 146 return ret;
nexpaq 0:6c56fb4bc5f0 147 }
nexpaq 0:6c56fb4bc5f0 148
nexpaq 0:6c56fb4bc5f0 149 int SSL_write(SSL *ssl, const void *buf, int num)
nexpaq 0:6c56fb4bc5f0 150 {
nexpaq 0:6c56fb4bc5f0 151 return ssl_write(ssl, buf, num);
nexpaq 0:6c56fb4bc5f0 152 }
nexpaq 0:6c56fb4bc5f0 153
nexpaq 0:6c56fb4bc5f0 154 int SSL_CTX_use_certificate_file(SSL_CTX *ssl_ctx, const char *file, int type)
nexpaq 0:6c56fb4bc5f0 155 {
nexpaq 0:6c56fb4bc5f0 156 return (ssl_obj_load(ssl_ctx, SSL_OBJ_X509_CERT, file, NULL) == SSL_OK);
nexpaq 0:6c56fb4bc5f0 157 }
nexpaq 0:6c56fb4bc5f0 158
nexpaq 0:6c56fb4bc5f0 159 int SSL_CTX_use_PrivateKey_file(SSL_CTX *ssl_ctx, const char *file, int type)
nexpaq 0:6c56fb4bc5f0 160 {
nexpaq 0:6c56fb4bc5f0 161 return (ssl_obj_load(ssl_ctx, SSL_OBJ_RSA_KEY, file, key_password) == SSL_OK);
nexpaq 0:6c56fb4bc5f0 162 }
nexpaq 0:6c56fb4bc5f0 163
nexpaq 0:6c56fb4bc5f0 164 int SSL_CTX_use_certificate_ASN1(SSL_CTX *ssl_ctx, int len, const uint8_t *d)
nexpaq 0:6c56fb4bc5f0 165 {
nexpaq 0:6c56fb4bc5f0 166 return (ssl_obj_memory_load(ssl_ctx,
nexpaq 0:6c56fb4bc5f0 167 SSL_OBJ_X509_CERT, d, len, NULL) == SSL_OK);
nexpaq 0:6c56fb4bc5f0 168 }
nexpaq 0:6c56fb4bc5f0 169
nexpaq 0:6c56fb4bc5f0 170 int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
nexpaq 0:6c56fb4bc5f0 171 unsigned int sid_ctx_len)
nexpaq 0:6c56fb4bc5f0 172 {
nexpaq 0:6c56fb4bc5f0 173 return 1;
nexpaq 0:6c56fb4bc5f0 174 }
nexpaq 0:6c56fb4bc5f0 175
nexpaq 0:6c56fb4bc5f0 176 int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx)
nexpaq 0:6c56fb4bc5f0 177 {
nexpaq 0:6c56fb4bc5f0 178 return 1;
nexpaq 0:6c56fb4bc5f0 179 }
nexpaq 0:6c56fb4bc5f0 180
nexpaq 0:6c56fb4bc5f0 181 int SSL_CTX_use_certificate_chain_file(SSL_CTX *ssl_ctx, const char *file)
nexpaq 0:6c56fb4bc5f0 182 {
nexpaq 0:6c56fb4bc5f0 183 return (ssl_obj_load(ssl_ctx,
nexpaq 0:6c56fb4bc5f0 184 SSL_OBJ_X509_CERT, file, NULL) == SSL_OK);
nexpaq 0:6c56fb4bc5f0 185 }
nexpaq 0:6c56fb4bc5f0 186
nexpaq 0:6c56fb4bc5f0 187 int SSL_shutdown(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 188 {
nexpaq 0:6c56fb4bc5f0 189 return 1;
nexpaq 0:6c56fb4bc5f0 190 }
nexpaq 0:6c56fb4bc5f0 191
nexpaq 0:6c56fb4bc5f0 192 /*** get/set session ***/
nexpaq 0:6c56fb4bc5f0 193 SSL_SESSION *SSL_get1_session(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 194 {
nexpaq 0:6c56fb4bc5f0 195 return (SSL_SESSION *)ssl_get_session_id(ssl); /* note: wrong cast */
nexpaq 0:6c56fb4bc5f0 196 }
nexpaq 0:6c56fb4bc5f0 197
nexpaq 0:6c56fb4bc5f0 198 int SSL_set_session(SSL *ssl, SSL_SESSION *session)
nexpaq 0:6c56fb4bc5f0 199 {
nexpaq 0:6c56fb4bc5f0 200 memcpy(ssl->session_id, (uint8_t *)session, SSL_SESSION_ID_SIZE);
nexpaq 0:6c56fb4bc5f0 201 return 1;
nexpaq 0:6c56fb4bc5f0 202 }
nexpaq 0:6c56fb4bc5f0 203
nexpaq 0:6c56fb4bc5f0 204 void SSL_SESSION_free(SSL_SESSION *session) { }
nexpaq 0:6c56fb4bc5f0 205 /*** end get/set session ***/
nexpaq 0:6c56fb4bc5f0 206
nexpaq 0:6c56fb4bc5f0 207 long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
nexpaq 0:6c56fb4bc5f0 208 {
nexpaq 0:6c56fb4bc5f0 209 return 0;
nexpaq 0:6c56fb4bc5f0 210 }
nexpaq 0:6c56fb4bc5f0 211
nexpaq 0:6c56fb4bc5f0 212 void SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
nexpaq 0:6c56fb4bc5f0 213 int (*verify_callback)(int, void *)) { }
nexpaq 0:6c56fb4bc5f0 214
nexpaq 0:6c56fb4bc5f0 215 void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth) { }
nexpaq 0:6c56fb4bc5f0 216
nexpaq 0:6c56fb4bc5f0 217 int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
nexpaq 0:6c56fb4bc5f0 218 const char *CApath)
nexpaq 0:6c56fb4bc5f0 219 {
nexpaq 0:6c56fb4bc5f0 220 return 1;
nexpaq 0:6c56fb4bc5f0 221 }
nexpaq 0:6c56fb4bc5f0 222
nexpaq 0:6c56fb4bc5f0 223 void *SSL_load_client_CA_file(const char *file)
nexpaq 0:6c56fb4bc5f0 224 {
nexpaq 0:6c56fb4bc5f0 225 return (void *)file;
nexpaq 0:6c56fb4bc5f0 226 }
nexpaq 0:6c56fb4bc5f0 227
nexpaq 0:6c56fb4bc5f0 228 void SSL_CTX_set_client_CA_list(SSL_CTX *ssl_ctx, void *file)
nexpaq 0:6c56fb4bc5f0 229 {
nexpaq 0:6c56fb4bc5f0 230
nexpaq 0:6c56fb4bc5f0 231 ssl_obj_load(ssl_ctx, SSL_OBJ_X509_CERT, (const char *)file, NULL);
nexpaq 0:6c56fb4bc5f0 232 }
nexpaq 0:6c56fb4bc5f0 233
nexpaq 0:6c56fb4bc5f0 234 void SSLv23_method(void) { }
nexpaq 0:6c56fb4bc5f0 235
nexpaq 0:6c56fb4bc5f0 236 void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, void *cb) { }
nexpaq 0:6c56fb4bc5f0 237
nexpaq 0:6c56fb4bc5f0 238 void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u)
nexpaq 0:6c56fb4bc5f0 239 {
nexpaq 0:6c56fb4bc5f0 240 key_password = (char *)u;
nexpaq 0:6c56fb4bc5f0 241 }
nexpaq 0:6c56fb4bc5f0 242
nexpaq 0:6c56fb4bc5f0 243 int SSL_peek(SSL *ssl, void *buf, int num)
nexpaq 0:6c56fb4bc5f0 244 {
nexpaq 0:6c56fb4bc5f0 245 memcpy(buf, ssl->bm_data, num);
nexpaq 0:6c56fb4bc5f0 246 return num;
nexpaq 0:6c56fb4bc5f0 247 }
nexpaq 0:6c56fb4bc5f0 248
nexpaq 0:6c56fb4bc5f0 249 void SSL_set_bio(SSL *ssl, void *rbio, void *wbio) { }
nexpaq 0:6c56fb4bc5f0 250
nexpaq 0:6c56fb4bc5f0 251 long SSL_get_verify_result(const SSL *ssl)
nexpaq 0:6c56fb4bc5f0 252 {
nexpaq 0:6c56fb4bc5f0 253 return ssl_handshake_status(ssl);
nexpaq 0:6c56fb4bc5f0 254 }
nexpaq 0:6c56fb4bc5f0 255
nexpaq 0:6c56fb4bc5f0 256 int SSL_state(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 257 {
nexpaq 0:6c56fb4bc5f0 258 return 0x03; // ok state
nexpaq 0:6c56fb4bc5f0 259 }
nexpaq 0:6c56fb4bc5f0 260
nexpaq 0:6c56fb4bc5f0 261 /** end of could do better list */
nexpaq 0:6c56fb4bc5f0 262
nexpaq 0:6c56fb4bc5f0 263 void *SSL_get_peer_certificate(const SSL *ssl)
nexpaq 0:6c56fb4bc5f0 264 {
nexpaq 0:6c56fb4bc5f0 265 return &ssl->ssl_ctx->certs[0];
nexpaq 0:6c56fb4bc5f0 266 }
nexpaq 0:6c56fb4bc5f0 267
nexpaq 0:6c56fb4bc5f0 268 int SSL_clear(SSL *ssl)
nexpaq 0:6c56fb4bc5f0 269 {
nexpaq 0:6c56fb4bc5f0 270 return 1;
nexpaq 0:6c56fb4bc5f0 271 }
nexpaq 0:6c56fb4bc5f0 272
nexpaq 0:6c56fb4bc5f0 273
nexpaq 0:6c56fb4bc5f0 274 int SSL_CTX_check_private_key(const SSL_CTX *ctx)
nexpaq 0:6c56fb4bc5f0 275 {
nexpaq 0:6c56fb4bc5f0 276 return 1;
nexpaq 0:6c56fb4bc5f0 277 }
nexpaq 0:6c56fb4bc5f0 278
nexpaq 0:6c56fb4bc5f0 279 int SSL_CTX_set_cipher_list(SSL *s, const char *str)
nexpaq 0:6c56fb4bc5f0 280 {
nexpaq 0:6c56fb4bc5f0 281 return 1;
nexpaq 0:6c56fb4bc5f0 282 }
nexpaq 0:6c56fb4bc5f0 283
nexpaq 0:6c56fb4bc5f0 284 int SSL_get_error(const SSL *ssl, int ret)
nexpaq 0:6c56fb4bc5f0 285 {
nexpaq 0:6c56fb4bc5f0 286 ssl_display_error(ret);
nexpaq 0:6c56fb4bc5f0 287 return 0; /* TODO: return proper return code */
nexpaq 0:6c56fb4bc5f0 288 }
nexpaq 0:6c56fb4bc5f0 289
nexpaq 0:6c56fb4bc5f0 290 void SSL_CTX_set_options(SSL_CTX *ssl_ctx, int option) {}
nexpaq 0:6c56fb4bc5f0 291 int SSL_library_init(void ) { return 1; }
nexpaq 0:6c56fb4bc5f0 292 void SSL_load_error_strings(void ) {}
nexpaq 0:6c56fb4bc5f0 293 void ERR_print_errors_fp(FILE *fp) {}
nexpaq 0:6c56fb4bc5f0 294
nexpaq 0:6c56fb4bc5f0 295 #ifndef CONFIG_SSL_SKELETON_MODE
nexpaq 0:6c56fb4bc5f0 296 long SSL_CTX_get_timeout(const SSL_CTX *ssl_ctx) {
nexpaq 0:6c56fb4bc5f0 297 return CONFIG_SSL_EXPIRY_TIME*3600; }
nexpaq 0:6c56fb4bc5f0 298 long SSL_CTX_set_timeout(SSL_CTX *ssl_ctx, long t) {
nexpaq 0:6c56fb4bc5f0 299 return SSL_CTX_get_timeout(ssl_ctx); }
nexpaq 0:6c56fb4bc5f0 300 #endif
nexpaq 0:6c56fb4bc5f0 301 void BIO_printf(FILE *f, const char *format, ...)
nexpaq 0:6c56fb4bc5f0 302 {
nexpaq 0:6c56fb4bc5f0 303 va_list(ap);
nexpaq 0:6c56fb4bc5f0 304 va_start(ap, format);
nexpaq 0:6c56fb4bc5f0 305 vfprintf(f, format, ap);
nexpaq 0:6c56fb4bc5f0 306 va_end(ap);
nexpaq 0:6c56fb4bc5f0 307 }
nexpaq 0:6c56fb4bc5f0 308
nexpaq 0:6c56fb4bc5f0 309 void* BIO_s_null(void) { return NULL; }
nexpaq 0:6c56fb4bc5f0 310 FILE *BIO_new(bio_func_type_t func)
nexpaq 0:6c56fb4bc5f0 311 {
nexpaq 0:6c56fb4bc5f0 312 if (func == BIO_s_null)
nexpaq 0:6c56fb4bc5f0 313 return fopen("/dev/null", "r");
nexpaq 0:6c56fb4bc5f0 314 else
nexpaq 0:6c56fb4bc5f0 315 return NULL;
nexpaq 0:6c56fb4bc5f0 316 }
nexpaq 0:6c56fb4bc5f0 317
nexpaq 0:6c56fb4bc5f0 318 FILE *BIO_new_fp(FILE *stream, int close_flag) { return stream; }
nexpaq 0:6c56fb4bc5f0 319 int BIO_free(FILE *a) { if (a != stdout && a != stderr) fclose(a); return 1; }
nexpaq 0:6c56fb4bc5f0 320
nexpaq 0:6c56fb4bc5f0 321
nexpaq 0:6c56fb4bc5f0 322
nexpaq 0:6c56fb4bc5f0 323 #endif