Skip to content

Commit 74b4a55

Browse files
committed
Merge branch 'feature/update_wolfssl_to_commercial_version_3.15.7' into 'master'
feat(wolfssl): update wolfssl to commercial version 3.15.7 See merge request sdk/ESP8266_RTOS_SDK!716
2 parents e7d7389 + f56dfe2 commit 74b4a55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3311
-1518
lines changed

components/ssl/Kconfig

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ menu "SSL"
22

33
choice SSL_LIBRARY_CHOOSE
44
prompt "Choose SSL/TLS library"
5-
default SSL_USING_WOLFSSL
5+
default SSL_USING_MBEDTLS
66
help
77
Choose the SSL/TLS library which you want to use.
88

@@ -16,6 +16,17 @@ config SSL_USING_WOLFSSL
1616
bool "wolfSSL"
1717
endchoice
1818

19+
menu "wolfSSL"
20+
depends on SSL_USING_WOLFSSL
21+
22+
config WOLFSSL_DEBUG
23+
bool "Enable wolfSSL debugging"
24+
default n
25+
help
26+
Enable wolfSSL debugging functions at compile time.
27+
28+
endmenu # wolfSSL
29+
1930
menu "mbedTLS"
2031
depends on SSL_USING_MBEDTLS
2132

components/ssl/component.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
ifdef CONFIG_SSL_USING_WOLFSSL
66
COMPONENT_ADD_INCLUDEDIRS := wolfssl/include wolfssl/wolfssl wolfssl/wolfssl/wolfssl
77

8+
ifdef CONFIG_WOLFSSL_DEBUG
9+
WOLFSSLLIB = wolfssl_debug
10+
COMPONENT_ADD_LDFLAGS := -L $(COMPONENT_PATH)/wolfssl/lib -lwolfssl_debug
11+
else
812
WOLFSSLLIB = wolfssl
913
COMPONENT_ADD_LDFLAGS := -L $(COMPONENT_PATH)/wolfssl/lib -lwolfssl
14+
endif
1015

1116
# re-link program if wolfssl library change
1217
COMPONENT_ADD_LINKER_DEPS := $(patsubst %,$(COMPONENT_PATH)/wolfssl/lib/lib%.a,$(WOLFSSLLIB))

components/ssl/wolfssl/include/user_settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#define NO_RC4
3232
#define NO_RABBIT
3333
#define HAVE_ECC
34+
#define HAVE_AES_ECB
35+
#define WOLFSSL_AES_DIRECT
3436
#define WC_NO_HARDEN
3537
#define FREERTOS
3638
#define WOLFSSL_TYPES
@@ -39,6 +41,7 @@
3941
#define WOLFSSL_ALLOW_TLSV10
4042
#define WOLFSSL_SMALL_STACK
4143
#define SMALL_SESSION_CACHE
44+
#define OPENSSL_EXTRA
4245

4346
#define SSL_CTX_use_certificate_ASN1(ctx,len,buf) wolfSSL_CTX_use_certificate_buffer(ctx,buf,len,WOLFSSL_FILETYPE_PEM)
4447
#define SSL_CTX_use_PrivateKey_ASN1(type,ctx,buf,len) wolfSSL_CTX_use_PrivateKey_buffer(ctx,buf,len, WOLFSSL_FILETYPE_PEM)
@@ -54,6 +57,7 @@
5457
#endif
5558

5659
#ifndef CUSTOM_RAND_GENERATE_BLOCK
60+
#include "esp_libc.h"
5761
/* To use define the following:*/
5862
#define CUSTOM_RAND_GENERATE_BLOCK os_get_random
5963
#endif
660 KB
Binary file not shown.
2.03 MB
Binary file not shown.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* asn1.h
2+
*
3+
* Copyright (C) 2006-2018 wolfSSL Inc. All rights reserved.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* Contact licensing@wolfssl.com with any questions or comments.
8+
*
9+
* https://www.wolfssl.com
10+
*/
11+
12+
13+
/* asn1.h for openssl */
14+
15+
#ifndef WOLFSSL_ASN1_H_
16+
#define WOLFSSL_ASN1_H_
17+
18+
#include <wolfssl/openssl/ssl.h>
19+
20+
#define ASN1_STRING_new wolfSSL_ASN1_STRING_type_new
21+
#define ASN1_STRING_type_new wolfSSL_ASN1_STRING_type_new
22+
#define ASN1_STRING_set wolfSSL_ASN1_STRING_set
23+
#define ASN1_STRING_free wolfSSL_ASN1_STRING_free
24+
25+
#define V_ASN1_OCTET_STRING 0x04 /* tag for ASN1_OCTET_STRING */
26+
#define V_ASN1_NEG 0x100
27+
#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
28+
#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
29+
30+
/* Type for ASN1_print_ex */
31+
# define ASN1_STRFLGS_ESC_2253 1
32+
# define ASN1_STRFLGS_ESC_CTRL 2
33+
# define ASN1_STRFLGS_ESC_MSB 4
34+
# define ASN1_STRFLGS_ESC_QUOTE 8
35+
# define ASN1_STRFLGS_UTF8_CONVERT 0x10
36+
# define ASN1_STRFLGS_IGNORE_TYPE 0x20
37+
# define ASN1_STRFLGS_SHOW_TYPE 0x40
38+
# define ASN1_STRFLGS_DUMP_ALL 0x80
39+
# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
40+
# define ASN1_STRFLGS_DUMP_DER 0x200
41+
# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \
42+
ASN1_STRFLGS_ESC_CTRL | \
43+
ASN1_STRFLGS_ESC_MSB | \
44+
ASN1_STRFLGS_UTF8_CONVERT | \
45+
ASN1_STRFLGS_DUMP_UNKNOWN | \
46+
ASN1_STRFLGS_DUMP_DER)
47+
48+
#define MBSTRING_UTF8 0x1000
49+
50+
#endif /* WOLFSSL_ASN1_H_ */

components/ssl/wolfssl/wolfssl/wolfssl/openssl/bn.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
/* bn.h
22
*
3-
* Copyright (C) 2006-2017 wolfSSL Inc. All rights reserved.
3+
* Copyright (C) 2006-2018 wolfSSL Inc. All rights reserved.
44
*
55
* This file is part of wolfSSL.
66
*
77
* Contact licensing@wolfssl.com with any questions or comments.
88
*
9-
* http://www.wolfssl.com
9+
* https://www.wolfssl.com
1010
*/
1111

1212

1313
/* bn.h for openssl */
1414

15+
/*!
16+
\file wolfssl/openssl/bn.h
17+
\brief bn.h for openssl
18+
*/
19+
1520

1621
#ifndef WOLFSSL_BN_H_
1722
#define WOLFSSL_BN_H_
@@ -96,7 +101,7 @@ WOLFSSL_API int wolfSSL_BN_is_prime_ex(const WOLFSSL_BIGNUM*, int,
96101
WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_mod_word(const WOLFSSL_BIGNUM*,
97102
WOLFSSL_BN_ULONG);
98103
#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
99-
WOLFSSL_API int wolfSSL_BN_print_fp(FILE*, const WOLFSSL_BIGNUM*);
104+
WOLFSSL_API int wolfSSL_BN_print_fp(XFILE, const WOLFSSL_BIGNUM*);
100105
#endif
101106
WOLFSSL_API int wolfSSL_BN_rshift(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*, int);
102107
WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_CTX_get(WOLFSSL_BN_CTX *ctx);
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* crypto.h
2+
*
3+
* Copyright (C) 2006-2018 wolfSSL Inc. All rights reserved.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* Contact licensing@wolfssl.com with any questions or comments.
8+
*
9+
* https://www.wolfssl.com
10+
*/
11+
12+
13+
/* crypto.h for openSSL */
14+
15+
#ifndef WOLFSSL_CRYPTO_H_
16+
#define WOLFSSL_CRYPTO_H_
17+
18+
#include <wolfssl/openssl/opensslv.h>
19+
20+
#include <wolfssl/wolfcrypt/settings.h>
21+
22+
#ifdef WOLFSSL_PREFIX
23+
#include "prefix_crypto.h"
24+
#endif
25+
26+
27+
WOLFSSL_API const char* wolfSSLeay_version(int type);
28+
WOLFSSL_API unsigned long wolfSSLeay(void);
29+
30+
#ifdef OPENSSL_EXTRA
31+
WOLFSSL_API void wolfSSL_OPENSSL_free(void*);
32+
WOLFSSL_API void *wolfSSL_OPENSSL_malloc(size_t a);
33+
#endif
34+
35+
#define CRYPTO_THREADID void
36+
37+
#define SSLeay_version wolfSSLeay_version
38+
#define SSLeay wolfSSLeay
39+
40+
41+
#define SSLEAY_VERSION 0x0090600fL
42+
#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
43+
#define CRYPTO_lock wc_LockMutex_ex
44+
45+
/* this function was used to set the default malloc, free, and realloc */
46+
#define CRYPTO_malloc_init() /* CRYPTO_malloc_init is not needed */
47+
48+
#define OPENSSL_free wolfSSL_OPENSSL_free
49+
#define OPENSSL_malloc wolfSSL_OPENSSL_malloc
50+
51+
#if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || \
52+
defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA)
53+
#define CRYPTO_set_mem_ex_functions wolfSSL_CRYPTO_set_mem_ex_functions
54+
#define FIPS_mode wolfSSL_FIPS_mode
55+
#define FIPS_mode_set wolfSSL_FIPS_mode_set
56+
typedef struct CRYPTO_EX_DATA CRYPTO_EX_DATA;
57+
typedef void (CRYPTO_free_func)(void*parent, void*ptr, CRYPTO_EX_DATA *ad, int idx,
58+
long argl, void* argp);
59+
#define CRYPTO_THREADID_set_callback wolfSSL_THREADID_set_callback
60+
#define CRYPTO_THREADID_set_numeric wolfSSL_THREADID_set_numeric
61+
62+
#define CRYPTO_r_lock wc_LockMutex_ex
63+
#define CRYPTO_unlock wc_LockMutex_ex
64+
65+
#define CRYPTO_THREAD_lock wc_LockMutex
66+
#define CRYPTO_THREAD_r_lock wc_LockMutex
67+
#define CRYPTO_THREAD_unlock wc_UnLockMutex
68+
69+
#endif /* OPENSSL_ALL || HAVE_STUNNEL || WOLFSSL_NGINX || WOLFSSL_HAPROXY */
70+
71+
#endif /* header */

components/ssl/wolfssl/wolfssl/wolfssl/openssl/dsa.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* dsa.h
22
*
3-
* Copyright (C) 2006-2017 wolfSSL Inc. All rights reserved.
3+
* Copyright (C) 2006-2018 wolfSSL Inc. All rights reserved.
44
*
55
* This file is part of wolfSSL.
66
*
77
* Contact licensing@wolfssl.com with any questions or comments.
88
*
9-
* http://www.wolfssl.com
9+
* https://www.wolfssl.com
1010
*/
1111

1212

components/ssl/wolfssl/wolfssl/wolfssl/openssl/ec.h

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* ec.h
22
*
3-
* Copyright (C) 2006-2017 wolfSSL Inc. All rights reserved.
3+
* Copyright (C) 2006-2018 wolfSSL Inc. All rights reserved.
44
*
55
* This file is part of wolfSSL.
66
*
77
* Contact licensing@wolfssl.com with any questions or comments.
88
*
9-
* http://www.wolfssl.com
9+
* https://www.wolfssl.com
1010
*/
1111

1212

@@ -24,6 +24,7 @@ extern "C" {
2424

2525
/* Map OpenSSL NID value */
2626
enum {
27+
POINT_CONVERSION_COMPRESSED = 2,
2728
POINT_CONVERSION_UNCOMPRESSED = 4,
2829

2930
#ifdef HAVE_ECC
@@ -92,6 +93,10 @@ struct WOLFSSL_EC_KEY {
9293
char exSet; /* external set from internal ? */
9394
};
9495

96+
97+
#define WOLFSSL_EC_KEY_LOAD_PRIVATE 1
98+
#define WOLFSSL_EC_KEY_LOAD_PUBLIC 2
99+
95100
WOLFSSL_API
96101
int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *curve,
97102
const WOLFSSL_EC_POINT *p,
@@ -103,6 +108,9 @@ WOLFSSL_API
103108
int wolfSSL_EC_KEY_LoadDer(WOLFSSL_EC_KEY* key,
104109
const unsigned char* der, int derSz);
105110
WOLFSSL_API
111+
int wolfSSL_EC_KEY_LoadDer_ex(WOLFSSL_EC_KEY* key,
112+
const unsigned char* der, int derSz, int opt);
113+
WOLFSSL_API
106114
void wolfSSL_EC_KEY_free(WOLFSSL_EC_KEY *key);
107115
WOLFSSL_API
108116
WOLFSSL_EC_POINT *wolfSSL_EC_KEY_get0_public_key(const WOLFSSL_EC_KEY *key);
@@ -167,36 +175,47 @@ WOLFSSL_API
167175
int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group,
168176
const WOLFSSL_EC_POINT *a);
169177

170-
#define EC_KEY_free wolfSSL_EC_KEY_free
171-
#define EC_KEY_get0_public_key wolfSSL_EC_KEY_get0_public_key
172-
#define EC_KEY_get0_group wolfSSL_EC_KEY_get0_group
173-
#define EC_KEY_set_private_key wolfSSL_EC_KEY_set_private_key
174-
#define EC_KEY_get0_private_key wolfSSL_EC_KEY_get0_private_key
175-
#define EC_KEY_new_by_curve_name wolfSSL_EC_KEY_new_by_curve_name
176-
#define EC_KEY_set_group wolfSSL_EC_KEY_set_group
177-
#define EC_KEY_generate_key wolfSSL_EC_KEY_generate_key
178-
#define EC_KEY_set_asn1_flag wolfSSL_EC_KEY_set_asn1_flag
179-
#define EC_KEY_set_public_key wolfSSL_EC_KEY_set_public_key
180-
#define EC_KEY_new wolfSSL_EC_KEY_new
181-
182-
#define EC_GROUP_set_asn1_flag wolfSSL_EC_GROUP_set_asn1_flag
183-
#define EC_GROUP_new_by_curve_name wolfSSL_EC_GROUP_new_by_curve_name
184-
#define EC_GROUP_cmp wolfSSL_EC_GROUP_cmp
185-
#define EC_GROUP_get_curve_name wolfSSL_EC_GROUP_get_curve_name
186-
#define EC_GROUP_get_degree wolfSSL_EC_GROUP_get_degree
187-
#define EC_GROUP_get_order wolfSSL_EC_GROUP_get_order
188-
#define EC_GROUP_free wolfSSL_EC_GROUP_free
189-
190-
#define EC_POINT_new wolfSSL_EC_POINT_new
178+
#ifndef HAVE_SELFTEST
179+
WOLFSSL_API
180+
char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
181+
const WOLFSSL_EC_POINT* point, int form,
182+
WOLFSSL_BN_CTX* ctx);
183+
#endif
184+
185+
#define EC_KEY_new wolfSSL_EC_KEY_new
186+
#define EC_KEY_free wolfSSL_EC_KEY_free
187+
#define EC_KEY_get0_public_key wolfSSL_EC_KEY_get0_public_key
188+
#define EC_KEY_get0_group wolfSSL_EC_KEY_get0_group
189+
#define EC_KEY_set_private_key wolfSSL_EC_KEY_set_private_key
190+
#define EC_KEY_get0_private_key wolfSSL_EC_KEY_get0_private_key
191+
#define EC_KEY_new_by_curve_name wolfSSL_EC_KEY_new_by_curve_name
192+
#define EC_KEY_set_group wolfSSL_EC_KEY_set_group
193+
#define EC_KEY_generate_key wolfSSL_EC_KEY_generate_key
194+
#define EC_KEY_set_asn1_flag wolfSSL_EC_KEY_set_asn1_flag
195+
#define EC_KEY_set_public_key wolfSSL_EC_KEY_set_public_key
196+
197+
#define EC_GROUP_free wolfSSL_EC_GROUP_free
198+
#define EC_GROUP_set_asn1_flag wolfSSL_EC_GROUP_set_asn1_flag
199+
#define EC_GROUP_new_by_curve_name wolfSSL_EC_GROUP_new_by_curve_name
200+
#define EC_GROUP_cmp wolfSSL_EC_GROUP_cmp
201+
#define EC_GROUP_get_curve_name wolfSSL_EC_GROUP_get_curve_name
202+
#define EC_GROUP_get_degree wolfSSL_EC_GROUP_get_degree
203+
#define EC_GROUP_get_order wolfSSL_EC_GROUP_get_order
204+
205+
#define EC_POINT_new wolfSSL_EC_POINT_new
206+
#define EC_POINT_free wolfSSL_EC_POINT_free
191207
#define EC_POINT_get_affine_coordinates_GFp \
192-
wolfSSL_EC_POINT_get_affine_coordinates_GFp
193-
#define EC_POINT_mul wolfSSL_EC_POINT_mul
194-
#define EC_POINT_clear_free wolfSSL_EC_POINT_clear_free
195-
#define EC_POINT_cmp wolfSSL_EC_POINT_cmp
196-
#define EC_POINT_free wolfSSL_EC_POINT_free
197-
#define EC_POINT_is_at_infinity wolfSSL_EC_POINT_is_at_infinity
198-
199-
#define EC_POINT_dump wolfSSL_EC_POINT_dump
208+
wolfSSL_EC_POINT_get_affine_coordinates_GFp
209+
#define EC_POINT_mul wolfSSL_EC_POINT_mul
210+
#define EC_POINT_clear_free wolfSSL_EC_POINT_clear_free
211+
#define EC_POINT_cmp wolfSSL_EC_POINT_cmp
212+
#define EC_POINT_is_at_infinity wolfSSL_EC_POINT_is_at_infinity
213+
214+
#ifndef HAVE_SELFTEST
215+
#define EC_POINT_point2hex wolfSSL_EC_POINT_point2hex
216+
#endif
217+
218+
#define EC_POINT_dump wolfSSL_EC_POINT_dump
200219

201220
#ifdef __cplusplus
202221
} /* extern "C" */

0 commit comments

Comments
 (0)