Home | History | Annotate | Download | only in vtls
      1 #ifndef HEADER_CURL_CYASSL_H
      2 #define HEADER_CURL_CYASSL_H
      3 /***************************************************************************
      4  *                                  _   _ ____  _
      5  *  Project                     ___| | | |  _ \| |
      6  *                             / __| | | | |_) | |
      7  *                            | (__| |_| |  _ <| |___
      8  *                             \___|\___/|_| \_\_____|
      9  *
     10  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel (at) haxx.se>, et al.
     11  *
     12  * This software is licensed as described in the file COPYING, which
     13  * you should have received as part of this distribution. The terms
     14  * are also available at https://curl.haxx.se/docs/copyright.html.
     15  *
     16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
     17  * copies of the Software, and permit persons to whom the Software is
     18  * furnished to do so, under the terms of the COPYING file.
     19  *
     20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     21  * KIND, either express or implied.
     22  *
     23  ***************************************************************************/
     24 #include "curl_setup.h"
     25 
     26 #ifdef USE_CYASSL
     27 
     28 /* KEEP_PEER_CERT is a product of the presence of build time symbol
     29    OPENSSL_EXTRA without NO_CERTS, depending on the version. KEEP_PEER_CERT is
     30    in wolfSSL's settings.h, and the latter two are build time symbols in
     31    options.h. */
     32 #ifndef KEEP_PEER_CERT
     33 #if defined(HAVE_CYASSL_GET_PEER_CERTIFICATE) || \
     34     defined(HAVE_WOLFSSL_GET_PEER_CERTIFICATE) || \
     35     (defined(OPENSSL_EXTRA) && !defined(NO_CERTS))
     36 #define KEEP_PEER_CERT
     37 #endif
     38 #endif
     39 
     40 CURLcode Curl_cyassl_connect(struct connectdata *conn, int sockindex);
     41 bool Curl_cyassl_data_pending(const struct connectdata* conn, int connindex);
     42 int Curl_cyassl_shutdown(struct connectdata* conn, int sockindex);
     43 
     44  /* close a SSL connection */
     45 void Curl_cyassl_close(struct connectdata *conn, int sockindex);
     46 
     47 void Curl_cyassl_session_free(void *ptr);
     48 size_t Curl_cyassl_version(char *buffer, size_t size);
     49 int Curl_cyassl_shutdown(struct connectdata *conn, int sockindex);
     50 int Curl_cyassl_init(void);
     51 CURLcode Curl_cyassl_connect_nonblocking(struct connectdata *conn,
     52                                          int sockindex,
     53                                          bool *done);
     54 int Curl_cyassl_random(struct Curl_easy *data,
     55                        unsigned char *entropy,
     56                        size_t length);
     57 void Curl_cyassl_sha256sum(const unsigned char *tmp, /* input */
     58                      size_t tmplen,
     59                      unsigned char *sha256sum, /* output */
     60                      size_t unused);
     61 
     62 /* Set the API backend definition to Schannel */
     63 #define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL
     64 
     65 /* this backend supports CURLOPT_SSL_CTX_* */
     66 #define have_curlssl_ssl_ctx 1
     67 
     68 #ifdef KEEP_PEER_CERT
     69 /* this backend supports CURLOPT_PINNEDPUBLICKEY */
     70 #define have_curlssl_pinnedpubkey 1
     71 #endif
     72 
     73 /* API setup for CyaSSL */
     74 #define curlssl_init Curl_cyassl_init
     75 #define curlssl_cleanup() Curl_nop_stmt
     76 #define curlssl_connect Curl_cyassl_connect
     77 #define curlssl_connect_nonblocking Curl_cyassl_connect_nonblocking
     78 #define curlssl_session_free(x)  Curl_cyassl_session_free(x)
     79 #define curlssl_close_all(x) ((void)x)
     80 #define curlssl_close Curl_cyassl_close
     81 #define curlssl_shutdown(x,y) Curl_cyassl_shutdown(x,y)
     82 #define curlssl_set_engine(x,y) ((void)x, (void)y, CURLE_NOT_BUILT_IN)
     83 #define curlssl_set_engine_default(x) ((void)x, CURLE_NOT_BUILT_IN)
     84 #define curlssl_engines_list(x) ((void)x, (struct curl_slist *)NULL)
     85 #define curlssl_version Curl_cyassl_version
     86 #define curlssl_check_cxn(x) ((void)x, -1)
     87 #define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y)
     88 #define curlssl_random(x,y,z) Curl_cyassl_random(x,y,z)
     89 #define curlssl_sha256sum(a,b,c,d) Curl_cyassl_sha256sum(a,b,c,d)
     90 
     91 #endif /* USE_CYASSL */
     92 #endif /* HEADER_CURL_CYASSL_H */
     93