Ignore:
Timestamp:
Feb 7, 2019, 8:36:33 AM (5 years ago)
Author:
coas-nagasima
Message:

wolfsslを3.15.7にバージョンアップ

Location:
asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl
Files:
1 added
23 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/bio.h

    r337 r372  
     1/* bio.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* bio.h for openssl */
    223
     
    1233#endif
    1334
     35#define BIO_FLAG_BASE64_NO_NL WOLFSSL_BIO_FLAG_BASE64_NO_NL
     36#define BIO_FLAG_READ         WOLFSSL_BIO_FLAG_READ
     37#define BIO_FLAG_WRITE        WOLFSSL_BIO_FLAG_WRITE
     38#define BIO_FLAG_IO_SPECIAL   WOLFSSL_BIO_FLAG_IO_SPECIAL
     39#define BIO_FLAG_RETRY        WOLFSSL_BIO_FLAG_RETRY
    1440
     41#define BIO_find_type wolfSSL_BIO_find_type
     42#define BIO_next      wolfSSL_BIO_next
     43#define BIO_gets      wolfSSL_BIO_gets
     44
     45
     46#define BIO_TYPE_FILE WOLFSSL_BIO_FILE
     47#define BIO_TYPE_BIO  WOLFSSL_BIO_BIO
     48#define BIO_TYPE_MEM  WOLFSSL_BIO_MEMORY
     49#define BIO_TYPE_BASE64 WOLFSSL_BIO_BASE64
    1550
    1651
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/bn.h

    r337 r372  
     1/* bn.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* bn.h for openssl */
     23
     24/*!
     25    \file wolfssl/openssl/bn.h
     26    \brief bn.h for openssl
     27*/
    228
    329
     
    3864WOLFSSL_API int wolfSSL_BN_mod_exp(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a,
    3965        const WOLFSSL_BIGNUM *p, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx);
     66WOLFSSL_API int wolfSSL_BN_mod_mul(WOLFSSL_BIGNUM *r, const WOLFSSL_BIGNUM *a,
     67        const WOLFSSL_BIGNUM *b, const WOLFSSL_BIGNUM *m, WOLFSSL_BN_CTX *ctx);
    4068WOLFSSL_API const WOLFSSL_BIGNUM* wolfSSL_BN_value_one(void);
    4169
     
    5684WOLFSSL_API int wolfSSL_mask_bits(WOLFSSL_BIGNUM*, int n);
    5785
     86WOLFSSL_API int wolfSSL_BN_pseudo_rand(WOLFSSL_BIGNUM*, int bits, int top,
     87        int bottom);
    5888WOLFSSL_API int wolfSSL_BN_rand(WOLFSSL_BIGNUM*, int bits, int top, int bottom);
    5989WOLFSSL_API int wolfSSL_BN_is_bit_set(const WOLFSSL_BIGNUM*, int n);
     
    71101WOLFSSL_API int wolfSSL_BN_set_bit(WOLFSSL_BIGNUM*, int);
    72102WOLFSSL_API int wolfSSL_BN_set_word(WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
     103WOLFSSL_API unsigned long wolfSSL_BN_get_word(const WOLFSSL_BIGNUM*);
    73104
    74105WOLFSSL_API int wolfSSL_BN_add(WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*,
     
    80111                                                 WOLFSSL_BN_ULONG);
    81112#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
    82     WOLFSSL_API int wolfSSL_BN_print_fp(FILE*, const WOLFSSL_BIGNUM*);
     113    WOLFSSL_API int wolfSSL_BN_print_fp(XFILE, const WOLFSSL_BIGNUM*);
    83114#endif
    84115WOLFSSL_API int wolfSSL_BN_rshift(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*, int);
    85116WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_CTX_get(WOLFSSL_BN_CTX *ctx);
    86117WOLFSSL_API void wolfSSL_BN_CTX_start(WOLFSSL_BN_CTX *ctx);
    87 
     118WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_mod_inverse(WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*,
     119                                        const WOLFSSL_BIGNUM*, WOLFSSL_BN_CTX *ctx);
    88120typedef WOLFSSL_BIGNUM BIGNUM;
    89121typedef WOLFSSL_BN_CTX BN_CTX;
     
    112144#define BN_mod       wolfSSL_BN_mod
    113145#define BN_mod_exp   wolfSSL_BN_mod_exp
     146#define BN_mod_mul   wolfSSL_BN_mod_mul
    114147#define BN_sub       wolfSSL_BN_sub
    115148#define BN_value_one wolfSSL_BN_value_one
     
    117150#define BN_mask_bits wolfSSL_mask_bits
    118151
     152#define BN_pseudo_rand wolfSSL_BN_pseudo_rand
    119153#define BN_rand       wolfSSL_BN_rand
    120154#define BN_is_bit_set wolfSSL_BN_is_bit_set
     
    124158#define BN_copy wolfSSL_BN_copy
    125159
     160#define BN_get_word wolfSSL_BN_get_word
    126161#define BN_set_word wolfSSL_BN_set_word
    127162
     
    145180#define BN_CTX_start wolfSSL_BN_CTX_start
    146181
     182#define BN_mod_inverse wolfSSL_BN_mod_inverse
     183
    147184#ifdef __cplusplus
    148185    }  /* extern "C" */
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/crypto.h

    r337 r372  
     1/* crypto.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* crypto.h for openSSL */
    223
     
    1637WOLFSSL_API unsigned long wolfSSLeay(void);
    1738
     39#ifdef OPENSSL_EXTRA
     40WOLFSSL_API void wolfSSL_OPENSSL_free(void*);
     41WOLFSSL_API void *wolfSSL_OPENSSL_malloc(size_t a);
     42#endif
     43
    1844#define CRYPTO_THREADID void
    1945
     
    2450#define SSLEAY_VERSION 0x0090600fL
    2551#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
     52#define CRYPTO_lock wc_LockMutex_ex
    2653
    27 #if defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
     54/* this function was used to set the default malloc, free, and realloc */
     55#define CRYPTO_malloc_init() /* CRYPTO_malloc_init is not needed */
     56
     57#define OPENSSL_free wolfSSL_OPENSSL_free
     58#define OPENSSL_malloc wolfSSL_OPENSSL_malloc
     59
     60#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \
     61    defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA)
    2862#define CRYPTO_set_mem_ex_functions      wolfSSL_CRYPTO_set_mem_ex_functions
    2963#define FIPS_mode                        wolfSSL_FIPS_mode
     
    3569#define CRYPTO_THREADID_set_numeric wolfSSL_THREADID_set_numeric
    3670
    37 #define CRYPTO_lock wc_LockMutex
    38 #define CRYPTO_r_lock wc_LockMutex
    39 #define CRYPTO_unlock wc_UnLockMutex
     71#define CRYPTO_r_lock wc_LockMutex_ex
     72#define CRYPTO_unlock wc_LockMutex_ex
    4073
    4174#define CRYPTO_THREAD_lock wc_LockMutex
     
    4376#define CRYPTO_THREAD_unlock wc_UnLockMutex
    4477
    45 #define OPENSSL_malloc(a)  XMALLOC(a, NULL, DYNAMIC_TYPE_OPENSSL)
    46 
    47 #endif /* HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY */
     78#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY */
    4879
    4980#endif /* header */
    50 
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/des.h

    r337 r372  
    4646typedef /* const */ WOLFSSL_DES_cblock WOLFSSL_const_DES_cblock;
    4747typedef WOLFSSL_DES_cblock WOLFSSL_DES_key_schedule;
     48typedef unsigned int WOLFSSL_DES_LONG;
    4849
    4950
     
    5455
    5556
     57WOLFSSL_API int wolfSSL_DES_is_weak_key(WOLFSSL_const_DES_cblock* key);
     58WOLFSSL_API WOLFSSL_DES_LONG wolfSSL_DES_cbc_cksum(const unsigned char* in,
     59            WOLFSSL_DES_cblock* out, long length, WOLFSSL_DES_key_schedule* sc,
     60            WOLFSSL_const_DES_cblock* iv);
    5661WOLFSSL_API int wolfSSL_DES_set_key(WOLFSSL_const_DES_cblock* myDes,
    5762                                               WOLFSSL_DES_key_schedule* key);
     
    8590typedef WOLFSSL_const_DES_cblock const_DES_cblock;
    8691typedef WOLFSSL_DES_key_schedule DES_key_schedule;
     92typedef WOLFSSL_DES_LONG DES_LONG;
    8793
    8894#define DES_check_key(x) /* Define WOLFSSL_CHECK_DESKEY to check key */
     95#define DES_is_weak_key       wolfSSL_DES_is_weak_key
    8996#define DES_set_key           wolfSSL_DES_set_key
    9097#define DES_set_key_checked   wolfSSL_DES_set_key_checked
     
    96103#define DES_ecb_encrypt       wolfSSL_DES_ecb_encrypt
    97104#define DES_ede3_cbc_encrypt  wolfSSL_DES_ede3_cbc_encrypt
     105#define DES_cbc_cksum         wolfSSL_DES_cbc_cksum
    98106
    99107#ifdef __cplusplus
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/dh.h

    r337 r372  
     1/* dh.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* dh.h for openSSL */
    223
     
    4465#define DH_generate_key wolfSSL_DH_generate_key
    4566#define DH_compute_key  wolfSSL_DH_compute_key
     67#define get_rfc3526_prime_1536 wolfSSL_DH_1536_prime
    4668
    4769
     
    5072#endif
    5173
    52 #ifdef HAVE_STUNNEL
     74#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL)
    5375#define DH_generate_parameters    wolfSSL_DH_generate_parameters
    5476#define DH_generate_parameters_ex wolfSSL_DH_generate_parameters_ex
    55 #endif /* HAVE_STUNNEL */
    56 #endif /* header */
     77#endif /* OPENSSL_ALL || HAVE_STUNNEL */
     78
     79#endif /* WOLFSSL_DH_H_ */
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/dsa.h

    r337 r372  
     1/* dsa.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* dsa.h for openSSL */
    223
     
    3455
    3556WOLFSSL_API int wolfSSL_DSA_generate_key(WOLFSSL_DSA*);
     57
     58typedef void (*WOLFSSL_BN_CB)(int i, int j, void* exArg);
     59WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_generate_parameters(int bits,
     60                   unsigned char* seed, int seedLen, int* counterRet,
     61                   unsigned long* hRet, WOLFSSL_BN_CB cb, void* CBArg);
    3662WOLFSSL_API int wolfSSL_DSA_generate_parameters_ex(WOLFSSL_DSA*, int bits,
    3763                   unsigned char* seed, int seedLen, int* counterRet,
     
    5177
    5278#define DSA_generate_key           wolfSSL_DSA_generate_key
     79#define DSA_generate_parameters    wolfSSL_DSA_generate_parameters
    5380#define DSA_generate_parameters_ex wolfSSL_DSA_generate_parameters_ex
    5481
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ec.h

    r337 r372  
     1/* ec.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ec.h for openssl */
    223
     
    1334/* Map OpenSSL NID value */
    1435enum {
     36    POINT_CONVERSION_COMPRESSED = 2,
    1537    POINT_CONVERSION_UNCOMPRESSED = 4,
    1638
     
    81103};
    82104
     105
     106#define WOLFSSL_EC_KEY_LOAD_PRIVATE 1
     107#define WOLFSSL_EC_KEY_LOAD_PUBLIC  2
     108
    83109WOLFSSL_API
    84110int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *curve,
     
    92118                           const unsigned char* der, int derSz);
    93119WOLFSSL_API
     120int wolfSSL_EC_KEY_LoadDer_ex(WOLFSSL_EC_KEY* key,
     121                              const unsigned char* der, int derSz, int opt);
     122WOLFSSL_API
    94123void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key);
    95124WOLFSSL_API
     
    131160WOLFSSL_API
    132161void wolfSSL_EC_GROUP_free(WOLFSSL_EC_GROUP *group);
    133 #if defined(DEBUG_WOLFSSL) && !defined(NO_FILESYSTEM)
    134 WOLFSSL_API
    135 void wolfssl_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p);
    136 #endif
    137162WOLFSSL_API
    138163WOLFSSL_EC_POINT *wolfSSL_EC_POINT_new(const WOLFSSL_EC_GROUP *group);
     
    160185                                    const WOLFSSL_EC_POINT *a);
    161186
     187#ifndef HAVE_SELFTEST
     188WOLFSSL_API
     189char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
     190                                 const WOLFSSL_EC_POINT* point, int form,
     191                                 WOLFSSL_BN_CTX* ctx);
     192#endif
     193
     194#define EC_KEY_new                      wolfSSL_EC_KEY_new
    162195#define EC_KEY_free wolfSSL_EC_KEY_free
    163196#define EC_KEY_get0_public_key wolfSSL_EC_KEY_get0_public_key
     
    170203#define EC_KEY_set_asn1_flag wolfSSL_EC_KEY_set_asn1_flag
    171204#define EC_KEY_set_public_key wolfSSL_EC_KEY_set_public_key
    172 #define EC_KEY_new wolfSSL_EC_KEY_new
    173 
     205
     206#define EC_GROUP_free                   wolfSSL_EC_GROUP_free
    174207#define EC_GROUP_set_asn1_flag wolfSSL_EC_GROUP_set_asn1_flag
    175208#define EC_GROUP_new_by_curve_name wolfSSL_EC_GROUP_new_by_curve_name
     
    178211#define EC_GROUP_get_degree wolfSSL_EC_GROUP_get_degree
    179212#define EC_GROUP_get_order wolfSSL_EC_GROUP_get_order
    180 #define EC_GROUP_free wolfSSL_EC_GROUP_free
    181213
    182214#define EC_POINT_new wolfSSL_EC_POINT_new
     215#define EC_POINT_free                   wolfSSL_EC_POINT_free
    183216#define EC_POINT_get_affine_coordinates_GFp \
    184217            wolfSSL_EC_POINT_get_affine_coordinates_GFp
     
    186219#define EC_POINT_clear_free wolfSSL_EC_POINT_clear_free
    187220#define EC_POINT_cmp wolfSSL_EC_POINT_cmp
    188 #define EC_POINT_free wolfSSL_EC_POINT_free
    189221#define EC_POINT_is_at_infinity wolfSSL_EC_POINT_is_at_infinity
     222
     223#ifndef HAVE_SELFTEST
     224    #define EC_POINT_point2hex          wolfSSL_EC_POINT_point2hex
     225#endif
     226
     227#define EC_POINT_dump                   wolfSSL_EC_POINT_dump
    190228
    191229#ifdef __cplusplus
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ec25519.h

    r337 r372  
     1/* ec25519.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ec25519.h */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ecdh.h

    r337 r372  
     1/* ecdh.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ecdh.h for openssl */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ecdsa.h

    r337 r372  
     1/* ecdsa.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ecdsa.h for openssl */
    223
     
    3354                                        WOLFSSL_EC_KEY *eckey);
    3455
     56WOLFSSL_API WOLFSSL_ECDSA_SIG *wolfSSL_d2i_ECDSA_SIG(WOLFSSL_ECDSA_SIG **sig,
     57                                                     const unsigned char **pp,
     58                                                     long len);
     59WOLFSSL_API int wolfSSL_i2d_ECDSA_SIG(const WOLFSSL_ECDSA_SIG *sig,
     60                                      unsigned char **pp);
     61
    3562#define ECDSA_SIG_free wolfSSL_ECDSA_SIG_free
    3663#define ECDSA_SIG_new wolfSSL_ECDSA_SIG_new
    3764#define ECDSA_do_sign wolfSSL_ECDSA_do_sign
    3865#define ECDSA_do_verify wolfSSL_ECDSA_do_verify
     66#define d2i_ECDSA_SIG          wolfSSL_d2i_ECDSA_SIG
     67#define i2d_ECDSA_SIG          wolfSSL_i2d_ECDSA_SIG
    3968
    4069#ifdef __cplusplus
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ed25519.h

    r337 r372  
     1/* ed25519.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ed25519.h */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/err.h

    r337 r372  
     1/* err.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
     22#ifndef WOLFSSL_OPENSSL_ERR_
     23#define WOLFSSL_OPENSSL_ERR_
     24
     25#include <wolfssl/openssl/ssl.h>
     26
    127/* err.h for openssl */
    228#define ERR_load_crypto_strings          wolfSSL_ERR_load_crypto_strings
    329#define ERR_peek_last_error              wolfSSL_ERR_peek_last_error
     30
     31#endif /* WOLFSSL_OPENSSL_ERR_ */
     32
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/evp.h

    r337 r372  
    2222
    2323
    24 /*  evp.h defines mini evp openssl compatibility layer
    25  *
     24/*!
     25    \file wolfssl/openssl/evp.h
     26    \brief evp.h defines mini evp openssl compatibility layer
    2627 */
    2728
     
    3637#endif
    3738
     39#ifndef NO_MD4
     40    #include <wolfssl/openssl/md4.h>
     41#endif
    3842#ifndef NO_MD5
    3943    #include <wolfssl/openssl/md5.h>
     
    5256    #include <wolfssl/wolfcrypt/idea.h>
    5357#endif
     58#include <wolfssl/wolfcrypt/pwdbased.h>
    5459
    5560#ifdef __cplusplus
     
    5762#endif
    5863
     64
    5965typedef char WOLFSSL_EVP_CIPHER;
     66#ifndef WOLFSSL_EVP_TYPE_DEFINED /* guard on redeclaration */
    6067typedef char WOLFSSL_EVP_MD;
    61 
     68typedef struct WOLFSSL_EVP_PKEY WOLFSSL_EVP_PKEY;
     69#define WOLFSSL_EVP_TYPE_DEFINED
     70#endif
     71
     72typedef WOLFSSL_EVP_PKEY       EVP_PKEY;
     73typedef WOLFSSL_EVP_PKEY       PKCS8_PRIV_KEY_INFO;
     74
     75#ifndef NO_MD4
     76    WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_md4(void);
     77#endif
    6278#ifndef NO_MD5
    6379    WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_md5(void);
     
    7490WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ecb(void);
    7591WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_cbc(void);
     92#if !defined(NO_AES) && defined(HAVE_AES_CBC)
    7693WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_cbc(void);
    7794WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_cbc(void);
     95#endif
    7896WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_128_ctr(void);
    7997WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_192_ctr(void);
     
    89107
    90108typedef union {
     109    #ifndef NO_MD4
     110        WOLFSSL_MD4_CTX    md4;
     111    #endif
    91112    #ifndef NO_MD5
    92113        WOLFSSL_MD5_CTX    md5;
     
    108129} WOLFSSL_Hasher;
    109130
     131typedef struct WOLFSSL_EVP_PKEY_CTX WOLFSSL_EVP_PKEY_CTX;
    110132
    111133typedef struct WOLFSSL_EVP_MD_CTX {
     
    115137    } hash;
    116138    unsigned char macType;
     139    WOLFSSL_EVP_PKEY_CTX *pctx;
    117140} WOLFSSL_EVP_MD_CTX;
    118141
     
    152175    EVP_PKEY_DSA      = 17,
    153176    EVP_PKEY_EC       = 18,
     177#ifdef HAVE_IDEA
    154178    IDEA_CBC_TYPE     = 19,
     179#endif
    155180    NID_sha1          = 64,
    156     NID_md2           = 3,
     181    NID_sha224        = 65,
     182    NID_md2           = 77,
    157183    NID_md5           =  4,
    158184    NID_hmac          = 855,
     
    198224} WOLFSSL_EVP_CIPHER_CTX;
    199225
    200 
    201 #ifndef WOLFSSL_EVP_PKEY_TYPE_DEFINED /* guard on redeclaration */
    202 typedef struct WOLFSSL_EVP_PKEY     WOLFSSL_EVP_PKEY;
    203 #define WOLFSSL_EVP_PKEY_TYPE_DEFINED
    204 #endif
    205 
    206 struct WOLFSSL_EVP_PKEY {
    207     int type;         /* openssh dereference */
    208     int save_type;    /* openssh dereference */
    209     int pkey_sz;
    210     union {
    211         char* ptr; /* der format of key / or raw for NTRU */
    212     } pkey;
    213     #ifdef HAVE_ECC
    214         int pkey_curve;
    215     #endif
     226struct  WOLFSSL_EVP_PKEY_CTX {
     227    WOLFSSL_EVP_PKEY *pkey;
     228    int op; /* operation */
     229    int padding;
    216230};
    217231
    218232typedef int WOLFSSL_ENGINE  ;
    219233typedef WOLFSSL_ENGINE ENGINE;
    220 typedef int WOLFSSL_EVP_PKEY_CTX;
    221234typedef WOLFSSL_EVP_PKEY_CTX EVP_PKEY_CTX;
     235
     236#define EVP_PKEY_OP_ENCRYPT (1 << 6)
     237#define EVP_PKEY_OP_DECRYPT (1 << 7)
    222238
    223239WOLFSSL_API void wolfSSL_EVP_init(void);
     
    229245WOLFSSL_API void wolfSSL_EVP_MD_CTX_init(WOLFSSL_EVP_MD_CTX* ctx);
    230246WOLFSSL_API int  wolfSSL_EVP_MD_CTX_cleanup(WOLFSSL_EVP_MD_CTX* ctx);
     247WOLFSSL_API int  wolfSSL_EVP_MD_CTX_copy(WOLFSSL_EVP_MD_CTX *out, const WOLFSSL_EVP_MD_CTX *in);
     248WOLFSSL_API int  wolfSSL_EVP_MD_CTX_copy_ex(WOLFSSL_EVP_MD_CTX *out, const WOLFSSL_EVP_MD_CTX *in);
     249WOLFSSL_API int  wolfSSL_EVP_MD_CTX_type(const WOLFSSL_EVP_MD_CTX *ctx);
    231250WOLFSSL_API const WOLFSSL_EVP_MD *wolfSSL_EVP_MD_CTX_md(const WOLFSSL_EVP_MD_CTX *ctx);
    232251WOLFSSL_API const WOLFSSL_EVP_CIPHER *wolfSSL_EVP_get_cipherbyname(const char *name);
     
    239258                                     WOLFSSL_ENGINE *impl);
    240259WOLFSSL_API int wolfSSL_EVP_DigestUpdate(WOLFSSL_EVP_MD_CTX* ctx, const void* data,
    241                                        unsigned long sz);
     260                                       size_t sz);
    242261WOLFSSL_API int wolfSSL_EVP_DigestFinal(WOLFSSL_EVP_MD_CTX* ctx, unsigned char* md,
    243262                                      unsigned int* s);
     
    255274                                            unsigned char *sig, size_t *siglen);
    256275
    257 #ifndef NO_MD5
     276WOLFSSL_API int wolfSSL_EVP_DigestVerifyInit(WOLFSSL_EVP_MD_CTX *ctx,
     277                                             WOLFSSL_EVP_PKEY_CTX **pctx,
     278                                             const WOLFSSL_EVP_MD *type,
     279                                             WOLFSSL_ENGINE *e,
     280                                             WOLFSSL_EVP_PKEY *pkey);
     281WOLFSSL_API int wolfSSL_EVP_DigestVerifyUpdate(WOLFSSL_EVP_MD_CTX *ctx,
     282                                               const void *d, size_t cnt);
     283WOLFSSL_API int wolfSSL_EVP_DigestVerifyFinal(WOLFSSL_EVP_MD_CTX *ctx,
     284                                              const unsigned char *sig,
     285                                              size_t siglen);
     286
     287
    258288WOLFSSL_API int wolfSSL_EVP_BytesToKey(const WOLFSSL_EVP_CIPHER*,
    259289                              const WOLFSSL_EVP_MD*, const unsigned char*,
    260290                              const unsigned char*, int, int, unsigned char*,
    261291                              unsigned char*);
    262 #endif
    263292
    264293WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_init(WOLFSSL_EVP_CIPHER_CTX* ctx);
     
    267296WOLFSSL_API int  wolfSSL_EVP_CIPHER_CTX_iv_length(const WOLFSSL_EVP_CIPHER_CTX*);
    268297WOLFSSL_API int  wolfSSL_EVP_CIPHER_iv_length(const WOLFSSL_EVP_CIPHER*);
     298WOLFSSL_API int wolfSSL_EVP_Cipher_key_length(const WOLFSSL_EVP_CIPHER* c);
    269299
    270300
    271301WOLFSSL_API int  wolfSSL_EVP_CipherInit(WOLFSSL_EVP_CIPHER_CTX* ctx,
    272302                                    const WOLFSSL_EVP_CIPHER* type,
    273                                     unsigned char* key, unsigned char* iv,
     303                                    const unsigned char* key,
     304                                    const unsigned char* iv,
    274305                                    int enc);
    275306WOLFSSL_API int  wolfSSL_EVP_CipherInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx,
    276307                                    const WOLFSSL_EVP_CIPHER* type,
    277308                                    WOLFSSL_ENGINE *impl,
    278                                     unsigned char* key, unsigned char* iv,
     309                                    const unsigned char* key,
     310                                    const unsigned char* iv,
    279311                                    int enc);
    280312WOLFSSL_API int  wolfSSL_EVP_EncryptInit(WOLFSSL_EVP_CIPHER_CTX* ctx,
    281313                                    const WOLFSSL_EVP_CIPHER* type,
    282                                     unsigned char* key, unsigned char* iv);
     314                                    const unsigned char* key,
     315                                    const unsigned char* iv);
    283316WOLFSSL_API int  wolfSSL_EVP_EncryptInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx,
    284317                                    const WOLFSSL_EVP_CIPHER* type,
    285318                                    WOLFSSL_ENGINE *impl,
    286                                     unsigned char* key, unsigned char* iv);
     319                                    const unsigned char* key,
     320                                    const unsigned char* iv);
    287321WOLFSSL_API int  wolfSSL_EVP_DecryptInit(WOLFSSL_EVP_CIPHER_CTX* ctx,
    288322                                    const WOLFSSL_EVP_CIPHER* type,
    289                                     unsigned char* key, unsigned char* iv);
     323                                    const unsigned char* key,
     324                                    const unsigned char* iv);
    290325WOLFSSL_API int  wolfSSL_EVP_DecryptInit_ex(WOLFSSL_EVP_CIPHER_CTX* ctx,
    291326                                    const WOLFSSL_EVP_CIPHER* type,
    292327                                    WOLFSSL_ENGINE *impl,
    293                                     unsigned char* key, unsigned char* iv);
     328                                    const unsigned char* key,
     329                                    const unsigned char* iv);
    294330WOLFSSL_API int wolfSSL_EVP_CipherUpdate(WOLFSSL_EVP_CIPHER_CTX *ctx,
    295331                                   unsigned char *out, int *outl,
     
    320356WOLFSSL_API const WOLFSSL_EVP_MD* wolfSSL_EVP_get_digestbynid(int);
    321357
     358WOLFSSL_API int wolfSSL_EVP_PKEY_assign_RSA(WOLFSSL_EVP_PKEY* pkey,
     359                                            WOLFSSL_RSA* key);
     360WOLFSSL_API int wolfSSL_EVP_PKEY_assign_EC_KEY(WOLFSSL_EVP_PKEY* pkey,
     361                                               WOLFSSL_EC_KEY* key);
    322362WOLFSSL_API WOLFSSL_RSA* wolfSSL_EVP_PKEY_get1_RSA(WOLFSSL_EVP_PKEY*);
    323363WOLFSSL_API WOLFSSL_DSA* wolfSSL_EVP_PKEY_get1_DSA(WOLFSSL_EVP_PKEY*);
    324364WOLFSSL_API WOLFSSL_EC_KEY *wolfSSL_EVP_PKEY_get1_EC_KEY(WOLFSSL_EVP_PKEY *key);
     365WOLFSSL_API int wolfSSL_EVP_PKEY_set1_RSA(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_RSA *key);
    325366
    326367WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_mac_key(int type, ENGINE* e,
     
    328369WOLFSSL_API const unsigned char* wolfSSL_EVP_PKEY_get0_hmac(const WOLFSSL_EVP_PKEY* pkey,
    329370        size_t* len);
     371WOLFSSL_API int wolfSSL_EVP_PKEY_bits(const WOLFSSL_EVP_PKEY *pkey);
     372WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx);
     373WOLFSSL_API WOLFSSL_EVP_PKEY_CTX *wolfSSL_EVP_PKEY_CTX_new(WOLFSSL_EVP_PKEY *pkey, WOLFSSL_ENGINE *e);
     374WOLFSSL_API int wolfSSL_EVP_PKEY_CTX_set_rsa_padding(WOLFSSL_EVP_PKEY_CTX *ctx, int padding);
     375WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt(WOLFSSL_EVP_PKEY_CTX *ctx,
     376                     unsigned char *out, size_t *outlen,
     377                     const unsigned char *in, size_t inlen);
     378WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt_init(WOLFSSL_EVP_PKEY_CTX *ctx);
     379WOLFSSL_API int wolfSSL_EVP_PKEY_encrypt(WOLFSSL_EVP_PKEY_CTX *ctx,
     380                     unsigned char *out, size_t *outlen,
     381                     const unsigned char *in, size_t inlen);
     382WOLFSSL_API int wolfSSL_EVP_PKEY_encrypt_init(WOLFSSL_EVP_PKEY_CTX *ctx);
     383WOLFSSL_API WOLFSSL_EVP_PKEY *wolfSSL_EVP_PKEY_new(void);
     384WOLFSSL_API void wolfSSL_EVP_PKEY_free(WOLFSSL_EVP_PKEY*);
     385WOLFSSL_API int wolfSSL_EVP_PKEY_size(WOLFSSL_EVP_PKEY *pkey);
     386WOLFSSL_API int wolfSSL_EVP_PKEY_type(int type);
     387WOLFSSL_API int wolfSSL_EVP_PKEY_id(const EVP_PKEY *pkey);
     388WOLFSSL_API int wolfSSL_EVP_PKEY_base_id(const EVP_PKEY *pkey);
     389WOLFSSL_API int wolfSSL_EVP_SignFinal(WOLFSSL_EVP_MD_CTX *ctx, unsigned char *sigret,
     390                  unsigned int *siglen, WOLFSSL_EVP_PKEY *pkey);
     391WOLFSSL_API int wolfSSL_EVP_SignInit(WOLFSSL_EVP_MD_CTX *ctx, const WOLFSSL_EVP_MD *type);
     392WOLFSSL_API int wolfSSL_EVP_SignUpdate(WOLFSSL_EVP_MD_CTX *ctx, const void *data, size_t len);
     393WOLFSSL_API int wolfSSL_EVP_VerifyFinal(WOLFSSL_EVP_MD_CTX *ctx,
     394        unsigned char* sig, unsigned int sig_len, WOLFSSL_EVP_PKEY *pkey);
     395WOLFSSL_API int wolfSSL_EVP_VerifyInit(WOLFSSL_EVP_MD_CTX *ctx, const WOLFSSL_EVP_MD *type);
     396WOLFSSL_API int wolfSSL_EVP_VerifyUpdate(WOLFSSL_EVP_MD_CTX *ctx, const void *data, size_t len);
     397
    330398
    331399/* these next ones don't need real OpenSSL type, for OpenSSH compat only */
     
    347415WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_flags(const WOLFSSL_EVP_CIPHER *cipher);
    348416WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_set_flags(WOLFSSL_EVP_CIPHER_CTX *ctx, int flags);
     417WOLFSSL_API void wolfSSL_EVP_CIPHER_CTX_clear_flags(WOLFSSL_EVP_CIPHER_CTX *ctx, int flags);
    349418WOLFSSL_API unsigned long wolfSSL_EVP_CIPHER_CTX_mode(const WOLFSSL_EVP_CIPHER_CTX *ctx);
    350419WOLFSSL_API int  wolfSSL_EVP_CIPHER_CTX_set_padding(WOLFSSL_EVP_CIPHER_CTX *c, int pad);
    351420WOLFSSL_API int  wolfSSL_EVP_add_digest(const WOLFSSL_EVP_MD *digest);
    352421WOLFSSL_API int  wolfSSL_EVP_add_cipher(const WOLFSSL_EVP_CIPHER *cipher);
     422WOLFSSL_API void wolfSSL_EVP_cleanup(void);
     423WOLFSSL_API int  wolfSSL_add_all_algorithms(void);
     424WOLFSSL_API int  wolfSSL_OpenSSL_add_all_algorithms_noconf(void);
     425
     426WOLFSSL_API int wolfSSL_PKCS5_PBKDF2_HMAC_SHA1(const char * pass, int passlen,
     427                                               const unsigned char * salt,
     428                                               int saltlen, int iter,
     429                                               int keylen, unsigned char *out);
    353430
    354431#define EVP_CIPH_STREAM_CIPHER WOLFSSL_EVP_CIPH_STREAM_CIPHER
     
    371448#define WOLFSSL_EVP_CIPH_CCM_MODE           0x7
    372449#define WOLFSSL_EVP_CIPH_NO_PADDING       0x100
     450#define WOLFSSL_EVP_CIPH_TYPE_INIT         0xff
    373451
    374452/* end OpenSSH compat */
     
    379457typedef WOLFSSL_EVP_CIPHER_CTX EVP_CIPHER_CTX;
    380458
     459#ifndef NO_MD4
     460    #define EVP_md4       wolfSSL_EVP_md4
     461#endif
    381462#ifndef NO_MD5
    382463    #define EVP_md5       wolfSSL_EVP_md5
    383464#endif
    384465#define EVP_sha1      wolfSSL_EVP_sha1
     466#define EVP_dds1      wolfSSL_EVP_sha1
    385467#define EVP_sha224    wolfSSL_EVP_sha224
    386468#define EVP_sha256    wolfSSL_EVP_sha256
     
    414496#define EVP_MD_CTX_cleanup wolfSSL_EVP_MD_CTX_cleanup
    415497#define EVP_MD_CTX_md      wolfSSL_EVP_MD_CTX_md
    416 #define EVP_MD_CTX_type    wolfSSL_EVP_MD_type
     498#define EVP_MD_CTX_type    wolfSSL_EVP_MD_CTX_type
    417499#define EVP_MD_type        wolfSSL_EVP_MD_type
    418500
     
    425507#define EVP_DigestSignUpdate wolfSSL_EVP_DigestSignUpdate
    426508#define EVP_DigestSignFinal  wolfSSL_EVP_DigestSignFinal
     509#define EVP_DigestVerifyInit   wolfSSL_EVP_DigestVerifyInit
     510#define EVP_DigestVerifyUpdate wolfSSL_EVP_DigestVerifyUpdate
     511#define EVP_DigestVerifyFinal  wolfSSL_EVP_DigestVerifyFinal
    427512#define EVP_BytesToKey     wolfSSL_EVP_BytesToKey
    428513
     
    438523
    439524#define EVP_CIPHER_iv_length          wolfSSL_EVP_CIPHER_iv_length
     525#define EVP_CIPHER_key_length         wolfSSL_EVP_Cipher_key_length
    440526
    441527#define EVP_CipherInit                wolfSSL_EVP_CipherInit
     
    465551#define EVP_get_digestbyname          wolfSSL_EVP_get_digestbyname
    466552
     553#define EVP_PKEY_asign_RSA             wolfSSL_EVP_PKEY_assign_RSA
     554#define EVP_PKEY_asign_EC_KEY          wolfSSL_EVP_PKEY_assign_EC_KEY
     555#define EVP_PKEY_get1_DSA              wolfSSL_EVP_PKEY_get1_DSA
    467556#define EVP_PKEY_get1_RSA   wolfSSL_EVP_PKEY_get1_RSA
    468557#define EVP_PKEY_get1_DSA   wolfSSL_EVP_PKEY_get1_DSA
     558#define EVP_PKEY_set1_RSA              wolfSSL_EVP_PKEY_set1_RSA
    469559#define EVP_PKEY_get1_EC_KEY wolfSSL_EVP_PKEY_get1_EC_KEY
    470560#define EVP_PKEY_get0_hmac  wolfSSL_EVP_PKEY_get0_hmac
    471561#define EVP_PKEY_new_mac_key       wolfSSL_EVP_PKEY_new_mac_key
     562#define EVP_MD_CTX_copy                wolfSSL_EVP_MD_CTX_copy
     563#define EVP_MD_CTX_copy_ex             wolfSSL_EVP_MD_CTX_copy_ex
     564#define EVP_PKEY_bits                  wolfSSL_EVP_PKEY_bits
     565#define EVP_PKEY_CTX_free              wolfSSL_EVP_PKEY_CTX_free
     566#define EVP_PKEY_CTX_new               wolfSSL_EVP_PKEY_CTX_new
     567#define EVP_PKEY_CTX_set_rsa_padding   wolfSSL_EVP_PKEY_CTX_set_rsa_padding
     568#define EVP_PKEY_decrypt               wolfSSL_EVP_PKEY_decrypt
     569#define EVP_PKEY_decrypt_init          wolfSSL_EVP_PKEY_decrypt_init
     570#define EVP_PKEY_encrypt               wolfSSL_EVP_PKEY_encrypt
     571#define EVP_PKEY_encrypt_init          wolfSSL_EVP_PKEY_encrypt_init
     572#define EVP_PKEY_new                   wolfSSL_PKEY_new
     573#define EVP_PKEY_free                  wolfSSL_EVP_PKEY_free
     574#define EVP_PKEY_size                  wolfSSL_EVP_PKEY_size
     575#define EVP_PKEY_type                  wolfSSL_EVP_PKEY_type
     576#define EVP_PKEY_base_id               wolfSSL_EVP_PKEY_base_id
     577#define EVP_PKEY_id                    wolfSSL_EVP_PKEY_id
     578#define EVP_SignFinal                  wolfSSL_EVP_SignFinal
     579#define EVP_SignInit                   wolfSSL_EVP_SignInit
     580#define EVP_SignUpdate                 wolfSSL_EVP_SignUpdate
     581#define EVP_VerifyFinal                wolfSSL_EVP_VerifyFinal
     582#define EVP_VerifyInit                 wolfSSL_EVP_VerifyInit
     583#define EVP_VerifyUpdate               wolfSSL_EVP_VerifyUpdate
    472584
    473585#define EVP_CIPHER_CTX_block_size  wolfSSL_EVP_CIPHER_CTX_block_size
     
    475587#define EVP_CIPHER_flags           wolfSSL_EVP_CIPHER_flags
    476588#define EVP_CIPHER_CTX_set_flags   wolfSSL_EVP_CIPHER_CTX_set_flags
     589#define EVP_CIPHER_CTX_clear_flags wolfSSL_EVP_CIPHER_CTX_clear_flags
    477590#define EVP_CIPHER_CTX_set_padding wolfSSL_EVP_CIPHER_CTX_set_padding
    478591#define EVP_CIPHER_CTX_flags       wolfSSL_EVP_CIPHER_CTX_flags
    479592#define EVP_add_digest             wolfSSL_EVP_add_digest
    480593#define EVP_add_cipher             wolfSSL_EVP_add_cipher
     594#define EVP_cleanup                wolfSSL_EVP_cleanup
     595
     596#define OpenSSL_add_all_digests()  wolfCrypt_Init()
     597#define OpenSSL_add_all_ciphers()  wolfCrypt_Init()
     598#define OpenSSL_add_all_algorithms wolfSSL_add_all_algorithms
     599#define OpenSSL_add_all_algorithms_noconf wolfSSL_OpenSSL_add_all_algorithms_noconf
     600#define wolfSSL_OPENSSL_add_all_algorithms_noconf wolfSSL_OpenSSL_add_all_algorithms_noconf
     601
     602#define PKCS5_PBKDF2_HMAC_SHA1     wolfSSL_PKCS5_PBKDF2_HMAC_SHA1
    481603
    482604#ifndef EVP_MAX_MD_SIZE
     
    489611#endif
    490612
     613WOLFSSL_API void printPKEY(WOLFSSL_EVP_PKEY *k);
     614
    491615#ifdef __cplusplus
    492616    } /* extern "C" */
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/hmac.h

    r337 r372  
    3737
    3838#include <wolfssl/openssl/evp.h>
     39#include <wolfssl/openssl/opensslv.h>
    3940#include <wolfssl/wolfcrypt/hmac.h>
    4041
     
    5354    Hmac hmac;
    5455    int  type;
     56    word32  save_ipad[WC_HMAC_BLOCK_SIZE  / sizeof(word32)];  /* same block size all*/
     57    word32  save_opad[WC_HMAC_BLOCK_SIZE  / sizeof(word32)];
    5558} WOLFSSL_HMAC_CTX;
    5659
    5760
    58 WOLFSSL_API void wolfSSL_HMAC_Init(WOLFSSL_HMAC_CTX* ctx, const void* key,
     61WOLFSSL_API int wolfSSL_HMAC_CTX_Init(WOLFSSL_HMAC_CTX* ctx);
     62WOLFSSL_API int wolfSSL_HMAC_CTX_copy(WOLFSSL_HMAC_CTX* des,
     63                                       WOLFSSL_HMAC_CTX* src);
     64WOLFSSL_LOCAL int wolfSSL_HmacCopy(Hmac* des, Hmac* src);
     65WOLFSSL_API int wolfSSL_HMAC_Init(WOLFSSL_HMAC_CTX* ctx, const void* key,
    5966                                 int keylen, const EVP_MD* type);
    6067WOLFSSL_API int wolfSSL_HMAC_Init_ex(WOLFSSL_HMAC_CTX* ctx, const void* key,
    61                                      int len, const EVP_MD* md, void* impl);
    62 WOLFSSL_API void wolfSSL_HMAC_Update(WOLFSSL_HMAC_CTX* ctx,
     68                             int keylen, const EVP_MD* type, WOLFSSL_ENGINE* e);
     69WOLFSSL_API int wolfSSL_HMAC_Update(WOLFSSL_HMAC_CTX* ctx,
    6370                                   const unsigned char* data, int len);
    64 WOLFSSL_API void wolfSSL_HMAC_Final(WOLFSSL_HMAC_CTX* ctx, unsigned char* hash,
     71WOLFSSL_API int wolfSSL_HMAC_Final(WOLFSSL_HMAC_CTX* ctx, unsigned char* hash,
    6572                                  unsigned int* len);
    66 WOLFSSL_API void wolfSSL_HMAC_cleanup(WOLFSSL_HMAC_CTX* ctx);
    67 
     73WOLFSSL_API int wolfSSL_HMAC_cleanup(WOLFSSL_HMAC_CTX* ctx);
    6874
    6975typedef struct WOLFSSL_HMAC_CTX HMAC_CTX;
     
    7177#define HMAC(a,b,c,d,e,f,g) wolfSSL_HMAC((a),(b),(c),(d),(e),(f),(g))
    7278
    73 #define HMAC_Init    wolfSSL_HMAC_Init
     79#define HMAC_CTX_init wolfSSL_HMAC_CTX_Init
     80#define HMAC_CTX_copy wolfSSL_HMAC_CTX_copy
    7481#define HMAC_Init_ex wolfSSL_HMAC_Init_ex
     82#define HMAC_Init     wolfSSL_HMAC_Init
    7583#define HMAC_Update  wolfSSL_HMAC_Update
    7684#define HMAC_Final   wolfSSL_HMAC_Final
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/md5.h

    r337 r372  
     1/* md5.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* md5.h for openssl */
    223
     
    2142
    2243typedef struct WOLFSSL_MD5_CTX {
    23     int holder[28 + (WC_ASYNC_DEV_SIZE / sizeof(int))];   /* big enough to hold wolfcrypt md5, but check on init */
     44    void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];   /* big enough to hold wolfcrypt md5, but check on init */
    2445} WOLFSSL_MD5_CTX;
    2546
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ocsp.h

    r337 r372  
     1/* ocsp.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ocsp.h for libcurl */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/opensslv.h

    r337 r372  
     1/* opensslv.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* opensslv.h compatibility */
    223
     
    627
    728/* api version compatibility */
    8 #if defined(HAVE_STUNNEL) || defined(HAVE_LIGHTY) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
     29#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(HAVE_LIGHTY) || \
     30    defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
    931     /* version number can be increased for Lighty after compatibility for ECDH
    1032        is added */
     
    1840
    1941#endif /* header */
    20 
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/pem.h

    r337 r372  
     1/* pem.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* pem.h for openssl */
     23
     24/*!
     25    \file wolfssl/openssl/pem.h
     26*/
    227
    328
     
    1439#endif
    1540
    16 #define PEM_write_bio_PrivateKey wolfSSL_PEM_write_bio_PrivateKey
    17 
    1841/* RSA */
    1942WOLFSSL_API
     
    2346                                        pem_password_cb* cb, void* arg);
    2447WOLFSSL_API
     48WOLFSSL_RSA* wolfSSL_PEM_read_bio_RSAPrivateKey(WOLFSSL_BIO* bio,
     49                                                  WOLFSSL_RSA**,
     50                                                  pem_password_cb* cb,
     51                                                  void* arg);
     52WOLFSSL_API
    2553int wolfSSL_PEM_write_mem_RSAPrivateKey(RSA* rsa, const EVP_CIPHER* cipher,
    2654                                        unsigned char* passwd, int len,
     
    2856#if !defined(NO_FILESYSTEM)
    2957WOLFSSL_API
    30 int wolfSSL_PEM_write_RSAPrivateKey(FILE *fp, WOLFSSL_RSA *rsa,
     58int wolfSSL_PEM_write_RSAPrivateKey(XFILE fp, WOLFSSL_RSA *rsa,
    3159                                    const EVP_CIPHER *enc,
    3260                                    unsigned char *kstr, int klen,
    3361                                    pem_password_cb *cb, void *u);
    3462WOLFSSL_API
    35 WOLFSSL_RSA *wolfSSL_PEM_read_RSAPublicKey(FILE *fp, WOLFSSL_RSA **x,
     63WOLFSSL_RSA *wolfSSL_PEM_read_RSAPublicKey(XFILE fp, WOLFSSL_RSA **x,
    3664                                           pem_password_cb *cb, void *u);
    3765WOLFSSL_API
    38 int wolfSSL_PEM_write_RSAPublicKey(FILE *fp, WOLFSSL_RSA *x);
     66int wolfSSL_PEM_write_RSAPublicKey(XFILE fp, WOLFSSL_RSA *x);
    3967
    4068WOLFSSL_API
    41 int wolfSSL_PEM_write_RSA_PUBKEY(FILE *fp, WOLFSSL_RSA *x);
     69int wolfSSL_PEM_write_RSA_PUBKEY(XFILE fp, WOLFSSL_RSA *x);
    4270#endif /* NO_FILESYSTEM */
    4371
     
    5684#if !defined(NO_FILESYSTEM)
    5785WOLFSSL_API
    58 int wolfSSL_PEM_write_DSAPrivateKey(FILE *fp, WOLFSSL_DSA *dsa,
     86int wolfSSL_PEM_write_DSAPrivateKey(XFILE fp, WOLFSSL_DSA *dsa,
    5987                                    const EVP_CIPHER *enc,
    6088                                    unsigned char *kstr, int klen,
    6189                                    pem_password_cb *cb, void *u);
    6290WOLFSSL_API
    63 int wolfSSL_PEM_write_DSA_PUBKEY(FILE *fp, WOLFSSL_DSA *x);
     91int wolfSSL_PEM_write_DSA_PUBKEY(XFILE fp, WOLFSSL_DSA *x);
    6492#endif /* NO_FILESYSTEM */
    6593
     
    77105#if !defined(NO_FILESYSTEM)
    78106WOLFSSL_API
    79 int wolfSSL_PEM_write_ECPrivateKey(FILE *fp, WOLFSSL_EC_KEY *key,
     107int wolfSSL_PEM_write_ECPrivateKey(XFILE fp, WOLFSSL_EC_KEY *key,
    80108                                   const EVP_CIPHER *enc,
    81109                                   unsigned char *kstr, int klen,
    82110                                   pem_password_cb *cb, void *u);
    83111WOLFSSL_API
    84 int wolfSSL_PEM_write_EC_PUBKEY(FILE *fp, WOLFSSL_EC_KEY *key);
     112int wolfSSL_PEM_write_EC_PUBKEY(XFILE fp, WOLFSSL_EC_KEY *key);
    85113#endif /* NO_FILESYSTEM */
    86114
     
    92120                                                  void* arg);
    93121WOLFSSL_API
     122WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_bio_PUBKEY(WOLFSSL_BIO* bio,
     123                                              WOLFSSL_EVP_PKEY **key,
     124                                              pem_password_cb *cb, void *pass);
     125WOLFSSL_API
    94126int wolfSSL_PEM_write_bio_PrivateKey(WOLFSSL_BIO* bio, WOLFSSL_EVP_PKEY* key,
    95127                                        const WOLFSSL_EVP_CIPHER* cipher,
     
    97129                                        pem_password_cb* cb, void* arg);
    98130
    99 WOLFSSL_API
    100 int wolfSSL_EVP_PKEY_type(int type);
    101131
    102132WOLFSSL_API
    103 int wolfSSL_EVP_PKEY_base_id(const EVP_PKEY *pkey);
     133int wolfSSL_PEM_read_bio(WOLFSSL_BIO* bio, char **name, char **header,
     134                         unsigned char **data, long *len);
     135WOLFSSL_API
     136int wolfSSL_PEM_write_bio(WOLFSSL_BIO *bio, const char *name,
     137                          const char *header, const unsigned char *data,
     138                          long len);
     139#if !defined(NO_FILESYSTEM)
     140WOLFSSL_API
     141int wolfSSL_PEM_read(XFILE fp, char **name, char **header, unsigned char **data,
     142                     long *len);
     143WOLFSSL_API
     144int wolfSSL_PEM_write(XFILE fp, const char *name, const char *header,
     145                      const unsigned char *data, long len);
     146#endif
    104147
    105148#if !defined(NO_FILESYSTEM)
    106149WOLFSSL_API
    107 WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x,
     150WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PUBKEY(XFILE fp, EVP_PKEY **x,
    108151                                                                                  pem_password_cb *cb, void *u);
    109152WOLFSSL_API
    110 WOLFSSL_X509 *wolfSSL_PEM_read_X509(FILE *fp, WOLFSSL_X509 **x,
     153WOLFSSL_X509 *wolfSSL_PEM_read_X509(XFILE fp, WOLFSSL_X509 **x,
    111154                                          pem_password_cb *cb, void *u);
    112155WOLFSSL_API
    113 WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PrivateKey(FILE *fp, WOLFSSL_EVP_PKEY **x,
     156WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PrivateKey(XFILE fp, WOLFSSL_EVP_PKEY **x,
    114157                                          pem_password_cb *cb, void *u);
     158
     159WOLFSSL_API
     160int wolfSSL_PEM_write_X509(XFILE fp, WOLFSSL_X509 *x);
    115161#endif /* NO_FILESYSTEM */
     162
     163#define PEM_read                        wolfSSL_PEM_read
     164#define PEM_read_bio                    wolfSSL_PEM_read_bio
     165#define PEM_write                       wolfSSL_PEM_write
     166#define PEM_write_bio                   wolfSSL_PEM_write_bio
    116167
    117168#define PEM_read_X509               wolfSSL_PEM_read_X509
    118169#define PEM_read_PrivateKey         wolfSSL_PEM_read_PrivateKey
     170#define PEM_write_X509                  wolfSSL_PEM_write_X509
    119171#define PEM_write_bio_PrivateKey    wolfSSL_PEM_write_bio_PrivateKey
     172#define PEM_write_bio_PKCS8PrivateKey   wolfSSL_PEM_write_bio_PKCS8PrivateKey
    120173/* RSA */
    121174#define PEM_write_bio_RSAPrivateKey wolfSSL_PEM_write_bio_RSAPrivateKey
     175#define PEM_read_bio_RSAPrivateKey      wolfSSL_PEM_read_bio_RSAPrivateKey
    122176#define PEM_write_RSAPrivateKey     wolfSSL_PEM_write_RSAPrivateKey
    123177#define PEM_write_RSA_PUBKEY        wolfSSL_PEM_write_RSA_PUBKEY
     
    135189#define PEM_read_bio_PrivateKey wolfSSL_PEM_read_bio_PrivateKey
    136190#define PEM_read_PUBKEY         wolfSSL_PEM_read_PUBKEY
    137 #define EVP_PKEY_type           wolfSSL_EVP_PKEY_type
     191#define PEM_read_bio_PUBKEY             wolfSSL_PEM_read_bio_PUBKEY
    138192
    139193#ifdef __cplusplus
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/rand.h

    r337 r372  
     1/* rand.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* rand.h for openSSL */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ripemd.h

    r337 r372  
     1/* ripemd.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* ripemd.h for openssl */
    223
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/rsa.h

    r337 r372  
     1/* rsa.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* rsa.h for openSSL */
    223
     
    1233#endif
    1334
    14 
    15 enum  {
    16     RSA_PKCS1_PADDING = 1,
    17     RSA_PKCS1_OAEP_PADDING = 4
    18  };
    19 
    20 /* rsaTypes */
    21 enum {
    22     NID_sha256 = 672,
    23     NID_sha384 = 673,
    24     NID_sha512 = 674
    25 };
     35/* Padding types */
     36#define RSA_PKCS1_PADDING      0
     37#define RSA_PKCS1_OAEP_PADDING 1
    2638
    2739#ifndef WOLFSSL_RSA_TYPE_DEFINED /* guard on redeclaration */
     
    3345
    3446struct WOLFSSL_RSA {
     47#ifdef WC_RSA_BLINDING
     48    WC_RNG* rng;              /* for PrivateDecrypt blinding */
     49#endif
    3550        WOLFSSL_BIGNUM* n;
    3651        WOLFSSL_BIGNUM* e;
     
    4156        WOLFSSL_BIGNUM* dmq1;      /* dQ */
    4257        WOLFSSL_BIGNUM* iqmp;      /* u */
     58    void*          heap;
    4359    void*          internal;  /* our RSA */
    4460    char           inSet;     /* internal set from external ? */
    4561    char           exSet;     /* external set from internal ? */
     62    char           ownRng;    /* flag for if the rng should be free'd */
    4663};
    4764
     
    5875WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, const unsigned char* fr,
    5976                                 unsigned char* to, WOLFSSL_RSA*, int padding);
     77WOLFSSL_API int wolfSSL_RSA_private_encrypt(int len, unsigned char* in,
     78                            unsigned char* out, WOLFSSL_RSA* rsa, int padding);
    6079
    6180WOLFSSL_API int wolfSSL_RSA_size(const WOLFSSL_RSA*);
     
    6382                               unsigned int mLen, unsigned char* sigRet,
    6483                               unsigned int* sigLen, WOLFSSL_RSA*);
     84WOLFSSL_API int wolfSSL_RSA_sign_ex(int type, const unsigned char* m,
     85                               unsigned int mLen, unsigned char* sigRet,
     86                               unsigned int* sigLen, WOLFSSL_RSA*, int);
     87WOLFSSL_API int wolfSSL_RSA_verify(int type, const unsigned char* m,
     88                               unsigned int mLen, const unsigned char* sig,
     89                               unsigned int sigLen, WOLFSSL_RSA*);
    6590WOLFSSL_API int wolfSSL_RSA_public_decrypt(int flen, const unsigned char* from,
    6691                                  unsigned char* to, WOLFSSL_RSA*, int padding);
    6792WOLFSSL_API int wolfSSL_RSA_GenAdd(WOLFSSL_RSA*);
    6893WOLFSSL_API int wolfSSL_RSA_LoadDer(WOLFSSL_RSA*, const unsigned char*, int sz);
     94WOLFSSL_API int wolfSSL_RSA_LoadDer_ex(WOLFSSL_RSA*, const unsigned char*, int sz, int opt);
    6995
     96#define WOLFSSL_RSA_LOAD_PRIVATE 1
     97#define WOLFSSL_RSA_LOAD_PUBLIC  2
     98#define WOLFSSL_RSA_F4           0x10001L
    7099
    71100#define RSA_new  wolfSSL_RSA_new
     
    77106#define RSA_public_encrypt  wolfSSL_RSA_public_encrypt
    78107#define RSA_private_decrypt wolfSSL_RSA_private_decrypt
     108#define RSA_private_encrypt wolfSSL_RSA_private_encrypt
    79109
    80110#define RSA_size           wolfSSL_RSA_size
    81111#define RSA_sign           wolfSSL_RSA_sign
     112#define RSA_verify          wolfSSL_RSA_verify
    82113#define RSA_public_decrypt wolfSSL_RSA_public_decrypt
    83114
     115#define RSA_F4             WOLFSSL_RSA_F4
    84116
    85117#ifdef __cplusplus
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/sha.h

    r337 r372  
     1/* sha.h
     2 *
     3 * Copyright (C) 2006-2017 wolfSSL Inc.
     4 *
     5 * This file is part of wolfSSL.
     6 *
     7 * wolfSSL is free software; you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation; either version 2 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * wolfSSL is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20 */
     21
    122/* sha.h for openssl */
    223
     
    1940typedef struct WOLFSSL_SHA_CTX {
    2041    /* big enough to hold wolfcrypt Sha, but check on init */
    21     int holder[28 + (WC_ASYNC_DEV_SIZE / sizeof(int))];
     42    void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
    2243} WOLFSSL_SHA_CTX;
    2344
     
    5475typedef struct WOLFSSL_SHA224_CTX {
    5576    /* big enough to hold wolfcrypt Sha224, but check on init */
    56     ALIGN16 int holder[34 + (WC_ASYNC_DEV_SIZE / sizeof(int))];
     77    ALIGN16 void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
    5778} WOLFSSL_SHA224_CTX;
    5879
     
    81102typedef struct WOLFSSL_SHA256_CTX {
    82103    /* big enough to hold wolfcrypt Sha256, but check on init */
    83     ALIGN16 int holder[34 + (WC_ASYNC_DEV_SIZE / sizeof(int))];
     104    ALIGN16 void* holder[(272 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
    84105} WOLFSSL_SHA256_CTX;
    85106
     
    99120#define SHA256_Update wolfSSL_SHA256_Update
    100121#define SHA256_Final  wolfSSL_SHA256_Final
     122#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
     123    /* SHA256 is only available in non-fips mode because of SHA256 enum in FIPS
     124     * build. */
     125    #define SHA256 wolfSSL_SHA256
     126#endif
    101127
    102128
     
    105131typedef struct WOLFSSL_SHA384_CTX {
    106132    /* big enough to hold wolfCrypt Sha384, but check on init */
    107     long long holder[32 + (WC_ASYNC_DEV_SIZE / sizeof(long long))];
     133    void* holder[(256 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
    108134} WOLFSSL_SHA384_CTX;
    109135
     
    123149#define SHA384_Update wolfSSL_SHA384_Update
    124150#define SHA384_Final  wolfSSL_SHA384_Final
    125 
     151#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
     152    /* SHA384 is only available in non-fips mode because of SHA384 enum in FIPS
     153     * build. */
     154    #define SHA384 wolfSSL_SHA384
     155#endif
    126156#endif /* WOLFSSL_SHA384 */
    127157
     
    130160typedef struct WOLFSSL_SHA512_CTX {
    131161    /* big enough to hold wolfCrypt Sha384, but check on init */
    132     long long holder[36 + (WC_ASYNC_DEV_SIZE / sizeof(long long))];
     162    void* holder[(288 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
    133163} WOLFSSL_SHA512_CTX;
    134164
     
    148178#define SHA512_Update wolfSSL_SHA512_Update
    149179#define SHA512_Final  wolfSSL_SHA512_Final
    150 
     180#if defined(NO_OLD_SHA_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
     181    /* SHA512 is only available in non-fips mode because of SHA512 enum in FIPS
     182     * build. */
     183    #define SHA512 wolfSSL_SHA512
     184#endif
    151185#endif /* WOLFSSL_SHA512 */
    152186
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/openssl/ssl.h

    r337 r372  
    3131
    3232/* wolfssl_openssl compatibility layer */
     33#ifndef OPENSSL_EXTRA_SSL_GUARD
     34#define OPENSSL_EXTRA_SSL_GUARD
    3335#include <wolfssl/ssl.h>
     36#endif /* OPENSSL_EXTRA_SSL_GUARD */
    3437
    3538#include <wolfssl/openssl/evp.h>
     39#ifdef OPENSSL_EXTRA
     40#include <wolfssl/openssl/crypto.h>
     41#endif
     42
     43#if defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY)
     44#include <wolfssl/wolfcrypt/asn.h>
     45#endif
    3646
    3747#ifdef __cplusplus
     
    5666
    5767typedef WOLFSSL_X509       X509;
     68typedef WOLFSSL_X509       X509_REQ;
    5869typedef WOLFSSL_X509_NAME  X509_NAME;
    5970typedef WOLFSSL_X509_CHAIN X509_CHAIN;
    6071
     72typedef WOLFSSL_STACK      EXTENDED_KEY_USAGE;
     73
    6174
    6275/* redeclare guard */
    6376#define WOLFSSL_TYPES_DEFINED
    6477
    65 
    66 typedef WOLFSSL_EVP_PKEY               EVP_PKEY;
    6778typedef WOLFSSL_BIO                    BIO;
    6879typedef WOLFSSL_BIO_METHOD             BIO_METHOD;
     
    8798#define ASN1_GENERALIZEDTIME WOLFSSL_ASN1_TIME
    8899
    89 typedef WOLFSSL_MD4_CTX        MD4_CTX;
    90100typedef WOLFSSL_COMP_METHOD    COMP_METHOD;
    91101typedef WOLFSSL_X509_REVOKED   X509_REVOKED;
     
    94104typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
    95105
     106#define EVP_CIPHER_INFO        EncryptedInfo
     107
     108#define STACK_OF(x) WOLFSSL_STACK
     109
    96110#define CRYPTO_free   XFREE
    97111#define CRYPTO_malloc XMALLOC
     112#define CRYPTO_EX_new                   WOLFSSL_CRYPTO_EX_new
     113#define CRYPTO_EX_dup                   WOLFSSL_CRYPTO_EX_dup
     114#define CRYPTO_EX_free                  WOLFSSL_CRYPTO_EX_free
     115
     116/* depreciated */
     117#define CRYPTO_thread_id                wolfSSL_thread_id
     118#define CRYPTO_set_id_callback          wolfSSL_set_id_callback
     119 
     120#define CRYPTO_LOCK             0x01
     121#define CRYPTO_UNLOCK           0x02
     122#define CRYPTO_READ             0x04
     123#define CRYPTO_WRITE            0x08
     124
     125#define CRYPTO_set_locking_callback     wolfSSL_set_locking_callback
     126#define CRYPTO_set_dynlock_create_callback  wolfSSL_set_dynlock_create_callback
     127#define CRYPTO_set_dynlock_lock_callback wolfSSL_set_dynlock_lock_callback
     128#define CRYPTO_set_dynlock_destroy_callback wolfSSL_set_dynlock_destroy_callback
     129#define CRYPTO_num_locks                wolfSSL_num_locks
     130#define CRYPTO_dynlock_value            WOLFSSL_dynlock_value
     131
     132#define CRYPTO_cleanup_all_ex_data      wolfSSL_cleanup_all_ex_data
     133
     134/* this function was used to set the default malloc, free, and realloc */
     135#define CRYPTO_malloc_init() /* CRYPTO_malloc_init is not needed */
    98136
    99137#define SSL_get_client_random(ssl,out,outSz) \
     
    103141#define SSL_get_shared_ciphers(ctx,buf,len) \
    104142                                   wolfSSL_get_shared_ciphers((ctx),(buf),(len))
    105 
    106 #define ERR_print_errors_fp(file) wolfSSL_ERR_dump_errors_fp((file))
    107143
    108144/* at the moment only returns ok */
     
    115151#define SSL_use_certificate           wolfSSL_use_certificate
    116152#define SSL_use_certificate_ASN1      wolfSSL_use_certificate_ASN1
    117 
     153#define d2i_PKCS8_PRIV_KEY_INFO_bio     wolfSSL_d2i_PKCS8_PKEY_bio
     154#define d2i_PKCS8PrivateKey_bio         wolfSSL_d2i_PKCS8PrivateKey_bio
     155#define PKCS8_PRIV_KEY_INFO_free        wolfSSL_EVP_PKEY_free
     156#define d2i_PKCS12_fp                   wolfSSL_d2i_PKCS12_fp
     157
     158#define d2i_PUBKEY                      wolfSSL_d2i_PUBKEY
     159#define d2i_PUBKEY_bio                  wolfSSL_d2i_PUBKEY_bio
     160#define d2i_PrivateKey                  wolfSSL_d2i_PrivateKey
     161#define d2i_AutoPrivateKey              wolfSSL_d2i_AutoPrivateKey
    118162#define SSL_use_PrivateKey         wolfSSL_use_PrivateKey
    119163#define SSL_use_PrivateKey_ASN1    wolfSSL_use_PrivateKey_ASN1
     
    122166
    123167#define SSLv23_method       wolfSSLv23_method
     168#define SSLv23_client_method            wolfSSLv23_client_method
     169#define SSLv2_client_method             wolfSSLv2_client_method
     170#define SSLv2_server_method             wolfSSLv2_server_method
    124171#define SSLv3_server_method wolfSSLv3_server_method
    125172#define SSLv3_client_method wolfSSLv3_client_method
     173#define TLSv1_method                    wolfTLSv1_method
    126174#define TLSv1_server_method wolfTLSv1_server_method
    127175#define TLSv1_client_method wolfTLSv1_client_method
     176#define TLSv1_1_method                  wolfTLSv1_1_method
    128177#define TLSv1_1_server_method wolfTLSv1_1_server_method
    129178#define TLSv1_1_client_method wolfTLSv1_1_client_method
     179#define TLSv1_2_method                  wolfTLSv1_2_method
    130180#define TLSv1_2_server_method wolfTLSv1_2_server_method
    131181#define TLSv1_2_client_method wolfTLSv1_2_client_method
     182#define TLSv1_3_method                  wolfTLSv1_3_method
     183#define TLSv1_3_server_method           wolfTLSv1_3_server_method
     184#define TLSv1_3_client_method           wolfTLSv1_3_client_method
     185
     186#define X509_FILETYPE_ASN1 SSL_FILETYPE_ASN1
    132187
    133188#ifdef WOLFSSL_DTLS
     
    185240#define SSL_CTX_set_cipher_list wolfSSL_CTX_set_cipher_list
    186241#define SSL_set_cipher_list     wolfSSL_set_cipher_list
    187 
    188 #define ERR_error_string wolfSSL_ERR_error_string
    189 #define ERR_error_string_n wolfSSL_ERR_error_string_n
    190 #define ERR_reason_error_string wolfSSL_ERR_reason_error_string
    191242
    192243#define SSL_set_ex_data wolfSSL_set_ex_data
     
    216267#define SSL_SESSION_get_master_key_length wolfSSL_SESSION_get_master_key_length
    217268
    218 #define X509_NAME_get_text_by_NID wolfSSL_X509_NAME_get_text_by_NID
    219 #define X509_get_ext_d2i wolfSSL_X509_get_ext_d2i
    220 #define X509_digest wolfSSL_X509_digest
     269#define DSA_dup_DH                      wolfSSL_DSA_dup_DH
     270 
     271#define i2d_X509_bio                    wolfSSL_i2d_X509_bio
     272#define d2i_X509_bio                    wolfSSL_d2i_X509_bio
     273#define d2i_X509_fp                     wolfSSL_d2i_X509_fp
     274#define i2d_X509                        wolfSSL_i2d_X509
     275#define d2i_X509                        wolfSSL_d2i_X509
     276#define PEM_read_bio_X509               wolfSSL_PEM_read_bio_X509
     277#define PEM_read_bio_X509_AUX           wolfSSL_PEM_read_bio_X509_AUX
     278#define PEM_read_X509                   wolfSSL_PEM_read_X509
     279#define PEM_write_bio_X509              wolfSSL_PEM_write_bio_X509
     280#define PEM_write_bio_X509_AUX          wolfSSL_PEM_write_bio_X509_AUX
     281
     282#define i2d_X509_REQ                    wolfSSL_i2d_X509_REQ
     283#define X509_REQ_new                    wolfSSL_X509_REQ_new
     284#define X509_REQ_free                   wolfSSL_X509_REQ_free
     285#define X509_REQ_sign                   wolfSSL_X509_REQ_sign
     286#define X509_REQ_set_subject_name       wolfSSL_X509_REQ_set_subject_name
     287#define X509_REQ_set_pubkey             wolfSSL_X509_REQ_set_pubkey
     288#define PEM_write_bio_X509_REQ          wolfSSL_PEM_write_bio_X509_REQ
     289
     290#define X509_new                        wolfSSL_X509_new
    221291#define X509_free wolfSSL_X509_free
    222 #define OPENSSL_free wolfSSL_OPENSSL_free
     292#define X509_load_certificate_file      wolfSSL_X509_load_certificate_file
     293#define X509_digest                     wolfSSL_X509_digest
     294#define X509_get_ext_d2i                wolfSSL_X509_get_ext_d2i
     295#define X509_get_issuer_name            wolfSSL_X509_get_issuer_name
     296#define X509_get_subject_name           wolfSSL_X509_get_subject_name
     297#define X509_get_pubkey                 wolfSSL_X509_get_pubkey
     298#define X509_get_notBefore(cert)      (ASN1_TIME*)wolfSSL_X509_notBefore((cert))
     299#define X509_get_notAfter(cert)       (ASN1_TIME*)wolfSSL_X509_notAfter((cert))
     300#define X509_get_serialNumber           wolfSSL_X509_get_serialNumber
     301#define X509_get0_pubkey_bitstr         wolfSSL_X509_get0_pubkey_bitstr
     302#define X509_get_ex_new_index           wolfSSL_X509_get_ex_new_index
     303#define X509_get_ex_data                wolfSSL_X509_get_ex_data
     304#define X509_set_ex_data                wolfSSL_X509_set_ex_data
     305#define X509_get1_ocsp                  wolfSSL_X509_get1_ocsp
     306#ifndef WOLFSSL_HAPROXY
     307#define X509_get_version                wolfSSL_X509_get_version
     308#endif
     309#define X509_get_signature_nid          wolfSSL_X509_get_signature_nid
     310#define X509_set_subject_name           wolfSSL_X509_set_subject_name
     311#define X509_set_pubkey                 wolfSSL_X509_set_pubkey
     312#define X509_print                      wolfSSL_X509_print
     313#define X509_verify_cert_error_string   wolfSSL_X509_verify_cert_error_string
     314#define X509_verify_cert                wolfSSL_X509_verify_cert
     315#define X509_check_private_key          wolfSSL_X509_check_private_key
     316#define X509_check_ca                   wolfSSL_X509_check_ca
     317#define X509_check_host                 wolfSSL_X509_check_host
     318#define X509_email_free                 wolfSSL_X509_email_free
     319#define X509_check_issued               wolfSSL_X509_check_issued
     320#define X509_dup                        wolfSSL_X509_dup
     321 
     322#define sk_X509_new                     wolfSSL_sk_X509_new
     323#define sk_X509_num                     wolfSSL_sk_X509_num
     324#define sk_X509_value                   wolfSSL_sk_X509_value
     325#define sk_X509_push                    wolfSSL_sk_X509_push
     326#define sk_X509_pop                     wolfSSL_sk_X509_pop
     327#define sk_X509_pop_free                wolfSSL_sk_X509_pop_free
     328#define sk_X509_free                    wolfSSL_sk_X509_free
     329
     330#define i2d_X509_NAME                   wolfSSL_i2d_X509_NAME
     331#define X509_NAME_new                   wolfSSL_X509_NAME_new
     332#define X509_NAME_free                  wolfSSL_X509_NAME_free
     333#define X509_NAME_get_text_by_NID       wolfSSL_X509_NAME_get_text_by_NID
     334#define X509_NAME_cmp                   wolfSSL_X509_NAME_cmp
     335#define X509_NAME_ENTRY_free            wolfSSL_X509_NAME_ENTRY_free
     336#define X509_NAME_ENTRY_create_by_NID   wolfSSL_X509_NAME_ENTRY_create_by_NID
     337#define X509_NAME_add_entry             wolfSSL_X509_NAME_add_entry
     338#define X509_NAME_add_entry_by_txt      wolfSSL_X509_NAME_add_entry_by_txt
     339#define X509_NAME_oneline               wolfSSL_X509_NAME_oneline
     340#define X509_NAME_get_index_by_NID      wolfSSL_X509_NAME_get_index_by_NID
     341#define X509_NAME_print_ex              wolfSSL_X509_NAME_print_ex
     342#define X509_NAME_digest                wolfSSL_X509_NAME_digest
     343#define X509_cmp_current_time           wolfSSL_X509_cmp_current_time
     344
     345#define sk_X509_NAME_pop_free           wolfSSL_sk_X509_NAME_pop_free
     346#define sk_X509_NAME_num                wolfSSL_sk_X509_NAME_num
     347#define sk_X509_NAME_value              wolfSSL_sk_X509_NAME_value
     348
     349    typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY;
     350
     351#define X509_NAME_entry_count           wolfSSL_X509_NAME_entry_count
     352#define X509_NAME_ENTRY_get_object      wolfSSL_X509_NAME_ENTRY_get_object
     353#define X509_NAME_get_entry             wolfSSL_X509_NAME_get_entry
     354#define X509_NAME_ENTRY_get_data        wolfSSL_X509_NAME_ENTRY_get_data
     355#define X509_NAME_ENTRY_get_object      wolfSSL_X509_NAME_ENTRY_get_object
     356
     357#define X509_V_FLAG_CRL_CHECK     WOLFSSL_CRL_CHECK
     358#define X509_V_FLAG_CRL_CHECK_ALL WOLFSSL_CRL_CHECKALL
     359
     360#define X509_V_FLAG_USE_CHECK_TIME WOLFSSL_USE_CHECK_TIME
     361#define X509_V_FLAG_NO_CHECK_TIME  WOLFSSL_NO_CHECK_TIME
     362#define X509_CHECK_FLAG_NO_WILDCARDS WOLFSSL_NO_WILDCARDS
     363
     364#define X509_STORE_CTX_get_current_cert wolfSSL_X509_STORE_CTX_get_current_cert
     365#define X509_STORE_CTX_set_verify_cb    wolfSSL_X509_STORE_CTX_set_verify_cb
     366#define X509_STORE_CTX_new              wolfSSL_X509_STORE_CTX_new
     367#define X509_STORE_CTX_free             wolfSSL_X509_STORE_CTX_free
     368#define X509_STORE_CTX_get_chain        wolfSSL_X509_STORE_CTX_get_chain
     369#define X509_STORE_CTX_get_error        wolfSSL_X509_STORE_CTX_get_error
     370#define X509_STORE_CTX_get_error_depth  wolfSSL_X509_STORE_CTX_get_error_depth
     371#define X509_STORE_CTX_init             wolfSSL_X509_STORE_CTX_init
     372#define X509_STORE_CTX_cleanup          wolfSSL_X509_STORE_CTX_cleanup
     373#define X509_STORE_CTX_set_error        wolfSSL_X509_STORE_CTX_set_error
     374#define X509_STORE_CTX_get_ex_data      wolfSSL_X509_STORE_CTX_get_ex_data
     375 
     376#define X509_STORE_new                  wolfSSL_X509_STORE_new
     377#define X509_STORE_free                 wolfSSL_X509_STORE_free
     378#define X509_STORE_add_lookup           wolfSSL_X509_STORE_add_lookup
     379#define X509_STORE_add_cert             wolfSSL_X509_STORE_add_cert
     380#define X509_STORE_add_crl              wolfSSL_X509_STORE_add_crl
     381#define X509_STORE_set_flags            wolfSSL_X509_STORE_set_flags
     382#define X509_STORE_get1_certs           wolfSSL_X509_STORE_get1_certs
     383#define X509_STORE_get_by_subject       wolfSSL_X509_STORE_get_by_subject
     384#define X509_STORE_CTX_get1_issuer      wolfSSL_X509_STORE_CTX_get1_issuer
     385#define X509_STORE_CTX_set_time         wolfSSL_X509_STORE_CTX_set_time
     386
     387#define X509_LOOKUP_add_dir             wolfSSL_X509_LOOKUP_add_dir
     388#define X509_LOOKUP_load_file           wolfSSL_X509_LOOKUP_load_file
     389#define X509_LOOKUP_hash_dir            wolfSSL_X509_LOOKUP_hash_dir
     390#define X509_LOOKUP_file                wolfSSL_X509_LOOKUP_file
     391 
     392#define d2i_X509_CRL                    wolfSSL_d2i_X509_CRL
     393#define d2i_X509_CRL_fp                 wolfSSL_d2i_X509_CRL_fp
     394#define PEM_read_X509_CRL               wolfSSL_PEM_read_X509_CRL
     395 
     396#define X509_CRL_free                   wolfSSL_X509_CRL_free
     397#define X509_CRL_get_lastUpdate         wolfSSL_X509_CRL_get_lastUpdate
     398#define X509_CRL_get_nextUpdate         wolfSSL_X509_CRL_get_nextUpdate
     399#define X509_CRL_verify                 wolfSSL_X509_CRL_verify
     400#define X509_CRL_get_REVOKED            wolfSSL_X509_CRL_get_REVOKED
     401
     402#define sk_X509_REVOKED_num             wolfSSL_sk_X509_REVOKED_num
     403#define sk_X509_REVOKED_value           wolfSSL_sk_X509_REVOKED_value
     404
     405#define X509_OBJECT_free_contents       wolfSSL_X509_OBJECT_free_contents
    223406
    224407#define OCSP_parse_url wolfSSL_OCSP_parse_url
    225 #define SSLv23_client_method wolfSSLv23_client_method
    226 #define SSLv2_client_method wolfSSLv2_client_method
    227 #define SSLv2_server_method wolfSSLv2_server_method
    228408
    229409#define MD4_Init wolfSSL_MD4_Init
     
    260440#define BIO_set_flags wolfSSL_BIO_set_flags
    261441
    262 #define OpenSSL_add_all_digests()
    263 #define OpenSSL_add_all_algorithms wolfSSL_add_all_algorithms
    264442#define SSLeay_add_ssl_algorithms  wolfSSL_add_all_algorithms
    265443#define SSLeay_add_all_algorithms  wolfSSL_add_all_algorithms
     
    271449#define RAND_egd        wolfSSL_RAND_egd
    272450#define RAND_seed       wolfSSL_RAND_seed
     451#define RAND_cleanup                    wolfSSL_RAND_Cleanup
    273452#define RAND_add        wolfSSL_RAND_add
     453#define RAND_poll                       wolfSSL_RAND_poll
     454#define RAND_status                     wolfSSL_RAND_status
     455#define RAND_bytes                      wolfSSL_RAND_bytes
     456#define RAND_pseudo_bytes               wolfSSL_RAND_pseudo_bytes
    274457
    275458#define COMP_zlib                       wolfSSL_COMP_zlib
     
    279462#define SSL_get_ex_new_index wolfSSL_get_ex_new_index
    280463
    281 #define CRYPTO_set_id_callback wolfSSL_set_id_callback
    282 #define CRYPTO_set_locking_callback wolfSSL_set_locking_callback
    283 #define CRYPTO_set_dynlock_create_callback wolfSSL_set_dynlock_create_callback
    284 #define CRYPTO_set_dynlock_lock_callback wolfSSL_set_dynlock_lock_callback
    285 #define CRYPTO_set_dynlock_destroy_callback wolfSSL_set_dynlock_destroy_callback
    286 #define CRYPTO_num_locks wolfSSL_num_locks
    287 
    288 
    289 #define CRYPTO_LOCK             1
    290 #define CRYPTO_UNLOCK           2
    291 #define CRYPTO_READ             4
    292 #define CRYPTO_WRITE            8
    293 
    294 #define X509_STORE_CTX_get_current_cert wolfSSL_X509_STORE_CTX_get_current_cert
    295 #define X509_STORE_add_cert             wolfSSL_X509_STORE_add_cert
    296 #define X509_STORE_set_flags            wolfSSL_X509_STORE_set_flags
    297 #define X509_STORE_CTX_get_chain        wolfSSL_X509_STORE_CTX_get_chain
    298 #define X509_STORE_CTX_get_error wolfSSL_X509_STORE_CTX_get_error
    299 #define X509_STORE_CTX_get_error_depth wolfSSL_X509_STORE_CTX_get_error_depth
    300 
    301 #define X509_NAME_oneline             wolfSSL_X509_NAME_oneline
    302 #define X509_get_issuer_name          wolfSSL_X509_get_issuer_name
    303 #define X509_get_subject_name         wolfSSL_X509_get_subject_name
    304 #define X509_verify_cert_error_string wolfSSL_X509_verify_cert_error_string
    305 
    306 #define X509_LOOKUP_add_dir wolfSSL_X509_LOOKUP_add_dir
    307 #define X509_LOOKUP_load_file wolfSSL_X509_LOOKUP_load_file
    308 #define X509_LOOKUP_hash_dir wolfSSL_X509_LOOKUP_hash_dir
    309 #define X509_LOOKUP_file wolfSSL_X509_LOOKUP_file
    310 
    311 #define X509_STORE_add_lookup wolfSSL_X509_STORE_add_lookup
    312 #define X509_STORE_new wolfSSL_X509_STORE_new
    313 #define X509_STORE_get_by_subject wolfSSL_X509_STORE_get_by_subject
    314 #define X509_STORE_CTX_init wolfSSL_X509_STORE_CTX_init
    315 #define X509_STORE_CTX_cleanup wolfSSL_X509_STORE_CTX_cleanup
    316 
    317 #define X509_CRL_get_lastUpdate wolfSSL_X509_CRL_get_lastUpdate
    318 #define X509_CRL_get_nextUpdate wolfSSL_X509_CRL_get_nextUpdate
    319 
    320 #define X509_get_pubkey           wolfSSL_X509_get_pubkey
    321 #define X509_CRL_verify           wolfSSL_X509_CRL_verify
    322 #define X509_STORE_CTX_set_error  wolfSSL_X509_STORE_CTX_set_error
    323 #define X509_OBJECT_free_contents wolfSSL_X509_OBJECT_free_contents
    324 #define EVP_PKEY_new              wolfSSL_PKEY_new
    325 #define EVP_PKEY_free             wolfSSL_EVP_PKEY_free
    326 #define EVP_PKEY_type             wolfSSL_EVP_PKEY_type
    327 #define EVP_PKEY_base_id          wolfSSL_EVP_PKEY_base_id
    328 #define X509_cmp_current_time     wolfSSL_X509_cmp_current_time
    329 #define sk_X509_REVOKED_num       wolfSSL_sk_X509_REVOKED_num
    330 #define X509_CRL_get_REVOKED      wolfSSL_X509_CRL_get_REVOKED
    331 #define sk_X509_REVOKED_value     wolfSSL_sk_X509_REVOKED_value
    332 #define X509_get_notBefore(cert)  (ASN1_TIME*)wolfSSL_X509_notBefore((cert))
    333 #define X509_get_notAfter(cert)   (ASN1_TIME*)wolfSSL_X509_notAfter((cert))
    334 
    335 
    336 #define X509_get_serialNumber wolfSSL_X509_get_serialNumber
    337 
     464
     465typedef WOLFSSL_ASN1_BIT_STRING    ASN1_BIT_STRING;
     466
     467#define ASN1_TIME_adj                   wolfSSL_ASN1_TIME_adj
    338468#define ASN1_TIME_print              wolfSSL_ASN1_TIME_print
     469#define ASN1_TIME_to_generalizedtime    wolfSSL_ASN1_TIME_to_generalizedtime
    339470#define ASN1_GENERALIZEDTIME_print   wolfSSL_ASN1_GENERALIZEDTIME_print
    340 
     471#define ASN1_GENERALIZEDTIME_free       wolfSSL_ASN1_GENERALIZEDTIME_free
     472
     473#define ASN1_tag2str                    wolfSSL_ASN1_tag2str
     474
     475#define i2a_ASN1_INTEGER                wolfSSL_i2a_ASN1_INTEGER
     476#define i2c_ASN1_INTEGER                wolfSSL_i2c_ASN1_INTEGER
     477#define ASN1_INTEGER_new                wolfSSL_ASN1_INTEGER_new
     478#define ASN1_INTEGER_free               wolfSSL_ASN1_INTEGER_free
    341479#define ASN1_INTEGER_cmp wolfSSL_ASN1_INTEGER_cmp
    342480#define ASN1_INTEGER_get wolfSSL_ASN1_INTEGER_get
    343481#define ASN1_INTEGER_to_BN wolfSSL_ASN1_INTEGER_to_BN
     482
     483#define ASN1_STRING_data                wolfSSL_ASN1_STRING_data
     484#define ASN1_STRING_get0_data           wolfSSL_ASN1_STRING_data
     485#define ASN1_STRING_length              wolfSSL_ASN1_STRING_length
    344486#define ASN1_STRING_to_UTF8 wolfSSL_ASN1_STRING_to_UTF8
     487#define ASN1_STRING_print_ex            wolfSSL_ASN1_STRING_print_ex
     488
     489#define ASN1_UTCTIME_pr                 wolfSSL_ASN1_UTCTIME_pr
     490
     491#define ASN1_IA5STRING                  WOLFSSL_ASN1_STRING
     492
     493#define ASN1_OCTET_STRING               WOLFSSL_ASN1_STRING
    345494
    346495#define SSL_load_client_CA_file wolfSSL_load_client_CA_file
     
    350499#define SSL_CTX_set_cert_store             wolfSSL_CTX_set_cert_store
    351500#define SSL_CTX_get_cert_store             wolfSSL_CTX_get_cert_store
    352 #define X509_STORE_CTX_get_ex_data         wolfSSL_X509_STORE_CTX_get_ex_data
    353501#define SSL_get_ex_data_X509_STORE_CTX_idx wolfSSL_get_ex_data_X509_STORE_CTX_idx
    354502#define SSL_get_ex_data wolfSSL_get_ex_data
     
    357505#define SSL_CTX_set_default_passwd_cb wolfSSL_CTX_set_default_passwd_cb
    358506
    359 #define SSL_CTX_set_timeout(ctx, to) wolfSSL_CTX_set_timeout(ctx, (unsigned int) to)
     507#define SSL_CTX_set_timeout(ctx, to)    \
     508                                 wolfSSL_CTX_set_timeout(ctx, (unsigned int) to)
    360509#define SSL_CTX_set_info_callback wolfSSL_CTX_set_info_callback
    361 
    362 #define ERR_peek_error wolfSSL_ERR_peek_error
    363 #define ERR_peek_last_error_line  wolfSSL_ERR_peek_last_error_line
    364 #define ERR_peek_errors_fp         wolfSSL_ERR_peek_errors_fp
    365 #define ERR_GET_REASON wolfSSL_ERR_GET_REASON
     510#define SSL_CTX_set_alpn_protos         wolfSSL_CTX_set_alpn_protos
    366511
    367512#define SSL_alert_type_string wolfSSL_alert_type_string
     
    391536
    392537#define SSL_DEFAULT_CIPHER_LIST WOLFSSL_DEFAULT_CIPHER_LIST
    393 #define RSA_F4 WOLFSSL_RSA_F4
    394538
    395539#define SSL_CTX_set_psk_client_callback wolfSSL_CTX_set_psk_client_callback
     
    405549#define SSL_set_psk_server_callback wolfSSL_set_psk_server_callback
    406550
    407 #define ERR_get_error_line_data wolfSSL_ERR_get_error_line_data
    408 
     551/* system file ints for ERR_put_error */
     552#define SYS_F_ACCEPT      WOLFSSL_SYS_ACCEPT
     553#define SYS_F_BIND        WOLFSSL_SYS_BIND
     554#define SYS_F_CONNECT     WOLFSSL_SYS_CONNECT
     555#define SYS_F_FOPEN       WOLFSSL_SYS_FOPEN
     556#define SYS_F_FREAD       WOLFSSL_SYS_FREAD
     557#define SYS_F_GETADDRINFO WOLFSSL_SYS_GETADDRINFO
     558#define SYS_F_GETSOCKOPT  WOLFSSL_SYS_GETSOCKOPT
     559#define SYS_F_GETSOCKNAME WOLFSSL_SYS_GETSOCKNAME
     560#define SYS_F_OPENDIR     WOLFSSL_SYS_OPENDIR
     561#define SYS_F_SETSOCKOPT  WOLFSSL_SYS_SETSOCKOPT
     562#define SYS_F_SOCKET      WOLFSSL_SYS_SOCKET
     563#define SYS_F_GETHOSTBYNAME  WOLFSSL_SYS_GETHOSTBYNAME
     564#define SYS_F_GETNAMEINFO    WOLFSSL_SYS_GETNAMEINFO
     565#define SYS_F_GETSERVBYNAME  WOLFSSL_SYS_GETSERVBYNAME
     566#define SYS_F_IOCTLSOCKET    WOLFSSL_SYS_IOCTLSOCKET
     567#define SYS_F_LISTEN         WOLFSSL_SYS_LISTEN
     568
     569#define ERR_GET_REASON                  wolfSSL_ERR_GET_REASON
     570
     571#define ERR_put_error                   wolfSSL_ERR_put_error
     572#define ERR_peek_error                  wolfSSL_ERR_peek_error
     573#define ERR_peek_errors_fp              wolfSSL_ERR_peek_errors_fp
     574#define ERR_peek_error_line_data        wolfSSL_ERR_peek_error_line_data
     575#define ERR_peek_last_error             wolfSSL_ERR_peek_last_error
     576#define ERR_peek_last_error_line        wolfSSL_ERR_peek_last_error_line
     577#define ERR_get_error_line              wolfSSL_ERR_get_error_line
     578#define ERR_get_error_line_data         wolfSSL_ERR_get_error_line_data
    409579#define ERR_get_error wolfSSL_ERR_get_error
     580#define ERR_print_errors_fp(file)       wolfSSL_ERR_dump_errors_fp((file))
    410581#define ERR_clear_error wolfSSL_ERR_clear_error
    411 
    412 #define RAND_status wolfSSL_RAND_status
    413 #define RAND_bytes wolfSSL_RAND_bytes
     582#define ERR_free_strings                wolfSSL_ERR_free_strings
     583#define ERR_remove_state                wolfSSL_ERR_remove_state
     584#define ERR_remove_thread_state         wolfSSL_ERR_remove_thread_state
     585#define ERR_error_string                wolfSSL_ERR_error_string
     586#define ERR_error_string_n              wolfSSL_ERR_error_string_n
     587#define ERR_reason_error_string         wolfSSL_ERR_reason_error_string
     588#define ERR_load_BIO_strings            wolfSSL_ERR_load_BIO_strings
     589
    414590#define SSLv23_server_method wolfSSLv23_server_method
    415591#define SSL_CTX_set_options wolfSSL_CTX_set_options
    416 #define SSL_CTX_check_private_key wolfSSL_CTX_check_private_key
    417 
    418 #define ERR_free_strings wolfSSL_ERR_free_strings
    419 #define ERR_remove_state wolfSSL_ERR_remove_state
    420 #define EVP_cleanup wolfSSL_EVP_cleanup
    421 
    422 #define CRYPTO_cleanup_all_ex_data wolfSSL_cleanup_all_ex_data
     592#define SSL_CTX_get_options             wolfSSL_CTX_get_options
     593#define SSL_CTX_clear_options           wolfSSL_CTX_clear_options
     594
     595#define SSL_CTX_check_private_key       wolfSSL_CTX_check_private_key
     596#define SSL_check_private_key           wolfSSL_check_private_key
     597
    423598#define SSL_CTX_set_mode wolfSSL_CTX_set_mode
    424599#define SSL_CTX_get_mode wolfSSL_CTX_get_mode
     
    430605#define SSL_CTX_set_session_id_context wolfSSL_CTX_set_session_id_context
    431606#define SSL_get_peer_certificate wolfSSL_get_peer_certificate
     607#define SSL_get_peer_cert_chain         wolfSSL_get_peer_cert_chain
    432608
    433609#define SSL_want_read wolfSSL_want_read
     
    435611
    436612#define BIO_prf wolfSSL_BIO_prf
    437 #define ASN1_UTCTIME_pr wolfSSL_ASN1_UTCTIME_pr
    438613
    439614#define sk_num wolfSSL_sk_num
    440615#define sk_value wolfSSL_sk_value
    441 #define sk_X509_pop  wolfSSL_sk_X509_pop
    442 #define sk_X509_free wolfSSL_sk_X509_free
    443 #define d2i_X509_bio wolfSSL_d2i_X509_bio
     616
     617#define d2i_PKCS12_bio                  wolfSSL_d2i_PKCS12_bio
     618#define d2i_PKCS12_fp                   wolfSSL_d2i_PKCS12_fp
     619
     620#define d2i_RSAPublicKey                wolfSSL_d2i_RSAPublicKey
     621#define d2i_RSAPrivateKey               wolfSSL_d2i_RSAPrivateKey
     622#define i2d_RSAPrivateKey               wolfSSL_i2d_RSAPrivateKey
     623#define i2d_RSAPublicKey                wolfSSL_i2d_RSAPublicKey
    444624
    445625#define SSL_CTX_get_ex_data wolfSSL_CTX_get_ex_data
     
    455635#define SSL_SESSION_get_time wolfSSL_SESSION_get_time
    456636#define SSL_CTX_get_ex_new_index wolfSSL_CTX_get_ex_new_index
    457 #define PEM_read_bio_X509 wolfSSL_PEM_read_bio_X509
    458 #define PEM_read_bio_X509_AUX wolfSSL_PEM_read_bio_X509_AUX
     637#define PEM_read                        wolfSSL_PEM_read
     638#define PEM_write                       wolfSSL_PEM_write
     639#define PEM_get_EVP_CIPHER_INFO         wolfSSL_PEM_get_EVP_CIPHER_INFO
     640#define PEM_do_header                   wolfSSL_PEM_do_header
    459641
    460642/*#if OPENSSL_API_COMPAT < 0x10100000L*/
     
    467649#define SSL_set_tmp_rsa(ssl,rsa)             1
    468650/*#endif*/
     651
    469652#define CONF_modules_unload(a)
    470653
     
    474657#define SSL_get_default_timeout(ctx) 500
    475658
    476 /* Lighthttp compatibility */
    477 
    478 #if defined(HAVE_LIGHTY)  || defined(WOLFSSL_MYSQL_COMPATIBLE) || \
    479     defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \
    480     defined(HAVE_POCO_LIB) || defined(WOLFSSL_HAPROXY)
    481 typedef WOLFSSL_X509_NAME_ENTRY X509_NAME_ENTRY;
    482 
    483 #define X509_NAME_free wolfSSL_X509_NAME_free
    484659#define SSL_CTX_use_certificate wolfSSL_CTX_use_certificate
    485660#define SSL_CTX_use_PrivateKey wolfSSL_CTX_use_PrivateKey
    486661#define BIO_read_filename wolfSSL_BIO_read_filename
    487662#define BIO_s_file wolfSSL_BIO_s_file
    488 #define OBJ_nid2sn wolfSSL_OBJ_nid2sn
    489 #define OBJ_obj2nid wolfSSL_OBJ_obj2nid
    490 #define OBJ_sn2nid wolfSSL_OBJ_sn2nid
    491663#define SSL_CTX_set_verify_depth wolfSSL_CTX_set_verify_depth
    492664#define SSL_set_verify_depth wolfSSL_set_verify_depth
    493665#define SSL_get_app_data wolfSSL_get_app_data
    494666#define SSL_set_app_data wolfSSL_set_app_data
    495 #define X509_NAME_entry_count wolfSSL_X509_NAME_entry_count
    496 #define X509_NAME_ENTRY_get_object wolfSSL_X509_NAME_ENTRY_get_object
    497 #define X509_NAME_get_entry wolfSSL_X509_NAME_get_entry
    498 #define ASN1_STRING_data wolfSSL_ASN1_STRING_data
    499 #define ASN1_STRING_length wolfSSL_ASN1_STRING_length
    500 #define X509_NAME_get_index_by_NID wolfSSL_X509_NAME_get_index_by_NID
    501 #define X509_NAME_ENTRY_get_data wolfSSL_X509_NAME_ENTRY_get_data
    502 #define sk_X509_NAME_pop_free  wolfSSL_sk_X509_NAME_pop_free
    503667#define SHA1 wolfSSL_SHA1
    504 #define X509_check_private_key wolfSSL_X509_check_private_key
     668
    505669#define SSL_dup_CA_list wolfSSL_dup_CA_list
    506670
    507 #define NID_commonName 0x03 /* matchs ASN_COMMON_NAME in asn.h */
    508 
    509 #define OBJ_nid2ln wolfSSL_OBJ_nid2ln
    510 #define OBJ_txt2nid wolfSSL_OBJ_txt2nid
     671enum {
     672    GEN_DNS   = 0x02, /* ASN_DNS_TYPE */
     673    GEN_EMAIL = 0x01, /* ASN_RFC822_TYPE */
     674    GEN_URI   = 0x06  /* ASN_URI_TYPE */
     675};
     676
    511677#define PEM_read_bio_DHparams wolfSSL_PEM_read_bio_DHparams
    512678#define PEM_read_bio_DSAparams wolfSSL_PEM_read_bio_DSAparams
    513 #define PEM_write_bio_X509 wolfSSL_PEM_write_bio_X509
    514 
    515 
    516 #ifdef WOLFSSL_HAPROXY
     679
     680#if defined(OPENSSL_ALL) || defined(WOLFSSL_HAPROXY)
    517681#define SSL_get_rbio                      wolfSSL_SSL_get_rbio
    518682#define SSL_get_wbio                      wolfSSL_SSL_get_wbio
     
    520684#define SSL_get_ciphers(x)                wolfSSL_get_ciphers_compat(x)
    521685#define SSL_SESSION_get_id                wolfSSL_SESSION_get_id
    522 #define ASN1_STRING_get0_data             wolfSSL_ASN1_STRING_data
    523 #define SSL_get_cipher_bits(s,np)         wolfSSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
     686#define SSL_get_cipher_bits(s,np)       \
     687                          wolfSSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
    524688#define sk_SSL_CIPHER_num                 wolfSSL_sk_SSL_CIPHER_num
    525689#define sk_SSL_COMP_zero                  wolfSSL_sk_SSL_COMP_zero
    526690#define sk_SSL_CIPHER_value               wolfSSL_sk_SSL_CIPHER_value
    527 #endif /* WOLFSSL_HAPROXY */
    528 #endif /* HAVE_STUNNEL || HAVE_LIGHTY || WOLFSSL_MYSQL_COMPATIBLE || WOLFSSL_NGINX || HAVE_POCO_LIB || WOLFSSL_HAPROXY */
     691#endif /* OPENSSL_ALL || WOLFSSL_HAPROXY */
     692
     693#if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO)
     694#include <wolfssl/openssl/pem.h>
     695
     696typedef STACK_OF(WOLFSSL_ASN1_OBJECT) GENERAL_NAMES;
     697#define SSL_CTRL_CHAIN       88
     698#define BIO_CTRL_WPENDING    13
     699#define GEN_IPADD            7
     700#define ERR_LIB_SSL          20
     701#define SSL_R_SHORT_READ     10
     702#define ERR_R_PEM_LIB        9
     703#define V_ASN1_IA5STRING     22
     704#define SSL_CTRL_MODE        33       
     705
     706#define SSL_CTX_clear_chain_certs(ctx) SSL_CTX_set0_chain(ctx,NULL)
     707#define d2i_RSAPrivateKey_bio           wolfSSL_d2i_RSAPrivateKey_bio
     708#define SSL_CTX_use_RSAPrivateKey       wolfSSL_CTX_use_RSAPrivateKey
     709#define d2i_PrivateKey_bio              wolfSSL_d2i_PrivateKey_bio
     710#define BIO_new_bio_pair                wolfSSL_BIO_new_bio_pair
     711#define SSL_get_verify_callback         wolfSSL_get_verify_callback
     712#define GENERAL_NAMES_free(GENERAL_NAMES)NULL
     713
     714#define SSL_set_mode(ssl,op)         wolfSSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
     715
     716#define SSL_CTX_use_certificate_ASN1    wolfSSL_CTX_use_certificate_ASN1
     717#define SSL_CTX_set0_chain(ctx,sk) \
     718                             wolfSSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk))
     719#define SSL_CTX_get_app_data(ctx)       wolfSSL_CTX_get_ex_data(ctx,0)
     720#define SSL_CTX_set_app_data(ctx,arg)   wolfSSL_CTX_set_ex_data(ctx,0, \
     721                                                                  (char *)(arg))
     722#endif /* OPENSSL_ALL || WOLFSSL_ASIO */
    529723
    530724#define SSL_CTX_set_tmp_dh wolfSSL_CTX_set_tmp_dh
     
    533727#define BIO_ctrl            wolfSSL_BIO_ctrl
    534728#define BIO_ctrl_pending    wolfSSL_BIO_ctrl_pending
     729#define BIO_wpending                    wolfSSL_BIO_wpending
    535730#define BIO_get_mem_ptr     wolfSSL_BIO_get_mem_ptr
    536731#define BIO_int_ctrl        wolfSSL_BIO_int_ctrl
     
    551746#define BIO_set_mem_eof_return wolfSSL_BIO_set_mem_eof_return
    552747
     748#define TLSEXT_STATUSTYPE_ocsp  1
     749
    553750#define SSL_set_options      wolfSSL_set_options
    554751#define SSL_get_options      wolfSSL_get_options
     752#define SSL_clear_options               wolfSSL_clear_options
    555753#define SSL_set_tmp_dh       wolfSSL_set_tmp_dh
    556754#define SSL_clear_num_renegotiations    wolfSSL_clear_num_renegotiations
     
    561759#define SSL_get_tlsext_status_ids       wolfSSL_get_tlsext_status_ids
    562760#define SSL_set_tlsext_status_ids       wolfSSL_set_tlsext_status_ids
    563 #define SSL_get_tlsext_status_ocsp_resp wolfSSL_get_tlsext_status_ocsp_resp
     761#define SSL_get_tlsext_status_ocsp_res  wolfSSL_get_tlsext_status_ocsp_resp
     762#define SSL_set_tlsext_status_ocsp_res  wolfSSL_set_tlsext_status_ocsp_resp
    564763#define SSL_set_tlsext_status_ocsp_resp wolfSSL_set_tlsext_status_ocsp_resp
     764#define SSL_get_tlsext_status_ocsp_resp  wolfSSL_get_tlsext_status_ocsp_resp
    565765
    566766#define SSL_CTX_add_extra_chain_cert wolfSSL_CTX_add_extra_chain_cert
     
    615815#define SSL_CTX_ctrl wolfSSL_CTX_ctrl
    616816
    617 #define X509_V_FLAG_CRL_CHECK     WOLFSSL_CRL_CHECK
    618 #define X509_V_FLAG_CRL_CHECK_ALL WOLFSSL_CRL_CHECKALL
    619 
    620 #if defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX)
     817#define SSL3_RANDOM_SIZE                32 /* same as RAN_LEN in internal.h */
     818#if defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || defined(OPENSSL_EXTRA) \
     819                                                         || defined(OPENSSL_ALL)
    621820#include <wolfssl/openssl/asn1.h>
    622821
     
    628827#define SSL3_ST_SR_CLNT_HELLO_A         (0x110|0x2000)
    629828#define ASN1_STRFLGS_ESC_MSB             4
    630 #define X509_V_ERR_CERT_REJECTED         28
    631829
    632830#define SSL_MAX_MASTER_KEY_LENGTH        WOLFSSL_MAX_MASTER_KEY_LENGTH
     
    635833#define SSL_alert_type_string_long       wolfSSL_alert_type_string_long
    636834#define SSL_CIPHER_get_bits              wolfSSL_CIPHER_get_bits
    637 #define sk_X509_NAME_num                 wolfSSL_sk_X509_NAME_num
    638 #define sk_X509_num                      wolfSSL_sk_X509_num
    639 #define X509_NAME_print_ex               wolfSSL_X509_NAME_print_ex
    640 #define X509_get0_pubkey_bitstr          wolfSSL_X509_get0_pubkey_bitstr
     835#define sk_GENERAL_NAME_num             wolfSSL_sk_GENERAL_NAME_num
    641836#define SSL_CTX_get_options              wolfSSL_CTX_get_options
    642837
    643838#define SSL_CTX_flush_sessions           wolfSSL_flush_sessions
    644839#define SSL_CTX_add_session              wolfSSL_CTX_add_session
    645 #define SSL_get_SSL_CTX                  wolfSSL_get_SSL_CTX
    646840#define SSL_version                      wolfSSL_version
    647841#define SSL_get_state                    wolfSSL_get_state
    648842#define SSL_state_string_long            wolfSSL_state_string_long
    649 #define SSL_get_peer_cert_chain          wolfSSL_get_peer_cert_chain
    650 #define sk_X509_NAME_value               wolfSSL_sk_X509_NAME_value
    651 #define sk_X509_value                    wolfSSL_sk_X509_value
     843
     844#define sk_GENERAL_NAME_value           wolfSSL_sk_GENERAL_NAME_value
    652845#define SSL_SESSION_get_ex_data          wolfSSL_SESSION_get_ex_data
    653846#define SSL_SESSION_set_ex_data          wolfSSL_SESSION_set_ex_data
    654847#define SSL_SESSION_get_ex_new_index     wolfSSL_SESSION_get_ex_new_index
    655848#define SSL_SESSION_get_id               wolfSSL_SESSION_get_id
    656 #define CRYPTO_dynlock_value             WOLFSSL_dynlock_value
    657 typedef WOLFSSL_ASN1_BIT_STRING    ASN1_BIT_STRING;
    658 #define X509_STORE_get1_certs            wolfSSL_X509_STORE_get1_certs
    659 #define sk_X509_pop_free                 wolfSSL_sk_X509_pop_free
    660 
     849#define sk_GENERAL_NAME_pop_free        wolfSSL_sk_GENERAL_NAME_pop_free
     850#define GENERAL_NAME_free               NULL
     851
     852#define SSL3_AL_FATAL                   2
    661853#define SSL_TLSEXT_ERR_OK                    0
    662854#define SSL_TLSEXT_ERR_ALERT_FATAL           alert_fatal
     
    673865#define PSK_MAX_PSK_LEN                      256
    674866#define PSK_MAX_IDENTITY_LEN                 128
    675 #define ERR_remove_thread_state WOLFSSL_ERR_remove_thread_state
    676867#define SSL_CTX_clear_options wolfSSL_CTX_clear_options
    677868
     
    680871#define SSL_CTX_get_default_passwd_cb          wolfSSL_CTX_get_default_passwd_cb
    681872#define SSL_CTX_get_default_passwd_cb_userdata wolfSSL_CTX_get_default_passwd_cb_userdata
    682 
    683 /* certificate extension NIDs */
    684 #define NID_basic_constraints         133
    685 #define NID_key_usage                 129  /* 2.5.29.15 */
    686 #define NID_ext_key_usage             151  /* 2.5.29.37 */
    687 #define NID_subject_key_identifier    128
    688 #define NID_authority_key_identifier  149
    689 #define NID_private_key_usage_period  130  /* 2.5.29.16 */
    690 #define NID_subject_alt_name          131
    691 #define NID_issuer_alt_name           132
    692 #define NID_info_access               69
    693 #define NID_sinfo_access              79  /* id-pe 11 */
    694 #define NID_name_constraints          144 /* 2.5.29.30 */
    695 #define NID_certificate_policies      146
    696 #define NID_policy_mappings           147
    697 #define NID_policy_constraints        150
    698 #define NID_inhibit_any_policy        168 /* 2.5.29.54 */
    699 #define NID_tlsfeature                92  /* id-pe 24 */
    700 
    701873
    702874#define SSL_CTX_set_msg_callback        wolfSSL_CTX_set_msg_callback
     
    705877#define SSL_set_msg_callback_arg        wolfSSL_set_msg_callback_arg
    706878
    707 /* certificate extension NIDs */
    708 #define NID_basic_constraints         133
    709 #define NID_key_usage                 129  /* 2.5.29.15 */
    710 #define NID_ext_key_usage             151  /* 2.5.29.37 */
    711 #define NID_subject_key_identifier    128
    712 #define NID_authority_key_identifier  149
    713 #define NID_private_key_usage_period  130  /* 2.5.29.16 */
    714 #define NID_subject_alt_name          131
    715 #define NID_issuer_alt_name           132
    716 #define NID_info_access               69
    717 #define NID_sinfo_access              79  /* id-pe 11 */
    718 #define NID_name_constraints          144 /* 2.5.29.30 */
    719 #define NID_certificate_policies      146
    720 #define NID_policy_mappings           147
    721 #define NID_policy_constraints        150
    722 #define NID_inhibit_any_policy        168 /* 2.5.29.54 */
    723 #define NID_tlsfeature                92  /* id-pe 24 */
    724 
     879
     880/* Nginx uses this to determine if reached end of certs in file.
     881 * PEM_read_bio_X509 is called and the return error is lost.
     882 * The error that needs to be detected is: SSL_NO_PEM_HEADER.
     883 */
     884#define ERR_GET_LIB(l)  (int)((((unsigned long)l)>>24L)&0xffL)
     885#define PEM_R_NO_START_LINE     108
     886#define ERR_LIB_PEM             9
     887#define ERR_LIB_X509            10
    725888
    726889#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
    727     defined(WOLFSSL_MYSQL_COMPATIBLE)
     890    defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(OPENSSL_ALL) || \
     891    defined(HAVE_LIGHTY)
    728892
    729893#include <wolfssl/error-ssl.h>
     
    754918#define SSL_R_WRONG_VERSION_NUMBER                 VERSION_ERROR
    755919#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC  ENCRYPT_ERROR
    756 
    757 /* Nginx uses this to determine if reached end of certs in file.
    758  * PEM_read_bio_X509 is called and the return error is lost.
    759  * The error that needs to be detected is: SSL_NO_PEM_HEADER.
    760  */
    761 #define ERR_GET_LIB(l)  (int)((((unsigned long)l)>>24L)&0xffL)
    762 #define PEM_R_NO_START_LINE     108
    763 #define ERR_LIB_PEM             9
     920#define SSL_R_HTTPS_PROXY_REQUEST                  PARSE_ERROR
     921#define SSL_R_HTTP_REQUEST                         PARSE_ERROR
     922#define SSL_R_UNSUPPORTED_PROTOCOL                 VERSION_ERROR
     923
    764924
    765925#ifdef HAVE_SESSION_TICKET
     
    769929
    770930#define OPENSSL_config                    wolfSSL_OPENSSL_config
    771 #define X509_get_ex_new_index             wolfSSL_X509_get_ex_new_index
    772 #define X509_get_ex_data                  wolfSSL_X509_get_ex_data
    773 #define X509_set_ex_data                  wolfSSL_X509_set_ex_data
    774 #define X509_NAME_digest                  wolfSSL_X509_NAME_digest
     931#define OPENSSL_memdup                  wolfSSL_OPENSSL_memdup
    775932#define SSL_CTX_get_timeout               wolfSSL_SSL_CTX_get_timeout
    776933#define SSL_CTX_set_tmp_ecdh              wolfSSL_SSL_CTX_set_tmp_ecdh
     
    781938#define SSL_in_init                       wolfSSL_SSL_in_init
    782939#define SSL_get0_session                  wolfSSL_SSL_get0_session
    783 #define X509_check_host                   wolfSSL_X509_check_host
    784 #define i2a_ASN1_INTEGER                  wolfSSL_i2a_ASN1_INTEGER
    785 #define ERR_peek_error_line_data          wolfSSL_ERR_peek_error_line_data
    786940#define SSL_CTX_set_tlsext_ticket_key_cb  wolfSSL_CTX_set_tlsext_ticket_key_cb
    787 #define X509_email_free                   wolfSSL_X509_email_free
    788 #define X509_get1_ocsp                    wolfSSL_X509_get1_ocsp
    789941#define SSL_CTX_set_tlsext_status_cb      wolfSSL_CTX_set_tlsext_status_cb
    790 #define X509_check_issued                 wolfSSL_X509_check_issued
    791 #define X509_dup                          wolfSSL_X509_dup
    792 #define X509_STORE_CTX_new                wolfSSL_X509_STORE_CTX_new
    793 #define X509_STORE_CTX_free               wolfSSL_X509_STORE_CTX_free
    794942#define SSL_CTX_get_extra_chain_certs     wolfSSL_CTX_get_extra_chain_certs
    795 #define X509_STORE_CTX_get1_issuer        wolfSSL_X509_STORE_CTX_get1_issuer
    796943#define sk_OPENSSL_STRING_value           wolfSSL_sk_WOLFSSL_STRING_value
    797944#define SSL_get0_alpn_selected            wolfSSL_get0_alpn_selected
     
    804951#define SSL_CTX_set1_curves_list          wolfSSL_CTX_set1_curves_list
    805952
    806 #endif /* WOLFSSL_NGINX || WOLFSSL_HAPROXY */
     953#endif /* WOLFSSL_NGINX || WOLFSSL_HAPROXY || WOLFSSL_MYSQL_COMPATIBLE ||
     954          OPENSSL_ALL || HAVE_LIGHTY */
     955
     956#ifdef OPENSSL_EXTRA
     957#define SSL_CTX_add_client_CA           wolfSSL_CTX_add_client_CA
     958#define SSL_CTX_set_srp_password        wolfSSL_CTX_set_srp_password
     959#define SSL_CTX_set_srp_username        wolfSSL_CTX_set_srp_username
     960#define SSL_get_SSL_CTX                 wolfSSL_get_SSL_CTX
     961
     962#define ERR_NUM_ERRORS                  16
     963#define EVP_PKEY_RSA                    6
     964#define EVP_PKEY_RSA2                   19
     965#define SN_pkcs9_emailAddress           "Email"
     966#define LN_pkcs9_emailAddress           "emailAddress"
     967#define NID_pkcs9_emailAddress          48
     968#define OBJ_pkcs9_emailAddress          1L,2L,840L,113539L,1L,9L,1L
     969
     970#define SSL_get_rbio                    wolfSSL_SSL_get_rbio
     971#define SSL_get_wbio                    wolfSSL_SSL_get_wbio
     972#define SSL_do_handshake                wolfSSL_SSL_do_handshake
     973#endif  /* OPENSSL_EXTRA */
    807974
    808975#ifdef __cplusplus
     
    810977#endif
    811978
    812 
    813979#endif /* wolfSSL_openssl_h__ */
Note: See TracChangeset for help on using the changeset viewer.